26 protected ref array<SCR_MilitaryBaseComponent>
m_aBases = {};
135 array<IEntity> queue = {editComponent.GetOwner()};
136 SCR_MilitaryBaseComponent baseComponent;
137 SCR_MilitaryBaseLogicComponent logicComponent;
140 const bool checkeEditableEntityComponent;
142 while (!queue.IsEmpty())
144 processedEntity = queue[0];
147 if (!processedEntity)
152 baseComponent = SCR_MilitaryBaseComponent.Cast(processedEntity.
FindComponent(SCR_MilitaryBaseComponent));
153 logicComponent = SCR_MilitaryBaseLogicComponent.Cast(processedEntity.
FindComponent(SCR_MilitaryBaseLogicComponent));
164 while (nextInHierarchy)
166 queue.Insert(nextInHierarchy);
167 nextInHierarchy = nextInHierarchy.
GetSibling();
177 int distanceLimit = baseComponent.GetRadius() * baseComponent.GetRadius();
181 if (
vector.DistanceSqXZ(
position, logicComponent.GetOwner().GetOrigin()) > distanceLimit)
183 baseComponent.UnregisterLogicComponent(logicComponent);
184 logicComponent.UnregisterBase(baseComponent);
188 baseComponent.RegisterLogicComponent(logicComponent);
189 logicComponent.RegisterBase(baseComponent);
201 foreach (SCR_MilitaryBaseComponent baseComponent :
m_aBases)
203 radius = baseComponent.GetRadius();
205 if (
vector.DistanceSqXZ(
position, baseComponent.GetOwner().GetOrigin()) > (radius * radius))
207 baseComponent.UnregisterLogicComponent(logicComponent);
208 logicComponent.UnregisterBase(baseComponent);
212 baseComponent.RegisterLogicComponent(logicComponent);
213 logicComponent.RegisterBase(baseComponent);
221 FactionManager fManager =
GetGame().GetFactionManager();
227 array<Faction> allFactions = {};
228 array<SCR_Faction> playableFactions = {};
229 fManager.GetFactionsList(allFactions);
230 array<int> callsignIndexesSource = {};
232 foreach (
Faction faction : allFactions)
237 playableFactions.Insert(factionCast);
240 if (playableFactions.IsEmpty())
245 callsignIndexesSource = playableFactions[0].GetBaseCallsignIndexes();
248 foreach (
int indexSource : callsignIndexesSource)
253 foreach (
int i,
SCR_Faction faction : playableFactions)
259 if (!faction.GetBaseCallsignByIndex(indexSource))
281 vector basePosition =
base.GetOwner().GetOrigin();
282 int baseRadius =
base.GetRadius();
283 int distanceLimit = baseRadius * baseRadius;
303 if (
vector.DistanceSqXZ(component.GetOwner().GetOrigin(), basePosition) <= distanceLimit)
305 base.RegisterLogicComponent(component);
306 component.RegisterBase(
base);
330 int GetBases(notnull out array<SCR_MilitaryBaseComponent> bases)
354 radius =
base.GetRadius();
358 base.RegisterLogicComponent(component);
359 component.RegisterBase(
base);
ArmaReforgerScripted GetGame()
ScriptInvokerBase< OnBaseFactionChangedDelegate > OnBaseFactionChangedInvoker
func OnBaseFactionChangedDelegate
func OnBaseUnregisteredDelegate
func OnBaseRegisteredDelegate
ScriptInvokerBase< OnBaseRegisteredDelegate > OnBaseRegisteredInvoker
ScriptInvokerBase< OnBaseUnregisteredDelegate > OnBaseUnregisteredInvoker
ScriptInvokerBase< OnLogicPresenceChangedDelegate > OnLogicPresenceChangedInvoker
func OnLogicPresenceChangedDelegate
proto external Managed FindComponent(typename typeName)
proto external IEntity GetChildren()
proto external IEntity GetSibling()
void OnLogicUnregisteredInBase(SCR_MilitaryBaseLogicComponent logic, SCR_MilitaryBaseComponent base)
OnLogicPresenceChangedInvoker GetOnLogicUnregisteredInBase()
int GetBases(notnull out array< SCR_MilitaryBaseComponent > bases)
void OnBaseTransformChanged(notnull SCR_MilitaryBaseComponent baseComponent)
Base has been moved, recalculate members in radius.
OnBaseFactionChangedInvoker GetOnBaseFactionChanged()
ref OnBaseUnregisteredInvoker m_OnBaseUnregistered
OnBaseRegisteredInvoker GetOnBaseRegistered()
ref array< SCR_MilitaryBaseLogicComponent > m_aLogicComponents
void OnLogicTransformChanged(notnull SCR_MilitaryBaseLogicComponent logicComponent)
Logic has been moved, recalculate members in radius of bases.
void RegisterBase(notnull SCR_MilitaryBaseComponent base)
void UnregisterBase(notnull SCR_MilitaryBaseComponent base)
ref array< SCR_MilitaryBaseComponent > m_aBases
void LoadAvailableCallsigns()
ref OnBaseRegisteredInvoker m_OnBaseRegistered
static SCR_MilitaryBaseSystem GetInstance()
OnBaseUnregisteredInvoker GetOnBaseUnregistered()
ref OnLogicPresenceChangedInvoker m_OnLogicUnregisteredInBase
ref OnBaseFactionChangedInvoker m_OnBaseFactionChanged
void OnEntityTransformChanged(notnull SCR_EditableEntityComponent editComponent)
When a base or logic component is moved, recalculate registered members.
void RegisterLogicComponent(notnull SCR_MilitaryBaseLogicComponent component)
void OnBaseFactionChanged(Faction faction, SCR_MilitaryBaseComponent base)
void UnregisterLogicComponent(notnull SCR_MilitaryBaseLogicComponent component)
ref array< int > m_aAvailableCallsignIds
OnLogicPresenceChangedInvoker GetOnLogicRegisteredInBase()
void OnLogicRegisteredInBase(SCR_MilitaryBaseLogicComponent logic, SCR_MilitaryBaseComponent base)
ref OnLogicPresenceChangedInvoker m_OnLogicRegisteredInBase
Structure holding world system meta-information required by the engine.
WorldSystemPoint ESystemPoint