DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Класс Land_WarheadStorage_PowerStation
+ Граф наследования:Land_WarheadStorage_PowerStation:

Защищенные члены

void Land_WarheadStorage_PowerStation ()
 
override void DeferredInit ()
 
override void OnVariablesSynchronized ()
 
vector GetPowerGeneratorSpawnPos ()
 
void LinkPowerGeneratorServer ()
 
PowerGeneratorStatic GetPowerGenerator ()
 
void AnimateLever (int index, int state=-1)
 
void PlayLeverSound (string leverName, int state)
 
void StartTimer ()
 
void CheckStopTimer ()
 
void Tick ()
 
void OnLeverToggled ()
 
void TurnAllLeversOff ()
 
string GetLeverComponentNameByLeverIndex (int leverIndex)
 
int GetLeverIndexByComponentName (string name)
 
void UpdateLeverStatesServer ()
 
void OnGeneratorStart ()
 
void OnGeneratorStop ()
 
override void OnAnimationPhaseStarted (string animSource, float phase)
 
Land_WarheadStorage_Main GetClosestBunker ()
 
void DebugPrepareGenerator ()
 

Защищенные статические члены

static void RegisterBunker (Land_WarheadStorage_Main bunker)
 
static void UnregisterBunker (Land_WarheadStorage_Main bunker)
 

Защищенные данные

bool m_InitBunkerState
 
ref Timer m_UpdateTimer
 
int m_LeverStatesBits
 
int m_LastActivatedLeverId
 
PowerGeneratorStatic m_PowerGenerator
 
bool m_IsPowerGeneratorRunning
 
int m_PlaySparks
 
const string LEVERS_POS_MEMPOINT = "leverup_axis"
 
const string GENERATOR_POS_MEMPOINT = "generator_pos"
 
const string SWITCH_UP_SOUND = "Power_Station_Switch_Up_SoundSet"
 
const string SWITCH_DOWN_SOUND = "Power_Station_Switch_Down_SoundSet"
 
const string SPARKLES_SOUND = "Power_Station_generator_overpowered_SoundSet"
 

Статические защищенные данные

static ref set< Land_WarheadStorage_Mainm_Bunkers
 

Подробное описание

Конструктор(ы)

◆ Land_WarheadStorage_PowerStation()

20 {
21 m_PlaySparks = 0;
22
23 RegisterNetSyncVariableInt("m_PlaySparks", 0, 4);
24 }
int m_PlaySparks
Definition Land_WarheadStorage_PowerStation.c:10

Перекрестные ссылки m_PlaySparks.

Методы

◆ AnimateLever()

void AnimateLever ( int index,
int state = -1 )
inlineprotected
86 {
88
89 if (!GetGame().IsServer())
90 return;
91
92 StartTimer();
93
94 float animPhase = state;
95
96 if (state == -1)
97 {
98 if (GetAnimationPhase(leverName) > 0)
99 animPhase = 0;
100 else
101 animPhase = 1;
102 }
103
104 SetAnimationPhase(leverName, animPhase);
105 }
void StartTimer()
Definition Land_WarheadStorage_PowerStation.c:119
string GetLeverComponentNameByLeverIndex(int leverIndex)
Definition Land_WarheadStorage_PowerStation.c:210
Definition EntityAI.c:95
proto native CGame GetGame()

Перекрестные ссылки GetGame(), GetLeverComponentNameByLeverIndex() и StartTimer().

Используется в TurnAllLeversOff().

◆ CheckStopTimer()

void CheckStopTimer ( )
inlineprotected
127 {
128 if (m_UpdateTimer.GetRunTime() > 10)
129 {
131 }
132 }
ref Timer m_UpdateTimer
Definition Land_WarheadStorage_PowerStation.c:5

Перекрестные ссылки m_UpdateTimer.

Используется в Tick().

◆ DebugPrepareGenerator()

void DebugPrepareGenerator ( )
inlineprotected
355 {
356 if (GetGame().IsServer())
357 {
358 m_PowerGenerator.GetCompEM().SetEnergy(10000);
359 m_PowerGenerator.GetInventory().CreateInInventory("GlowPlug");
360 }
361 }
PowerGeneratorStatic m_PowerGenerator
Definition Land_WarheadStorage_PowerStation.c:8

Перекрестные ссылки GetGame() и m_PowerGenerator.

◆ DeferredInit()

override void DeferredInit ( )
inlineprotected
27 {
28 if (GetGame().IsServer())
30
31 GetGame().RegisterNetworkStaticObject(this);
32 }
void LinkPowerGeneratorServer()
Definition Land_WarheadStorage_PowerStation.c:57

Перекрестные ссылки GetGame() и LinkPowerGeneratorServer().

◆ GetClosestBunker()

Land_WarheadStorage_Main GetClosestBunker ( )
inlineprotected
300 {
301 float smallestDist = float.MAX;
304
305 if (!m_Bunkers)
306 return null;
307
309 {
310 float dist = vector.DistanceSq(bunker.GetPosition(),thisPos);
311 if (dist < smallestDist)
312 {
315 }
316 }
317
319 {
320 m_InitBunkerState = true;
321
322 if (GetGame().IsServer() && m_PowerGenerator && m_PowerGenerator.GetCompEM().IsWorking())
323 closestBunker.SetPowerServer(true);
324 }
325
326 return closestBunker;
327 }
class JsonUndergroundAreaTriggerData GetPosition
Definition UndergroundAreaLoader.c:9
Definition Land_WarheadStorage_Main.c:2
bool m_InitBunkerState
Definition Land_WarheadStorage_PowerStation.c:3
static ref set< Land_WarheadStorage_Main > m_Bunkers
Definition Land_WarheadStorage_PowerStation.c:4
Definition EnConvert.c:106
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.

Перекрестные ссылки vector::DistanceSq(), GetGame(), GetPosition, m_Bunkers, m_InitBunkerState и m_PowerGenerator.

Используется в OnGeneratorStart(), OnGeneratorStop() и UpdateLeverStatesServer().

◆ GetLeverComponentNameByLeverIndex()

string GetLeverComponentNameByLeverIndex ( int leverIndex)
inlineprotected
211 {
212 switch (leverIndex)
213 {
214 case 1:
215 return "lever1";
216 case 2:
217 return "lever2";
218 case 3:
219 return "lever3";
220 case 4:
221 return "lever4";
222 }
223 return "lever1";
224 }

Используется в AnimateLever(), Tick() и TurnAllLeversOff().

◆ GetLeverIndexByComponentName()

int GetLeverIndexByComponentName ( string name)
inlineprotected
227 {
228 name.ToLower();
229 switch (name)
230 {
231 case "storagedoor1":
232 return 1;
233 case "storagedoor2":
234 return 2;
235 case "storagedoor3":
236 return 3;
237 case "storagedoor4":
238 return 4;
239 }
240 return 0;
241 }
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo

Перекрестные ссылки name.

◆ GetPowerGenerator()

PowerGeneratorStatic GetPowerGenerator ( )
inlineprotected
79 {
80 return m_PowerGenerator;
81 }

Перекрестные ссылки m_PowerGenerator.

◆ GetPowerGeneratorSpawnPos()

vector GetPowerGeneratorSpawnPos ( )
inlineprotected
52 {
54 return ModelToWorld(generatorPosLocal);
55 }
const string GENERATOR_POS_MEMPOINT
Definition Land_WarheadStorage_PowerStation.c:13

Перекрестные ссылки GENERATOR_POS_MEMPOINT.

Используется в LinkPowerGeneratorServer().

◆ LinkPowerGeneratorServer()

void LinkPowerGeneratorServer ( )
inlineprotected
58 {
60
62 {
64
66 m_PowerGenerator = PowerGeneratorStatic.Cast(GetGame().CreateObjectEx("PowerGeneratorStatic", GetPowerGeneratorSpawnPos(), flags, RF_IGNORE));
67 m_PowerGenerator.SetOrientation(thisOrientation + "180 0 0");
68 }
69
71
72 //DebugPrepareGenerator();
73
74 if (m_PowerGenerator.GetCompEM().IsWorking())
75 OnGeneratorStart();//the generator can be already running when we link to it as it has a persistent running state
76 }
vector GetOrientation()
Definition AreaDamageManager.c:306
const int ECE_SETUP
Definition CentralEconomy.c:9
const int ECE_UPDATEPATHGRAPH
Definition CentralEconomy.c:13
const int RF_IGNORE
Definition CentralEconomy.c:56
const int ECE_NOLIFETIME
Definition CentralEconomy.c:29
const int ECE_CREATEPHYSICS
Definition CentralEconomy.c:16
void OnGeneratorStart()
Definition Land_WarheadStorage_PowerStation.c:252
vector GetPowerGeneratorSpawnPos()
Definition Land_WarheadStorage_PowerStation.c:51
Definition PowerGeneratorStatic.c:2
static PowerGeneratorStatic GetClosestGenerator(vector position, float tolerance)
Definition PowerGeneratorStatic.c:37
void SetParent(Land_WarheadStorage_PowerStation parent)
Definition PowerGeneratorStatic.c:54

Перекрестные ссылки ECE_CREATEPHYSICS, ECE_NOLIFETIME, ECE_SETUP, ECE_UPDATEPATHGRAPH, PowerGeneratorStatic::GetClosestGenerator(), GetGame(), GetOrientation(), GetPowerGeneratorSpawnPos(), m_PowerGenerator, OnGeneratorStart(), RF_IGNORE и PowerGeneratorStatic::SetParent().

Используется в DeferredInit().

◆ OnAnimationPhaseStarted()

override void OnAnimationPhaseStarted ( string animSource,
float phase )
inlineprotected
283 {
284 #ifndef SERVER
285 if (animSource.Contains("lever"))
286 {
287 if (phase > 0)
289 else
291 }
292 #endif
293 }
void PlayLeverSound(string leverName, int state)
Definition Land_WarheadStorage_PowerStation.c:107

Перекрестные ссылки PlayLeverSound().

◆ OnGeneratorStart()

void OnGeneratorStart ( )
inlineprotected
253 {
254 if (GetGame().IsServer())
255 {
257
259 if (closestBunker)
260 closestBunker.SetPowerServer(true);
261
262 m_PlaySparks = 0;
263 SetSynchDirty();
264 }
265 }
Land_WarheadStorage_Main GetClosestBunker()
Definition Land_WarheadStorage_PowerStation.c:299
bool m_IsPowerGeneratorRunning
Definition Land_WarheadStorage_PowerStation.c:9

Перекрестные ссылки GetClosestBunker(), GetGame(), m_IsPowerGeneratorRunning и m_PlaySparks.

Используется в LinkPowerGeneratorServer() и PowerGeneratorStatic::OnWorkStart().

◆ OnGeneratorStop()

void OnGeneratorStop ( )
inlineprotected
268 {
269 if (GetGame().IsServer())
270 {
272
274
276
277 if (closestBunker)
278 closestBunker.SetPowerServer(false);
279 }
280 }
void TurnAllLeversOff()
Definition Land_WarheadStorage_PowerStation.c:196

Перекрестные ссылки GetClosestBunker(), GetGame(), m_IsPowerGeneratorRunning и TurnAllLeversOff().

Используется в PowerGeneratorStatic::OnWorkStop().

◆ OnLeverToggled()

void OnLeverToggled ( )
inlineprotected
173 {
176 {
177 //doors are being opened/closed only when we are opening/closing a single door, or when none of the doors are supposed to be open
178 //so here, we only force all levers to OFF, and that in turn will make the doors to be closed later on
179
180 if (leversActivatedCount > 1 && m_PlaySparks == 0)
181 {
183 SetSynchDirty();
184 }
185
187 {
188 m_PowerGenerator.GetCompEM().SwitchOff();
189 m_PowerGenerator.GetCompEM().InteractBranch(m_PowerGenerator);
190 }
191
193 }
194 }
int m_LeverStatesBits
Definition Land_WarheadStorage_PowerStation.c:6
int m_LastActivatedLeverId
Definition Land_WarheadStorage_PowerStation.c:7
Definition EnMath.c:7
static proto int GetNumberOfSetBits(int i)
returns the number of bits set in a bitmask i

Перекрестные ссылки Math::GetNumberOfSetBits(), m_IsPowerGeneratorRunning, m_LastActivatedLeverId, m_LeverStatesBits, m_PlaySparks, m_PowerGenerator и TurnAllLeversOff().

Используется в Tick().

◆ OnVariablesSynchronized()

override void OnVariablesSynchronized ( )
inlineprotected
35 {
36 super.OnVariablesSynchronized();
37
38 if (m_PlaySparks != 0)
39 {
41 string mempoint = "lever" + m_PlaySparks.ToString() + "_sparks_pos";
42 sound = SEffectManager.PlaySoundCachedParams(SPARKLES_SOUND, ModelToWorld(GetMemoryPointPos(mempoint)));
43 sound.SetAutodestroy(true);
44
45 ParticleManager.GetInstance().PlayInWorld(ParticleList.LEVER_SPARKS, ModelToWorld(GetMemoryPointPos(mempoint)));
46
47 m_PlaySparks = 0;
48 }
49 }
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Definition ParticleManager.c:84
Wrapper class for managing sound through SEffectManager.
Definition EffectSound.c:5
const string SPARKLES_SOUND
Definition Land_WarheadStorage_PowerStation.c:17
Definition ParticleList.c:12
static const int LEVER_SPARKS
Definition ParticleList.c:137
Manager class for managing Effect (EffectParticle, EffectSound)
Definition EffectManager.c:6
static EffectSound PlaySoundCachedParams(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound, using or creating cached SoundParams.
Definition EffectManager.c:207

Перекрестные ссылки ParticleList::LEVER_SPARKS, m_PlaySparks, ParticleManager(), SEffectManager::PlaySoundCachedParams() и SPARKLES_SOUND.

◆ PlayLeverSound()

void PlayLeverSound ( string leverName,
int state )
inlineprotected
108 {
110
111 if (state == 0)
112 PlaySoundSetAtMemoryPoint(sound, SWITCH_DOWN_SOUND, LEVERS_POS_MEMPOINT, false, 0, 0);
113 else if (state == 1)
114 PlaySoundSetAtMemoryPoint(sound, SWITCH_UP_SOUND, LEVERS_POS_MEMPOINT, false, 0, 0);
115
116 sound.SetAutodestroy(true);
117 }
const string LEVERS_POS_MEMPOINT
Definition Land_WarheadStorage_PowerStation.c:12
const string SWITCH_DOWN_SOUND
Definition Land_WarheadStorage_PowerStation.c:16
const string SWITCH_UP_SOUND
Definition Land_WarheadStorage_PowerStation.c:15

Перекрестные ссылки LEVERS_POS_MEMPOINT, SWITCH_DOWN_SOUND и SWITCH_UP_SOUND.

Используется в OnAnimationPhaseStarted().

◆ RegisterBunker()

static void RegisterBunker ( Land_WarheadStorage_Main bunker)
inlinestaticprotected
330 {
331 if (!m_Bunkers)
332 {
334 }
335 m_Bunkers.Insert(bunker);
336 }

Перекрестные ссылки m_Bunkers.

Используется в Land_WarheadStorage_Main::Land_WarheadStorage_Main().

◆ StartTimer()

void StartTimer ( )
inlineprotected
120 {
121 if (!m_UpdateTimer)
122 m_UpdateTimer = new Timer();
123 m_UpdateTimer.Run(0.1, this, "Tick", NULL, true);
124 }
Definition DayZPlayerImplement.c:63

Перекрестные ссылки m_UpdateTimer.

Используется в AnimateLever().

◆ Tick()

void Tick ( )
inlineprotected
135 {
136 bool updated = false;
137 for (int index = 1; index <= 4; index++)
138 {
139 float animPhase = GetAnimationPhase(GetLeverComponentNameByLeverIndex(index));
140 int bit = 1 << (index - 1);
141
142 if (animPhase == 0)
143 {
144 if ((bit & m_LeverStatesBits) != 0)
145 {
146 // in the bitmask, this lever is set as ON, but the anim phase is saying it should be OFF, turn the bit off
148 updated = true;
149 }
150 }
151 else if (animPhase == 1)
152 {
153 if ((bit & m_LeverStatesBits) == 0)
154 {
155 // in the bitmask, this lever is set as OFF, but the anim phase is saying it should be ON, turn the bit on
157 updated = true;
158
160 }
161 }
162 }
163 if (updated)
164 {
167 }
168
170 }
void CheckStopTimer()
Definition Land_WarheadStorage_PowerStation.c:126
void OnLeverToggled()
Definition Land_WarheadStorage_PowerStation.c:172
void UpdateLeverStatesServer()
Definition Land_WarheadStorage_PowerStation.c:243

Перекрестные ссылки CheckStopTimer(), GetLeverComponentNameByLeverIndex(), m_LastActivatedLeverId, m_LeverStatesBits, OnLeverToggled() и UpdateLeverStatesServer().

◆ TurnAllLeversOff()

void TurnAllLeversOff ( )
inlineprotected
197 {
198 string leverName;
199
200 for (int i = 1; i < 5; i++)
201 {
203 if (GetAnimationPhase(leverName) > 0)
204 AnimateLever(i, 0);
205 }
206 }
void AnimateLever(int index, int state=-1)
Definition Land_WarheadStorage_PowerStation.c:85

Перекрестные ссылки AnimateLever() и GetLeverComponentNameByLeverIndex().

Используется в OnGeneratorStop() и OnLeverToggled().

◆ UnregisterBunker()

static void UnregisterBunker ( Land_WarheadStorage_Main bunker)
inlinestaticprotected
339 {
340 if (m_Bunkers)
341 {
342 int index = m_Bunkers.Find(bunker);
343 if (index != -1)
344 {
345 m_Bunkers.Remove(index);
346 }
347 else
348 {
349 ErrorEx("Attempted to unregister non-registered bunker");
350 }
351 }
352 }
enum ShapeType ErrorEx

Перекрестные ссылки ErrorEx и m_Bunkers.

Используется в Land_WarheadStorage_Main::~Land_WarheadStorage_Main().

◆ UpdateLeverStatesServer()

void UpdateLeverStatesServer ( )
inlineprotected
244 {
246 if (!closestBunker)
247 return;
248
249 closestBunker.SetLeverStatesServer(m_LeverStatesBits);
250 }

Перекрестные ссылки GetClosestBunker() и m_LeverStatesBits.

Используется в Tick().

Поля

◆ GENERATOR_POS_MEMPOINT

const string GENERATOR_POS_MEMPOINT = "generator_pos"
protected

Используется в GetPowerGeneratorSpawnPos().

◆ LEVERS_POS_MEMPOINT

const string LEVERS_POS_MEMPOINT = "leverup_axis"
protected

Используется в PlayLeverSound().

◆ m_Bunkers

ref set<Land_WarheadStorage_Main> m_Bunkers
staticprotected

Используется в GetClosestBunker(), RegisterBunker() и UnregisterBunker().

◆ m_InitBunkerState

bool m_InitBunkerState
protected

Используется в GetClosestBunker().

◆ m_IsPowerGeneratorRunning

bool m_IsPowerGeneratorRunning
protected

Используется в OnGeneratorStart(), OnGeneratorStop() и OnLeverToggled().

◆ m_LastActivatedLeverId

int m_LastActivatedLeverId
protected

Используется в OnLeverToggled() и Tick().

◆ m_LeverStatesBits

int m_LeverStatesBits
protected

Используется в OnLeverToggled(), Tick() и UpdateLeverStatesServer().

◆ m_PlaySparks

◆ m_PowerGenerator

◆ m_UpdateTimer

ref Timer m_UpdateTimer
protected

Используется в CheckStopTimer() и StartTimer().

◆ SPARKLES_SOUND

const string SPARKLES_SOUND = "Power_Station_generator_overpowered_SoundSet"
protected

Используется в OnVariablesSynchronized().

◆ SWITCH_DOWN_SOUND

const string SWITCH_DOWN_SOUND = "Power_Station_Switch_Down_SoundSet"
protected

Используется в PlayLeverSound().

◆ SWITCH_UP_SOUND

const string SWITCH_UP_SOUND = "Power_Station_Switch_Up_SoundSet"
protected

Используется в PlayLeverSound().


Объявления и описания членов класса находятся в файле: