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

◆ EEOnAfterLoad()

void Entity::EEOnAfterLoad ( )
inlineprotected

Called when entity is part of "connected system" and being restored after load.

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

1334 {
1335 // ENERGY MANAGER
1336 // Restore connections between devices which were connected before server restart
1337 if ( m_EM && m_EM.GetRestorePlugState() )
1338 {
1339 int b1 = m_EM.GetEnergySourceStorageIDb1();
1340 int b2 = m_EM.GetEnergySourceStorageIDb2();
1341 int b3 = m_EM.GetEnergySourceStorageIDb3();
1342 int b4 = m_EM.GetEnergySourceStorageIDb4();
1343
1344 // get pointer to EntityAI based on this ID
1345 EntityAI potential_energy_source = GetGame().GetEntityByPersitentID(b1, b2, b3, b4); // This function is available only in this event!
1346
1347 // IMPORTANT!
1348 // Object IDs acquired here become INVALID when electric devices are transfered to another server while in plugged state (like Flashlight plugged into its attachment 9V battery)
1349 // To avoid issues, these items must be excluded from this system of restoring plug state so they don't unintentionally plug to incorrect devices through these invalid IDs.
1350 // Therefore their plug state is being restored withing the EEItemAttached() event while being excluded by the following 'if' conditions...
1351
1352 bool is_attachment = false;
1353
1354 if (potential_energy_source)
1355 is_attachment = GetInventory().HasAttachment(potential_energy_source);
1356
1357 if ( !is_attachment && potential_energy_source )
1358 is_attachment = potential_energy_source.GetInventory().HasAttachment(this);
1359
1360 if ( potential_energy_source && potential_energy_source.GetCompEM() /*&& potential_energy_source.HasEnergyManager()*/ && !is_attachment )
1361 m_EM.PlugThisInto(potential_energy_source); // restore connection
1362 }
1363 }
proto native EntityAI GetEntityByPersitentID(int b1, int b2, int b3, int b4)
proto native GameInventory GetInventory()
void EntityAI()
cache blood infection chance (cfgVehicles-><entity>->Skinning->BloodInfectionSettings)
Определения EntityAI.c:202
ComponentEnergyManager m_EM
Определения EntityAI.c:306
proto native bool HasAttachment(notnull EntityAI e)
brief Returns True if entity is attached to this
proto native CGame GetGame()

Перекрестные ссылки EntityAI(), CGame::GetEntityByPersitentID(), GetGame(), GetInventory() и m_EM.