DayZ 1.29
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ SwitchOn()

void ComponentEnergyManager::SwitchOn ( )
inlineprotected

Energy manager: Switches ON the device so it starts doing its work if it has enough energy.

См. определение в файле ComponentEnergyManager.c строка 384

385 {
387
388 if (g_Game.IsServer() || !g_Game.IsMultiplayer())
389 {
391 {
392 m_IsSwichedOn = true;
393 Synch();
394
395 DeviceUpdate(); // 'Wake up' this device now
396 StartUpdates();
397
398 // 'Wakes up' all connected devices
400
402
403 // Call event
404 g_Game.GameScript.CallFunction(m_ThisEntityAI, "OnSwitchOn", NULL, 0);
405 }
406 }
407
408 if ( !g_Game.IsServer() && g_Game.IsMultiplayer()/* && CanSwitchOn() */) // I want the CanSwitchOn() check, but when it's here, the OnSwitchOn() event is never called on client-side due to engine's synchronization system changing the m_IsSwichedOn to true without any specific event beign called. (Yes there is OnVariablesSynchronized() but that is called also when m_CanWork is synchronized, so I need to write a method of knowing when was this specific value changed.)
409 {
410 g_Game.GameScript.CallFunction(m_ThisEntityAI, "OnSwitchOn", NULL, 0);
411 }
412 }
DayZGame g_Game
Определения DayZGame.c:3942
EntityAI m_ThisEntityAI
Определения Component.c:24
void WakeUpWholeBranch(EntityAI original_caller)
Определения ComponentEnergyManager.c:1587
bool CanSwitchOn()
Energy manager: Checks if the device can be switched ON.
Определения ComponentEnergyManager.c:765
bool m_IsSwichedOnPreviousState
Определения ComponentEnergyManager.c:25

Перекрестные ссылки CanSwitchOn(), DeviceUpdate(), g_Game, m_IsSwichedOn, m_IsSwichedOnPreviousState, Component::m_ThisEntityAI, StartUpdates(), Synch(), UpdateCanWork() и WakeUpWholeBranch().

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