Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionlockeddoors.c
Go to the documentation of this file.
2 {
3  void ActionLockedDoors()
4  {
5  m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_OPENDOORFW;
6  //m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
7  m_Text = "#open";
8  }
9 
10  override void CreateConditionComponents()
11  {
14  }
15 
16  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
17  {
18  if( !target ) return false;
19  //if( IsDamageDestroyed(action_data.m_Target) ) return false;
20  if( !IsBuilding(target) ) return false;
21  if( !IsInReach(player, target, UAMaxDistances.DEFAULT) ) return false;
22 
23  Building building;
24  if( Class.CastTo(building, target.GetObject()) )
25  {
26  int doorIndex = building.GetDoorIndex(target.GetComponentIndex());
27  if ( doorIndex != -1 )
28  {
29  return building.IsDoorLocked(doorIndex);
30  }
31  }
32  return false;
33  }
34 
35  override void OnExecute( ActionData action_data )
36  {
37  Building building;
38  if ( Class.CastTo(building, action_data.m_Target.GetObject()) )
39  {
40  int doorIndex = building.GetDoorIndex(action_data.m_Target.GetComponentIndex());
41  if ( doorIndex != -1 )
42  {
43  building.OpenDoor(doorIndex);
44  }
45  }
46  }
47 };
ItemBase
Definition: inventoryitem.c:730
ActionLockedDoors
Definition: actionlockeddoors.c:1
CCINone
Definition: ccinone.c:1
UAMaxDistances
Definition: actionconstants.c:104
ActionInteractBase
Definition: actioninteractbase.c:54
PlayerBase
Definition: playerbaseclient.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
CCTCursor
Definition: cctcursor.c:1
IsInReach
protected bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
Definition: actionbase.c:928
m_Text
protected string m_Text
Definition: actionbase.c:49
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
IsBuilding
protected bool IsBuilding(ActionTarget target)
Definition: actionbase.c:918
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10