9 static const string SUPPORT_TASK_DESCRIPTION_TEXT =
"#AR-CampaignTasks_TitleEvac";
12 protected vector m_vStartOrigin;
15 static float GetMinDistanceFromStart()
22 return supportEntity.GetMinDistanceFromStart();
28 static float GetMaxDistanceFromRequester()
35 return supportEntity.GetMaxDistanceFromRequester();
41 override string GetMapDescriptorText()
43 return GetTaskListTaskText();
47 void PeriodicalCheck()
56 bool assigneeCloseEnough =
true;
57 bool requesterInBase =
false;
62 supportEntity.FailTask(
this);
66 FactionAffiliationComponent factionAffiliationComponent = FactionAffiliationComponent.Cast(requesterEntity.FindComponent(FactionAffiliationComponent));
67 if (!factionAffiliationComponent)
70 Faction requesterFaction = factionAffiliationComponent.GetAffiliatedFaction();
72 vector requesterOrigin = requesterEntity.GetOrigin();
74 array<SCR_MilitaryBaseComponent> bases = {};
77 for (
int i = 0; i < bases.Count(); i++)
84 if (requesterFaction != campaignBase.GetCampaignFaction())
87 vector baseOrigin = campaignBase.GetOwner().GetOrigin();
88 float baseToStartDistance = vector.Distance(baseOrigin, m_vStartOrigin);
93 if (!campaignBase.GetIsEntityPresent(requesterEntity))
96 requesterInBase =
true;
102 assigneeCloseEnough =
false;
105 IEntity assigneeEntity = assignee.GetControlledEntity();
106 vector assigneePosition = vector.Zero;
108 assigneePosition = assigneeEntity.GetOrigin();
109 float distance = vector.Distance(requesterOrigin, assigneePosition);
112 assigneeCloseEnough =
false;
117 if (assigneeCloseEnough)
118 supportEntity.FinishTask(
this);
120 supportEntity.FailTask(
this);
125 void SetStartOrigin(vector startOrigin)
127 if (m_vStartOrigin != vector.Zero)
129 m_vStartOrigin = startOrigin;
137 if (!requesterEntity)
140 m_vStartOrigin = requesterEntity.GetOrigin();
146 vector GetStartOrigin()
148 return m_vStartOrigin;
152 override void Serialize(ScriptBitWriter writer)
154 super.Serialize(writer);
156 vector startOrigin = GetStartOrigin();
157 writer.WriteVector(startOrigin);
161 override void Deserialize(ScriptBitReader reader)
163 super.Deserialize(reader);
166 reader.ReadVector(startOrigin);
167 SetStartOrigin(startOrigin);
176 SetEventMask(EntityEvent.FRAME);