Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionlockdoors.c
Go to the documentation of this file.
2 {
3  override void CreateActionComponent()
4  {
5  m_ActionData.m_ActionComponent = new CAContinuousTime(UATimeSpent.LOCK);
6  }
7 };
8 
10 {
11  void ActionLockDoors()
12  {
13  m_CallbackClass = ActionLockDoorsCB;
14  m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
15  m_FullBody = true;
16  m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
18  m_Text = "#lock_door";
19  }
20 
21  override void CreateConditionComponents()
22  {
25  }
26 
27  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
28  {
29  if( !target ) return false;
30  //if( IsDamageDestroyed(action_data.m_Target) ) return false;
31  if( !IsBuilding(target) ) return false;
32  if( !IsInReach(player, target, UAMaxDistances.DEFAULT) ) return false;
33 
34  Building building;
35  if( Class.CastTo(building, target.GetObject()) )
36  {
37  int doorIndex = building.GetDoorIndex(target.GetComponentIndex());
38  if ( doorIndex != -1 )
39  return building.CanDoorBeLocked(doorIndex);
40  }
41  return false;
42  }
43 
44  protected void LockDoor(ActionTarget target)
45  {
46  Building building;
47 
48  if ( Class.CastTo(building, target.GetObject()) )
49  {
50  int doorIndex = building.GetDoorIndex(target.GetComponentIndex());
51  if ( doorIndex != -1 )
52  {
53  building.LockDoor(doorIndex);
54  }
55  }
56  }
57 
58  override void OnFinishProgressServer( ActionData action_data )
59  {
60  LockDoor(action_data.m_Target);
61 
62  //Damage the Lockpick
63  //float dmg = action_data.m_MainItem.GetMaxHealth() * 0.04; //Multiply max health by 'x' amount depending on number of usages wanted (0.04 = 25)
64 
65  action_data.m_Player.GetSoftSkillsManager().AddSpecialty( m_SpecialtyWeight );
66 
67  float skillLevel = action_data.m_Player.GetSoftSkillsManager().GetSpecialtyLevel();
68  float appliedDamage = 5 + 2*skillLevel;
69  MiscGameplayFunctions.DealAbsoluteDmg(action_data.m_MainItem, appliedDamage);
70  }
71 };
ItemBase
Definition: inventoryitem.c:730
CAContinuousTime
Definition: cacontinuoustime.c:1
UASoftSkillsWeight
Definition: actionconstants.c:118
ActionLockDoorsCB
Definition: actionlockdoors.c:1
UAMaxDistances
Definition: actionconstants.c:104
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
ActionLockDoors
Definition: actionlockdoors.c:9
CCTCursor
Definition: cctcursor.c:1
UATimeSpent
Definition: actionconstants.c:26
ActionContinuousBaseCB
Definition: actioncontinuousbase.c:1
IsInReach
protected bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
Definition: actionbase.c:928
m_Text
protected string m_Text
Definition: actionbase.c:49
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
IsBuilding
protected bool IsBuilding(ActionTarget target)
Definition: actionbase.c:918
ActionContinuousBase
Definition: actioncontinuousbase.c:132
CCINonRuined
Definition: ccinonruined.c:1
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10
m_SpecialtyWeight
protected float m_SpecialtyWeight
Definition: actionbase.c:68
m_StanceMask
protected int m_StanceMask
Definition: actionbase.c:53