DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
ActionUnlockDoors.c
Go to the documentation of this file.
2{
3 override void CreateActionComponent()
4 {
6 }
7};
8
10{
12 {
14 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
15 m_FullBody = true;
16 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
17 m_Text = "#unlock";
18 }
19
21 {
24 }
25
26 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
27 {
28 if( !target ) return false;
29 //if( IsDamageDestroyed(action_data.m_Target) ) return false;
30 if( !IsBuilding(target) ) return false;
31 if( !IsInReach(player, target, UAMaxDistances.DEFAULT) ) return false;
32
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.IsDoorLocked(doorIndex);
40 }
41 return false;
42 }
43
44 protected void UnlockDoor(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.UnlockDoor(doorIndex);
54 }
55 }
56 }
57
58 override void OnFinishProgressServer( ActionData action_data )
59 {
60 UnlockDoor(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 }
72};
protected float m_SpecialtyWeight
Definition ActionBase.c:68
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
protected bool IsBuilding(ActionTarget target)
Definition ActionBase.c:917
protected bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
Definition ActionBase.c:927
protected string m_Text
Definition ActionBase.c:49
protected bool m_FullBody
Definition ActionBase.c:52
protected int m_StanceMask
Definition ActionBase.c:53
class ActionTargets ActionTarget
protected ActionData m_ActionData
ItemBase m_MainItem
Definition ActionBase.c:28
PlayerBase m_Player
Definition ActionBase.c:33
ref CABase m_ActionComponent
Definition ActionBase.c:30
ref ActionTarget m_Target
Definition ActionBase.c:32
override void CreateActionComponent()
override void OnFinishProgressServer(ActionData action_data)
override void CreateConditionComponents()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
protected void UnlockDoor(ActionTarget target)
Super root of all classes in Enforce script.
Definition EnScript.c:11
const float DEFAULT
const float UNLOCK
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.