10 [
Attribute(
"#AR-Tasks_RequestFromTransport")]
13 [
Attribute(
"#AR-Tasks_RequestToTransport")]
16 [
Attribute(
"50",
"How far can the assignee be from the requester when the task is evaluated.")]
17 protected float m_fMaxDistanceAssignee;
19 [
Attribute(
"50",
"How far from the destination is the task evaluated.")]
20 protected float m_fMaxDistanceDestination;
22 protected bool m_bSetFromPosition;
23 protected vector m_vFromPosition;
24 protected vector m_vToPosition;
27 float GetMaxDistanceAssigneeSq()
29 return m_fMaxDistanceAssignee * m_fMaxDistanceAssignee;
33 float GetMaxDistanceDestinationSq()
35 return m_fMaxDistanceDestination * m_fMaxDistanceAssignee;
39 SCR_TransportTask CreateNewTransportTask(
int requesterID, vector fromPosition, vector toPosition)
47 SetRequester(task, requester);
48 SetTargetPosition(task, toPosition);
59 int taskID = task.GetTaskID();
61 RPC_SetTargetPosition(taskID,
position);
62 Rpc(RPC_SetTargetPosition, taskID,
position);
71 if (!transportTask.GetVolunteerMet())
73 transportTask.SetVolunteerMet(
true);
75 MoveTask(transportTask.GetTargetPosition(), transportTask.GetTaskID());
76 Rpc(RPC_TransportTaskNextPhase, transportTask.GetTaskID());
79 FinishTask(transportTask);
83 [
RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
84 protected void RPC_TransportTaskNextPhase(
int taskID)
92 transportTask.SetVolunteerMet(
true);
96 [
RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
97 void RPC_SetTargetPosition(
int taskID, vector
position)
111 void RequestTransport(
int requesterID, vector fromPosition, vector toPosition)
113 CreateNewTransportTask(requesterID, fromPosition, toPosition);
117 protected override void RegisterContextualMenuCallbacks()
119 if (m_sRequestButtonText.IsEmpty())
130 entry.SetName(m_sRequestButtonText);
131 entry.SetSupportClass(
this);
132 entry.GetOnPerform().Insert(Request);
135 radialMenu.InsertCustomRadialEntry(entry);
139 protected void SetToPosition()
145 m_vToPosition = radialMenu.GetMenuWorldPosition();
146 m_bSetFromPosition =
false;
150 protected void SetFromPosition()
156 m_vFromPosition = radialMenu.GetMenuWorldPosition();
157 m_bSetFromPosition =
true;
161 override bool CanRequest()
163 return super.CanRequest();
167 override void SetRequestButtonText(notnull TextWidget textWidget)
169 if (!m_bSetFromPosition)
170 textWidget.SetTextFormat(m_sRequestFromText);
172 textWidget.SetTextFormat(m_sRequestToText);
176 override void Request()
178 if (!m_bSetFromPosition)
186 PlayerController playerController =
GetGame().GetPlayerController();
187 if (!playerController)
192 if (!taskNetworkComponent)
198 taskNetworkComponent.RequestTransport(m_vFromPosition, m_vToPosition);