5 protected IEntity m_HQRadio;
7 static const float MAX_BASE_DISTANCE = 50;
10 protected bool IsParentBase(IEntity ent)
17 m_Base.RegisterHQRadio(m_HQRadio);
26 protected void CheckParentBase(vector origin)
29 Print(
"HQ radio at " +
string.ToString(origin) +
" is not close enough (" + MAX_BASE_DISTANCE +
"m) to any Conflict base!", LogLevel.ERROR);
36 PlayerController playerController =
GetGame().GetPlayerController();
38 if (!playerController)
42 SCR_CampaignNetworkComponent campaignNetworkComponent = SCR_CampaignNetworkComponent.Cast(playerController.FindComponent(SCR_CampaignNetworkComponent));
44 if (campaignNetworkComponent)
45 campaignNetworkComponent.ToggleBaseCapture(base, isBeingCaptured);
49 override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
59 BaseWorld world =
GetGame().GetWorld();
64 vector origin = pOwnerEntity.GetOrigin();
67 world.QueryEntitiesBySphere(origin, MAX_BASE_DISTANCE, IsParentBase,
null, EQueryEntitiesFlags.ALL);
70 GetGame().GetCallqueue().CallLater(CheckParentBase, 1000,
false, origin);
74 override void OnActionStart(IEntity pUserEntity)
76 bool isAI =
GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(pUserEntity) == 0;
79 ToggleBaseCaptured(m_Base,
true);
83 override void OnActionCanceled(IEntity pOwnerEntity, IEntity pUserEntity)
85 ToggleBaseCaptured(m_Base,
false);
89 override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
94 bool isAI =
GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(pUserEntity) == 0;
98 FactionAffiliationComponent comp = FactionAffiliationComponent.Cast(pUserEntity.FindComponent(FactionAffiliationComponent));
109 PlayerController playerController =
GetGame().GetPlayerController();
111 if (!playerController)
114 SCR_CampaignNetworkComponent campaignNetworkComponent = SCR_CampaignNetworkComponent.Cast(playerController.FindComponent(SCR_CampaignNetworkComponent));
116 if (campaignNetworkComponent)
117 campaignNetworkComponent.CaptureBase(m_Base);
122 override bool CanBePerformedScript(IEntity user)
124 bool isAI =
GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(user) == 0;
128 FactionAffiliationComponent comp = FactionAffiliationComponent.Cast(user.FindComponent(FactionAffiliationComponent));
133 return (comp.GetAffiliatedFaction() !=
m_Base.GetFaction());
143 if (
m_Base.GetFaction() == playerFaction)
145 SetCannotPerformReason(
"#AR-Campaign_Action_Done-UC");
150 if (m_Base != playerFaction.GetMainBase() && !
m_Base.IsHQRadioTrafficPossible(playerFaction))
152 SetCannotPerformReason(
"#AR-Campaign_Action_NoSignal-UC");
161 override bool CanBeShownScript(IEntity user)
163 CharacterControllerComponent comp = CharacterControllerComponent.Cast(user.FindComponent(CharacterControllerComponent));
171 return (m_Base !=
null);
175 override bool HasLocalEffectOnlyScript()