Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionopenfence.c
Go to the documentation of this file.
2 {
3  ref NoiseParams m_NoisePar;
4  const string SELECTION_INTERACT = "gate_interact";
5 
6  void ActionOpenFence()
7  {
8  m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_OPENDOORFW;
9  m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
10  m_Text = "#open";
11  }
12 
13  override void CreateConditionComponents()
14  {
17  }
18 
19  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
20  {
21  Object targetObject = target.GetObject();
22  if ( targetObject && targetObject.CanUseConstruction() )
23  {
24  Fence fence = Fence.Cast( targetObject );
25 
26  if ( fence && fence.CanOpenFence() )
27  {
28  array<string> selections = new array<string>;
29  targetObject.GetActionComponentNameList(target.GetComponentIndex(), selections);
30 
31  for ( int i = 0; i < selections.Count(); i++ )
32  {
33  if ( selections[i] == SELECTION_INTERACT )
34  return true;
35  }
36  }
37  }
38 
39  return false;
40  }
41 
42  override void OnStartServer( ActionData action_data )
43  {
44  Fence fence = Fence.Cast( action_data.m_Target.GetObject() );
45  fence.OpenFence();
46  }
47 
48  override void OnEndServer( ActionData action_data )
49  {
50  m_NoisePar = new NoiseParams();
51  m_NoisePar.LoadFromPath("CfgVehicles SurvivorBase NoiseActionDefault");
52  NoiseSystem noise = GetGame().GetNoiseSystem();
53  if ( noise )
54  {
55  if ( action_data.m_Player )
56  noise.AddNoisePos(action_data.m_Player, action_data.m_Target.GetObject().GetPosition(), m_NoisePar);
57  }
58  }
59 }
ItemBase
Definition: inventoryitem.c:730
GetGame
proto native CGame GetGame()
CCINone
Definition: ccinone.c:1
ActionInteractBase
Definition: actioninteractbase.c:54
PlayerBase
Definition: playerbaseclient.c:1
NoiseParams
class ObjectSpawnerHandler NoiseParams
ActionOpenFence
Definition: actionopenfence.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
Object
Definition: objecttyped.c:1
m_NoisePar
ref NoiseParams m_NoisePar
Definition: actionopendoors.c:2
CCTCursor
Definition: cctcursor.c:1
array< string >
NoiseSystem
Definition: noise.c:1
m_Text
protected string m_Text
Definition: actionbase.c:49
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
m_StanceMask
protected int m_StanceMask
Definition: actionbase.c:53