DayZ 1.24
Loading...
Searching...
No Matches
ActionCloseDoors.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 = "#close";
10 }
11
13 {
16 }
17
18 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
19 {
20 if (!target)
21 return false;
22
23 if (!IsBuilding(target))
24 return false;
25
26 Building building;
27 if (Class.CastTo(building, target.GetObject()))
28 {
29 int doorIndex = building.GetDoorIndex(target.GetComponentIndex());
30 if (doorIndex != -1)
31 {
33 return false;
34
35 return building.CanDoorBeClosed(doorIndex);
36 }
37 }
38
39 return false;
40 }
41
43 {
44 Building building;
45 if (Class.CastTo(building, action_data.m_Target.GetObject()))
46 {
47 int doorIndex = building.GetDoorIndex(action_data.m_Target.GetComponentIndex());
48 if (doorIndex != -1)
49 {
50 if (building.CanDoorBeClosed(doorIndex))
51 building.CloseDoor(doorIndex);
52
53 }
54 }
55 }
56
58 {
59 m_NoisePar = new NoiseParams();
60 m_NoisePar.LoadFromPath("CfgVehicles SurvivorBase NoiseActionDefault");
61 NoiseSystem noise = GetGame().GetNoiseSystem();
62 if (noise)
63 {
64 if (action_data.m_Player)
65 noise.AddNoisePos(action_data.m_Player, action_data.m_Target.GetObject().GetPosition(), m_NoisePar);
66 }
67 }
68}
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
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
int m_StanceMask
Definition ActionBase.c:53
class NoiseSystem NoiseParams()
Definition Noise.c:15
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override void OnEndServer(ActionData action_data)
ref NoiseParams m_NoisePar
override void CreateConditionComponents()
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.