Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
actiontakearrowtohands.c
Go to the documentation of this file.
1
class
ActionTakeArrowToHands
:
ActionInteractBase
2
{
3
void
ActionTakeArrowToHands
()
4
{
5
m_CommandUID
=
DayZPlayerConstants
.CMD_ACTIONMOD_PICKUP_HANDS;
6
m_CommandUIDProne
=
DayZPlayerConstants
.CMD_ACTIONFB_PICKUP_HANDS;
7
m_Text
=
"#take_to_hands"
;
8
}
9
10
override
void
CreateConditionComponents
()
11
{
12
m_ConditionItem
=
new
CCINone
();
13
m_ConditionTarget
=
new
CCTObject
(
UAMaxDistances
.
DEFAULT
);
14
}
15
16
override
bool
HasProneException
()
17
{
18
return
true
;
19
}
20
21
override
typename
GetInputType
()
22
{
23
return
ContinuousInteractActionInput
;
24
}
25
26
override
bool
HasProgress
()
27
{
28
return
false
;
29
}
30
31
override
bool
ActionCondition
(
PlayerBase
player,
ActionTarget
target,
ItemBase
item)
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
}
50
51
override
Object
GetDisplayInteractObject
(
PlayerBase
player,
ActionTarget
target)
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
{
60
return
arrowManager.
GetFirstArrow
();
61
}
62
63
return
null;
64
}
65
66
override
bool
CanContinue
(
ActionData
action_data)
67
{
68
return
true
;
69
}
70
71
override
bool
InventoryReservation
(
ActionData
action_data)
72
{
73
bool
success =
true
;
74
75
InventoryLocation
il =
new
InventoryLocation
();
76
77
EntityAI
targetEntity;
78
if
(
EntityAI
.CastTo(targetEntity, action_data.m_Target.GetObject()))
79
{
80
ArrowManagerBase
arrowManager = targetEntity.GetArrowManager();
81
if
(arrowManager)
82
{
83
ItemBase
targetArrow =
ItemBase
.Cast(arrowManager.
GetFirstArrow
());
84
if
(targetArrow)
85
{
86
il.
SetHands
(action_data.m_Player,targetArrow);
87
if
(action_data.m_Player.GetInventory().HasInventoryReservation(targetArrow, il))
88
{
89
success =
false
;
90
}
91
else
92
{
93
action_data.m_Player.GetInventory().AddInventoryReservationEx(targetArrow, il,
GameInventory
.
c_InventoryReservationTimeoutMS
);
94
}
95
}
96
}
97
}
98
99
if
(success)
100
{
101
if
(il)
102
action_data.m_ReservedInventoryLocations.Insert(il);
103
}
104
105
return
success;
106
}
107
108
109
override
void
OnExecute
(
ActionData
action_data)
110
{
111
if
(
g_Game
.IsDedicatedServer())
112
{
113
ClearActionJuncture
(action_data);
114
return
;
115
}
116
117
InventoryLocation
il = action_data.m_ReservedInventoryLocations.Get(0);
118
119
ItemBase
arrow =
ItemBase
.Cast(il.
GetItem
());
120
ClearInventoryReservationEx
(action_data);
121
122
float
stackable = arrow.GetTargetQuantityMax(-1);
123
124
if
(stackable == 0 || stackable >= arrow.GetQuantity())
125
{
126
action_data.m_Player.PredictiveTakeEntityToHands(arrow);
127
}
128
else
129
{
130
arrow.SplitIntoStackMaxToInventoryLocationClient(il);
131
}
132
}
133
134
override
void
CreateAndSetupActionCallback
(
ActionData
action_data)
135
{
136
EntityAI
target =
EntityAI
.Cast(action_data.m_Target.GetObject());
137
if
(!target)
138
return
;
139
140
ActionBaseCB
callback;
141
142
if
(target.IsHeavyBehaviour())
143
{
144
Class
.
CastTo
(callback, action_data.m_Player.StartCommand_Action(
DayZPlayerConstants
.CMD_ACTIONFB_PICKUP_HEAVY,
GetCallbackClassTypename
(),
DayZPlayerConstants
.STANCEMASK_ERECT));
145
}
146
else
147
{
148
if
(action_data.m_Player.IsPlayerInStance(
DayZPlayerConstants
.STANCEMASK_CROUCH |
DayZPlayerConstants
.STANCEMASK_ERECT))
149
{
150
Class
.
CastTo
(callback, action_data.m_Player.AddCommandModifier_Action(
m_CommandUID
,
GetCallbackClassTypename
()));
151
}
152
else
153
{
154
Class
.
CastTo
(callback, action_data.m_Player.StartCommand_Action(
m_CommandUIDProne
,
GetCallbackClassTypename
(),
DayZPlayerConstants
.STANCEMASK_PRONE));
155
}
156
}
157
158
callback.
SetActionData
(action_data);
159
callback.
InitActionComponent
();
160
action_data.m_Callback = callback;
161
}
162
163
164
override
bool
CanBeUsedOnBack
()
165
{
166
return
true
;
167
}
168
}
ActionData
ActionBase ActionData
Definition
actionbase.c:30
ActionTarget
class ActionTargets ActionTarget
ActionBaseCB
Definition
animatedactionbase.c:2
ActionBaseCB::InitActionComponent
void InitActionComponent()
Definition
animatedactionbase.c:66
ActionBaseCB::SetActionData
void SetActionData(ActionData action_data)
Definition
animatedactionbase.c:109
ActionBase::m_Text
string m_Text
Definition
actionbase.c:64
ActionBase::m_ConditionItem
ref CCIBase m_ConditionItem
Definition
actionbase.c:70
ActionBase::m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition
actionbase.c:71
ActionBase::ClearInventoryReservationEx
void ClearInventoryReservationEx(ActionData action_data)
Definition
actionbase.c:1040
ActionBase::ClearActionJuncture
void ClearActionJuncture(ActionData action_data)
Definition
actionbase.c:1104
ActionInteractBase::ActionInteractBase
void ActionInteractBase()
Definition
actioninteractbase.c:43
ActionTakeArrowToHands::CanBeUsedOnBack
override bool CanBeUsedOnBack()
Definition
actiontakearrowtohands.c:164
ActionTakeArrowToHands::ActionTakeArrowToHands
void ActionTakeArrowToHands()
Definition
actiontakearrowtohands.c:3
ActionTakeArrowToHands::CanContinue
override bool CanContinue(ActionData action_data)
Definition
actiontakearrowtohands.c:66
ActionTakeArrowToHands::HasProgress
override bool HasProgress()
Definition
actiontakearrowtohands.c:26
ActionTakeArrowToHands::CreateConditionComponents
override void CreateConditionComponents()
Definition
actiontakearrowtohands.c:10
ActionTakeArrowToHands::InventoryReservation
override bool InventoryReservation(ActionData action_data)
Definition
actiontakearrowtohands.c:71
ActionTakeArrowToHands::GetDisplayInteractObject
override Object GetDisplayInteractObject(PlayerBase player, ActionTarget target)
Definition
actiontakearrowtohands.c:51
ActionTakeArrowToHands::OnExecute
override void OnExecute(ActionData action_data)
Definition
actiontakearrowtohands.c:109
ActionTakeArrowToHands::ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition
actiontakearrowtohands.c:31
ActionTakeArrowToHands::GetInputType
override GetInputType()
Definition
actiontakearrowtohands.c:21
ActionTakeArrowToHands::CreateAndSetupActionCallback
override void CreateAndSetupActionCallback(ActionData action_data)
Definition
actiontakearrowtohands.c:134
ActionTakeArrowToHands::HasProneException
override bool HasProneException()
Definition
actiontakearrowtohands.c:16
AnimatedActionBase::m_CommandUIDProne
int m_CommandUIDProne
Definition
animatedactionbase.c:144
AnimatedActionBase::GetCallbackClassTypename
GetCallbackClassTypename()
Definition
animatedactionbase.c:312
AnimatedActionBase::m_CommandUID
int m_CommandUID
Definition
animatedactionbase.c:143
ArrowManagerBase
Definition
arrowmanagerbase.c:2
ArrowManagerBase::GetFirstArrow
EntityAI GetFirstArrow()
Definition
arrowmanagerbase.c:82
CCINone
Definition
ccinone.c:2
CCTObject
Definition
cctobject.c:2
Class
Super root of all classes in Enforce script.
Definition
enscript.c:11
ContinuousInteractActionInput
Definition
actioninput.c:523
EntityAI
Definition
inventoryitem.c:2
GameInventory
script counterpart to engine's class Inventory
Definition
inventory.c:81
GameInventory::c_InventoryReservationTimeoutMS
const int c_InventoryReservationTimeoutMS
reservations
Definition
inventory.c:714
InventoryLocation
InventoryLocation.
Definition
inventorylocation.c:30
InventoryLocation::SetHands
proto native void SetHands(notnull EntityAI parent, EntityAI e)
InventoryLocation::GetItem
proto native EntityAI GetItem()
returns item of current inventory location
ItemBase
Definition
inventoryitem.c:742
Object
Definition
objecttyped.c:2
PlayerBase
Definition
playerbaseclient.c:2
UAMaxDistances
Definition
actionconstants.c:110
UAMaxDistances::DEFAULT
const float DEFAULT
Definition
actionconstants.c:112
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition
dayzplayer.c:602
Class::CastTo
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
Games
Dayz
scripts
4_world
classes
useractionscomponent
actions
interact
actiontakearrowtohands.c
Generated by
1.17.0