DayZ 1.29
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ActionCloseDoors.c
См. документацию.
2{
4
6 {
7 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_OPENDOORFW;
8 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
9 m_Text = "#close";
10 }
11
13 {
16 }
17
18 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
19 {
20 if (!target)
21 return false;
22
23 if (!IsBuilding(target))
24 return false;
25
26 Building building;
27 if (Class.CastTo(building, target.GetObject()))
28 {
29 int doorIndex = building.GetDoorIndex(target.GetComponentIndex());
30 if (doorIndex != -1)
31 {
32 if (!IsInReach(player, target, UAMaxDistances.DEFAULT))
33 return false;
34
35 return building.CanDoorBeClosed(doorIndex);
36 }
37 }
38
39 return false;
40 }
41
42 override void OnStartServer(ActionData action_data)
43 {
44 super.OnStartServer(action_data);
45
46 Building building;
47 if (Class.CastTo(building, action_data.m_Target.GetObject()))
48 {
49 int doorIndex = building.GetDoorIndex(action_data.m_Target.GetComponentIndex());
50 if (doorIndex != -1)
51 {
52 if (building.CanDoorBeClosed(doorIndex))
53 {
54 building.CloseDoor(doorIndex);
55 }
56 }
57 }
58 }
59
60 override void OnEndServer(ActionData action_data)
61 {
62 super.OnEndServer(action_data);
63
64 m_NoisePar = new NoiseParams();
65 m_NoisePar.LoadFromPath("CfgVehicles SurvivorBase NoiseActionDefault");
66 NoiseSystem noise = g_Game.GetNoiseSystem();
67 if (noise)
68 {
69 if (action_data.m_Player)
70 noise.AddNoisePos(action_data.m_Player, action_data.m_Target.GetObject().GetPosition(), m_NoisePar, NoiseAIEvaluate.GetNoiseReduction(g_Game.GetWeather()));
71 }
72 }
73
74 override bool IsLockTargetOnUse()
75 {
76 return false;
77 }
78}
ActionBase ActionData
Определения ActionBase.c:30
class ActionTargets ActionTarget
DayZGame g_Game
Определения DayZGame.c:3942
class NoiseSystem NoiseParams()
Определения Noise.c:15
int m_StanceMask
Определения ActionBase.c:68
bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
Определения ActionBase.c:1181
string m_Text
Определения ActionBase.c:64
ref CCIBase m_ConditionItem
Определения ActionBase.c:70
bool IsBuilding(ActionTarget target)
Определения ActionBase.c:1171
ref CCTBase m_ConditionTarget
Определения ActionBase.c:71
void ActionCloseDoors()
Определения ActionCloseDoors.c:5
override bool IsLockTargetOnUse()
Определения ActionCloseDoors.c:74
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Определения ActionCloseDoors.c:18
override void OnEndServer(ActionData action_data)
Определения ActionCloseDoors.c:60
ref NoiseParams m_NoisePar
Определения ActionCloseDoors.c:3
override void CreateConditionComponents()
Определения ActionCloseDoors.c:12
override void OnStartServer(ActionData action_data)
Определения ActionCloseDoors.c:42
void ActionInteractBase()
Определения ActionInteractBase.c:43
int m_CommandUID
Определения AnimatedActionBase.c:143
proto native void CloseDoor(int index)
Attempts to close the door.
proto native int GetDoorIndex(int componentIndex)
Gets the index of the door based on the view geometry component index.
bool CanDoorBeClosed(int doorIndex)
Определения CCINone.c:2
Определения CCTCursor.c:2
Super root of all classes in Enforce script.
Определения EnScript.c:11
static float GetNoiseReduction(Weather weather)
Определения SensesAIEvaluate.c:18
proto void AddNoisePos(EntityAI source_entity, vector pos, NoiseParams noise_params, float external_strenght_multiplier=1.0)
Определения Noise.c:2
Определения PlayerBaseClient.c:2
const float DEFAULT
Определения ActionConstants.c:112
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.