DayZ 1.24
Loading...
Searching...
No Matches
ActionOpenDoors.c
Go to the documentation of this file.
2{
4
6 {
7 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_OPENDOORFW;
8 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
9 m_Text = "#open";
10 }
11
13 {
16 }
17
18 protected bool CheckIfDoorIsLocked()
19 {
20 return true;
21 }
22
23 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
24 {
25 if (!target)
26 return false;
27
28 if (!IsBuilding(target))
29 return false;
30
31 Building building;
32 if (Class.CastTo(building, target.GetObject()))
33 {
34 int doorIndex = building.GetDoorIndex(target.GetComponentIndex());
35 if (doorIndex != -1)
36 {
38 return false;
39
40 return building.CanDoorBeOpened(doorIndex, CheckIfDoorIsLocked());
41
42 }
43 }
44
45 return false;
46 }
47
49 {
50 Building building;
51 if (Class.CastTo(building, action_data.m_Target.GetObject()))
52 {
53 int doorIndex = building.GetDoorIndex(action_data.m_Target.GetComponentIndex());
54 if (doorIndex != -1)
55 {
56 if (building.CanDoorBeOpened(doorIndex, CheckIfDoorIsLocked()))
57 building.OpenDoor(doorIndex);
58 }
59 }
60 }
61
63 {
64 m_NoisePar = new NoiseParams();
65 m_NoisePar.LoadFromPath("CfgVehicles SurvivorBase NoiseActionDefault");
66 NoiseSystem noise = GetGame().GetNoiseSystem();
67 if (noise)
68 {
69 if (action_data.m_Player)
70 noise.AddNoisePos(action_data.m_Player, action_data.m_Target.GetObject().GetPosition(), m_NoisePar);
71 }
72 }
73}
74
76{
77 override bool CheckIfDoorIsLocked()
78 {
79 return false;
80 }
81
83 {
85 //super.OnEndServer(action_data);
86 }
87};
string m_Text
Definition ActionBase.c:49
bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
Definition ActionBase.c:856
void OnEndServer(ActionData action_data)
Definition ActionBase.c:962
bool IsBuilding(ActionTarget target)
Definition ActionBase.c:846
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
int m_StanceMask
Definition ActionBase.c:53
ActionOpenDoors ActionInteractBase CheckIfDoorIsLocked()
class NoiseSystem NoiseParams()
Definition Noise.c:15
override void OnEndServer(ActionData action_data)
ref NoiseParams m_NoisePar
override void CreateConditionComponents()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override void OnStartServer(ActionData action_data)
Super root of all classes in Enforce script.
Definition EnScript.c:11
const float DEFAULT
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.