DayZ 1.24
Loading...
Searching...
No Matches
ActionLockDoors.c
Go to the documentation of this file.
8
10{
12 {
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
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 building.LockDoor(doorIndex);
53 }
54 }
55
57 {
58 LockDoor(action_data.m_Target);
59
60 //Damage the Lockpick
61 //float dmg = action_data.m_MainItem.GetMaxHealth() * 0.04; //Multiply max health by 'x' amount depending on number of usages wanted (0.04 = 25)
62
63 action_data.m_Player.GetSoftSkillsManager().AddSpecialty(m_SpecialtyWeight);
64
65 float skillLevel = action_data.m_Player.GetSoftSkillsManager().GetSpecialtyLevel();
66 float appliedDamage = 5 + 2 * skillLevel;
67 MiscGameplayFunctions.DealAbsoluteDmg(action_data.m_MainItem, appliedDamage);
68 }
69};
bool m_FullBody
Definition ActionBase.c:52
string m_Text
Definition ActionBase.c:49
bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
Definition ActionBase.c:856
bool IsBuilding(ActionTarget target)
Definition ActionBase.c:846
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
float m_SpecialtyWeight
Definition ActionBase.c:68
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
int m_StanceMask
Definition ActionBase.c:53
ActionData m_ActionData
ref CABase m_ActionComponent
Definition ActionBase.c:30
override void CreateActionComponent()
void LockDoor(ActionTarget target)
override void CreateConditionComponents()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override void OnFinishProgressServer(ActionData action_data)
Super root of all classes in Enforce script.
Definition EnScript.c:11
const float DEFAULT
const float LOCK
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.