10 [
Attribute(
"#AR-CampaignTasks_RequestImpossiblePosition-UC")]
11 protected string m_sNowhereToRun;
13 [
Attribute(
"#AR-CampaignTasks_RequestImpossibleSignal-UC")]
14 protected string m_sNoSignal;
16 [
Attribute(
"1000",
desc:
"Minimum distance of a base from the place this task is requested from. (in m)")]
17 protected float m_fMinDistanceFromStart;
19 [
Attribute(
"50",
desc:
"Maximum distance of the rescuer from the evacuated player, once a rescue base is reached. (in m)")]
20 protected float m_fMaxDistanceFromRequester;
23 override bool CanRequest()
25 return (super.CanRequest() && HasValidBase());
29 override void Request()
32 if (!playerController)
39 vector
position = ctxMenu.GetMenuWorldPosition();
41 IEntity requesterEntity = playerController.GetMainEntity();
45 FactionAffiliationComponent factionAffiliationComponent = FactionAffiliationComponent.Cast(requesterEntity.FindComponent(FactionAffiliationComponent));
46 if (!factionAffiliationComponent)
49 Faction requesterFaction = factionAffiliationComponent.GetAffiliatedFaction();
50 if (!requesterFaction)
53 vector requesterOrigin = requesterEntity.GetOrigin();
54 array<SCR_MilitaryBaseComponent> bases = {};
58 bool foundValidBase =
false;
59 for (
int i = bases.Count() - 1; i >= 0; i--)
64 float baseToStartDistance = vector.Distance(bases[i].
GetOwner().
GetOrigin(), requesterOrigin);
68 foundValidBase =
true;
87 if (!taskNetworkComponent)
90 taskNetworkComponent.RequestEvacuation(
position);
95 void RequestEvacuation(
int requesterID, vector
position)
101 evacuateTask.SetStartOrigin(
position);
105 SetRequester(evacuateTask, requester);
109 float GetMinDistanceFromStart()
111 return m_fMinDistanceFromStart;
115 float GetMaxDistanceFromRequester()
117 return m_fMaxDistanceFromRequester;
124 if (!requesterEntity)
127 FactionAffiliationComponent factionAffiliationComponent = FactionAffiliationComponent.Cast(requesterEntity.FindComponent(FactionAffiliationComponent));
128 if (!factionAffiliationComponent)
131 Faction requesterFaction = factionAffiliationComponent.GetAffiliatedFaction();
132 if (!requesterFaction)
135 bool foundValidBase =
false;
137 vector requesterOrigin = requesterEntity.GetOrigin();
138 array<SCR_MilitaryBaseComponent> bases = {};
142 for (
int i = bases.Count() - 1; i >= 0; i--)
144 if (requesterFaction != bases[i].
GetFaction())
147 float baseToStartDistance = vector.Distance(bases[i].
GetOwner().
GetOrigin(), requesterOrigin);
151 foundValidBase =
true;
156 return foundValidBase;