Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionrestrainself.c
Go to the documentation of this file.
2 {
3  const float DEFAULT_RESTRAIN_TIME = 2;
4 
5  override void CreateActionComponent()
6  {
7  float time = DEFAULT_RESTRAIN_TIME;
8 
9  if( m_ActionData.m_MainItem.ConfigIsExisting("RestrainTime") )
10  {
11  time = m_ActionData.m_MainItem.ConfigGetFloat("RestrainTime");
12  }
13 
14  if( m_ActionData.m_Player.IsQuickRestrain() )
15  {
17  }
18 
19  m_ActionData.m_ActionComponent = new CAContinuousTime(time);
20  }
21 };
22 
24 {
25  void ActionRestrainSelf()
26  {
27  m_CallbackClass = ActionRestrainSelfCB;
28  m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_RESTRAINSELF;
29  m_FullBody = true;
30  m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
31  //m_Animation = "INJECTEPIPENS";
33  m_Text = "#restrain_self";
34  }
35 
36  override int GetStanceMask(PlayerBase player)
37  {
38  if ( player.IsPlayerInStance(DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_PRONE))
39  return DayZPlayerConstants.STANCEMASK_CROUCH;
40  else
41  return DayZPlayerConstants.STANCEMASK_ERECT;
42  }
43 
44  override void CreateConditionComponents()
45  {
48  }
49 
50  override bool HasTarget()
51  {
52  return false;
53  }
54 
55  override bool HasAlternativeInterrupt()
56  {
57  return true;
58  }
59 
60  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
61  {
62  if(player.IsRestrained())
63  {
64  return false;
65  }
66 
67  return true;
68  }
69 
70  override void OnFinishProgressServer( ActionData action_data )
71  {
72  PlayerBase player = PlayerBase.Cast( action_data.m_Player );
73  EntityAI item_in_hands = action_data.m_MainItem;
74  if( item_in_hands )
75  {
76  //action_data.m_Player.RemoveQuickBarEntityShortcut(item_in_hands);
77  string new_item_name = MiscGameplayFunctions.ObtainRestrainItemTargetClassname(item_in_hands);
78  MiscGameplayFunctions.TurnItemIntoItemEx(player, new TurnItemIntoItemLambdaRestrainLambda(item_in_hands, new_item_name, action_data.m_Player));
79  }
80  }
81 
82  override void OnFinishProgressClient( ActionData action_data )
83  {
84  //action_data.m_Player.RemoveQuickBarEntityShortcut(action_data.m_MainItem);
85  }
86 };
ItemBase
Definition: inventoryitem.c:730
ActionRestrainSelfCB
Definition: actionrestrainself.c:1
CAContinuousTime
Definition: cacontinuoustime.c:1
UASoftSkillsWeight
Definition: actionconstants.c:118
m_FullBody
protected bool m_FullBody
Definition: actionbase.c:52
PlayerBase
Definition: playerbaseclient.c:1
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
DEBUG_QUICK_UNRESTRAIN_TIME
const float DEBUG_QUICK_UNRESTRAIN_TIME
Definition: constants.c:599
m_Text
protected string m_Text
Definition: actionbase.c:49
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
ActionRestrainSelf
Definition: actionrestrainself.c:23
ActionContinuousBase
Definition: actioncontinuousbase.c:132
CCINonRuined
Definition: ccinonruined.c:1
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
m_SpecialtyWeight
protected float m_SpecialtyWeight
Definition: actionbase.c:68
m_StanceMask
protected int m_StanceMask
Definition: actionbase.c:53
EntityAI
Definition: building.c:5