Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
actiontakehybridattachmenttohands.c
Go to the documentation of this file.
1
2
class
ActionTakeHybridAttachmentToHands
:
ActionInteractBase
3
{
4
void
ActionTakeHybridAttachmentToHands
()
5
{
6
m_CommandUID
=
DayZPlayerConstants
.CMD_ACTIONMOD_PICKUP_HANDS;
7
m_CommandUIDProne
=
DayZPlayerConstants
.CMD_ACTIONFB_PICKUP_HANDS;
8
m_Text
=
"#take_to_hands"
;
9
}
10
11
override
void
CreateConditionComponents
()
12
{
13
m_ConditionItem
=
new
CCINotPresent
;
14
m_ConditionTarget
=
new
CCTCursor
;
15
}
16
17
override
bool
HasProneException
()
18
{
19
return
true
;
20
}
21
22
override
typename
GetInputType
()
23
{
24
return
ContinuousInteractActionInput
;
25
}
26
27
override
bool
HasProgress
()
28
{
29
return
false
;
30
}
31
32
override
bool
ActionCondition
(
PlayerBase
player,
ActionTarget
target,
ItemBase
item )
33
{
34
EntityAI
tgt_entity =
EntityAI
.Cast( target.GetObject() );
35
36
if
( tgt_entity &&
BaseBuildingBase
.Cast(tgt_entity) &&!tgt_entity.IsBeingPlaced()
/*&& BaseBuildingBase.Cast(tgt_entity).IsPlayerInside(player,"")*/
)
37
{
38
string
component_name = tgt_entity.GetActionComponentName( target.GetComponentIndex() );
39
40
ItemBase
attachment =
ItemBase
.Cast(tgt_entity.FindAttachmentBySlotName(component_name));
41
42
if
( attachment && player.GetInventory().CanAddEntityIntoHands(attachment) && attachment.
IsTakeable
() )
43
{
44
return
true
;
45
}
46
}
47
return
false
;
48
}
49
50
override
bool
CanContinue
(
ActionData
action_data )
51
{
52
return
true
;
53
}
54
55
override
void
OnExecute
(
ActionData
action_data )
56
{
57
if
(
g_Game
.IsDedicatedServer())
58
{
59
ClearActionJuncture
(action_data);
60
return
;
61
}
62
63
OnExecuteImpl
(action_data);
64
}
65
66
protected
void
OnExecuteImpl
(
ActionData
action_data )
67
{
68
EntityAI
tgt_entity =
EntityAI
.Cast( action_data.m_Target.GetObject() );
69
string
component_name = tgt_entity.GetActionComponentName( action_data.m_Target.GetComponentIndex() );
70
ItemBase
attachment;
71
72
if
( tgt_entity &&
ItemBase
.CastTo(attachment, tgt_entity.FindAttachmentBySlotName(component_name)) )
73
{
74
ClearInventoryReservationEx
(action_data);
75
float
stackable = attachment.GetTargetQuantityMax(-1);
76
77
if
( stackable == 0 || stackable >= attachment.GetQuantity() )
78
{
79
//take to hands
80
action_data.m_Player.PredictiveTakeEntityToHands( attachment );
81
}
82
else
if
( stackable != 0 && stackable < attachment.GetQuantity() )
83
{
84
//split and take to hands
85
attachment.SplitIntoStackMaxHandsClient( action_data.m_Player );
86
}
87
}
88
}
89
90
override
void
CreateAndSetupActionCallback
(
ActionData
action_data )
91
{
92
EntityAI
tgt_entity =
EntityAI
.Cast( action_data.m_Target.GetObject() );
93
string
component_name = tgt_entity.GetActionComponentName( action_data.m_Target.GetComponentIndex() );
94
ItemBase
attachment;
95
bool
heavy_item =
false
;
96
97
if
( tgt_entity &&
ItemBase
.CastTo(attachment, tgt_entity.FindAttachmentBySlotName(component_name)) )
98
{
99
ActionBaseCB
callback;
100
if
( attachment && attachment.ConfigIsExisting(
"heavyItem"
) && attachment.ConfigGetBool(
"heavyItem"
) )
101
{
102
heavy_item =
true
;
103
}
104
}
105
106
if
( heavy_item )
107
{
108
Class
.
CastTo
(callback, action_data.m_Player.StartCommand_Action(
DayZPlayerConstants
.CMD_ACTIONFB_PICKUP_HEAVY,
GetCallbackClassTypename
(),
DayZPlayerConstants
.STANCEMASK_ERECT));
109
}
110
else
111
{
112
if
( action_data.m_Player.IsPlayerInStance(
DayZPlayerConstants
.STANCEMASK_CROUCH |
DayZPlayerConstants
.STANCEMASK_ERECT) )
113
{
114
Class
.
CastTo
(callback, action_data.m_Player.AddCommandModifier_Action(
DayZPlayerConstants
.CMD_ACTIONMOD_PICKUP_HANDS,
GetCallbackClassTypename
()));
115
}
116
else
117
{
118
Class
.
CastTo
(callback, action_data.m_Player.StartCommand_Action(
DayZPlayerConstants
.CMD_ACTIONFB_PICKUP_HANDS,
GetCallbackClassTypename
(),
DayZPlayerConstants
.STANCEMASK_PRONE));
119
}
120
}
121
callback.SetActionData(action_data);
122
callback.InitActionComponent();
123
action_data.m_Callback = callback;
124
}
125
}
ActionData
ActionBase ActionData
Definition
actionbase.c:30
ActionTarget
class ActionTargets ActionTarget
ActionBaseCB
Definition
animatedactionbase.c:2
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
ActionTakeHybridAttachmentToHands::CanContinue
override bool CanContinue(ActionData action_data)
Definition
actiontakehybridattachmenttohands.c:50
ActionTakeHybridAttachmentToHands::OnExecuteImpl
void OnExecuteImpl(ActionData action_data)
Definition
actiontakehybridattachmenttohands.c:66
ActionTakeHybridAttachmentToHands::HasProgress
override bool HasProgress()
Definition
actiontakehybridattachmenttohands.c:27
ActionTakeHybridAttachmentToHands::CreateConditionComponents
override void CreateConditionComponents()
Definition
actiontakehybridattachmenttohands.c:11
ActionTakeHybridAttachmentToHands::OnExecute
override void OnExecute(ActionData action_data)
Definition
actiontakehybridattachmenttohands.c:55
ActionTakeHybridAttachmentToHands::ActionTakeHybridAttachmentToHands
void ActionTakeHybridAttachmentToHands()
Definition
actiontakehybridattachmenttohands.c:4
ActionTakeHybridAttachmentToHands::ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition
actiontakehybridattachmenttohands.c:32
ActionTakeHybridAttachmentToHands::GetInputType
override GetInputType()
Definition
actiontakehybridattachmenttohands.c:22
ActionTakeHybridAttachmentToHands::CreateAndSetupActionCallback
override void CreateAndSetupActionCallback(ActionData action_data)
Definition
actiontakehybridattachmenttohands.c:90
ActionTakeHybridAttachmentToHands::HasProneException
override bool HasProneException()
Definition
actiontakehybridattachmenttohands.c:17
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
BaseBuildingBase
Definition
fence.c:2
CCINotPresent
Definition
ccinotpresent.c:2
CCTCursor
Definition
cctcursor.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
ItemBase
Definition
inventoryitem.c:742
ItemBase::IsTakeable
override bool IsTakeable()
Definition
basebuildingbase.c:1008
PlayerBase
Definition
playerbaseclient.c:2
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
actiontakehybridattachmenttohands.c
Generated by
1.17.0