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

Protected Member Functions

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

Private Member Functions

void ActionOpenDoors ()
 
override void CreateConditionComponents ()
 

Private Attributes

ref NoiseParams m_NoisePar
 

Detailed Description

Definition at line 1 of file ActionOpenDoors.c.

Constructor & Destructor Documentation

◆ ActionOpenDoors()

void ActionOpenDoors::ActionOpenDoors ( )
inlineprivate

Definition at line 5 of file ActionOpenDoors.c.

6 {
7 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_OPENDOORFW;
8 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
9 m_Text = "#open";
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 ActionOpenDoors::ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprotected

Definition at line 23 of file ActionOpenDoors.c.

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 }
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(), CheckIfDoorIsLocked(), UAMaxDistances::DEFAULT, IsBuilding(), and IsInReach().

◆ CheckIfDoorIsLocked()

bool ActionOpenDoors::CheckIfDoorIsLocked ( )
inlineprotected

Definition at line 18 of file ActionOpenDoors.c.

19 {
20 return true;
21 }

Referenced by ActionCondition(), and OnStartServer().

◆ CreateConditionComponents()

override void ActionOpenDoors::CreateConditionComponents ( )
inlineprivate

Definition at line 12 of file ActionOpenDoors.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 ActionOpenDoors::OnEndServer ( ActionData action_data)
inlineprotected

Definition at line 62 of file ActionOpenDoors.c.

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

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

◆ OnStartServer()

override void ActionOpenDoors::OnStartServer ( ActionData action_data)
inlineprotected

Definition at line 48 of file ActionOpenDoors.c.

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 }

References Class::CastTo(), and CheckIfDoorIsLocked().

Member Data Documentation

◆ m_NoisePar

ref NoiseParams ActionOpenDoors::m_NoisePar
private

Definition at line 3 of file ActionOpenDoors.c.

Referenced by OnEndServer().


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