DayZ 1.24
Loading...
Searching...
No Matches
ActionUnrestrainSelf.c
Go to the documentation of this file.
2{
3 const float DEFAULT_STRUGGLE_TIME = 2;
4
5 override void CreateActionComponent()
6 {
8
9 if (m_ActionData.m_MainItem.ConfigIsExisting("StruggleLength"))
10 time = m_ActionData.m_MainItem.ConfigGetFloat("StruggleLength");
11
12#ifdef DEVELOPER
13 if (m_ActionData.m_Player.IsQuickRestrain())
15#endif
16
18 }
19
20 override void EndActionComponent()
21 {
22 // TODO for second type animation SetCommand(DayZPlayerConstants.CMD_ACTIONINT_FINISH);
24 SetCommand(DayZPlayerConstants.CMD_ACTIONINT_END);
25 else if (m_ActionData.m_State == UA_CANCEL)
26 {
27 m_Canceled = true;
28 SetCommand(DayZPlayerConstants.CMD_ACTIONINT_INTERRUPT);
29 return;
30 //Cancel();
31 }
32 else
33 {
34 m_Canceled = true;
35 SetCommand(DayZPlayerConstants.CMD_ACTIONINT_INTERRUPT);
36 return;
37 }
39 }
40};
41
43{
45 {
47 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_RESTRAINEDSTRUGGLE;
48 m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_RESTRAINEDSTRUGGLE;
49 m_Text = "#struggle";
50 }
51
57
58 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
59 {
60 return player.IsRestrained();
61 }
62
63 override bool HasProneException()
64 {
65 return true;
66 }
67
68 override bool HasTarget()
69 {
70 return false;
71 }
72
74 {
75
76 }
77
78
80 {
81 PlayerBase player = PlayerBase.Cast(action_data.m_Player);
83
84 if (item_in_hands)
85 {
86 if (item_in_hands.IsInherited(BarbedWireLocked))
87 {
88 int randNum = Math.RandomInt(0, 3); // Values 0 to 3 represent fore arm and arm roll bleed sources
89 player.m_BleedingManagerServer.AttemptAddBleedingSourceBySelection(PlayerBase.m_BleedingSourcesUp[randNum]);
90 }
91 player.SetRestrained(false);
93 MiscGameplayFunctions.TransformRestrainItem(item_in_hands, null, null, player);
94 //string new_item_name = MiscGameplayFunctions.ObtainRestrainItemTargetClassname(item_in_hands);
95 //MiscGameplayFunctions.TurnItemInHandsIntoItemEx(player, new UnrestrainSelfPlayer(item_in_hands, new_item_name));
96 }
97 }
98
99 override bool CanBeUsedInRestrain()
100 {
101 return true;
102 }
103};
104
string m_Text
Definition ActionBase.c:49
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
void SetCommand(int command_uid)
ActionData m_ActionData
PlayerBase m_Player
Definition ActionBase.c:33
ref CABase m_ActionComponent
Definition ActionBase.c:30
ItemBase m_MainItem
Definition ActionBase.c:28
override void CreateActionComponent()
override void EndActionComponent()
override void CreateConditionComponents()
override void OnEndAnimationLoopServer(ActionData action_data)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override void OnFinishProgressServer(ActionData action_data)
override bool CanBeUsedInRestrain()
override bool HasProneException()
Definition EnMath.c:7
base class for transformation operations (creating one item from another)
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
const float CLEAN_UNRESTRAIN_DAMAGE
Definition constants.c:842
const float DEBUG_QUICK_UNRESTRAIN_TIME
Definition constants.c:598
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
const int UA_FINISHED
Definition constants.c:436
const int UA_CANCEL
Definition constants.c:437