DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ActionManagerServer.c
См. документацию.
2{
4 ref ActionReciveData m_PendingActionReciveData;
5
11
12 //------------------------------------------
13 //EVENTS
14 //------------------------------------------
15 override void OnJumpStart()
16 {
18 }
19
21 {
23 {
25 {
28 }
29 else
30 {
31 m_CurrentActionData.m_Action.Interrupt(m_CurrentActionData);
32 }
33 }
34 }
35
36 override bool OnInputUserDataProcess(int userDataType, ParamsReadContext ctx)
37 {
38 switch (userDataType)
39 {
41 {
42#ifdef ENABLE_LOGGING
44 {
45 Debug.ActionLog("STS = " + m_Player.GetSimulationTimeStamp() + " INPUT_UDT_STANDARD_ACTION_START", this.ToString() , "n/a", "OnInputUserDataProcess", m_Player.ToString() );
46 }
47#endif
48 bool success = true;
49
50 int actionID = 0;
51 if (!ctx.Read(actionID))
52 return false;
53
54 ActionBase recvAction = GetAction(actionID);
55 if (!recvAction)
56 return false;
57
58 if (!recvAction.ReadFromContext(ctx, m_PendingActionReciveData))
59 success = false;
60
61 m_PendingAction = recvAction;
62
63 if (recvAction.UseAcknowledgment())
64 {
65 int ackID;
66 if (!ctx.Read(ackID))
67 success = false;
68
70 }
71
72 break;
73
74 }
75
77 {
78#ifdef ENABLE_LOGGING
80 {
81 Debug.ActionLog("STS = " + m_Player.GetSimulationTimeStamp() + " INPUT_UDT_STANDARD_ACTION_END_REQUEST", this.ToString() , "n/a", "OnInputUserDataProcess", m_Player.ToString() );
82 }
83#endif
84 //Debug.Log("Action want end request, STS = " + m_Player.GetSimulationTimeStamp());
85 int commandID = -10;
86 ctx.Read(commandID);
87
88 if (commandID == DayZPlayerConstants.CMD_ACTIONINT_INTERRUPT)
89 {
90 //Print("INPUT_UDT_STANDARD_ACTION_END_REQUEST | CMD_ACTIONINT_INTERRUPT");
92 }
93 else
94 {
95 //Print("INPUT_UDT_STANDARD_ACTION_END_REQUEST | m_ActionWantEndRequest");
97 }
98 }
99
101 {
102#ifdef ENABLE_LOGGING
104 {
105 Debug.ActionLog("STS = " + m_Player.GetSimulationTimeStamp() + " INPUT_UDT_STANDARD_ACTION_INPUT_END", this.ToString() , "n/a", "OnInputUserDataProcess", m_Player.ToString() );
106 }
107#endif
108 //Debug.Log("Action input ended, STS = " + m_Player.GetSimulationTimeStamp());
110 }
111 default:
112 return false;
113 }
114
115 if (!success)
116 {
117#ifdef ENABLE_LOGGING
119 {
120 Debug.ActionLog("STS = " + m_Player.GetSimulationTimeStamp() + " !success", this.ToString() , "n/a", "OnInputUserDataProcess", m_Player.ToString() );
121 }
122#endif
123 //Debug.Log("[AM] OnInputUserDataProcess INPUT_UDT_STANDARD_ACTION_START Error");
124 if (recvAction.UseAcknowledgment())
125 {
127 }
128 else
129 {
131 }
132
133 return false;
134 }
135 return true;
136
137 }
138
139 override void StartDeliveredAction()
140 {
142 {
144 return;
145 }
146
147 m_Interrupted = false;
148
149 bool accepted = false;
150 ActionBase pickedAction = m_CurrentActionData.m_Action;
151 ActionTarget target = m_CurrentActionData.m_Target;
152 ItemBase item = m_CurrentActionData.m_MainItem;
153
154#ifdef ENABLE_LOGGING
156 {
157 if (target)
158 {
159 Debug.ActionLog("STS = " + m_Player.GetSimulationTimeStamp() + "Item = " + item + ", " + target.DumpToString(), pickedAction.ToString() , "n/a", "StartDeliveredAction", m_Player.ToString());
160 }
161 else
162 {
163 Debug.ActionLog("STS = " + m_Player.GetSimulationTimeStamp() + "Item = " + item + ", NULL", pickedAction.ToString() , "n/a", "StartDeliveredAction", m_Player.ToString());
164 }
165 }
166#endif
167
168 if (!m_Player.GetCommandModifier_Action() && !m_Player.GetCommand_Action() && !m_Player.IsSprinting() && pickedAction && pickedAction.Can(m_Player,target,item))
169 {
170 if (pickedAction.AddActionJuncture(m_CurrentActionData))
171 accepted = true;
172 }
173
174 if (accepted)
175 {
176#ifdef ENABLE_LOGGING
178 {
179 Debug.ActionLog("STS = " + m_Player.GetSimulationTimeStamp() + " Action accepted", pickedAction.ToString() , "n/a", "CheckDeliveredAction", m_Player.ToString() );
180 }
181#endif
182 //Debug.Log("[AM] Action acccepted");
183 if (pickedAction.UseAcknowledgment())
184 {
185 //Unlock target
188 }
189 else
190 {
192 }
193 }
194 else
195 {
196#ifdef ENABLE_LOGGING
198 {
199 Debug.ActionLog("STS = " + m_Player.GetSimulationTimeStamp() + " Action rejected", pickedAction.ToString() , "n/a", "CheckDeliveredAction", m_Player.ToString() );
200 }
201#endif
202
203 if (pickedAction.UseAcknowledgment())
204 {
207 }
208 else
209 {
211 }
212 }
213 }
214
215 override void OnActionEnd()
216 {
217 //Debug.Log("Action ended - hard, STS = " + m_Player.GetSimulationTimeStamp());
219 {
220#ifdef ENABLE_LOGGING
222 {
223 Debug.ActionLog("STS = " + m_Player.GetSimulationTimeStamp(), this.ToString() , "n/a", "OnActionEnd", m_Player.ToString() );
224 }
225#endif
226 m_CurrentActionData.m_Action.ClearActionJuncture(m_CurrentActionData);
227
228 super.OnActionEnd();
229 }
230 }
231
232 //pCurrentCommandID is command ID at time of call command handler, some called methods can change actual true value (need call m_Player.GetCurrentCommandID() for actual command ID)
233 override void Update(int pCurrentCommandID)
234 {
235 super.Update(pCurrentCommandID);
236 int currentCommandID = m_Player.GetCurrentCommandID();
237
238 //Debug.Log("m_ActionWantEnd " + m_ActionInputWantEnd);
239
240 if (m_PendingAction)
241 {
243 {
244#ifdef ENABLE_LOGGING
246 {
247 Debug.ActionLog("STS = " + m_Player.GetSimulationTimeStamp() + " m_PendingAction && m_CurrentActionData", this.ToString() , "n/a", "Update", m_Player.ToString() );
248 }
249#endif
251 }
252 else
253 {
255 m_ActionInputWantEnd = false;
256
257 bool success = true;
258 ActionTarget target = new ActionTarget(null, null, -1, vector.Zero, 0);
259#ifdef ENABLE_LOGGING
261 {
262 Debug.ActionLog("STS = " + m_Player.GetSimulationTimeStamp(), m_PendingAction.ToString() , "n/a", "HandlePendingAction", m_Player.ToString() );
263 }
264#endif
265 if (!m_PendingAction.SetupAction(m_Player,target,m_Player.GetItemInHands(),m_CurrentActionData))
266 {
267 success = false;
268 }
269 //Debug.Log("[AM] Action data synced (" + m_Player + ") success: " + success);
270
271 if (success)
272 {
274 }
275 else
276 {
277 if (m_PendingAction.UseAcknowledgment())
278 {
280 }
281 else
282 {
284 }
285 }
286 }
287
288 m_PendingAction = null;
290 }
291
293 {
295 {
296 m_CurrentActionData.m_Action.OnUpdateServer(m_CurrentActionData);
297 }
298
299 //Debug.Log("m_CurrentActionData.m_State: " + m_CurrentActionData.m_State +" m_ActionWantEnd: " + m_ActionWantEndRequest );
300 switch (m_CurrentActionData.m_State)
301 {
302 case UA_AM_PENDING:
303 break;
304
305 case UA_AM_ACCEPTED:
306 // check currentCommandID before start or reject
307#ifdef ENABLE_LOGGING
309 {
310 Debug.ActionLog("STS = " + m_Player.GetSimulationTimeStamp() + " UA_AM_ACCEPTED", this.ToString() , "n/a", "Update", m_Player.ToString() );
311 }
312#endif
313 int condition_mask = ActionBase.ComputeConditionMask(m_Player, m_CurrentActionData.m_Target, m_CurrentActionData.m_MainItem);
314 bool canActionPerform = ((condition_mask & m_CurrentActionData.m_Action.m_ConditionMask) == condition_mask);
315 if (canActionPerform && ActionPossibilityCheck(currentCommandID))
316 {
319
320 if (m_CurrentActionData.m_Action && m_CurrentActionData.m_Action.IsInstant())
321 OnActionEnd();
322 }
323 else
324 {
326 }
328 break;
329
330 case UA_AM_REJECTED:
331#ifdef ENABLE_LOGGING
333 {
334 Debug.ActionLog("STS = " + m_Player.GetSimulationTimeStamp() + " UA_AM_REJECTED", this.ToString() , "n/a", "Update", m_Player.ToString() );
335 }
336#endif
337 OnActionEnd();
339 break;
340
341 default:
343 {
344#ifdef ENABLE_LOGGING
346 {
347 Debug.ActionLog("STS = " + m_Player.GetSimulationTimeStamp() + " m_ActionInputWantEnd", this.ToString() , "n/a", "Update", m_Player.ToString() );
348 }
349#endif
350 m_ActionInputWantEnd = false;
351 m_CurrentActionData.m_Action.EndInput(m_CurrentActionData);
352 }
353
355 {
356#ifdef ENABLE_LOGGING
358 {
359 Debug.ActionLog("STS = " + m_Player.GetSimulationTimeStamp() + " m_ActionWantEndRequest", this.ToString() , "n/a", "Update", m_Player.ToString() );
360 }
361#endif
363 m_CurrentActionData.m_Action.EndRequest(m_CurrentActionData);
364 }
365 break;
366 }
367 }
368 }
369
372 {
374 {
375#ifdef ENABLE_LOGGING
377 {
378 Debug.ActionLog("STS = " + m_Player.GetSimulationTimeStamp(), this.ToString() , "n/a", "RequestInterruptAction", m_Player.ToString() );
379 }
380#endif
382 }
383 }
384
385 override ActionReciveData GetReciveData()
386 {
388 }
389}
const int INPUT_UDT_STANDARD_ACTION_END_REQUEST
const int INPUT_UDT_STANDARD_ACTION_START
const int INPUT_UDT_STANDARD_ACTION_INPUT_END
void ActionBase()
Определения ActionBase.c:82
override ActionBase GetAction()
Определения ActionInput.c:506
bool m_Interrupted
Определения ActionManagerBase.c:49
ref ActionData m_CurrentActionData
Определения ActionManagerBase.c:61
bool m_ActionInputWantEnd
Определения ActionManagerBase.c:53
bool ActionPossibilityCheck(int pCurrentCommandID)
Определения ActionManagerBase.c:262
void ActionManagerBase(PlayerBase player)
Определения ActionManagerBase.c:63
int m_PendingActionAcknowledgmentID
Определения ActionManagerBase.c:59
bool m_ActionWantEndRequest
Определения ActionManagerBase.c:52
void ActionTarget(Object object, Object parent, int componentIndex, vector cursorHitPos, float utility, string surfaceName="")
Определения ActionTargets.c:125
DayZPlayer m_Player
Определения Hand_Events.c:42
ref ActionReciveData m_PendingActionReciveData
Определения ActionManagerServer.c:4
override ActionReciveData GetReciveData()
Определения ActionManagerServer.c:385
void ActionManagerServer(PlayerBase player)
Определения ActionManagerServer.c:6
override bool OnInputUserDataProcess(int userDataType, ParamsReadContext ctx)
Определения ActionManagerServer.c:36
override void OnJumpStart()
Определения ActionManagerServer.c:15
override void RequestInterruptAction()
server requests action interrupt
Определения ActionManagerServer.c:371
override void StartDeliveredAction()
Определения ActionManagerServer.c:139
override void Update(int pCurrentCommandID)
Определения ActionManagerServer.c:233
override void OnActionEnd()
Определения ActionManagerServer.c:215
ActionBase m_PendingAction
Определения ActionManagerServer.c:3
override void EndOrInterruptCurrentAction()
Определения ActionManagerServer.c:20
static void SendActionInterrupt(DayZPlayer pPlayer)
Определения DayZPlayerSyncJunctures.c:265
static void SendActionAcknowledgment(DayZPlayer pPlayer, int AckID, bool accept)
Определения DayZPlayerSyncJunctures.c:280
static void ActionLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Определения 3_Game/DayZ/tools/Debug.c:188
Определения 3_Game/DayZ/tools/Debug.c:2
static bool IsActionLogEnable()
Определения 3_Game/DayZ/tools/Debug.c:749
Определения PlayerBaseClient.c:2
proto bool Read(void value_in)
static const vector Zero
Определения EnConvert.c:123
Определения EnConvert.c:119
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
Serializer ParamsReadContext
Определения gameplay.c:15
const int UA_START
Определения 3_Game/DayZ/constants.c:501
const int UA_AM_ACCEPTED
Определения 3_Game/DayZ/constants.c:510
const int UA_AM_REJECTED
Определения 3_Game/DayZ/constants.c:511
const int UA_AM_PENDING
Определения 3_Game/DayZ/constants.c:509