DayZ 1.24
Loading...
Searching...
No Matches
ActionManagerClient Class Reference
Inheritance diagram for ActionManagerClient:
[legend]
Collaboration diagram for ActionManagerClient:
[legend]

Protected Member Functions

void ActionManagerClient (PlayerBase player)
 
override void Update (int pCurrentCommandID)
 
void RegisterInputs (PlayerBase player)
 
void SetActioninputOrder ()
 
void SetDefaultInputsOrder ()
 
override void RequestEndAction ()
 
override void EndActionInput ()
 
void InputsUpdate ()
 
void ProcessActionRequestEnd ()
 
void ProcessActionInputEnd ()
 
ActionBase GetPossibleAction (typename inputType)
 
array< ActionBaseGetPossibleActions (typename inputType)
 
int GetPossibleActionIndex (typename inputType)
 
int GetPossibleActionCount (typename inputType)
 
void InjectAction (ActionBase action, ActionTarget target, ItemBase item)
 
void InjectAction (typename actionType, ActionTarget target, ItemBase item)
 
void EjectAction (ActionBase action)
 
void EjectAction (typename actionType)
 
void ForceTarget (Object targetObject)
 
void ClearForceTarget ()
 
override ActionTarget FindActionTarget ()
 
ItemBase FindActionItem ()
 
bool HasHandInventoryReservation ()
 
void FindContextualUserActions (int pCurrentCommandID)
 
bool LockInventory (ActionData action_data)
 
void UnlockInventory (ActionData action_data)
 
void ActionStart (ActionBase action, ActionTarget target, ItemBase item, Param extra_data=NULL)
 
void HandleInputsOnActionStart (ActionBase action)
 
void HandleInputsOnActionEnd ()
 
void ResetInputsState ()
 
void ResetInputsActions ()
 
override void OnJumpStart ()
 
override void OnInstantAction (typename user_action_type, Param data=NULL)
 
void PerformActionStart (ActionBase action, ActionTarget target, ItemBase item, Param extra_data=NULL)
 
override void OnActionEnd ()
 
void SetInventoryAction (ActionBase action_name, ItemBase target_item, ItemBase main_item)
 
void SetInventoryAction (ActionBase action_name, ActionTarget target, ItemBase main_item)
 
void UnsetInventoryAction ()
 
override GetSelectedActionCategory ()
 
void UpdateActionCategoryPriority ()
 
override void SelectFirstActionCategory ()
 
override void SelectNextActionCategory ()
 
override void SelectPrevActionCategory ()
 
override void SelectNextAction ()
 
override void SelectPrevAction ()
 
bool CanPerformActionFromQuickbar (ItemBase mainItem, ItemBase targetItem)
 
void PerformActionFromQuickbar (ItemBase mainItem, ItemBase targetItem)
 
bool CanPerformActionFromInventory (ItemBase mainItem, ItemBase targetItem)
 
void PerformActionFromInventory (ItemBase mainItem, ItemBase targetItem)
 
bool CanSetActionFromInventory (ItemBase mainItem, ItemBase targetItem)
 
void SetActionFromInventory (ItemBase mainItem, ItemBase targetItem)
 
override void Interrupt ()
 
void RequestInterruptAction ()
 client requests action interrupt
 

Static Protected Member Functions

static ActionVariantManager GetVariantManager (typename actionName)
 

Protected Attributes

int m_LastAcknowledgmentID
 
bool m_ActionPossible
 
ref array< ref InventoryLocationm_ReservedInventoryLocations
 
ref InventoryActionHandler m_InventoryActionHandler
 
ref InventoryLocation m_HandInventoryLocationTest
 
ref TTypeNameActionInputMap m_RegistredInputsMap
 
ref array< ActionInputm_OrederedAllActionInput
 
ref array< ActionInputm_OrderedStandartActionInputs
 
ref array< ActionInputm_DefaultOrderOfActionInputs
 
int m_SelectedActionInputToSrollIndex
 
ref ActionData m_PendingActionData
 
bool m_ActionWantEndRequest_Send
 
bool m_ActionInputWantEnd_Send
 

Private Attributes

ref ActionTarget m_ForceTarget
 
ref ActionTargets m_Targets
 

Detailed Description

Definition at line 4 of file ActionManagerClient.c.

Constructor & Destructor Documentation

◆ ActionManagerClient()

void ActionManagerClient::ActionManagerClient ( PlayerBase player)
inlineprotected

Definition at line 24 of file ActionManagerClient.c.

25 {
32
37 }
void RegisterInputs(PlayerBase player)
ref array< ref InventoryLocation > m_ReservedInventoryLocations
ref InventoryActionHandler m_InventoryActionHandler
ref ActionTargets m_Targets
ref InventoryLocation m_HandInventoryLocationTest
Client only - manage set up crafting on client.
InventoryLocation.

References m_ActionInputWantEnd_Send, m_ActionWantEndRequest_Send, m_HandInventoryLocationTest, m_InventoryActionHandler, m_LastAcknowledgmentID, m_ReservedInventoryLocations, m_SelectedActionInputToSrollIndex, m_Targets, and RegisterInputs().

Member Function Documentation

◆ ActionStart()

void ActionManagerClient::ActionStart ( ActionBase action,
ActionTarget target,
ItemBase item,
Param extra_data = NULL )
inlineprotected

Definition at line 542 of file ActionManagerClient.c.

543 {
544 if (!m_CurrentActionData && action && ActionPossibilityCheck(m_Player.GetCurrentCommandID()))
545 {
549 m_ActionInputWantEnd = false;
550
551 if (action.CanBePerformedFromQuickbar())
552 m_Player.SetActionEndInput(action);
553
555
557 {
558 if (target)
559 Debug.ActionLog("Item = " + item + ", " + target.DumpToString(), action.ToString(), "n/a", "ActionStart", m_Player.ToString());
560 else
561 Debug.ActionLog("Item = " + item + ", no target", action.ToString(), "n/a", "ActionStart", m_Player.ToString());
562 }
563 m_Interrupted = false;
564 if (GetGame().IsMultiplayer() && !action.IsLocal())
565 {
567 {
568 DPrint("ScriptInputUserData already posted - ActionManagerClient");
569
571 Debug.ActionLog("Cannot start because ScriptInputUserData is already used", action.ToString(), "n/a", "ActionStart", m_Player.ToString());
572 return;
573 }
574 }
575
577 {
578 DPrint("Can not inicialize action" + action + " - ActionManagerClient");
580 return;
581 }
582
584 Debug.ActionLog("Action data created wait to start", action.ToString(), "n/a", "ActionStart", m_Player.ToString());
585
586 if (GetGame().IsMultiplayer() && !action.IsLocal())
587 {
590 ctx.Write(action.GetID());
591
592 action.WriteToContext(ctx, m_CurrentActionData);
593
594 if (action.UseAcknowledgment())
595 {
598
600 }
601
602 ctx.Send();
603
604 if (!action.UseAcknowledgment())
605 {
607 if (action.IsInstant())
608 OnActionEnd();
609 }
610 }
611 else
612 {
614 if (action.IsInstant())
615 OnActionEnd();
616 }
617 }
618 }
const int INPUT_UDT_STANDARD_ACTION_START
Definition _constants.c:2
bool m_Interrupted
ref ActionData m_CurrentActionData
bool m_ActionInputWantEnd
bool ActionPossibilityCheck(int pCurrentCommandID)
int m_PendingActionAcknowledgmentID
bool m_ActionWantEndRequest
DayZPlayer m_Player
Definition Hand_Events.c:42
override void OnActionEnd()
void HandleInputsOnActionStart(ActionBase action)
Definition Debug.c:14
static void ActionLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Definition Debug.c:143
static bool IsActionLogEnable()
Definition Debug.c:719
proto static native bool CanStoreInputUserData()
proto native CGame GetGame()
proto void DPrint(string var)
Prints content of variable to console/log. Should be used for critical messages so it will appear in ...
const int UA_AM_PENDING
Definition constants.c:446

References Debug::ActionLog(), ActionPossibilityCheck(), ScriptInputUserData::CanStoreInputUserData(), DPrint(), GetGame(), HandleInputsOnActionStart(), INPUT_UDT_STANDARD_ACTION_START, LogManager::IsActionLogEnable(), m_ActionInputWantEnd, m_ActionInputWantEnd_Send, m_ActionWantEndRequest, m_ActionWantEndRequest_Send, m_CurrentActionData, m_Interrupted, m_LastAcknowledgmentID, m_PendingActionAcknowledgmentID, m_Player, OnActionEnd(), and UA_AM_PENDING.

Referenced by InputsUpdate(), OnInstantAction(), PerformActionFromInventory(), PerformActionFromQuickbar(), and PerformActionStart().

◆ CanPerformActionFromInventory()

bool ActionManagerClient::CanPerformActionFromInventory ( ItemBase mainItem,
ItemBase targetItem )
inlineprotected

Definition at line 955 of file ActionManagerClient.c.

956 {
957 ItemBase itemInHand = m_Player.GetItemInHands();
958 ActionTarget target;
959 target = new ActionTarget(targetItem, null, -1, vector.Zero, -1);
960 bool hasTarget = targetItem != NULL;
961
962 if (mainItem)
963 {
965 ActionBase picked_action;
966 int i;
967
968 //First check single use actions
970 if (actions)
971 {
972 for (i = 0; i < actions.Count(); i++)
973 {
974 picked_action = ActionBase.Cast(actions[i]);
975 if (picked_action && picked_action.Can(m_Player, target, itemInHand) && picked_action.CanBePerformedFromInventory())
976 {
977 if (hasTarget == picked_action.HasTarget())
978 return true;
979 }
980 }
981 }
982
983 //Inventory specific actions
985 if (actions)
986 {
987 for (i = 0; i < actions.Count(); i++)
988 {
989 picked_action = ActionBase.Cast(actions[i]);
991 {
992 if (hasTarget == picked_action.HasTarget())
993 return true;
994 }
995 }
996 }
997 }
998 return false;
999 }
class ActionTargets ActionTarget
static const vector Zero
Definition EnConvert.c:110

References ActionTarget, m_Player, and vector::Zero.

◆ CanPerformActionFromQuickbar()

bool ActionManagerClient::CanPerformActionFromQuickbar ( ItemBase mainItem,
ItemBase targetItem )
inlineprotected

Definition at line 825 of file ActionManagerClient.c.

826 {
827 ItemBase itemInHand = m_Player.GetItemInHands();
828 ActionTarget target;
829 target = new ActionTarget(targetItem, null, -1, vector.Zero, -1);
830 bool hasTarget = targetItem != NULL;
831
832 if (mainItem)
833 {
835 ActionBase picked_action;
836 int i;
837
839 if (actions)
840 {
841 for (i = 0; i < actions.Count(); i++)
842 {
843 picked_action = ActionBase.Cast(actions[i]);
845 {
846 if (hasTarget == picked_action.HasTarget())
847 return true;
848 }
849 }
850 }
851 //First check continuous actions
852 mainItem.GetActions(ContinuousDefaultActionInput, actions);
853 if (actions)
854 {
855 for (i = 0; i < actions.Count(); i++)
856 {
857 picked_action = ActionBase.Cast(actions[i]);
858 if (picked_action && picked_action.Can(m_Player, target, itemInHand) && picked_action.CanBePerformedFromQuickbar())
859 {
860 if (hasTarget == picked_action.HasTarget())
861 return true;
862 }
863 }
864 }
865 //second single use actions
867 if (actions)
868 {
869 for (i = 0; i < actions.Count(); i++)
870 {
871 picked_action = ActionBase.Cast(actions[i]);
872 if (picked_action && picked_action.HasTarget() && picked_action.Can(m_Player, target, itemInHand) && picked_action.CanBePerformedFromQuickbar())
873 {
874 if (hasTarget == picked_action.HasTarget())
875 return true;
876 }
877 }
878 }
879 }
880 return false;
881 }

References ActionTarget, m_Player, and vector::Zero.

◆ CanSetActionFromInventory()

bool ActionManagerClient::CanSetActionFromInventory ( ItemBase mainItem,
ItemBase targetItem )
inlineprotected

Definition at line 1053 of file ActionManagerClient.c.

1054 {
1055 ItemBase itemInHand = m_Player.GetItemInHands();
1056 ActionTarget target;
1057 EntityAI parent = null;
1058 if (targetItem)
1059 parent = targetItem.GetHierarchyParent();
1060 target = new ActionTarget(targetItem, parent, -1, vector.Zero, -1);
1061 bool hasTarget = targetItem != NULL;
1062
1063 if (mainItem)
1064 {
1067 ActionBase picked_action;
1068 int variants_count, v;
1069
1070 //First check single use actions
1071 mainItem.GetActions(DefaultActionInput, actions);
1072 if (actions)
1073 {
1074 for (int i = 0; i < actions.Count(); i++)
1075 {
1076 picked_action = ActionBase.Cast(actions[i]);
1077 if (picked_action.HasVariants())
1078 {
1079 picked_action.UpdateVariants(itemInHand, targetItem, -1);
1080 picked_action.GetVariants(variant_actions);
1081 for (v = 0; v < variant_actions.Count(); v ++)
1082 {
1084 if (picked_action && picked_action.CanBeSetFromInventory() && picked_action.Can(m_Player, target, itemInHand))
1085 {
1086 if (hasTarget == picked_action.HasTarget())
1087 return true;
1088 }
1089 }
1090 }
1091 else
1092 {
1093 if (picked_action && picked_action.CanBeSetFromInventory() && picked_action.Can(m_Player, target, itemInHand))
1094 {
1095 if (hasTarget == picked_action.HasTarget())
1096 return true;
1097 }
1098 }
1099 }
1100 }
1101 //second continuous actions
1102 mainItem.GetActions(ContinuousDefaultActionInput, actions);
1103 if (actions)
1104 {
1105 for (int j = 0; j < actions.Count(); j++)
1106 {
1107 picked_action = ActionBase.Cast(actions[j]);
1108 if (picked_action.HasVariants())
1109 {
1110 picked_action.UpdateVariants(itemInHand, targetItem, -1);
1111 picked_action.GetVariants(variant_actions);
1112 for (v = 0; v < variant_actions.Count(); v ++)
1113 {
1115 if (picked_action && picked_action.HasTarget() && picked_action.CanBeSetFromInventory() && picked_action.Can(m_Player, target, itemInHand))
1116 {
1117 if (hasTarget == picked_action.HasTarget())
1118 return true;
1119 }
1120 }
1121 }
1122 else
1123 {
1124 if (picked_action && picked_action.HasTarget() && picked_action.CanBeSetFromInventory() && picked_action.Can(m_Player, target, itemInHand))
1125 {
1126 if (hasTarget == picked_action.HasTarget())
1127 return true;
1128 }
1129 }
1130 }
1131 }
1132 }
1133 return false;
1134 }

References ActionTarget, m_Player, and vector::Zero.

◆ ClearForceTarget()

void ActionManagerClient::ClearForceTarget ( )
inlineprotected

Definition at line 431 of file ActionManagerClient.c.

432 {
434 }
ref ActionTarget m_ForceTarget

References m_ForceTarget.

◆ EjectAction() [1/2]

void ActionManagerClient::EjectAction ( ActionBase action)
inlineprotected

Definition at line 410 of file ActionManagerClient.c.

411 {
412 ActionInput ai = action.GetInput();
413 ai.ClearForcedAction();
414 }

Referenced by EjectAction().

◆ EjectAction() [2/2]

void ActionManagerClient::EjectAction ( typename actionType )
inlineprotected

Definition at line 416 of file ActionManagerClient.c.

417 {
418 ActionBase action = GetAction(actionType);
420 }
override ActionBase GetAction()
void EjectAction(ActionBase action)

References EjectAction(), and GetAction().

◆ EndActionInput()

override void ActionManagerClient::EndActionInput ( )
inlineprotected

Definition at line 252 of file ActionManagerClient.c.

253 {
256 }

References m_ActionInputWantEnd, and m_ActionInputWantEnd_Send.

Referenced by InputsUpdate().

◆ FindActionItem()

ItemBase ActionManagerClient::FindActionItem ( )
inlineprotected

Definition at line 466 of file ActionManagerClient.c.

467 {
469 if (m_Player && m_Player.GetItemInHands() && m_Player.GetItemInHands().IsItemBase())
470 item = m_Player.GetItemInHands();
471 return item;
472 }

References m_Player.

Referenced by FindContextualUserActions().

◆ FindActionTarget()

override ActionTarget ActionManagerClient::FindActionTarget ( )
inlineprotected

Definition at line 438 of file ActionManagerClient.c.

439 {
440 if (m_ForceTarget)
441 return m_ForceTarget;
442
443 ActionTarget action_target;
445 int targetsCount = m_Targets.GetTargetsCount();
446 if (targetsCount)
447 {
448 for (int i = 0; i < targetsCount; ++i)
449 {
450 action_target = m_Targets.GetTarget(i);
451 Object targetObject = action_target.GetObject();
452 Object targetParent = action_target.GetParent();
453
454 if (targetParent)
455 break;
456
457 if (targetObject)
458 break;
459 }
460 }
461 else
463 return action_target;
464 }

References ActionTarget, m_ForceTarget, m_Targets, and vector::Zero.

Referenced by FindContextualUserActions(), and ActionTargetsCursor::GetTarget().

◆ FindContextualUserActions()

void ActionManagerClient::FindContextualUserActions ( int pCurrentCommandID)
inlineprotected

Definition at line 482 of file ActionManagerClient.c.

483 {
484 // TODO: NEEDS OPTIMIZATION (focus on UpdatePossibleActions > CraftingManager::OnUpdate)
485
486 m_ActionsAvaibale = false;
487 if (!m_ActionPossible || HasHandInventoryReservation() || GetGame().IsInventoryOpen())
488 {
490 return;
491 }
492
493 if (!GetRunningAction())
494 {
495 ActionBase action;
496 ActionTarget target;
498
499 // Gathering current inputs
500 m_ActionsAvaibale = true;
501
504
505 int actionConditionMask = ActionBase.ComputeConditionMask(m_Player, target, item);
506 for (int i = 0; i < m_OrederedAllActionInput.Count(); i++)
507 {
509 ain.UpdatePossibleActions(m_Player, target, item, actionConditionMask);
510 }
512 }
513 }
void SetActionContext(ActionTarget target, ItemBase item)
bool m_ActionsAvaibale
override ActionTarget FindActionTarget()
ref array< ActionInput > m_OrederedAllActionInput
proto native int GetRunningAction()
returns -1 when no action is running or RELOAD,MECHANISM, ....

References FindActionItem(), FindActionTarget(), GetGame(), GetRunningAction(), HasHandInventoryReservation(), m_ActionPossible, m_ActionsAvaibale, m_OrederedAllActionInput, m_Player, ResetInputsActions(), and SetActionContext().

Referenced by Update().

◆ ForceTarget()

void ActionManagerClient::ForceTarget ( Object targetObject)
inlineprotected

Definition at line 422 of file ActionManagerClient.c.

423 {
424 Object parent = null;
426 if (targetEntity)
427 parent = targetEntity.GetHierarchyParent();
428 m_ForceTarget = new ActionTarget(targetObject, parent, -1, vector.Zero, -1);
429 }

References ActionTarget, m_ForceTarget, and vector::Zero.

◆ GetPossibleAction()

ActionBase ActionManagerClient::GetPossibleAction ( typename inputType )
inlineprotected

Definition at line 363 of file ActionManagerClient.c.

364 {
366 if (action_input)
367 return action_input.GetAction();
368 return NULL;
369 }
ref TTypeNameActionInputMap m_RegistredInputsMap

References m_RegistredInputsMap.

◆ GetPossibleActionCount()

int ActionManagerClient::GetPossibleActionCount ( typename inputType )
inlineprotected

Definition at line 387 of file ActionManagerClient.c.

388 {
390 if (action_input)
391 return action_input.GetPossibleActionsCount();
392 return 0;
393 }

References m_RegistredInputsMap.

◆ GetPossibleActionIndex()

int ActionManagerClient::GetPossibleActionIndex ( typename inputType )
inlineprotected

Definition at line 379 of file ActionManagerClient.c.

380 {
382 if (action_input)
383 return action_input.GetPossibleActionIndex();
384 return -1;
385 }

References m_RegistredInputsMap.

◆ GetPossibleActions()

array< ActionBase > ActionManagerClient::GetPossibleActions ( typename inputType )
inlineprotected

Definition at line 371 of file ActionManagerClient.c.

372 {
374 if (action_input)
375 return action_input.GetPossibleActions();
376 return NULL;
377 }

References m_RegistredInputsMap.

◆ GetSelectedActionCategory()

override ActionManagerClient::GetSelectedActionCategory ( )
inlineprotected

Definition at line 726 of file ActionManagerClient.c.

727 {
729 }
ref array< ActionInput > m_OrderedStandartActionInputs

References m_OrderedStandartActionInputs, and m_SelectedActionInputToSrollIndex.

◆ GetVariantManager()

static ActionVariantManager ActionManagerClient::GetVariantManager ( typename actionName )
inlinestaticprotected

Definition at line 237 of file ActionManagerClient.c.

238 {
239 ActionBase action = GetAction(actionName);
240 if (action)
241 return action.GetVariantManager();
242 //VME ACTION not exist typo most likely
243 return null;
244 }

References GetAction().

Referenced by ConstructionActionData::ConstructionActionData(), and CraftingManager::CraftingManager().

◆ HandleInputsOnActionEnd()

void ActionManagerClient::HandleInputsOnActionEnd ( )
inlineprotected

Definition at line 632 of file ActionManagerClient.c.

633 {
635 }

References ResetInputsState().

Referenced by OnActionEnd().

◆ HandleInputsOnActionStart()

void ActionManagerClient::HandleInputsOnActionStart ( ActionBase action)
inlineprotected

Definition at line 620 of file ActionManagerClient.c.

621 {
622 for (int i = 0; i < m_OrederedAllActionInput.Count(); i++)
623 {
625 if (action.GetInput() == ain)
626 ain.OnActionStart();
627 else
628 ain.Reset();
629 }
630 }

References m_OrederedAllActionInput.

Referenced by ActionStart().

◆ HasHandInventoryReservation()

bool ActionManagerClient::HasHandInventoryReservation ( )
inlineprotected

Definition at line 474 of file ActionManagerClient.c.

475 {
476 m_HandInventoryLocationTest.SetHands(m_Player, m_Player.GetItemInHands());
477 if (m_Player.GetHumanInventory().HasInventoryReservation(m_Player.GetItemInHands(), m_HandInventoryLocationTest))
478 return true;
479 return false;
480 }

References m_HandInventoryLocationTest, and m_Player.

Referenced by FindContextualUserActions().

◆ InjectAction() [1/2]

void ActionManagerClient::InjectAction ( ActionBase action,
ActionTarget target,
ItemBase item )
inlineprotected

Definition at line 398 of file ActionManagerClient.c.

399 {
400 ActionInput ai = action.GetInput();
401 ai.ForceAction(action, target, item);
402 }

Referenced by InjectAction().

◆ InjectAction() [2/2]

void ActionManagerClient::InjectAction ( typename actionType ,
ActionTarget target,
ItemBase item )
inlineprotected

Definition at line 404 of file ActionManagerClient.c.

405 {
406 ActionBase action = GetAction(actionType);
408 }
void InjectAction(ActionBase action, ActionTarget target, ItemBase item)

References GetAction(), and InjectAction().

◆ InputsUpdate()

void ActionManagerClient::InputsUpdate ( )
inlineprotected

Definition at line 258 of file ActionManagerClient.c.

259 {
262 {
264 {
265 ActionInput ai = m_CurrentActionData.m_Action.GetInput();
266 ai.Update();
267 if (m_Player.IsQBControl())
268 {
269 if (ai.JustActivate())
270 m_Player.SetActionEndInput(m_CurrentActionData.m_Action);
271 }
272 else
273 {
274 if (ai.WasEnded() && (ai.GetInputType() == ActionInputType.AIT_CONTINUOUS || ai.GetInputType() == ActionInputType.AIT_CLICKCONTINUOUS))
276 }
277 }
278 }
279 else
280 {
282 {
283 for (int i = 0; i < m_OrederedAllActionInput.Count(); i++)
284 {
285
287 ain.Update();
288
289 if (ain.JustActivate())
290 {
291 ActionBase action = ain.GetAction();
292 if (action)
293 {
294 ActionStart(action, ain.GetUsedActionTarget(), ain.GetUsedMainItem());
295 break;
296 }
297 }
298 }
299 }
300 }
301 }
ActionInputType
Definition ActionInput.c:2
void ActionStart(ActionBase action, ActionTarget target, ItemBase item, Param extra_data=NULL)
override void EndActionInput()

References ActionStart(), EndActionInput(), m_ActionInputWantEnd, m_ActionsAvaibale, m_CurrentActionData, m_OrederedAllActionInput, and m_Player.

Referenced by Update().

◆ Interrupt()

override void ActionManagerClient::Interrupt ( )
inlineprotected

Definition at line 1186 of file ActionManagerClient.c.

1187 {
1188 super.Interrupt();
1189
1191 m_Interrupted = true;
1192 }

References m_CurrentActionData, and m_Interrupted.

◆ LockInventory()

bool ActionManagerClient::LockInventory ( ActionData action_data)
inlineprotected

Definition at line 516 of file ActionManagerClient.c.

517 {
518 bool success = false;
519 if (action_data.m_Action.IsInstant())
520 {
522 Debug.ActionLog("(-) Inventory lock - Not Used", action_data.m_Action.ToString(), "n/a", "LockInventory", action_data.m_Player.ToString());
523 success = true;
524 }
525 else
526 {
528 Debug.ActionLog("(X) Inventory lock", action_data.m_Action.ToString(), "n/a", "LockInventory", action_data.m_Player.ToString());
529 if (action_data.m_Action)
530 success = action_data.m_Action.InventoryReservation(action_data);
531 }
532 return success;
533 }

References Debug::ActionLog(), and LogManager::IsActionLogEnable().

◆ OnActionEnd()

override void ActionManagerClient::OnActionEnd ( )
inlineprotected

Definition at line 698 of file ActionManagerClient.c.

699 {
701 {
703 if (m_CurrentActionData.m_Action.RemoveForceTargetAfterUse())
704 m_InventoryActionHandler.DeactiveAction();
705
706 super.OnActionEnd();
708 }
709 }
void UnlockInventory(ActionData action_data)

References HandleInputsOnActionEnd(), m_CurrentActionData, m_InventoryActionHandler, and UnlockInventory().

Referenced by ActionStart(), OnJumpStart(), and Update().

◆ OnInstantAction()

override void ActionManagerClient::OnInstantAction ( typename user_action_type ,
Param data = NULL )
inlineprotected

Definition at line 670 of file ActionManagerClient.c.

671 {
672 ActionBase action = GetAction(user_action_type);
673 if (action)
675 }

References ActionStart(), and GetAction().

◆ OnJumpStart()

override void ActionManagerClient::OnJumpStart ( )
inlineprotected

Definition at line 655 of file ActionManagerClient.c.

656 {
658 {
660 {
661 OnActionEnd();
663 }
664 else
665 m_CurrentActionData.m_Action.Interrupt(m_CurrentActionData);
666 }
667 }
const int UA_AM_ACCEPTED
Definition constants.c:447
const int UA_AM_REJECTED
Definition constants.c:448

References m_CurrentActionData, m_PendingActionAcknowledgmentID, OnActionEnd(), UA_AM_ACCEPTED, UA_AM_PENDING, and UA_AM_REJECTED.

◆ PerformActionFromInventory()

void ActionManagerClient::PerformActionFromInventory ( ItemBase mainItem,
ItemBase targetItem )
inlineprotected

Definition at line 1002 of file ActionManagerClient.c.

1003 {
1004 ItemBase itemInHand = m_Player.GetItemInHands();
1005 ActionTarget target;
1006 target = new ActionTarget(targetItem, null, -1, vector.Zero, -1);
1007 bool hasTarget = targetItem != NULL;
1008
1009 if (mainItem)
1010 {
1011 ActionBase picked_action;
1013 int i;
1014
1015 //First check single use actions
1016 mainItem.GetActions(DefaultActionInput, actions);
1017 if (actions)
1018 {
1019 for (i = 0; i < actions.Count(); i++)
1020 {
1021 picked_action = ActionBase.Cast(actions[i]);
1022 if (picked_action && picked_action.Can(m_Player, target, itemInHand) && picked_action.CanBePerformedFromInventory())
1023 {
1024 if (hasTarget == picked_action.HasTarget())
1025 {
1027 return;
1028 }
1029 }
1030 }
1031 }
1032
1033 //Inventory specific actions
1035 if (actions)
1036 {
1037 for (i = 0; i < actions.Count(); i++)
1038 {
1039 picked_action = ActionBase.Cast(actions[i]);
1041 {
1042 if (hasTarget == picked_action.HasTarget())
1043 {
1045 return;
1046 }
1047 }
1048 }
1049 }
1050 }
1051 }

References ActionStart(), ActionTarget, m_Player, and vector::Zero.

◆ PerformActionFromQuickbar()

void ActionManagerClient::PerformActionFromQuickbar ( ItemBase mainItem,
ItemBase targetItem )
inlineprotected

Definition at line 883 of file ActionManagerClient.c.

884 {
885 ItemBase itemInHand = m_Player.GetItemInHands();
886 ActionTarget target;
887 ItemBase parent = null;
888 if (targetItem)
889 parent = ItemBase.Cast(targetItem.GetHierarchyParent());
890 target = new ActionTarget(targetItem, parent, -1, vector.Zero, -1);
891 bool hasTarget = targetItem != NULL;
892
893 if (mainItem)
894 {
895 ActionBase picked_action;
897 int i;
898
900 if (actions)
901 {
902 for (i = 0; i < actions.Count(); i++)
903 {
904 picked_action = ActionBase.Cast(actions[i]);
906 {
907 if (hasTarget == picked_action.HasTarget())
908 {
910 return;
911 }
912 }
913 }
914 }
915
916 //First continuous actions
917 mainItem.GetActions(ContinuousDefaultActionInput, actions);
918 if (actions)
919 {
920 for (i = 0; i < actions.Count(); i++)
921 {
922 picked_action = ActionBase.Cast(actions[i]);
923 if (picked_action && picked_action.HasTarget() && picked_action.Can(m_Player, target, itemInHand) && picked_action.CanBePerformedFromQuickbar())
924 {
925 if (hasTarget == picked_action.HasTarget())
926 {
928 return;
929 }
930 }
931 }
932 }
933 //Second check single use actions
935 if (actions)
936 {
937 for (i = 0; i < actions.Count(); i++)
938 {
939 picked_action = ActionBase.Cast(actions[i]);
940 if (picked_action && picked_action.Can(m_Player, target, itemInHand) && picked_action.CanBePerformedFromQuickbar())
941 {
942 if (hasTarget == picked_action.HasTarget())
943 {
945 return;
946 }
947 }
948 }
949 }
950
951 }
952 }

References ActionStart(), ActionTarget, m_Player, and vector::Zero.

◆ PerformActionStart()

void ActionManagerClient::PerformActionStart ( ActionBase action,
ActionTarget target,
ItemBase item,
Param extra_data = NULL )
inlineprotected

Definition at line 685 of file ActionManagerClient.c.

686 {
687 if (!GetGame().IsMultiplayer())
688 {
690
693 }
694 else
696 }
ref ActionData m_PendingActionData

References ActionStart(), GetGame(), m_PendingActionData, and m_Player.

◆ ProcessActionInputEnd()

void ActionManagerClient::ProcessActionInputEnd ( )
inlineprotected

Definition at line 331 of file ActionManagerClient.c.

332 {
334 {
335 if (GetGame().IsMultiplayer() && !m_CurrentActionData.m_Action.IsLocal())
336 {
338 {
340 Debug.ActionLog("Time stamp: " + m_Player.GetSimulationTimeStamp(), m_CurrentActionData.m_Action.ToString(), "n/a", "EndInput", m_CurrentActionData.m_Player.ToString());
343 ctxi.Send();
344
346
347 m_ActionInputWantEnd = false;
348 m_CurrentActionData.m_Action.EndInput(m_CurrentActionData);
349 }
350 }
351 else
352 {
354 {
356 m_ActionInputWantEnd = false;
357 m_CurrentActionData.m_Action.EndInput(m_CurrentActionData);
358 }
359 }
360 }
361 }
const int INPUT_UDT_STANDARD_ACTION_INPUT_END
Definition _constants.c:4

References Debug::ActionLog(), ScriptInputUserData::CanStoreInputUserData(), GetGame(), INPUT_UDT_STANDARD_ACTION_INPUT_END, LogManager::IsActionLogEnable(), m_ActionInputWantEnd, m_ActionInputWantEnd_Send, m_CurrentActionData, and m_Player.

Referenced by Update().

◆ ProcessActionRequestEnd()

void ActionManagerClient::ProcessActionRequestEnd ( )
inlineprotected

Definition at line 303 of file ActionManagerClient.c.

304 {
306 {
307 if (GetGame().IsMultiplayer() && !m_CurrentActionData.m_Action.IsLocal())
308 {
310 {
312 Debug.ActionLog("Time stamp: " + m_Player.GetSimulationTimeStamp(), m_CurrentActionData.m_Action.ToString(), "n/a", "EndRequest", m_CurrentActionData.m_Player.ToString());
315 ctx.Send();
316
318
320 m_CurrentActionData.m_Action.EndRequest(m_CurrentActionData);
321 }
322 }
323 else
324 {
326 m_CurrentActionData.m_Action.EndRequest(m_CurrentActionData);
327 }
328 }
329 }
const int INPUT_UDT_STANDARD_ACTION_END_REQUEST
Definition _constants.c:3

References Debug::ActionLog(), ScriptInputUserData::CanStoreInputUserData(), GetGame(), INPUT_UDT_STANDARD_ACTION_END_REQUEST, LogManager::IsActionLogEnable(), m_ActionWantEndRequest, m_ActionWantEndRequest_Send, m_CurrentActionData, and m_Player.

Referenced by Update().

◆ RegisterInputs()

void ActionManagerClient::RegisterInputs ( PlayerBase player)
inlineprotected

Definition at line 130 of file ActionManagerClient.c.

131 {
133 {
135
136 for (int i = 0; i < m_ActionsArray.Count(); i++)
137 {
138 ActionBase action = m_ActionsArray.Get(i);
139 typename input_type_name = action.GetInputType();
141
143 if (!ai)
144 {
145 ai = ActionInput.Cast(input_type_name.Spawn());
147 }
148 action.SetInput(ai);
149 }
150
151 for (int j = 0; j < m_RegistredInputsMap.Count(); j++)
152 m_RegistredInputsMap.GetElement(j).Init(player, this);
154 }
155
156 }
static ref array< ref ActionBase > m_ActionsArray
map< typename, ref ActionInput > TTypeNameActionInputMap

References m_ActionsArray, m_RegistredInputsMap, and SetActioninputOrder().

Referenced by ActionManagerClient().

◆ RequestEndAction()

override void ActionManagerClient::RequestEndAction ( )
inlineprotected

◆ RequestInterruptAction()

void ActionManagerClient::RequestInterruptAction ( )
inlineprotected

client requests action interrupt

Definition at line 1195 of file ActionManagerClient.c.

1196 {
1198 {
1201 ctx.Write(DayZPlayerConstants.CMD_ACTIONINT_INTERRUPT);
1202 ctx.Send();
1203 }
1204 }
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597

References ScriptInputUserData::CanStoreInputUserData(), and INPUT_UDT_STANDARD_ACTION_END_REQUEST.

◆ ResetInputsActions()

void ActionManagerClient::ResetInputsActions ( )
inlineprotected

Definition at line 646 of file ActionManagerClient.c.

647 {
648 for (int i = 0; i < m_OrederedAllActionInput.Count(); i++)
649 {
651 ain.ActionsSelectReset();
652 }
653 }

References m_OrederedAllActionInput.

Referenced by FindContextualUserActions(), and Update().

◆ ResetInputsState()

void ActionManagerClient::ResetInputsState ( )
inlineprotected

Definition at line 637 of file ActionManagerClient.c.

638 {
639 for (int i = 0; i < m_OrederedAllActionInput.Count(); i++)
640 {
642 ain.Reset();
643 }
644 }

References m_OrederedAllActionInput.

Referenced by HandleInputsOnActionEnd().

◆ SelectFirstActionCategory()

override void ActionManagerClient::SelectFirstActionCategory ( )
inlineprotected

◆ SelectNextAction()

override void ActionManagerClient::SelectNextAction ( )
inlineprotected

Definition at line 803 of file ActionManagerClient.c.

804 {
807 {
809 if (ai && ai.GetPossibleActionsCount() > 1)
810 ai.SelectNextAction();
811 }
812 }

References m_OrderedStandartActionInputs, and m_SelectedActionInputToSrollIndex.

◆ SelectNextActionCategory()

override void ActionManagerClient::SelectNextActionCategory ( )
inlineprotected

◆ SelectPrevAction()

override void ActionManagerClient::SelectPrevAction ( )
inlineprotected

Definition at line 814 of file ActionManagerClient.c.

815 {
818 {
820 if (ai && ai.GetPossibleActionsCount() > 1)
821 ai.SelectPrevAction();
822 }
823 }

References m_OrderedStandartActionInputs, and m_SelectedActionInputToSrollIndex.

◆ SelectPrevActionCategory()

override void ActionManagerClient::SelectPrevActionCategory ( )
inlineprotected

◆ SetActionFromInventory()

void ActionManagerClient::SetActionFromInventory ( ItemBase mainItem,
ItemBase targetItem )
inlineprotected

Definition at line 1137 of file ActionManagerClient.c.

1138 {
1139 ItemBase itemInHand = m_Player.GetItemInHands();
1140 ActionTarget target;
1141 target = new ActionTarget(targetItem, null, -1, vector.Zero, -1);
1142 bool hasTarget = targetItem != NULL;
1143
1144 if (mainItem)
1145 {
1147 ActionBase picked_action;
1148
1149 //First check single use actions
1150 mainItem.GetActions(DefaultActionInput, actions);
1151 if (actions)
1152 {
1153 for (int i = 0; i < actions.Count(); i++)
1154 {
1155 picked_action = ActionBase.Cast(actions[i]);
1156 if (picked_action && picked_action.Can(m_Player, target, itemInHand) && picked_action.CanBeSetFromInventory())
1157 {
1158 if (hasTarget == picked_action.HasTarget())
1159 {
1161 return;
1162 }
1163 }
1164 }
1165 }
1166 //second continuous actions
1167 mainItem.GetActions(ContinuousDefaultActionInput, actions);
1168 if (actions)
1169 {
1170 for (int j = 0; j < actions.Count(); j++)
1171 {
1172 picked_action = ActionBase.Cast(actions[j]);
1173 if (picked_action && picked_action.HasTarget() && picked_action.Can(m_Player, target, itemInHand) && picked_action.CanBeSetFromInventory())
1174 {
1175 if (hasTarget == picked_action.HasTarget())
1176 {
1178 return;
1179 }
1180 }
1181 }
1182 }
1183 }
1184 }
void SetInventoryAction(ActionBase action_name, ItemBase target_item, ItemBase main_item)

References ActionTarget, m_Player, SetInventoryAction(), and vector::Zero.

◆ SetActioninputOrder()

void ActionManagerClient::SetActioninputOrder ( )
inlineprotected

Definition at line 159 of file ActionManagerClient.c.

References m_OrederedAllActionInput, m_RegistredInputsMap, and SetDefaultInputsOrder().

Referenced by RegisterInputs().

◆ SetDefaultInputsOrder()

void ActionManagerClient::SetDefaultInputsOrder ( )
inlineprotected

◆ SetInventoryAction() [1/2]

void ActionManagerClient::SetInventoryAction ( ActionBase action_name,
ActionTarget target,
ItemBase main_item )
inlineprotected

Definition at line 716 of file ActionManagerClient.c.

717 {
719 }

References m_InventoryActionHandler.

◆ SetInventoryAction() [2/2]

void ActionManagerClient::SetInventoryAction ( ActionBase action_name,
ItemBase target_item,
ItemBase main_item )
inlineprotected

Definition at line 711 of file ActionManagerClient.c.

References m_InventoryActionHandler.

Referenced by SetActionFromInventory().

◆ UnlockInventory()

void ActionManagerClient::UnlockInventory ( ActionData action_data)
inlineprotected

Definition at line 534 of file ActionManagerClient.c.

535 {
537 Debug.ActionLog("(O) Inventory unlock", action_data.m_Action.ToString(), "n/a", "UnlockInventory", action_data.m_Player.ToString());
538 if (action_data.m_Action)
539 action_data.m_Action.ClearInventoryReservationEx(action_data);
540 }

References Debug::ActionLog(), and LogManager::IsActionLogEnable().

Referenced by OnActionEnd().

◆ UnsetInventoryAction()

void ActionManagerClient::UnsetInventoryAction ( )
inlineprotected

Definition at line 721 of file ActionManagerClient.c.

722 {
723 m_InventoryActionHandler.DeactiveAction();
724 }

References m_InventoryActionHandler.

◆ Update()

override void ActionManagerClient::Update ( int pCurrentCommandID)
inlineprotected

Definition at line 40 of file ActionManagerClient.c.

41 {
42 m_InventoryActionHandler.OnUpdate();
44 int currentCommandID = m_Player.GetCurrentCommandID();
46
47 if (m_PendingActionData) //SP only
48 {
50
52
53 if (m_CurrentActionData.m_Action.IsInstant())
55
57 }
58
60 {
62 m_CurrentActionData.m_Action.OnUpdateClient(m_CurrentActionData);
63
64 switch (m_CurrentActionData.m_State)
65 {
66 case UA_AM_PENDING:
67 break;
68
69 case UA_AM_ACCEPTED:
70 int condition_mask = ActionBase.ComputeConditionMask(m_Player, m_CurrentActionData.m_Target, m_CurrentActionData.m_MainItem);
71
72 m_CurrentActionData.m_Action.ClearInventoryReservationEx(m_CurrentActionData);
73 bool can_be_action_done = ((condition_mask & m_CurrentActionData.m_Action.m_ConditionMask) == condition_mask);
74 // check currentCommandID before start or reject
76 {
77 m_CurrentActionData.m_Action.InventoryReservation(m_CurrentActionData);
80
81 if (m_CurrentActionData.m_Action.IsInstant())
83 }
84 else
87 break;
88
89 case UA_AM_REJECTED:
92 break;
93
94 default:
97 break;
98 }
99 }
100
101#ifdef DEVELOPER
103 {
104 m_ActionPossible = false;
106 }
107 else
108 {
109#endif
111 {
112 bool isMenuOpen = false;
113#ifndef NO_GUI
114 isMenuOpen = GetGame().GetUIManager().IsMenuOpen(MENU_INVENTORY);
115#endif
117 m_Targets.Clear();
118 else
119 m_Targets.Update();
121 }
122
123 InputsUpdate();
124#ifdef DEVELOPER
125 }
126#endif
127
128 }
void FindContextualUserActions(int pCurrentCommandID)
static bool IsFreeCameraEnabled()
const int MENU_INVENTORY
Definition constants.c:170
const int UA_START
Definition constants.c:439

References ActionPossibilityCheck(), FindContextualUserActions(), GetGame(), InputsUpdate(), DeveloperFreeCamera::IsFreeCameraEnabled(), DayZPlayer::IsRaised(), m_ActionPossible, m_CurrentActionData, m_InventoryActionHandler, m_PendingActionAcknowledgmentID, m_PendingActionData, m_Player, m_Targets, MENU_INVENTORY, OnActionEnd(), ProcessActionInputEnd(), ProcessActionRequestEnd(), ResetInputsActions(), UA_AM_ACCEPTED, UA_AM_PENDING, UA_AM_REJECTED, and UA_START.

◆ UpdateActionCategoryPriority()

void ActionManagerClient::UpdateActionCategoryPriority ( )
inlineprotected

Member Data Documentation

◆ m_ActionInputWantEnd_Send

bool ActionManagerClient::m_ActionInputWantEnd_Send
protected

◆ m_ActionPossible

bool ActionManagerClient::m_ActionPossible
protected

Definition at line 9 of file ActionManagerClient.c.

Referenced by FindContextualUserActions(), and Update().

◆ m_ActionWantEndRequest_Send

bool ActionManagerClient::m_ActionWantEndRequest_Send
protected

◆ m_DefaultOrderOfActionInputs

ref array<ActionInput> ActionManagerClient::m_DefaultOrderOfActionInputs
protected

Definition at line 16 of file ActionManagerClient.c.

Referenced by SetDefaultInputsOrder(), and UpdateActionCategoryPriority().

◆ m_ForceTarget

ref ActionTarget ActionManagerClient::m_ForceTarget
private

Definition at line 1206 of file ActionManagerClient.c.

Referenced by ClearForceTarget(), FindActionTarget(), and ForceTarget().

◆ m_HandInventoryLocationTest

ref InventoryLocation ActionManagerClient::m_HandInventoryLocationTest
protected

Definition at line 12 of file ActionManagerClient.c.

Referenced by ActionManagerClient(), and HasHandInventoryReservation().

◆ m_InventoryActionHandler

ref InventoryActionHandler ActionManagerClient::m_InventoryActionHandler
protected

◆ m_LastAcknowledgmentID

int ActionManagerClient::m_LastAcknowledgmentID
protected

Definition at line 8 of file ActionManagerClient.c.

Referenced by ActionManagerClient(), and ActionStart().

◆ m_OrderedStandartActionInputs

◆ m_OrederedAllActionInput

◆ m_PendingActionData

ref ActionData ActionManagerClient::m_PendingActionData
protected

Definition at line 19 of file ActionManagerClient.c.

Referenced by PerformActionStart(), and Update().

◆ m_RegistredInputsMap

◆ m_ReservedInventoryLocations

ref array<ref InventoryLocation> ActionManagerClient::m_ReservedInventoryLocations
protected

Definition at line 10 of file ActionManagerClient.c.

Referenced by ActionManagerClient().

◆ m_SelectedActionInputToSrollIndex

int ActionManagerClient::m_SelectedActionInputToSrollIndex
protected

◆ m_Targets

ref ActionTargets ActionManagerClient::m_Targets
private

Definition at line 1207 of file ActionManagerClient.c.

Referenced by ActionManagerClient(), FindActionTarget(), and Update().


The documentation for this class was generated from the following file: