DayZ 1.24
Loading...
Searching...
No Matches
ActionUnfoldMap.c File Reference

Go to the source code of this file.

Classes

class  ActionUnfoldMapCB
 

Functions

ActionUnfoldMapCB ActionBaseCB ActionUnfoldMap ()
 
void ActionUnfoldMapCB ()
 
void ~ActionUnfoldMapCB ()
 
override void SetActionData (ActionData action_data)
 
bool CancelCondition ()
 
override void OnStateChange (int pOldState, int pCurrentState)
 
override void OnAnimationEvent (int pEventID)
 
override void OnFinish (bool pCanceled)
 
void PerformMapChange ()
 
bool StateCheck ()
 
override bool IsInstant ()
 
override void CreateConditionComponents ()
 
override bool HasTarget ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override int GetActionCategory ()
 
override void OnStartClient (ActionData action_data)
 
override void OnStartServer (ActionData action_data)
 
override void OnEndRequest (ActionData action_data)
 
override void Interrupt (ActionData action_data)
 
void OpenMap (ActionData action_data)
 

Variables

bool m_MapFolding
 
bool m_HasReceivedEvent
 
bool m_CancelCondition
 
int m_InitMovementState
 
int m_FinalMovementState
 

Function Documentation

◆ ActionCondition()

override bool ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )

Definition at line 185 of file ActionUnfoldMap.c.

186 {
187 if (player.m_hac || player.IsMapOpen())
188 return false;
189 return true;
190 }

◆ ActionUnfoldMap()

ActionUnfoldMapCB ActionBaseCB ActionUnfoldMap ( )

Definition at line 1 of file ActionUnfoldMap.c.

165 {
166 m_Text = "#unfold_map";
167 }
string m_Text
Definition ActionBase.c:49

Referenced by MissionBase::IsMapUnfoldActionRunning(), ActionUnfoldMapCB::OnFinish(), ActionConstructor::RegisterActions(), and ItemMap::SetActions().

◆ ActionUnfoldMapCB()

void ActionUnfoldMap::ActionUnfoldMapCB ( )

Definition at line 171 of file ActionUnfoldMap.c.

175 {
ref CCIBase m_ConditionItem
Definition ActionBase.c:55

◆ CancelCondition()

bool ActionUnfoldMap::CancelCondition ( )

Definition at line 207 of file ActionUnfoldMap.c.

210 {

◆ CreateConditionComponents()

override void CreateConditionComponents ( )

Definition at line 174 of file ActionUnfoldMap.c.

175 {
178 }
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56

References m_ConditionItem, and m_ConditionTarget.

◆ GetActionCategory()

override int GetActionCategory ( )

Definition at line 192 of file ActionUnfoldMap.c.

193 {
194 return AC_SINGLE_USE;
195 }
const int AC_SINGLE_USE
Definition _constants.c:2

References AC_SINGLE_USE.

◆ HasTarget()

override bool HasTarget ( )

Definition at line 180 of file ActionUnfoldMap.c.

181 {
182 return false;
183 }

◆ Interrupt()

override void Interrupt ( ActionData action_data)

Definition at line 215 of file ActionUnfoldMap.c.

216 {
217 if (action_data.m_Player.m_hac)
218 {
219 action_data.m_Player.m_hac.m_MapFolding = true;
220 action_data.m_Player.m_hac.PerformMapChange();
221 action_data.m_Player.m_hac.Cancel();
222 }
223 else //should never get here, End called from the callback
225 }
void End()
called on surrender end request end

◆ IsInstant()

override bool IsInstant ( )

Definition at line 169 of file ActionUnfoldMap.c.

170 {
171 return false;
172 }

◆ OnAnimationEvent()

override void ActionUnfoldMap::OnAnimationEvent ( int pEventID)

Definition at line 221 of file ActionUnfoldMap.c.

228 {
229 if (!action_data.m_Player.IsPlayerInStance(DayZPlayerConstants.STANCEMASK_PRONE))
230 action_data.m_Player.m_hac = ActionUnfoldMapCB.Cast(action_data.m_Player.AddCommandModifier_Action(DayZPlayerConstants.CMD_ACTIONMOD_VIEWMAP, ActionUnfoldMapCB));
231 else
232 action_data.m_Player.m_hac = ActionUnfoldMapCB.Cast(action_data.m_Player.StartCommand_Action(DayZPlayerConstants.CMD_ACTIONFB_VIEWMAP, ActionUnfoldMapCB, DayZPlayerConstants.STANCEMASK_PRONE));
233
234 // sets player for associated callback to use
235 if (action_data.m_Player.m_hac)
236 {
237 action_data.m_Player.m_hac.SetActionData(action_data);
238 action_data.m_Callback = action_data.m_Player.m_hac;
239 }
240 }
241}
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597

◆ OnEndRequest()

override void OnEndRequest ( ActionData action_data)

Definition at line 209 of file ActionUnfoldMap.c.

210 {
211 action_data.m_Callback.InternalCommand(DayZPlayerConstants.CMD_ACTIONINT_END);
212 action_data.m_State = UA_FINISHED;
213 }
const int UA_FINISHED
Definition constants.c:436

◆ OnFinish()

override void ActionUnfoldMap::OnFinish ( bool pCanceled)

Definition at line 243 of file ActionUnfoldMap.c.

244{
245 bool m_MapFolding;
250
251 void ActionUnfoldMapCB()
252 {
256 }
257
258 void ~ActionUnfoldMapCB()
259 {
260 if (GetGame() && GetGame().GetMission())
261 {
263 {
264 GetGame().GetMission().RemoveActiveInputExcludes({"map"}, false);
265 }
266 else
267 {
268 GetGame().GetMission().RemoveActiveInputExcludes({"loopedactions"}, false);
269 }
270 GetGame().GetMission().RemoveActiveInputRestriction(EInputRestrictors.MAP);
271 }
272
273 if (!m_ActionData || !m_ActionData.m_Player)
274 return;
275
276 ItemMap chernomap = ItemMap.Cast(m_ActionData.m_Player.GetItemInHands());
277 if (chernomap && m_ActionData.m_Player.IsMapOpen())
278 chernomap.SetMapStateOpen(false, m_ActionData.m_Player);
279 }
280
282 {
283 m_ActionData = action_data;
284 m_InitMovementState = m_ActionData.m_Player.m_MovementState.m_iStanceIdx;
285 }
286
287 bool CancelCondition()
288 {
289 return m_CancelCondition;
290 }
291
292 override void OnStateChange(int pOldState, int pCurrentState)
293 {
294 if (!m_ActionData || !m_ActionData.m_Player)
295 return;
296
298 m_CancelCondition = true;
299 }
300
301 override void OnAnimationEvent(int pEventID)
302 {
303 if (!m_ActionData || !m_ActionData.m_Player)
304 return;
305
306 switch (pEventID)
307 {
308 case UA_ANIM_EVENT:
309 m_HasReceivedEvent = true;
310 m_FinalMovementState = m_ActionData.m_Player.m_MovementState.m_iStanceIdx;
311
312 if (StateCheck())
313 {
315 m_CancelCondition = false;
316 }
317 else
318 m_CancelCondition = true;
319 break;
320 }
321 }
322
323 override void OnFinish(bool pCanceled)
324 {
325 if (m_ActionData && m_ActionData.m_Player)
326 {
327 if (m_ActionData && m_ActionData.m_ActionComponent)
328 m_ActionData.m_State = m_ActionData.m_ActionComponent.Interrupt(m_ActionData);
329
330 if ((!GetGame().IsDedicatedServer()) && GetGame().GetUIManager() && GetGame().GetUIManager().IsMenuOpen(MENU_MAP))
331 GetGame().GetUIManager().FindMenu(MENU_MAP).Close();
332
333 ActionUnfoldMap action = ActionUnfoldMap.Cast(m_ActionData.m_Action);
336
337 m_ActionData.m_Player.SetMapClosingSyncSet(false); //reset
338
339 ItemMap chernomap = ItemMap.Cast(m_ActionData.m_Player.GetItemInHands());
340 if (chernomap && m_ActionData.m_Player.IsMapOpen())
341 chernomap.SetMapStateOpen(false, m_ActionData.m_Player);
342
343 if (action)
344 action.End(m_ActionData);
345 }
346 }
347
348 void PerformMapChange()
349 {
350 if (m_ActionData.m_Player.IsSwimming() || m_ActionData.m_Player.IsClimbing() || m_ActionData.m_Player.IsFalling() || m_ActionData.m_Player.IsClimbingLadder() || m_ActionData.m_Player.IsUnconscious() || m_ActionData.m_Player.IsRestrained())
351 return;
352
353 ItemMap chernomap = ItemMap.Cast(m_ActionData.m_Player.GetItemInHands());
354 if (chernomap)
355 {
356 if (!m_ActionData.m_Player.IsMapOpen() && !m_MapFolding)
357 {
358 if (m_CancelCondition) //do not open when cancelling in progress
359 return;
360
361 chernomap.SetMapStateOpen(true, m_ActionData.m_Player);
362
363 if (!GetGame().IsMultiplayer() || GetGame().IsServer())
364 {
365 //chernomap.SyncMapMarkers();
366 }
367
368 if (!GetGame().IsDedicatedServer())
369 {
370 UIManager m_UIManager;
372 m_UIManager = GetGame().GetUIManager();
373 m_UIManager.CloseAll();
375 {
376 mapMenu = m_UIManager.EnterScriptedMenu(MENU_MAP, null);
377 mapMenu.InitMapItem(chernomap);
378 mapMenu.LoadMapMarkers();
379 GetGame().GetMission().AddActiveInputExcludes({"map"});
380 }
381 else
382 {
383 GetGame().GetMission().AddActiveInputExcludes({"loopedactions"});
384 }
385
386 GetGame().GetMission().AddActiveInputRestriction(EInputRestrictors.MAP);
387 }
388 }
389 else if (m_ActionData.m_Player.IsMapOpen())
390 {
391 chernomap.SetMapStateOpen(false, m_ActionData.m_Player);
392 m_MapFolding = true;
393 m_ActionData.m_Player.SetMapOpen(false);
394 }
395 }
396 }
397
398 bool StateCheck()
399 {
401 }
402}
403
404class ActionUnfoldMap: ActionBase
405{
406 void ActionUnfoldMap()
407 {
408 m_Text = "#unfold_map";
409 }
410
411 override bool IsInstant()
412 {
413 return false;
414 }
415
416 override void CreateConditionComponents()
417 {
420 }
421
422 override bool HasTarget()
423 {
424 return false;
425 }
426
427 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
428 {
429 if (player.m_hac || player.IsMapOpen())
430 return false;
431 return true;
432 }
433
434 override int GetActionCategory()
435 {
436 return AC_SINGLE_USE;
437 }
438
440 {
442 }
443
445 {
447 ItemMap chernomap = ItemMap.Cast(action_data.m_MainItem);
448 chernomap.SyncMapMarkers();
449 }
450
451 override void OnEndRequest(ActionData action_data)
452 {
453 action_data.m_Callback.InternalCommand(DayZPlayerConstants.CMD_ACTIONINT_END);
454 action_data.m_State = UA_FINISHED;
455 }
456
457 override void Interrupt(ActionData action_data)
458 {
459 if (action_data.m_Player.m_hac)
460 {
461 action_data.m_Player.m_hac.m_MapFolding = true;
462 action_data.m_Player.m_hac.PerformMapChange();
463 action_data.m_Player.m_hac.Cancel();
464 }
465 else //should never get here, End called from the callback
467 }
468
470 {
471 if (!action_data.m_Player.IsPlayerInStance(DayZPlayerConstants.STANCEMASK_PRONE))
472 action_data.m_Player.m_hac = ActionUnfoldMapCB.Cast(action_data.m_Player.AddCommandModifier_Action(DayZPlayerConstants.CMD_ACTIONMOD_VIEWMAP, ActionUnfoldMapCB));
473 else
474 action_data.m_Player.m_hac = ActionUnfoldMapCB.Cast(action_data.m_Player.StartCommand_Action(DayZPlayerConstants.CMD_ACTIONFB_VIEWMAP, ActionUnfoldMapCB, DayZPlayerConstants.STANCEMASK_PRONE));
475
476 // sets player for associated callback to use
477 if (action_data.m_Player.m_hac)
478 {
479 action_data.m_Player.m_hac.SetActionData(action_data);
480 action_data.m_Callback = action_data.m_Player.m_hac;
481 }
482 }
483}
void CreateConditionComponents()
Definition ActionBase.c:196
bool HasTarget()
Definition ActionBase.c:210
int GetActionCategory()
Definition ActionBase.c:244
void OnStartClient(ActionData action_data)
Definition ActionBase.c:946
void OnStartServer(ActionData action_data)
Definition ActionBase.c:949
void OnEndRequest(ActionData action_data)
Definition ActionBase.c:586
bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition ActionBase.c:350
bool IsInstant()
Definition ActionBase.c:228
void Interrupt()
override void OnStateChange(int pOldState, int pCurrentState)
bool m_MapFolding
bool CancelCondition()
bool StateCheck()
ActionUnfoldMapCB ActionBaseCB ActionUnfoldMap()
void ActionUnfoldMapCB()
override void OnAnimationEvent(int pEventID)
void ~ActionUnfoldMapCB()
void PerformMapChange()
bool m_HasReceivedEvent
override void OnFinish(bool pCanceled)
override void SetActionData(ActionData action_data)
int m_InitMovementState
bool m_CancelCondition
int m_FinalMovementState
void OpenMap(ActionData action_data)
class DayZCreatureAnimInterface RegisterAnimationEvent(string event_name, string function_name)
proto native UIScriptedMenu EnterScriptedMenu(int id, UIMenuPanel parent)
Create & open menu with specific id (see MenuID) and set its parent.
bool CloseAll()
Close all opened menus.
Definition UIManager.c:76
proto native CGame GetGame()
const int MENU_MAP
Definition constants.c:181
const int UA_ANIM_EVENT
Definition constants.c:443
static const int STATE_LOOP_IN
looped state
Definition human.c:351
proto native void EnableCancelCondition(bool pEnable)
proto native void EnableStateChangeCallback()
enables state change callback OnStateChange
static const int STATE_LOOP_LOOP
Definition human.c:352

◆ OnStartClient()

override void OnStartClient ( ActionData action_data)

Definition at line 197 of file ActionUnfoldMap.c.

198 {
200 }

References OpenMap().

◆ OnStartServer()

override void OnStartServer ( ActionData action_data)

Definition at line 202 of file ActionUnfoldMap.c.

203 {
205 ItemMap chernomap = ItemMap.Cast(action_data.m_MainItem);
206 chernomap.SyncMapMarkers();
207 }

References OpenMap().

◆ OnStateChange()

override void ActionUnfoldMap::OnStateChange ( int pOldState,
int pCurrentState )

Definition at line 212 of file ActionUnfoldMap.c.

216 {
217 if (action_data.m_Player.m_hac)
218 {
219 action_data.m_Player.m_hac.m_MapFolding = true;

◆ OpenMap()

void OpenMap ( ActionData action_data)

Definition at line 227 of file ActionUnfoldMap.c.

228 {
229 if (!action_data.m_Player.IsPlayerInStance(DayZPlayerConstants.STANCEMASK_PRONE))
230 action_data.m_Player.m_hac = ActionUnfoldMapCB.Cast(action_data.m_Player.AddCommandModifier_Action(DayZPlayerConstants.CMD_ACTIONMOD_VIEWMAP, ActionUnfoldMapCB));
231 else
232 action_data.m_Player.m_hac = ActionUnfoldMapCB.Cast(action_data.m_Player.StartCommand_Action(DayZPlayerConstants.CMD_ACTIONFB_VIEWMAP, ActionUnfoldMapCB, DayZPlayerConstants.STANCEMASK_PRONE));
233
234 // sets player for associated callback to use
235 if (action_data.m_Player.m_hac)
236 {
237 action_data.m_Player.m_hac.SetActionData(action_data);
238 action_data.m_Callback = action_data.m_Player.m_hac;
239 }
240 }

Referenced by OnStartClient(), and OnStartServer().

◆ PerformMapChange()

void ActionUnfoldMap::PerformMapChange ( )

Definition at line 268 of file ActionUnfoldMap.c.

269{
270 bool m_MapFolding;
275
276 void ActionUnfoldMapCB()
277 {
281 }
282
283 void ~ActionUnfoldMapCB()
284 {
285 if (GetGame() && GetGame().GetMission())
286 {
288 {
289 GetGame().GetMission().RemoveActiveInputExcludes({"map"}, false);
290 }
291 else
292 {
293 GetGame().GetMission().RemoveActiveInputExcludes({"loopedactions"}, false);
294 }
295 GetGame().GetMission().RemoveActiveInputRestriction(EInputRestrictors.MAP);
296 }
297
298 if (!m_ActionData || !m_ActionData.m_Player)
299 return;
300
301 ItemMap chernomap = ItemMap.Cast(m_ActionData.m_Player.GetItemInHands());
302 if (chernomap && m_ActionData.m_Player.IsMapOpen())
303 chernomap.SetMapStateOpen(false, m_ActionData.m_Player);
304 }
305
307 {
308 m_ActionData = action_data;
309 m_InitMovementState = m_ActionData.m_Player.m_MovementState.m_iStanceIdx;
310 }
311
312 bool CancelCondition()
313 {
314 return m_CancelCondition;
315 }
316
317 override void OnStateChange(int pOldState, int pCurrentState)
318 {
319 if (!m_ActionData || !m_ActionData.m_Player)
320 return;
321
323 m_CancelCondition = true;
324 }
325
326 override void OnAnimationEvent(int pEventID)
327 {
328 if (!m_ActionData || !m_ActionData.m_Player)
329 return;
330
331 switch (pEventID)
332 {
333 case UA_ANIM_EVENT:
334 m_HasReceivedEvent = true;
335 m_FinalMovementState = m_ActionData.m_Player.m_MovementState.m_iStanceIdx;
336
337 if (StateCheck())
338 {
340 m_CancelCondition = false;
341 }
342 else
343 m_CancelCondition = true;
344 break;
345 }
346 }
347
348 override void OnFinish(bool pCanceled)
349 {
350 if (m_ActionData && m_ActionData.m_Player)
351 {
352 if (m_ActionData && m_ActionData.m_ActionComponent)
353 m_ActionData.m_State = m_ActionData.m_ActionComponent.Interrupt(m_ActionData);
354
355 if ((!GetGame().IsDedicatedServer()) && GetGame().GetUIManager() && GetGame().GetUIManager().IsMenuOpen(MENU_MAP))
356 GetGame().GetUIManager().FindMenu(MENU_MAP).Close();
357
358 ActionUnfoldMap action = ActionUnfoldMap.Cast(m_ActionData.m_Action);
361
362 m_ActionData.m_Player.SetMapClosingSyncSet(false); //reset
363
364 ItemMap chernomap = ItemMap.Cast(m_ActionData.m_Player.GetItemInHands());
365 if (chernomap && m_ActionData.m_Player.IsMapOpen())
366 chernomap.SetMapStateOpen(false, m_ActionData.m_Player);
367
368 if (action)
369 action.End(m_ActionData);
370 }
371 }
372
373 void PerformMapChange()
374 {
375 if (m_ActionData.m_Player.IsSwimming() || m_ActionData.m_Player.IsClimbing() || m_ActionData.m_Player.IsFalling() || m_ActionData.m_Player.IsClimbingLadder() || m_ActionData.m_Player.IsUnconscious() || m_ActionData.m_Player.IsRestrained())
376 return;
377
378 ItemMap chernomap = ItemMap.Cast(m_ActionData.m_Player.GetItemInHands());
379 if (chernomap)
380 {
381 if (!m_ActionData.m_Player.IsMapOpen() && !m_MapFolding)
382 {
383 if (m_CancelCondition) //do not open when cancelling in progress
384 return;
385
386 chernomap.SetMapStateOpen(true, m_ActionData.m_Player);
387
388 if (!GetGame().IsMultiplayer() || GetGame().IsServer())
389 {
390 //chernomap.SyncMapMarkers();
391 }
392
393 if (!GetGame().IsDedicatedServer())
394 {
395 UIManager m_UIManager;
397 m_UIManager = GetGame().GetUIManager();
398 m_UIManager.CloseAll();
400 {
401 mapMenu = m_UIManager.EnterScriptedMenu(MENU_MAP, null);
402 mapMenu.InitMapItem(chernomap);
403 mapMenu.LoadMapMarkers();
404 GetGame().GetMission().AddActiveInputExcludes({"map"});
405 }
406 else
407 {
408 GetGame().GetMission().AddActiveInputExcludes({"loopedactions"});
409 }
410
411 GetGame().GetMission().AddActiveInputRestriction(EInputRestrictors.MAP);
412 }
413 }
414 else if (m_ActionData.m_Player.IsMapOpen())
415 {
416 chernomap.SetMapStateOpen(false, m_ActionData.m_Player);
417 m_MapFolding = true;
418 m_ActionData.m_Player.SetMapOpen(false);
419 }
420 }
421 }
422
423 bool StateCheck()
424 {
426 }
427}
428
429class ActionUnfoldMap: ActionBase
430{
431 void ActionUnfoldMap()
432 {
433 m_Text = "#unfold_map";
434 }
435
436 override bool IsInstant()
437 {
438 return false;
439 }
440
441 override void CreateConditionComponents()
442 {
445 }
446
447 override bool HasTarget()
448 {
449 return false;
450 }
451
452 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
453 {
454 if (player.m_hac || player.IsMapOpen())
455 return false;
456 return true;
457 }
458
459 override int GetActionCategory()
460 {
461 return AC_SINGLE_USE;
462 }
463
465 {
467 }
468
470 {
472 ItemMap chernomap = ItemMap.Cast(action_data.m_MainItem);
473 chernomap.SyncMapMarkers();
474 }
475
476 override void OnEndRequest(ActionData action_data)
477 {
478 action_data.m_Callback.InternalCommand(DayZPlayerConstants.CMD_ACTIONINT_END);
479 action_data.m_State = UA_FINISHED;
480 }
481
482 override void Interrupt(ActionData action_data)
483 {
484 if (action_data.m_Player.m_hac)
485 {
486 action_data.m_Player.m_hac.m_MapFolding = true;
487 action_data.m_Player.m_hac.PerformMapChange();
488 action_data.m_Player.m_hac.Cancel();
489 }
490 else //should never get here, End called from the callback
492 }
493
495 {
496 if (!action_data.m_Player.IsPlayerInStance(DayZPlayerConstants.STANCEMASK_PRONE))
497 action_data.m_Player.m_hac = ActionUnfoldMapCB.Cast(action_data.m_Player.AddCommandModifier_Action(DayZPlayerConstants.CMD_ACTIONMOD_VIEWMAP, ActionUnfoldMapCB));
498 else
499 action_data.m_Player.m_hac = ActionUnfoldMapCB.Cast(action_data.m_Player.StartCommand_Action(DayZPlayerConstants.CMD_ACTIONFB_VIEWMAP, ActionUnfoldMapCB, DayZPlayerConstants.STANCEMASK_PRONE));
500
501 // sets player for associated callback to use
502 if (action_data.m_Player.m_hac)
503 {
504 action_data.m_Player.m_hac.SetActionData(action_data);
505 action_data.m_Callback = action_data.m_Player.m_hac;
506 }
507 }
508}

◆ SetActionData()

override void ActionUnfoldMap::SetActionData ( ActionData action_data)

Definition at line 201 of file ActionUnfoldMap.c.

203 {
205 ItemMap chernomap = ItemMap.Cast(action_data.m_MainItem);

◆ StateCheck()

bool ActionUnfoldMap::StateCheck ( )

Definition at line 318 of file ActionUnfoldMap.c.

319{
320 bool m_MapFolding;
325
326 void ActionUnfoldMapCB()
327 {
331 }
332
333 void ~ActionUnfoldMapCB()
334 {
335 if (GetGame() && GetGame().GetMission())
336 {
338 {
339 GetGame().GetMission().RemoveActiveInputExcludes({"map"}, false);
340 }
341 else
342 {
343 GetGame().GetMission().RemoveActiveInputExcludes({"loopedactions"}, false);
344 }
345 GetGame().GetMission().RemoveActiveInputRestriction(EInputRestrictors.MAP);
346 }
347
348 if (!m_ActionData || !m_ActionData.m_Player)
349 return;
350
351 ItemMap chernomap = ItemMap.Cast(m_ActionData.m_Player.GetItemInHands());
352 if (chernomap && m_ActionData.m_Player.IsMapOpen())
353 chernomap.SetMapStateOpen(false, m_ActionData.m_Player);
354 }
355
357 {
358 m_ActionData = action_data;
359 m_InitMovementState = m_ActionData.m_Player.m_MovementState.m_iStanceIdx;
360 }
361
362 bool CancelCondition()
363 {
364 return m_CancelCondition;
365 }
366
367 override void OnStateChange(int pOldState, int pCurrentState)
368 {
369 if (!m_ActionData || !m_ActionData.m_Player)
370 return;
371
373 m_CancelCondition = true;
374 }
375
376 override void OnAnimationEvent(int pEventID)
377 {
378 if (!m_ActionData || !m_ActionData.m_Player)
379 return;
380
381 switch (pEventID)
382 {
383 case UA_ANIM_EVENT:
384 m_HasReceivedEvent = true;
385 m_FinalMovementState = m_ActionData.m_Player.m_MovementState.m_iStanceIdx;
386
387 if (StateCheck())
388 {
390 m_CancelCondition = false;
391 }
392 else
393 m_CancelCondition = true;
394 break;
395 }
396 }
397
398 override void OnFinish(bool pCanceled)
399 {
400 if (m_ActionData && m_ActionData.m_Player)
401 {
402 if (m_ActionData && m_ActionData.m_ActionComponent)
403 m_ActionData.m_State = m_ActionData.m_ActionComponent.Interrupt(m_ActionData);
404
405 if ((!GetGame().IsDedicatedServer()) && GetGame().GetUIManager() && GetGame().GetUIManager().IsMenuOpen(MENU_MAP))
406 GetGame().GetUIManager().FindMenu(MENU_MAP).Close();
407
408 ActionUnfoldMap action = ActionUnfoldMap.Cast(m_ActionData.m_Action);
411
412 m_ActionData.m_Player.SetMapClosingSyncSet(false); //reset
413
414 ItemMap chernomap = ItemMap.Cast(m_ActionData.m_Player.GetItemInHands());
415 if (chernomap && m_ActionData.m_Player.IsMapOpen())
416 chernomap.SetMapStateOpen(false, m_ActionData.m_Player);
417
418 if (action)
419 action.End(m_ActionData);
420 }
421 }
422
423 void PerformMapChange()
424 {
425 if (m_ActionData.m_Player.IsSwimming() || m_ActionData.m_Player.IsClimbing() || m_ActionData.m_Player.IsFalling() || m_ActionData.m_Player.IsClimbingLadder() || m_ActionData.m_Player.IsUnconscious() || m_ActionData.m_Player.IsRestrained())
426 return;
427
428 ItemMap chernomap = ItemMap.Cast(m_ActionData.m_Player.GetItemInHands());
429 if (chernomap)
430 {
431 if (!m_ActionData.m_Player.IsMapOpen() && !m_MapFolding)
432 {
433 if (m_CancelCondition) //do not open when cancelling in progress
434 return;
435
436 chernomap.SetMapStateOpen(true, m_ActionData.m_Player);
437
438 if (!GetGame().IsMultiplayer() || GetGame().IsServer())
439 {
440 //chernomap.SyncMapMarkers();
441 }
442
443 if (!GetGame().IsDedicatedServer())
444 {
445 UIManager m_UIManager;
447 m_UIManager = GetGame().GetUIManager();
448 m_UIManager.CloseAll();
450 {
451 mapMenu = m_UIManager.EnterScriptedMenu(MENU_MAP, null);
452 mapMenu.InitMapItem(chernomap);
453 mapMenu.LoadMapMarkers();
454 GetGame().GetMission().AddActiveInputExcludes({"map"});
455 }
456 else
457 {
458 GetGame().GetMission().AddActiveInputExcludes({"loopedactions"});
459 }
460
461 GetGame().GetMission().AddActiveInputRestriction(EInputRestrictors.MAP);
462 }
463 }
464 else if (m_ActionData.m_Player.IsMapOpen())
465 {
466 chernomap.SetMapStateOpen(false, m_ActionData.m_Player);
467 m_MapFolding = true;
468 m_ActionData.m_Player.SetMapOpen(false);
469 }
470 }
471 }
472
473 bool StateCheck()
474 {
476 }
477}
478
479class ActionUnfoldMap: ActionBase
480{
481 void ActionUnfoldMap()
482 {
483 m_Text = "#unfold_map";
484 }
485
486 override bool IsInstant()
487 {
488 return false;
489 }
490
491 override void CreateConditionComponents()
492 {
495 }
496
497 override bool HasTarget()
498 {
499 return false;
500 }
501
502 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
503 {
504 if (player.m_hac || player.IsMapOpen())
505 return false;
506 return true;
507 }
508
509 override int GetActionCategory()
510 {
511 return AC_SINGLE_USE;
512 }
513
515 {
517 }
518
520 {
522 ItemMap chernomap = ItemMap.Cast(action_data.m_MainItem);
523 chernomap.SyncMapMarkers();
524 }
525
526 override void OnEndRequest(ActionData action_data)
527 {
528 action_data.m_Callback.InternalCommand(DayZPlayerConstants.CMD_ACTIONINT_END);
529 action_data.m_State = UA_FINISHED;
530 }
531
532 override void Interrupt(ActionData action_data)
533 {
534 if (action_data.m_Player.m_hac)
535 {
536 action_data.m_Player.m_hac.m_MapFolding = true;
537 action_data.m_Player.m_hac.PerformMapChange();
538 action_data.m_Player.m_hac.Cancel();
539 }
540 else //should never get here, End called from the callback
542 }
543
545 {
546 if (!action_data.m_Player.IsPlayerInStance(DayZPlayerConstants.STANCEMASK_PRONE))
547 action_data.m_Player.m_hac = ActionUnfoldMapCB.Cast(action_data.m_Player.AddCommandModifier_Action(DayZPlayerConstants.CMD_ACTIONMOD_VIEWMAP, ActionUnfoldMapCB));
548 else
549 action_data.m_Player.m_hac = ActionUnfoldMapCB.Cast(action_data.m_Player.StartCommand_Action(DayZPlayerConstants.CMD_ACTIONFB_VIEWMAP, ActionUnfoldMapCB, DayZPlayerConstants.STANCEMASK_PRONE));
550
551 // sets player for associated callback to use
552 if (action_data.m_Player.m_hac)
553 {
554 action_data.m_Player.m_hac.SetActionData(action_data);
555 action_data.m_Callback = action_data.m_Player.m_hac;
556 }
557 }
558}

◆ ~ActionUnfoldMapCB()

void ActionUnfoldMap::~ActionUnfoldMapCB ( )

Definition at line 178 of file ActionUnfoldMap.c.

181 {
182 return false;
183 }
184
185 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
186 {
187 if (player.m_hac || player.IsMapOpen())
188 return false;
189 return true;
190 }
191
192 override int GetActionCategory()
193 {
194 return AC_SINGLE_USE;
195 }
196
198 {
override int GetActionCategory()
override void OnStartClient(ActionData action_data)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)

Variable Documentation

◆ m_CancelCondition

bool m_CancelCondition

Definition at line 167 of file ActionUnfoldMap.c.

◆ m_FinalMovementState

int m_FinalMovementState

Definition at line 169 of file ActionUnfoldMap.c.

◆ m_HasReceivedEvent

bool m_HasReceivedEvent

Definition at line 166 of file ActionUnfoldMap.c.

◆ m_InitMovementState

int m_InitMovementState

Definition at line 168 of file ActionUnfoldMap.c.

◆ m_MapFolding

bool m_MapFolding

Definition at line 165 of file ActionUnfoldMap.c.