DayZ 1.24
Loading...
Searching...
No Matches
ActionUnrestrainTargetEmpty.c
Go to the documentation of this file.
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 {
10 EntityAI item_in_hands = targetPlayer.GetItemInHands();
11
12 if (item_in_hands.ConfigIsExisting("StruggleLength"))
13 time = item_in_hands.ConfigGetFloat("StruggleLength") * UNRESTRAIN_STRUGGLE_MULTIPLIER;
14#ifdef DEVELOPER
15 if (m_ActionData.m_Player.IsQuickRestrain())
17#endif
18
20 }
21};
22
24{
26 {
28 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_RESTRAINTARGET;
29 m_FullBody = true;
30 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH;
31 m_Text = "#unrestrain";
32 }
33
34 override typename GetInputType()
35 {
37 }
38
39
41 {
42 action_data.m_Player.TryHideItemInHands(true);
43 }
44
46 {
47 action_data.m_Player.TryHideItemInHands(false);
48 }
49
55
56 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
57 {
58 PlayerBase targetPlayer = PlayerBase.Cast(target.GetObject());
59 return targetPlayer && targetPlayer.IsRestrained();
60 }
61
63 {
64 PlayerBase targetPlayer = PlayerBase.Cast(action_data.m_Target.GetObject());
65
66 if (CanReceiveAction(action_data.m_Target) && targetPlayer.IsRestrained())
67 {
68 EntityAI item_in_hands = targetPlayer.GetItemInHands();
69 targetPlayer.SetRestrained(false);
70 if (item_in_hands)
71 MiscGameplayFunctions.TransformRestrainItem(item_in_hands, null, action_data.m_Player, targetPlayer);
72 else
73 ErrorEx("Failed to obtain item in target player's hands during empty handed unrestraining");
74 }
75 }
76
78 {
79 action_data.m_Player.TryHideItemInHands(true);
80 }
81
83 {
84 if (action_data.m_Player) action_data.m_Player.TryHideItemInHands(false);
85 }
86
87};
bool m_FullBody
Definition ActionBase.c:52
string m_Text
Definition ActionBase.c:49
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
bool CanReceiveAction(ActionTarget target)
Definition ActionBase.c:594
int m_StanceMask
Definition ActionBase.c:53
ActionData m_ActionData
PlayerBase m_Player
Definition ActionBase.c:33
ref ActionTarget m_Target
Definition ActionBase.c:32
ref CABase m_ActionComponent
Definition ActionBase.c:30
override void OnEndServer(ActionData action_data)
override void OnEndClient(ActionData action_data)
override void OnStartClient(ActionData action_data)
override void OnStartServer(ActionData action_data)
override void OnFinishProgressServer(ActionData action_data)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
const float DEFAULT
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
enum ShapeType ErrorEx
const float DEBUG_QUICK_UNRESTRAIN_TIME
Definition constants.c:598