DayZ 1.29
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
Land_WarheadStorage_Bunker_Facility.c
См. документацию.
2{
3 protected const float DOOR_AUTOCLOSE_TIME = 12; //how long before the door auto-close after being opened
4
6
7 override void DeferredInit()
8 {
9 g_Game.RegisterNetworkStaticObject(this);
10
11 if (g_Game.IsServer())
12 {
13 for (int i = 0; i < GetDoorCount(); ++i)
15
17 }
18 }
19
20 override bool CanDoorBeOpened(int doorIndex, bool checkIfLocked = false)
21 {
22 if (!super.CanDoorBeOpened(doorIndex, checkIfLocked))
23 return false;
24
25 switch (doorIndex)
26 {
27 case 7:
28 return IsDoorClosed(8);
29 case 8:
30 return IsDoorClosed(7);
31 }
32
33 return true;
34 }
35
36 override bool CanDoorBeClosed(int doorIndex)
37 {
38 if (IsPressureDoor(doorIndex))
39 return IsDoorOpen(doorIndex) && !IsDoorOpening(doorIndex);
40
41 return super.CanDoorBeClosed(doorIndex);
42 }
43
44 override void OnDoorOpenStart(DoorStartParams params)
45 {
48
49 if (IsPressureDoor(params.param1))
50 {
51 Timer doorTimer = new Timer();
52 doorTimer.Run(DOOR_AUTOCLOSE_TIME, this, "AutoCloseDoor", new Param1<int>(params.param1));
53 m_AutoCloseTimers.Set(params.param1, doorTimer);
54 }
55 }
56
57 override void OnDoorCloseStart(DoorStartParams params)
58 {
59 RemoveDoorTimer(params.param1);
60 }
61
63 {
64 super.OnSpawnByObjectSpawner(item);
65
66 if (item.customString == string.Empty)
67 return;
68
70 if (jsonData && jsonData.Triggers)
71 {
72 foreach (int index, auto triggerData : jsonData.Triggers)
73 {
74 if (triggerData.CustomSpawn)
75 {
76 //JSON: "customString": "undergroundTriggerTag=TAG_NAME"
77 TStringArray customStringData = new TStringArray();
78 item.customString.Split(";", customStringData);
79
80 foreach (string entry : customStringData)
81 {
82 TStringArray optionValuePair = new TStringArray();
83 entry.Split("=", optionValuePair);
84 if (optionValuePair[0] == "undergroundTriggerTag")
85 {
86 if (optionValuePair[1] == triggerData.Tag)
87 JsonUndergroundTriggers.SpawnTriggerCarrier(this, index, triggerData);
88 }
89 }
90 }
91 }
92 }
93 }
94
95 private void AutoCloseDoor(int doorIndex)
96 {
97 CloseDoor(doorIndex);
98 RemoveDoorTimer(doorIndex);
99 }
100
101 private void RemoveDoorTimer(int doorIndex)
102 {
104 m_AutoCloseTimers.Remove(doorIndex);
105 }
106
107 private bool IsPressureDoor(int doorIndex)
108 {
109 switch (doorIndex)
110 {
111 case 7:
112 case 8:
113 return true;
114 }
115
116 return false;
117 }
118
119}
Param1< int > DoorStartParams
Определения 3_Game/DayZ/Entities/Building.c:1
map
Определения ControlsXboxNew.c:4
DayZGame g_Game
Определения DayZGame.c:3942
proto native int GetDoorCount()
Returns the number of the doors in the building.
proto native void CloseDoor(int index)
Attempts to close the door.
proto native bool IsDoorClosed(int index)
When the phase is at the close phase target (0.0)
proto native bool IsDoorOpen(int index)
When the door is requested to be fully open (animation wanted phase is greater than 0....
proto native bool IsDoorOpening(int index)
When the wanted phase is at the open phase target (1.0)
string customString
Определения ObjectSpawner.c:107
static void SpawnParentedTriggers(EntityAI parent)
Определения UndergroundAreaLoader.c:5
ref array< ref JsonUndergroundAreaTriggerData > Triggers
Определения UndergroundAreaLoader.c:3
static void SpawnTriggerCarrier(EntityAI parent, int index, JsonUndergroundAreaTriggerData data)
Определения UndergroundAreaLoader.c:24
override void OnSpawnByObjectSpawner(ITEM_SpawnerObject item)
override bool CanDoorBeClosed(int doorIndex)
override void OnDoorOpenStart(DoorStartParams params)
override bool CanDoorBeOpened(int doorIndex, bool checkIfLocked=false)
ref map< int, ref Timer > m_AutoCloseTimers
override void OnDoorCloseStart(DoorStartParams params)
Определения DayZPlayerImplement.c:39
static JsonUndergroundTriggers GetData()
Определения UndergroundAreaLoader.c:108
Определения CachedEquipmentStorage.c:4
array< string > TStringArray
Определения EnScript.c:712
void Split(string sample, out array< string > output)
Splits string into array of strings separated by 'sample'.
Определения EnString.c:396
static const string Empty
Определения EnString.c:7