DayZ 1.27
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 строка 375

376 {
378
379 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
380 {
381 if ( CanSwitchOn() )
382 {
383 m_IsSwichedOn = true;
384 Synch();
385
386 DeviceUpdate(); // 'Wake up' this device now
387 StartUpdates();
388
389 // 'Wakes up' all connected devices
391
393
394 // Call event
395 GetGame().GameScript.CallFunction(m_ThisEntityAI, "OnSwitchOn", NULL, 0);
396 }
397 }
398
399 if ( !GetGame().IsServer() && GetGame().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.)
400 {
401 GetGame().GameScript.CallFunction(m_ThisEntityAI, "OnSwitchOn", NULL, 0);
402 }
403 }
ScriptModule GameScript
Определения Game.c:12
EntityAI m_ThisEntityAI
Определения Component.c:24
void WakeUpWholeBranch(EntityAI original_caller)
Определения ComponentEnergyManager.c:1527
bool CanSwitchOn()
Energy manager: Checks if the device can be switched ON.
Определения ComponentEnergyManager.c:741
bool m_IsSwichedOnPreviousState
Определения ComponentEnergyManager.c:25
proto native CGame GetGame()
proto volatile int CallFunction(Class inst, string function, out void returnVal, void parm)

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

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