DayZ 1.24
Loading...
Searching...
No Matches
ActionCloseDoors Class Reference
Inheritance diagram for ActionCloseDoors:
[legend]
Collaboration diagram for ActionCloseDoors:
[legend]

Private Member Functions

void ActionCloseDoors ()
 
override void CreateConditionComponents ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void OnStartServer (ActionData action_data)
 
override void OnEndServer (ActionData action_data)
 

Private Attributes

ref NoiseParams m_NoisePar
 

Detailed Description

Definition at line 1 of file ActionCloseDoors.c.

Constructor & Destructor Documentation

◆ ActionCloseDoors()

void ActionCloseDoors::ActionCloseDoors ( )
inlineprivate

Definition at line 5 of file ActionCloseDoors.c.

6 {
7 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_OPENDOORFW;
8 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
9 m_Text = "#close";
10 }
string m_Text
Definition ActionBase.c:49
int m_StanceMask
Definition ActionBase.c:53
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597

References AnimatedActionBase::m_CommandUID, m_StanceMask, and m_Text.

Member Function Documentation

◆ ActionCondition()

override bool ActionCloseDoors::ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate

Definition at line 18 of file ActionCloseDoors.c.

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 }
bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
Definition ActionBase.c:856
bool IsBuilding(ActionTarget target)
Definition ActionBase.c:846
Super root of all classes in Enforce script.
Definition EnScript.c:11
const float DEFAULT
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References Class::CastTo(), UAMaxDistances::DEFAULT, IsBuilding(), and IsInReach().

◆ CreateConditionComponents()

override void ActionCloseDoors::CreateConditionComponents ( )
inlineprivate

Definition at line 12 of file ActionCloseDoors.c.

13 {
16 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56

References m_ConditionItem, and m_ConditionTarget.

◆ OnEndServer()

override void ActionCloseDoors::OnEndServer ( ActionData action_data)
inlineprivate

Definition at line 57 of file ActionCloseDoors.c.

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 }
class NoiseSystem NoiseParams()
Definition Noise.c:15
ref NoiseParams m_NoisePar
proto native CGame GetGame()

References GetGame(), m_NoisePar, and NoiseParams().

◆ OnStartServer()

override void ActionCloseDoors::OnStartServer ( ActionData action_data)
inlineprivate

Definition at line 42 of file ActionCloseDoors.c.

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 }

References Class::CastTo().

Member Data Documentation

◆ m_NoisePar

ref NoiseParams ActionCloseDoors::m_NoisePar
private

Definition at line 3 of file ActionCloseDoors.c.

Referenced by OnEndServer().


The documentation for this class was generated from the following file: