Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
actionlockeddoors.c
Go to the documentation of this file.
2{
4 {
5 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_OPENDOORFW;
6 //m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
7 m_Text = "#open";
8 }
9
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};
ActionBase ActionData
Definition actionbase.c:30
class ActionTargets ActionTarget
string m_Text
Definition actionbase.c:64
bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
bool IsBuilding(ActionTarget target)
ref CCIBase m_ConditionItem
Definition actionbase.c:70
ref CCTBase m_ConditionTarget
Definition actionbase.c:71
override void CreateConditionComponents()
override void OnExecute(ActionData action_data)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
proto native int GetDoorIndex(int componentIndex)
Gets the index of the door based on the view geometry component index.
proto native bool IsDoorLocked(int index)
When the door is locked.
proto native void OpenDoor(int index)
Attempts to open the door.
Super root of all classes in Enforce script.
Definition enscript.c:11
const float DEFAULT
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.