Dayz Explorer 1.28.160049
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 }
8
9 override void CreateConditionComponents()
10 {
13 }
14
15 override string GetText()
16 {
17 return "#open";
18 }
19
20 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
21 {
22 if( !target ) return false;
23 //if( IsDamageDestroyed(action_data.m_Target) ) return false;
24 if( !IsBuilding(target) ) return false;
25 if( !IsInReach(player, target, UAMaxDistances.DEFAULT) ) return false;
26
27 Building building;
28 if( Class.CastTo(building, target.GetObject()) )
29 {
30 int doorIndex = building.GetDoorIndex(target.GetComponentIndex());
31 if ( doorIndex != -1 )
32 {
33 return building.IsDoorLocked(doorIndex);
34 }
35 }
36 return false;
37 }
38
39 override void OnExecute( ActionData action_data )
40 {
41 Building building;
42 if ( Class.CastTo(building, action_data.m_Target.GetObject()) )
43 {
44 int doorIndex = building.GetDoorIndex(action_data.m_Target.GetComponentIndex());
45 if ( doorIndex != -1 )
46 {
47 building.OpenDoor(doorIndex);
48 }
49 }
50 }
51};
bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
ref CCIBase m_ConditionItem
Definition actionbase.c:64
bool IsBuilding(ActionTarget target)
ref CCTBase m_ConditionTarget
Definition actionbase.c:65
Super root of all classes in Enforce script.
Definition enscript.c:11
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602