Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
actionunrestraintargetempty.c
Go to the documentation of this file.
1
class
ActionUnrestrainTargetHandsCB
:
ActionContinuousBaseCB
2
{
3
const
float
DEFAULT_STRUGGLE_TIME
= 2;
4
const
float
UNRESTRAIN_STRUGGLE_MULTIPLIER
= 0.75;
//multiplier for the struggle time normally used for the player unrestraining themselves, this allows unrestraining to be bound to the 'StruggleLength' config param
5
6
override
void
CreateActionComponent
()
7
{
8
float
time =
DEFAULT_STRUGGLE_TIME
;
9
PlayerBase
targetPlayer =
PlayerBase
.Cast(
m_ActionData
.m_Target.GetObject());
10
EntityAI
item_in_hands = targetPlayer.GetItemInHands();
11
12
if
( item_in_hands.ConfigIsExisting(
"StruggleLength"
) )
13
{
14
time = item_in_hands.ConfigGetFloat(
"StruggleLength"
) *
UNRESTRAIN_STRUGGLE_MULTIPLIER
;
15
}
16
#ifdef DEVELOPER
17
if
(
m_ActionData
.m_Player.IsQuickRestrain() )
18
{
19
time =
DEBUG_QUICK_UNRESTRAIN_TIME
;
20
}
21
#endif
22
23
m_ActionData
.m_ActionComponent =
new
CAContinuousTime
(time);
24
}
25
};
26
27
class
ActionUnrestrainTargetHands
:
ActionContinuousBase
28
{
29
void
ActionUnrestrainTargetHands
()
30
{
31
m_CallbackClass
=
ActionUnrestrainTargetHandsCB
;
32
m_CommandUID
=
DayZPlayerConstants
.CMD_ACTIONFB_RESTRAINTARGET;
33
m_FullBody
=
true
;
34
m_StanceMask
=
DayZPlayerConstants
.STANCEMASK_CROUCH;
35
m_Text
=
"#unrestrain"
;
36
}
37
38
override
typename
GetInputType
()
39
{
40
return
ContinuousInteractActionInput
;
41
}
42
43
44
45
override
void
OnStartServer
(
ActionData
action_data)
46
{
47
super.OnStartServer(action_data);
48
49
action_data.m_Player.TryHideItemInHands(
true
);
50
}
51
52
override
void
OnEndServer
(
ActionData
action_data)
53
{
54
super.OnEndServer(action_data);
55
56
action_data.m_Player.TryHideItemInHands(
false
);
57
}
58
59
override
void
CreateConditionComponents
()
60
{
61
m_ConditionItem
=
new
CCINone
;
62
m_ConditionTarget
=
new
CCTObject
(
UAMaxDistances
.
DEFAULT
);
63
}
64
65
override
bool
ActionCondition
(
PlayerBase
player,
ActionTarget
target,
ItemBase
item )
66
{
67
PlayerBase
targetPlayer =
PlayerBase
.Cast(target.GetObject());
68
return
targetPlayer && targetPlayer.IsRestrained();
69
}
70
71
override
void
OnFinishProgressServer
(
ActionData
action_data )
72
{
73
PlayerBase
targetPlayer =
PlayerBase
.Cast(action_data.m_Target.GetObject());
74
75
if
(
CanReceiveAction
(action_data.m_Target) && targetPlayer.IsRestrained())
76
{
77
EntityAI
item_in_hands = targetPlayer.GetItemInHands();
78
targetPlayer.SetRestrained(
false
);
79
if
(item_in_hands)
80
{
81
MiscGameplayFunctions.TransformRestrainItem(item_in_hands, null, action_data.m_Player, targetPlayer);
82
}
83
else
84
{
85
ErrorEx
(
"Failed to obtain item in target player's hands during empty handed unrestraining"
);
86
}
87
}
88
}
89
90
override
void
OnStartClient
(
ActionData
action_data)
91
{
92
action_data.m_Player.TryHideItemInHands(
true
);
93
}
94
95
override
void
OnEndClient
(
ActionData
action_data )
96
{
97
if
( action_data.m_Player ) action_data.m_Player.TryHideItemInHands(
false
);
98
}
99
100
};
ActionData
ActionBase ActionData
Definition
actionbase.c:30
ActionTarget
class ActionTargets ActionTarget
ActionBaseCB::m_ActionData
ActionData m_ActionData
Definition
animatedactionbase.c:3
ActionBase::m_FullBody
bool m_FullBody
Definition
actionbase.c:67
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::CanReceiveAction
bool CanReceiveAction(ActionTarget target)
Definition
actionbase.c:805
ActionBase::m_StanceMask
int m_StanceMask
Definition
actionbase.c:68
ActionContinuousBaseCB
Definition
actioncontinuousbase.c:2
ActionContinuousBase::ActionContinuousBase
void ActionContinuousBase()
Definition
actioncontinuousbase.c:124
ActionUnrestrainTargetHandsCB
Definition
actionunrestraintargetempty.c:2
ActionUnrestrainTargetHandsCB::UNRESTRAIN_STRUGGLE_MULTIPLIER
const float UNRESTRAIN_STRUGGLE_MULTIPLIER
Definition
actionunrestraintargetempty.c:4
ActionUnrestrainTargetHandsCB::DEFAULT_STRUGGLE_TIME
const float DEFAULT_STRUGGLE_TIME
Definition
actionunrestraintargetempty.c:3
ActionUnrestrainTargetHandsCB::CreateActionComponent
override void CreateActionComponent()
Definition
actionunrestraintargetempty.c:6
ActionUnrestrainTargetHands::OnFinishProgressServer
override void OnFinishProgressServer(ActionData action_data)
Definition
actionunrestraintargetempty.c:71
ActionUnrestrainTargetHands::OnEndServer
override void OnEndServer(ActionData action_data)
Definition
actionunrestraintargetempty.c:52
ActionUnrestrainTargetHands::ActionUnrestrainTargetHands
void ActionUnrestrainTargetHands()
Definition
actionunrestraintargetempty.c:29
ActionUnrestrainTargetHands::OnStartClient
override void OnStartClient(ActionData action_data)
Definition
actionunrestraintargetempty.c:90
ActionUnrestrainTargetHands::CreateConditionComponents
override void CreateConditionComponents()
Definition
actionunrestraintargetempty.c:59
ActionUnrestrainTargetHands::ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition
actionunrestraintargetempty.c:65
ActionUnrestrainTargetHands::GetInputType
override GetInputType()
Definition
actionunrestraintargetempty.c:38
ActionUnrestrainTargetHands::OnEndClient
override void OnEndClient(ActionData action_data)
Definition
actionunrestraintargetempty.c:95
ActionUnrestrainTargetHands::OnStartServer
override void OnStartServer(ActionData action_data)
Definition
actionunrestraintargetempty.c:45
AnimatedActionBase::m_CommandUID
int m_CommandUID
Definition
animatedactionbase.c:143
AnimatedActionBase::m_CallbackClass
m_CallbackClass
Definition
animatedactionbase.c:145
CAContinuousTime
Definition
cacontinuoustime.c:2
CCINone
Definition
ccinone.c:2
CCTObject
Definition
cctobject.c:2
ContinuousInteractActionInput
Definition
actioninput.c:523
EntityAI
Definition
inventoryitem.c:2
ItemBase
Definition
inventoryitem.c:742
PlayerBase
Definition
playerbaseclient.c:2
UAMaxDistances
Definition
actionconstants.c:110
UAMaxDistances::DEFAULT
const float DEFAULT
Definition
actionconstants.c:112
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition
dayzplayer.c:602
ErrorEx
enum ShapeType ErrorEx
DEBUG_QUICK_UNRESTRAIN_TIME
const float DEBUG_QUICK_UNRESTRAIN_TIME
\ misc
Definition
constants.c:650
Games
Dayz
scripts
4_world
classes
useractionscomponent
actions
continuous
actionunrestraintargetempty.c
Generated by
1.17.0