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

Private Member Functions

void ActionTakeArrowToHands ()
 
override void CreateConditionComponents ()
 
override bool HasProneException ()
 
override GetInputType ()
 
override bool HasProgress ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override Object GetDisplayInteractObject (PlayerBase player, ActionTarget target)
 
override bool CanContinue (ActionData action_data)
 
override bool InventoryReservation (ActionData action_data)
 
override void OnExecute (ActionData action_data)
 
override void CreateAndSetupActionCallback (ActionData action_data)
 
override bool CanBeUsedOnBack ()
 

Detailed Description

Definition at line 1 of file ActionTakeArrowToHands.c.

Constructor & Destructor Documentation

◆ ActionTakeArrowToHands()

void ActionTakeArrowToHands::ActionTakeArrowToHands ( )
inlineprivate

Definition at line 3 of file ActionTakeArrowToHands.c.

4 {
5 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_PICKUP_HANDS;
6 m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_PICKUP_HANDS;
7 m_Text = "#take_to_hands";
8 }
string m_Text
Definition ActionBase.c:49
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597

References AnimatedActionBase::m_CommandUID, AnimatedActionBase::m_CommandUIDProne, and m_Text.

Member Function Documentation

◆ ActionCondition()

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

Definition at line 31 of file ActionTakeArrowToHands.c.

32 {
33 EntityAI targetEntity = EntityAI.Cast(target.GetObject());
34 if (!targetEntity || (targetEntity && targetEntity.IsManagingArrows() && !targetEntity.IsDamageDestroyed()))
35 return false;
36
37 ArrowManagerBase arrowManager = targetEntity.GetArrowManager();
38 if (arrowManager)
39 {
40 ItemBase arrow = ItemBase.Cast(arrowManager.GetFirstArrow());
41 if (arrow && !arrow.IsSetForDeletion())
42 {
43 if (player.GetInventory().CanAddEntityIntoHands(arrow))
44 return true;
45 }
46 }
47
48 return false;
49 }

◆ CanBeUsedOnBack()

override bool ActionTakeArrowToHands::CanBeUsedOnBack ( )
inlineprivate

Definition at line 145 of file ActionTakeArrowToHands.c.

146 {
147 return true;
148 }

◆ CanContinue()

override bool ActionTakeArrowToHands::CanContinue ( ActionData action_data)
inlineprivate

Definition at line 64 of file ActionTakeArrowToHands.c.

65 {
66 return true;
67 }

◆ CreateAndSetupActionCallback()

override void ActionTakeArrowToHands::CreateAndSetupActionCallback ( ActionData action_data)
inlineprivate

Definition at line 121 of file ActionTakeArrowToHands.c.

122 {
123 EntityAI target = EntityAI.Cast(action_data.m_Target.GetObject());
124 if (!target)
125 return;
126
128
129 if (target.IsHeavyBehaviour())
130 Class.CastTo(callback, action_data.m_Player.StartCommand_Action(DayZPlayerConstants.CMD_ACTIONFB_PICKUP_HEAVY, GetCallbackClassTypename(), DayZPlayerConstants.STANCEMASK_ERECT));
131 else
132 {
133 if (action_data.m_Player.IsPlayerInStance(DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT))
134 Class.CastTo(callback, action_data.m_Player.AddCommandModifier_Action(m_CommandUID, GetCallbackClassTypename()));
135 else
136 Class.CastTo(callback, action_data.m_Player.StartCommand_Action(m_CommandUIDProne, GetCallbackClassTypename(), DayZPlayerConstants.STANCEMASK_PRONE));
137 }
138
139 callback.SetActionData(action_data);
140 callback.InitActionComponent();
141 action_data.m_Callback = callback;
142 }
Super root of all classes in Enforce script.
Definition EnScript.c:11
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References Class::CastTo(), AnimatedActionBase::GetCallbackClassTypename(), AnimatedActionBase::m_CommandUID, and AnimatedActionBase::m_CommandUIDProne.

◆ CreateConditionComponents()

override void ActionTakeArrowToHands::CreateConditionComponents ( )
inlineprivate

Definition at line 10 of file ActionTakeArrowToHands.c.

11 {
14 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
const float DEFAULT

References UAMaxDistances::DEFAULT, m_ConditionItem, and m_ConditionTarget.

◆ GetDisplayInteractObject()

override Object ActionTakeArrowToHands::GetDisplayInteractObject ( PlayerBase player,
ActionTarget target )
inlineprivate

Definition at line 51 of file ActionTakeArrowToHands.c.

52 {
53 EntityAI targetEntity = EntityAI.Cast(target.GetObject());
54 if (!targetEntity || (targetEntity && targetEntity.IsManagingArrows() && !targetEntity.IsDamageDestroyed()))
55 return null;
56
57 ArrowManagerBase arrowManager = targetEntity.GetArrowManager();
58 if (arrowManager)
59 return arrowManager.GetFirstArrow();
60
61 return null;
62 }

◆ GetInputType()

override ActionTakeArrowToHands::GetInputType ( )
inlineprivate

◆ HasProgress()

override bool ActionTakeArrowToHands::HasProgress ( )
inlineprivate

Definition at line 26 of file ActionTakeArrowToHands.c.

27 {
28 return false;
29 }

◆ HasProneException()

override bool ActionTakeArrowToHands::HasProneException ( )
inlineprivate

Definition at line 16 of file ActionTakeArrowToHands.c.

17 {
18 return true;
19 }

◆ InventoryReservation()

override bool ActionTakeArrowToHands::InventoryReservation ( ActionData action_data)
inlineprivate

Definition at line 69 of file ActionTakeArrowToHands.c.

70 {
71 bool success = true;
72
74
76 if (EntityAI.CastTo(targetEntity, action_data.m_Target.GetObject()))
77 {
78 ArrowManagerBase arrowManager = targetEntity.GetArrowManager();
79 if (arrowManager)
80 {
81 ItemBase targetArrow = ItemBase.Cast(arrowManager.GetFirstArrow());
82 if (targetArrow)
83 {
84 il.SetHands(action_data.m_Player, targetArrow);
85 if (action_data.m_Player.GetInventory().HasInventoryReservation(targetArrow, il))
86 success = false;
87 else
88 action_data.m_Player.GetInventory().AddInventoryReservationEx(targetArrow, il, GameInventory.c_InventoryReservationTimeoutMS);
89 }
90 }
91 }
92
93 if (success)
94 {
95 if (il)
96 action_data.m_ReservedInventoryLocations.Insert(il);
97 }
98
99 return success;
100 }
script counterpart to engine's class Inventory
Definition Inventory.c:79
const int c_InventoryReservationTimeoutMS
reservations
Definition Inventory.c:687
InventoryLocation.

References GameInventory::c_InventoryReservationTimeoutMS.

◆ OnExecute()

override void ActionTakeArrowToHands::OnExecute ( ActionData action_data)
inlineprivate

Definition at line 103 of file ActionTakeArrowToHands.c.

104 {
105 if (GetGame().IsMultiplayer() && GetGame().IsServer())
106 return;
107
108 InventoryLocation il = action_data.m_ReservedInventoryLocations.Get(0);
109
110 ItemBase arrow = ItemBase.Cast(il.GetItem());
112
113 float stackable = arrow.GetTargetQuantityMax(-1);
114
115 if (stackable == 0 || stackable >= arrow.GetQuantity())
116 action_data.m_Player.PredictiveTakeEntityToHands(arrow);
117 else
118 arrow.SplitIntoStackMaxToInventoryLocationClient(il);
119 }
void ClearInventoryReservationEx(ActionData action_data)
Definition ActionBase.c:790
proto native CGame GetGame()

References ClearInventoryReservationEx(), and GetGame().


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