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

◆ OnStoreSave()

void Entity::OnStoreSave ( ParamsWriteContext ctx)
inlineprotected

Engine calls this function to collect data from entity to store for persistence (on server side).

{
// dont forget to propagate this call trough class hierarchy!
super.OnStoreSave(ctx);
// write any data (using params) you want to store
int a = 5;
float b = 6.0;
ctx.Write(a);
ctx.Write(b);
}
void OnStoreSave(ParamsWriteContext ctx)
Engine calls this function to collect data from entity to store for persistence (on server side).
proto bool Write(void value_out)
Serializer ParamsWriteContext
Определения gameplay.c:16

См. определение в файле 3_Game/DayZ/Entities/EntityAI.c строка 2910

2911 {
2912 ConstructionBasic constructionComponent = GetConstructionBasic();
2913 if (constructionComponent)
2914 constructionComponent.HandleStoreSave(ctx);
2915
2916 // Saving of energy related states
2917 if ( m_EM )
2918 {
2919 // Save energy amount
2920 ctx.Write( m_EM.GetEnergy() );
2921
2922 // Save passive/active state
2923 ctx.Write( m_EM.IsPassive() );
2924
2925 // Save ON/OFF state
2926 ctx.Write( m_EM.IsSwitchedOn() );
2927
2928 // Save plugged/unplugged state
2929 ctx.Write( m_EM.IsPlugged() );
2930
2931 // ENERGY SOURCE
2932 // Save energy source IDs
2933 EntityAI energy_source = m_EM.GetEnergySource();
2934 int b1 = 0;
2935 int b2 = 0;
2936 int b3 = 0;
2937 int b4 = 0;
2938
2939 if (energy_source)
2940 {
2941 energy_source.GetPersistentID(b1, b2, b3, b4);
2942 }
2943
2944 ctx.Write( b1 ); // Save energy source block 1
2945 ctx.Write( b2 ); // Save energy source block 2
2946 ctx.Write( b3 ); // Save energy source block 3
2947 ctx.Write( b4 ); // Save energy source block 4
2948 }
2949
2950 // variable management system
2951 SaveVariables(ctx);
2952 }
void HandleStoreSave(ParamsWriteContext ctx)
void EntityAI()
cache blood infection chance (cfgVehicles-><entity>->Skinning->BloodInfectionSettings)
ComponentEnergyManager m_EM
void SaveVariables(ParamsWriteContext ctx)
ConstructionBasic GetConstructionBasic()
Construction itself is defined on module 4. Workaround. Don't forget to cast!

Перекрестные ссылки EntityAI(), GetConstructionBasic(), ConstructionBasic::HandleStoreSave(), m_EM, SaveVariables() и Serializer::Write().