Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_BaseTaskSupportEntity.c
Go to the documentation of this file.
1//------------------------------------------------------------------------------------------------
2//[EntityEditorProps(category: "GameScripted/Tasks", description: "Base task support entity.", color: "0 0 255 255")]
3//class SCR_BaseTaskSupportEntityClass: GenericEntityClass
4//{
5//};
6
7//------------------------------------------------------------------------------------------------
8//class SCR_BaseTaskSupportEntity : GenericEntity
9//{
10// [Attribute("{1844F5647E6D772A}UI/layouts/Tasks/TaskListEntry.layout")]
11// protected ResourceName m_sTaskDescriptionWidgetResource;
12//
13// [Attribute()]
14// protected ResourceName m_sTaskPrefab;
15//
16// //------------------------------------------------------------------------------------------------
17// void SetTargetFaction(notnull SCR_BaseTask task, notnull Faction faction)
18// {
19// if (!GetTaskManager())
20// return;
21//
22// FactionManager factionManager = GetGame().GetFactionManager();
23// if (!factionManager)
24// return;
25//
26// int taskID, factionIndex;
27// taskID = task.GetTaskID();
28// factionIndex = factionManager.GetFactionIndex(faction);
29//
30// Rpc(RPC_SetTargetFaction, taskID, factionIndex);
31// RPC_SetTargetFaction(taskID, factionIndex);
32// }
33//
34// //------------------------------------------------------------------------------------------------
35// [RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
36// void RPC_SetTargetFaction(int taskID, int factionIndex)
37// {
38// if (!GetTaskManager())
39// return;
40//
41// FactionManager factionManager = GetGame().GetFactionManager();
42// if (!factionManager)
43// return;
44//
45// SCR_BaseTask task = GetTaskManager().GetTask(taskID);
46// if (!task)
47// return;
48//
49// task.SetTargetFaction(factionManager.GetFactionByIndex(factionIndex));
50// }
51//
52// //------------------------------------------------------------------------------------------------
53// SCR_BaseTask CreateTask()
54// {
55// if (!GetTaskManager())
56// return null;
57//
58// return GetTaskManager().SpawnTask(GetResourceName()); // Also spawns task on clients
59// }
60//
61// //------------------------------------------------------------------------------------------------
62// void Initialize()
63// {
64// }
65//
66// //------------------------------------------------------------------------------------------------
67// //Called when task list is opened
68// [Obsolete("Use new SCR_TaskManagerUIComponent instead")]
69// void OnTaskListOpen(notnull SCR_TaskManagerUIComponent uiTaskManagerComponent)
70// {
71// }
72//
73// //------------------------------------------------------------------------------------------------
74// ResourceName GetTaskDescriptionWidgetResource()
75// {
76// return m_sTaskDescriptionWidgetResource;
77// }
78//
79// //------------------------------------------------------------------------------------------------
80// ResourceName GetResourceName()
81// {
82// return m_sTaskPrefab;
83// }
84//
85// //------------------------------------------------------------------------------------------------
86// Resource GetTaskPrefab()
87// {
88// if (m_sTaskPrefab.IsEmpty())
89// return null;
90//
91// return Resource.Load(m_sTaskPrefab);
92// }
93//
94// //------------------------------------------------------------------------------------------------
95// void MoveTask(vector newPosition, int taskID)
96// {
97// if (!GetTaskManager())
98// return;
99//
100// SCR_BaseTask task = GetTaskManager().GetTask(taskID);
101// if (!task)
102// return;
103//
104// task.SetOrigin(newPosition);
105//
106// if (GetTaskManager().IsProxy())
107// return;
108//
109// Rpc(RPC_MoveTask, taskID, newPosition);
110// }
111//
112// //------------------------------------------------------------------------------------------------
113// [RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
114// void RPC_MoveTask(int taskID, vector newPosition)
115// {
116// MoveTask(newPosition, taskID);
117// }
118//
119// //------------------------------------------------------------------------------------------------
120// //This should only be called on the server!
121// void AssignTask(notnull SCR_BaseTask task, notnull SCR_BaseTaskExecutor assignee, bool forced = false)
122// {
123// if (!GetTaskManager())
124// return;
125//
126// Rpc(RPC_AssignTask, SCR_BaseTaskExecutor.GetTaskExecutorID(assignee), task.GetTaskID(), GetTaskManager().GetTimestamp(), forced);
127// RPC_AssignTask(SCR_BaseTaskExecutor.GetTaskExecutorID(assignee), task.GetTaskID(), GetTaskManager().GetTimestamp(), forced);
128// }
129//
130// //------------------------------------------------------------------------------------------------
131// //! Assigns a task on clients.
132// [RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
133// void RPC_AssignTask(int playerID, int taskID, float timestamp, bool forced)
134// {
135// if (!GetTaskManager())
136// return;
137//
138// SCR_BaseTask task = GetTaskManager().GetTask(taskID);
139// if (!task)
140// return;
141//
142// SCR_BaseTaskExecutor assignee = SCR_BaseTaskExecutor.GetTaskExecutorByID(playerID);
143// if (!assignee)
144// return;
145//
146// task.AddAssignee(assignee, timestamp);
147// SCR_BaseTaskManager.s_OnTaskAssigned.Invoke(task);
148//
149// if (forced && assignee == SCR_BaseTaskExecutor.GetLocalExecutor())
150// SCR_PopUpNotification.GetInstance().PopupMsg(GetTaskManager().m_sAssignPopupGM);
151// }
152//
153// //------------------------------------------------------------------------------------------------
154// //This should only be called on the server!
155// void CancelTask(int taskID)
156// {
157// Rpc(RPC_CancelTask, taskID);
158// RPC_CancelTask(taskID);
159// }
160//
161// //------------------------------------------------------------------------------------------------
162// [RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
163// protected void RPC_CancelTask(int taskID)
164// {
165// if (!GetTaskManager())
166// return;
167//
168// SCR_BaseTask task = GetTaskManager().GetTask(taskID);
169//
170// if (!task)
171// return;
172//
173// task.Cancel();
174// GetTaskManager().DeleteTask(task);
175// }
176//
177// //------------------------------------------------------------------------------------------------
178// //This should only be called on the server!
179// void FinishTask(notnull SCR_BaseTask task)
180// {
181// int taskID = task.GetTaskID();
182// Rpc(RPC_FinishTask, taskID);
183// RPC_FinishTask(taskID);
184// }
185//
186// //------------------------------------------------------------------------------------------------
187// [RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
188// protected void RPC_FinishTask(int taskID)
189// {
190// if (!GetTaskManager())
191// return;
192//
193// SCR_BaseTask task = GetTaskManager().GetTask(taskID);
194//
195// if (!task || task.GetTaskState() == SCR_TaskState.FINISHED)
196// return;
197//
198// task.Finish();
199// }
200//
201// //------------------------------------------------------------------------------------------------
202// //This should only be called on the server!
203// void FailTask(notnull SCR_BaseTask task)
204// {
205// int taskID = task.GetTaskID();
206// Rpc(RPC_FailTask, taskID);
207// RPC_FailTask(taskID);
208// }
209//
210// //------------------------------------------------------------------------------------------------
211// [RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
212// protected void RPC_FailTask(int taskID)
213// {
214// if (!GetTaskManager())
215// return;
216//
217// SCR_BaseTask task = GetTaskManager().GetTask(taskID);
218//
219// if (!task)
220// task = GetTaskManager().GetFinishedTask(taskID);
221//
222// if (!task)
223// return;
224//
225// task.Fail();
226// GetTaskManager().DeleteTask(task);
227// }
228//
229// //------------------------------------------------------------------------------------------------
230// //This should only be called on the server!
231// void UnassignTask(notnull SCR_BaseTask task, notnull SCR_BaseTaskExecutor assignee, SCR_EUnassignReason reason)
232// {
233// int taskID = task.GetTaskID();
234// int executorID = SCR_BaseTaskExecutor.GetTaskExecutorID(assignee);
235// Rpc(RPC_UnassignTask, taskID, executorID, reason);
236// RPC_UnassignTask(taskID, executorID, reason);
237// }
238//
239// //------------------------------------------------------------------------------------------------
240// //! Assigns a task on clients.
241// [RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
242// void RPC_UnassignTask(int taskID, int playerID, SCR_EUnassignReason reason)
243// {
244// if (!GetTaskManager())
245// return;
246//
247// SCR_BaseTask task = GetTaskManager().GetTask(taskID);
248// if (!task)
249// return;
250//
251// SCR_BaseTaskExecutor assignee = SCR_BaseTaskExecutor.GetTaskExecutorByID(playerID);
252// if (!assignee)
253// return;
254//
255// switch (reason)
256// {
257// case SCR_EUnassignReason.ASSIGNEE_TIMEOUT:
258// break;
259// case SCR_EUnassignReason.ASSIGNEE_DISCONNECT:
260// break;
261// case SCR_EUnassignReason.ASSIGNEE_ABANDON:
262// {
263// GetTaskManager().AddAssigneeAbandoned(assignee);
264// break;
265// }
266// case SCR_EUnassignReason.GM_REASSIGN:
267// {
268// if (assignee == SCR_BaseTaskExecutor.GetLocalExecutor())
269// SCR_PopUpNotification.GetInstance().PopupMsg(GetTaskManager().GetReassignText());
270// break;
271// }
272// }
273//
274// task.RemoveAssignee(assignee, reason);
275// SCR_BaseTaskManager.s_OnTaskUnassigned.Invoke(task);
276// }
277//
278// //------------------------------------------------------------------------------------------------
279// //This should only be called on the server!
280// void SetTaskState(notnull SCR_BaseTask task, SCR_TaskState state)
281// {
282// int taskID = task.GetTaskID();
283// RPC_SetTaskState(taskID, state);
284// Rpc(RPC_SetTaskState, taskID, state);
285// }
286//
287// //------------------------------------------------------------------------------------------------
288// [RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
289// void RPC_SetTaskState(int taskID, SCR_TaskState state)
290// {
291// if (!GetTaskManager())
292// return;
293//
294// SCR_BaseTask task = GetTaskManager().GetTask(taskID);
295// if (!task)
296// return;
297//
298// task.SetState(state);
299// }
300//
301// //------------------------------------------------------------------------------------------------
302// //This should only be called on the server!
303// void SetTaskDescription(notnull SCR_BaseTask task, string description)
304// {
305// int taskID = task.GetTaskID();
306// RPC_SetTaskDescription(taskID, description);
307// Rpc(RPC_SetTaskDescription, taskID, description);
308// }
309//
310// //------------------------------------------------------------------------------------------------
311// [RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
312// void RPC_SetTaskDescription(int taskID, string description)
313// {
314// if (!GetTaskManager())
315// return;
316//
317// SCR_BaseTask task = GetTaskManager().GetTask(taskID);
318// if (!task)
319// return;
320//
321// task.SetDescription(description);
322// }
323//
324// //------------------------------------------------------------------------------------------------
325// //This should only be called on the server!
326// void SetTaskTitle(notnull SCR_BaseTask task, string title)
327// {
328// int taskID = task.GetTaskID();
329// RPC_SetTaskTitle(taskID, title);
330// Rpc(RPC_SetTaskTitle, taskID, title);
331// }
332//
333// //------------------------------------------------------------------------------------------------
334// [RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
335// void RPC_SetTaskTitle(int taskID, string title)
336// {
337// if (!GetTaskManager())
338// return;
339//
340// SCR_BaseTask task = GetTaskManager().GetTask(taskID);
341// if (!task)
342// return;
343//
344// task.SetTitle(title);
345// }
346//
347// //------------------------------------------------------------------------------------------------
348// protected void RegisterContextualMenuCallbacks()
349// {
350// }
351//
352// //------------------------------------------------------------------------------------------------
353// void OnMapOpen(MapConfiguration config)
354// {
355// RegisterContextualMenuCallbacks();
356// }
357//
358// //------------------------------------------------------------------------------------------------
359// override void EOnInit(IEntity owner)
360// {
361// if (!GetTaskManager())
362// return;
363//
364// GetTaskManager().RegisterSupportEntity(this);
365// }
366//
367// //------------------------------------------------------------------------------------------------
368// void SCR_BaseTaskSupportEntity(IEntitySource src, IEntity parent)
369// {
370// SetEventMask(EntityEvent.INIT);
371// SCR_MapEntity.GetMapInstance().GetOnMapOpen().Insert(OnMapOpen);
372//
373// if (!GetTaskManager())
374// return;
375//
376// RplComponent rplComponent = RplComponent.Cast(GetTaskManager().FindComponent(RplComponent));
377// if (!rplComponent)
378// return;
379//
380// rplComponent.InsertItem(this);
381// }
382//
383// //------------------------------------------------------------------------------------------------
384// void ~SCR_BaseTaskSupportEntity()
385// {
386// if (!GetTaskManager())
387// return;
388//
389// GetTaskManager().UnregisterSupportEntity(this);
390// }
391//};