15 protected vector m_vTargetPosition = vector.Zero;
16 protected bool m_bVolunteerMet =
false;
19 bool GetVolunteerMet()
21 return m_bVolunteerMet;
25 void SetVolunteerMet(
bool volunteerMet)
27 m_bVolunteerMet = volunteerMet;
31 if (IsAssignedToLocalPlayer())
33 if (IsLocallyRequestedTask())
39 void SetTargetPosition(vector targetPosition)
41 m_vTargetPosition = targetPosition;
45 vector GetTargetPosition()
47 return m_vTargetPosition;
51 override void OnAssigneeKilled()
60 if (GetVolunteerMet())
61 supportEntity.FailTask(
this);
65 void PeriodicalCheck()
74 IEntity assigneeEntity = assignee.GetControlledEntity();
75 IEntity requesterEntity = m_Requester.GetControlledEntity();
81 if (!GetVolunteerMet())
83 if (vector.DistanceSq(assigneeEntity.GetOrigin(), requesterEntity.GetOrigin()) > supportEntity.GetMaxDistanceAssigneeSq())
86 supportEntity.TransportTaskNextPhase(
this);
89 else if (vector.DistanceSq(requesterEntity.GetOrigin(),
GetOrigin()) > supportEntity.GetMaxDistanceDestinationSq())
92 supportEntity.FinishTask(
this);
96 override void Deserialize(ScriptBitReader reader)
98 super.Deserialize(reader);
100 reader.ReadVector(m_vTargetPosition);
103 reader.ReadBool(volunteerMet);
104 SetVolunteerMet(volunteerMet);
108 override void Serialize(ScriptBitWriter writer)
110 super.Serialize(writer);
112 vector targetPosition = GetTargetPosition();
113 writer.WriteVector(targetPosition);
114 writer.WriteBool(m_bVolunteerMet);
118 override void EOnInit(IEntity owner)
120 super.EOnInit(owner);
123 if (taskManager && taskManager.IsProxy())
132 SetEventMask(EntityEvent.INIT);