// WRONG - Will not compile
int value = condition ? 1 : 0;
// CORRECT
int value;
if (condition)
value = 1;
else
value = 0;
OVT_OVT_TownManagerComponent, OVT_ShopDatam_ prefix for all member variablesm_:
m_a - arraysm_m - mapsm_i - integersm_f - floatsm_s - stringsm_b - booleansm_v - vectorsref array<ref OVT_TownData> m_aTowns;
ref map<int, ref OVT_ShopData> m_mShops;
int m_iPlayerCount;
float m_fDistance;
string m_sPlayerName;
bool m_bIsActive;
vector m_vPosition;
s_ prefix for static variablesstatic OVT_SomeManager s_Instance;GetPropertyName()SetPropertyName()RpcAsk_ prefix for server requests, RpcDo_ for executionUse Doxygen-style comments with //! for methods and classes:
//! Manages all towns in the game world
class OVT_TownManagerComponent : OVT_Component
{
//! Get the nearest town to a position
//! \param pos World position to check
//! \return The nearest town data or null if none found
OVT_TownData GetNearestTown(vector pos)
{
// Implementation
}
}
Use [Attribute()] decorator for editor-exposed properties:
[Attribute("100", UIWidgets.Slider, desc: "Maximum distance to search for towns", params: "0 1000 1")]
protected float m_fMaxSearchDistance;
Scripts/Game/
├── Components/ # Entity components and UI components
├── GameMode/ # Core game logic and managers
├── Entities/ # Entity classes
├── Controllers/ # Controller components
├── Configuration/ # Config classes
├── UI/ # UI contexts and widgets
└── UserActions/ # Player interaction actions
OVT_TownData GetTownData(int townId)
{
if (!m_mTowns) return null;
OVT_TownData town = m_mTowns.Get(townId);
if (!town) return null;
return town;
}
FindComponent callsQueryEntitiesBySphere sparinglyAlways wrap FileIO and persistence operations for console compatibility:
#ifndef PLATFORM_CONSOLE
// File operations here
EPF_PersistenceComponent.SaveData();
#endif
OVT_TownManagerComponent townManager = OVT_Global.GetTowns();
if (!townManager) return;
OVT_OverthrowController controller = OVT_Global.GetController();
if (!controller) return;
OVT_MyComponent component = OVT_MyComponent.Cast(
controller.FindComponent(OVT_MyComponent)
);
if (!component) return;
IEntity entity = GetGame().GetWorld().FindEntityByID(entityId);
if (!entity) return; // Entity was deleted