Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionunrestrainself.c
Go to the documentation of this file.
2 {
3  const float DEFAULT_STRUGGLE_TIME = 2;
4 
5  override void CreateActionComponent()
6  {
7  float time = DEFAULT_STRUGGLE_TIME;
8 
9  if ( m_ActionData.m_MainItem.ConfigIsExisting("StruggleLength") )
10  {
11  time = m_ActionData.m_MainItem.ConfigGetFloat("StruggleLength");
12  }
13 
14  #ifdef DEVELOPER
15  if ( m_ActionData.m_Player.IsQuickRestrain() )
16  {
18  }
19  #endif
20 
21  m_ActionData.m_ActionComponent = new CAContinuousTime(time);
22  }
23 
24  override void EndActionComponent()
25  {
26  // TODO for second type animation SetCommand(DayZPlayerConstants.CMD_ACTIONINT_FINISH);
27  if ( m_ActionData.m_State == UA_FINISHED )
28  {
29  SetCommand(DayZPlayerConstants.CMD_ACTIONINT_END);
30  }
31  else if (m_ActionData.m_State == UA_CANCEL )
32  {
33  m_Canceled = true;
34  SetCommand(DayZPlayerConstants.CMD_ACTIONINT_INTERRUPT);
35  return;
36  //Cancel();
37  }
38  else
39  {
40  m_Canceled = true;
41  SetCommand(DayZPlayerConstants.CMD_ACTIONINT_INTERRUPT);
42  return;
43  }
44  m_ActionData.m_State = UA_FINISHED;
45  }
46 };
47 
49 {
51  {
52  m_CallbackClass = ActionUnrestrainSelfCB;
53  m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_RESTRAINEDSTRUGGLE;
54  m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_RESTRAINEDSTRUGGLE;
55  m_Text = "#struggle";
56  }
57 
58  override void CreateConditionComponents()
59  {
62  }
63 
64  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
65  {
66  return player.IsRestrained();
67  }
68 
69  override bool HasProneException()
70  {
71  return true;
72  }
73 
74  override bool HasTarget()
75  {
76  return false;
77  }
78 
79  override void OnEndAnimationLoopServer( ActionData action_data )
80  {
81 
82  }
83 
84 
85  override void OnFinishProgressServer( ActionData action_data )
86  {
87  PlayerBase player = PlayerBase.Cast(action_data.m_Player);
88  EntityAI item_in_hands = action_data.m_MainItem;
89 
90  if (item_in_hands)
91  {
92  if (item_in_hands.IsInherited(BarbedWireLocked))
93  {
94  int randNum = Math.RandomInt(0, 3); // Values 0 to 3 represent fore arm and arm roll bleed sources
95  player.m_BleedingManagerServer.AttemptAddBleedingSourceBySelection(PlayerBase.m_BleedingSourcesUp[randNum]);
96  }
97  player.SetRestrained(false);
98  item_in_hands.AddHealth(-GameConstants.CLEAN_UNRESTRAIN_DAMAGE);
99  MiscGameplayFunctions.TransformRestrainItem(item_in_hands, null, null, player);
100  //string new_item_name = MiscGameplayFunctions.ObtainRestrainItemTargetClassname(item_in_hands);
101  //MiscGameplayFunctions.TurnItemInHandsIntoItemEx(player, new UnrestrainSelfPlayer(item_in_hands, new_item_name));
102  }
103  }
104 
105  override bool CanBeUsedInRestrain()
106  {
107  return true;
108  }
109 };
110 
ItemBase
Definition: inventoryitem.c:730
CAContinuousTime
Definition: cacontinuoustime.c:1
ActionUnrestrainSelfCB
Definition: actionunrestrainself.c:1
UA_CANCEL
const int UA_CANCEL
Definition: constants.c:437
ActionUnrestrainSelf
Definition: actionunrestrainself.c:48
m_Canceled
bool m_Canceled
Definition: smptanimmeta.c:16
PlayerBase
Definition: playerbaseclient.c:1
UA_FINISHED
const int UA_FINISHED
Definition: constants.c:436
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
CCTSelf
Definition: cctself.c:1
ActionContinuousBaseCB
Definition: actioncontinuousbase.c:1
UnrestrainSelfPlayer
Definition: actionunrestrainself.c:111
DEBUG_QUICK_UNRESTRAIN_TIME
const float DEBUG_QUICK_UNRESTRAIN_TIME
Definition: constants.c:599
m_Text
protected string m_Text
Definition: actionbase.c:49
GameConstants
Definition: constants.c:612
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
ActionContinuousBase
Definition: actioncontinuousbase.c:132
CCINonRuined
Definition: ccinonruined.c:1
ReplaceItemWithNewLambdaBase
base class for transformation operations (creating one item from another)
Definition: replaceitemwithnewlambdabase.c:4
Math
Definition: enmath.c:6
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
EntityAI
Definition: building.c:5