DayZ 1.24
Loading...
Searching...
No Matches
ActionOpenDoors.c File Reference

Go to the source code of this file.

Classes

class  ActionOpenDoors
 

Functions

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

Variables

ref NoiseParams m_NoisePar
 

Function Documentation

◆ ActionCondition()

override bool CheckIfDoorIsLocked::ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
protected

Definition at line 98 of file ActionOpenDoors.c.

◆ ActionOpenDoors()

void CheckIfDoorIsLocked::ActionOpenDoors ( )

Definition at line 80 of file ActionOpenDoors.c.

83 {
85 //super.OnEndServer(action_data);

◆ CheckIfDoorIsLocked()

bool CheckIfDoorIsLocked ( )

Definition at line 1 of file ActionOpenDoors.c.

78 {
79 return false;
80 }

◆ CreateConditionComponents()

override void CheckIfDoorIsLocked::CreateConditionComponents ( )

Definition at line 87 of file ActionOpenDoors.c.

◆ OnEndServer()

override void CheckIfDoorIsLocked::OnEndServer ( ActionData action_data)
protected

Original action didn't add any noise to the NoiseSystem

Definition at line 137 of file ActionOpenDoors.c.

138{
140
141 void ActionOpenDoors()
142 {
143 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_OPENDOORFW;
144 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
145 m_Text = "#open";
146 }
147
148 override void CreateConditionComponents()
149 {
150 m_ConditionItem = new CCINone();
152 }
153
154 protected bool CheckIfDoorIsLocked()
155 {
156 return true;
157 }
158
159 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
160 {
161 if (!target)
162 return false;
163
164 if (!IsBuilding(target))
165 return false;
166
167 Building building;
168 if (Class.CastTo(building, target.GetObject()))
169 {
170 int doorIndex = building.GetDoorIndex(target.GetComponentIndex());
171 if (doorIndex != -1)
172 {
174 return false;
175
176 return building.CanDoorBeOpened(doorIndex, CheckIfDoorIsLocked());
177
178 }
179 }
180
181 return false;
182 }
183
185 {
186 Building building;
187 if (Class.CastTo(building, action_data.m_Target.GetObject()))
188 {
189 int doorIndex = building.GetDoorIndex(action_data.m_Target.GetComponentIndex());
190 if (doorIndex != -1)
191 {
192 if (building.CanDoorBeOpened(doorIndex, CheckIfDoorIsLocked()))
193 building.OpenDoor(doorIndex);
194 }
195 }
196 }
197
198 override void OnEndServer(ActionData action_data)
199 {
200 m_NoisePar = new NoiseParams();
201 m_NoisePar.LoadFromPath("CfgVehicles SurvivorBase NoiseActionDefault");
202 NoiseSystem noise = GetGame().GetNoiseSystem();
203 if (noise)
204 {
205 if (action_data.m_Player)
206 noise.AddNoisePos(action_data.m_Player, action_data.m_Target.GetObject().GetPosition(), m_NoisePar);
207 }
208 }
209}
210
212{
213 override bool CheckIfDoorIsLocked()
214 {
215 return false;
216 }
217
218 override void OnEndServer(ActionData action_data)
219 {
221 //super.OnEndServer(action_data);
222 }
223};
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
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override void OnStartServer(ActionData action_data)
override void OnEndServer(ActionData action_data)
ref NoiseParams m_NoisePar
override void CreateConditionComponents()
void ActionOpenDoors()
ActionOpenDoors ActionInteractBase CheckIfDoorIsLocked()
class NoiseSystem NoiseParams()
Definition Noise.c:15
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.

◆ OnStartServer()

override void CheckIfDoorIsLocked::OnStartServer ( ActionData action_data)
protected

Definition at line 123 of file ActionOpenDoors.c.

124{
126
127 void ActionOpenDoors()
128 {
129 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_OPENDOORFW;
130 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
131 m_Text = "#open";
132 }
133
134 override void CreateConditionComponents()
135 {
136 m_ConditionItem = new CCINone();
138 }
139
140 protected bool CheckIfDoorIsLocked()
141 {
142 return true;
143 }
144
145 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
146 {
147 if (!target)
148 return false;
149
150 if (!IsBuilding(target))
151 return false;
152
153 Building building;
154 if (Class.CastTo(building, target.GetObject()))
155 {
156 int doorIndex = building.GetDoorIndex(target.GetComponentIndex());
157 if (doorIndex != -1)
158 {
160 return false;
161
162 return building.CanDoorBeOpened(doorIndex, CheckIfDoorIsLocked());
163
164 }
165 }
166
167 return false;
168 }
169
171 {
172 Building building;
173 if (Class.CastTo(building, action_data.m_Target.GetObject()))
174 {
175 int doorIndex = building.GetDoorIndex(action_data.m_Target.GetComponentIndex());
176 if (doorIndex != -1)
177 {
178 if (building.CanDoorBeOpened(doorIndex, CheckIfDoorIsLocked()))
179 building.OpenDoor(doorIndex);
180 }
181 }
182 }
183
184 override void OnEndServer(ActionData action_data)
185 {
186 m_NoisePar = new NoiseParams();
187 m_NoisePar.LoadFromPath("CfgVehicles SurvivorBase NoiseActionDefault");
188 NoiseSystem noise = GetGame().GetNoiseSystem();
189 if (noise)
190 {
191 if (action_data.m_Player)
192 noise.AddNoisePos(action_data.m_Player, action_data.m_Target.GetObject().GetPosition(), m_NoisePar);
193 }
194 }
195}
196
198{
199 override bool CheckIfDoorIsLocked()
200 {
201 return false;
202 }
203
204 override void OnEndServer(ActionData action_data)
205 {
207 //super.OnEndServer(action_data);
208 }
209};

Variable Documentation

◆ m_NoisePar

ref NoiseParams m_NoisePar