Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_TaskNetworkComponent.c
Go to the documentation of this file.
1//[Obsolete(), EntityEditorProps(category: "GameScripted/Tasks", description: "Handles client > server communication for tasks. Should be attached to PlayerController.", color: "0 0 255 255")]
2//class SCR_TaskNetworkComponentClass : ScriptComponentClass
3//{
4//}
5//
7//[Obsolete()]
8//class SCR_TaskNetworkComponent : ScriptComponent
9//{
10// protected static const int INVALID_PLAYER_ID = -1;
11//
12// // Member variables
13// protected SCR_PlayerController m_PlayerController;
14// protected RplComponent m_RplComponent;
15//
16// //*********************//
17// //PUBLIC MEMBER METHODS//
18// //*********************//
19//
20// //------------------------------------------------------------------------------------------------
21// //! Allows the requester to cancel a task requested by them.
22// //! \param[in] taskID
23// void CancelTask(int taskID)
24// {
25// Rpc(RPC_CancelTask, taskID);
26// }
27//
28// //------------------------------------------------------------------------------------------------
29// //! Allows the local player to abandon a task assigned to them.
30// //! \param[in] taskID
31// void AbandonTask(int taskID)
32// {
33// if (m_RplComponent && m_RplComponent.Role() == RplRole.Authority)
34// {
35// // On server we call this just like any other method
36// RPC_AbandonTask(taskID, INVALID_PLAYER_ID);
37// }
38// else
39// {
40// // Find local task executor
41// SCR_BaseTaskExecutor taskExecutor = SCR_BaseTaskExecutor.GetLocalExecutor();
42// if (!taskExecutor)
43// return;
44//
45// // Send RPC to server requesting assignment
46// int playerID = SCR_BaseTaskExecutor.GetTaskExecutorID(taskExecutor);
47// Rpc(RPC_AbandonTask, taskID, playerID);
48// }
49// }
50//
51// //------------------------------------------------------------------------------------------------
52// //! Allows the local player to request assignment to a task.
53// //! \param[in] taskID
54// void RequestAssignment(int taskID)
55// {
56// if (m_RplComponent && m_RplComponent.Role() == RplRole.Authority)
57// {
58// // On server we call this just like any other method
59// RPC_RequestAssignment(taskID, INVALID_PLAYER_ID);
60// }
61// else
62// {
63// // Find local task executor
64// SCR_BaseTaskExecutor taskExecutor = SCR_BaseTaskExecutor.GetLocalExecutor();
65// if (!taskExecutor)
66// return;
67//
68// // Send RPC to server requesting assignment
69// int playerID = SCR_BaseTaskExecutor.GetTaskExecutorID(taskExecutor);
70// Rpc(RPC_RequestAssignment, taskID, playerID);
71// }
72// }
73//
74// //------------------------------------------------------------------------------------------------
75// //!
76// //! \param[in] gmID
77// //! \param[in] taskID
78// //! \param[in] playerID
79// void AssignTaskToPlayer(int gmID, int taskID, int playerID)
80// {
81// //Check if the player is game master
82// //This check is here in case someone called it even though they're not GM, prevents unncessary RPC sending
83// if (!SCR_EditorManagerEntity.IsLimitedInstance())
84// Rpc(RPC_AssignTaskToPlayer, gmID, taskID, playerID);
85// }
86//
87// //***********//
88// //RPC METHODS//
89// //***********//
90//
91// //------------------------------------------------------------------------------------------------
92// [RplRpc(RplChannel.Reliable, RplRcver.Server)]
93// protected void RPC_AssignTaskToPlayer(int gmID, int taskID, int playerID)
94// {
95// SCR_EditorManagerCore core = SCR_EditorManagerCore.Cast(SCR_EditorManagerCore.GetInstance(SCR_EditorManagerCore));
96// if (!core)
97// {
98// //Player cannot be GM
99// return;
100// }
101//
102// SCR_EditorManagerEntity manager = core.GetEditorManager(gmID);
103// if (!manager || manager.IsLimited())
104// {
105// //Player isn't GM
106// return;
107// }
108//
109// SCR_BaseTaskExecutor assignee = SCR_BaseTaskExecutor.GetTaskExecutorByID(playerID);
110// if (!assignee)
111// return;
112//
113// if (!GetTaskManager())
114// return;
115//
116// SCR_BaseTaskSupportEntity supportEntity = GetTaskManager().FindSupportEntity(SCR_BaseTaskSupportEntity);
117// if (!supportEntity)
118// return;
119//
120// SCR_BaseTask task = GetTaskManager().GetTask(taskID);
121// if (!task)
122// return;
123//
124// SCR_BaseTask assigneeTask = assignee.GetAssignedTask();
125// if (assigneeTask)
126// supportEntity.UnassignTask(assigneeTask, assignee, SCR_EUnassignReason.GM_REASSIGN);
127//
128// supportEntity.AssignTask(task, assignee, true);
129// }
130//
131// //------------------------------------------------------------------------------------------------
132// //! An RPC executed on the server, tells task manager to cancel given task by given player
133// //! \param[in] taskID
134// [RplRpc(RplChannel.Reliable, RplRcver.Server)]
135// protected void RPC_CancelTask(int taskID)
136// {
137// if (!GetTaskManager())
138// return;
139//
140// SCR_BaseTaskSupportEntity supportEntity = GetTaskManager().FindSupportEntity(SCR_BaseTaskSupportEntity);
141// if (supportEntity)
142// supportEntity.CancelTask(taskID);
143// }
144//
145// //------------------------------------------------------------------------------------------------
146// //! An RPC executed on the server, tells task manager to abandon given task by given player
147// //! \param[in] taskID
148// //! \param[in] playerID
149// [RplRpc(RplChannel.Reliable, RplRcver.Server)]
150// protected void RPC_AbandonTask(int taskID, int playerID)
151// {
152// SCR_BaseTaskExecutor assignee = null;
153//
154// if (playerID == INVALID_PLAYER_ID)
155// assignee = SCR_BaseTaskExecutor.GetLocalExecutor();
156// else
157// assignee = SCR_BaseTaskExecutor.GetTaskExecutorByID(playerID);
158//
159// if (!assignee)
160// return;
161//
162// GetTaskManager().AbandonTask(taskID, assignee);
163// }
164//
165// //------------------------------------------------------------------------------------------------
166// //! An RPC executed on the server, tells task manager to assign given task to given player
167// //! \param[in] taskID
168// //! \param[in] playerID
169// [RplRpc(RplChannel.Reliable, RplRcver.Server)]
170// protected void RPC_RequestAssignment(int taskID, int playerID)
171// {
172// SCR_BaseTaskExecutor assignee = null;
173//
174// if (playerID == INVALID_PLAYER_ID)
175// assignee = SCR_BaseTaskExecutor.GetLocalExecutor();
176// else
177// assignee = SCR_BaseTaskExecutor.GetTaskExecutorByID(playerID);
178//
179// if (!assignee)
180// return;
181//
182// GetTaskManager().RequestAssignment(taskID, assignee);
183// }
184//
185// //------------------------------------------------------------------------------------------------
186// override void EOnInit(IEntity owner)
187// {
188// m_PlayerController = SCR_PlayerController.Cast(PlayerController.Cast(owner));
189//
190// if (!m_PlayerController)
191// {
192// Print("SCR_TaskNetworkComponent must be attached to SCR_PlayerController!", LogLevel.ERROR);
193// return;
194// }
195//
196// m_RplComponent = RplComponent.Cast(m_PlayerController.FindComponent(RplComponent));
197// }
198//
199// //------------------------------------------------------------------------------------------------
200// override void OnPostInit(IEntity owner)
201// {
202// super.OnPostInit(owner);
203// SetEventMask(owner, EntityEvent.INIT);
204// }
205//
206// //------------------------------------------------------------------------------------------------
207// // constructor
208// void SCR_TaskNetworkComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
209// {
210// }
211//}