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

◆ OnStoreLoad()

bool Entity::OnStoreLoad ( ParamsReadContext ctx,
int version )
inlineprotected

Called when data is loaded from persistence (on server side).

void OnStoreLoad(ParamsReadContext ctx, int version)
{
// dont forget to propagate this call trough class hierarchy!
if ( !super.OnStoreLoad(ctx, version) )
return false;
// read data loaded from game database (format and order of reading must be the same as writing!)
int a;
if ( !ctx.Read(a) )
return false;
float b;
if ( !ctx.Read(b) )
return false;
return true;
}
bool OnStoreLoad(ParamsReadContext ctx, int version)
Called when data is loaded from persistence (on server side).
proto bool Read(void value_in)
Serializer ParamsReadContext
Определения gameplay.c:15

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

2979 {
2980 ConstructionBasic constructionComponent = GetConstructionBasic();
2981 if (version >= 143 && constructionComponent)
2982 {
2983 constructionComponent.HandleStoreLoad(ctx,version);
2984 }
2985
2986 // Restoring of energy related states
2987 if ( m_EM )
2988 {
2989 // Load energy amount
2990 float f_energy = 0;
2991 if ( !ctx.Read( f_energy ) )
2992 f_energy = 0;
2993 m_EM.SetEnergy(f_energy);
2994
2995 // Load passive/active state
2996 bool b_is_passive = false;
2997 if ( !ctx.Read( b_is_passive ) )
2998 return false;
2999 m_EM.SetPassiveState(b_is_passive);
3000
3001 // Load ON/OFF state
3002 bool b_is_on = false;
3003 if ( !ctx.Read( b_is_on ) )
3004 {
3005 m_EM.SwitchOn();
3006 return false;
3007 }
3008
3009 // Load plugged/unplugged state
3010 bool b_is_plugged = false;
3011 if ( !ctx.Read( b_is_plugged ) )
3012 return false;
3013
3014 // ENERGY SOURCE
3015 if ( version <= 103 )
3016 {
3017 // Load energy source ID low
3018 int i_energy_source_ID_low = 0; // Even 0 can be valid ID!
3019 if ( !ctx.Read( i_energy_source_ID_low ) )
3020 return false;
3021
3022 // Load energy source ID high
3023 int i_energy_source_ID_high = 0; // Even 0 can be valid ID!
3024 if ( !ctx.Read( i_energy_source_ID_high ) )
3025 return false;
3026 }
3027 else
3028 {
3029 int b1 = 0;
3030 int b2 = 0;
3031 int b3 = 0;
3032 int b4 = 0;
3033
3034 if ( !ctx.Read(b1) ) return false;
3035 if ( !ctx.Read(b2) ) return false;
3036 if ( !ctx.Read(b3) ) return false;
3037 if ( !ctx.Read(b4) ) return false;
3038
3039 if ( b_is_plugged )
3040 {
3041 // Because function GetEntityByPersitentID() cannot be called here, ID values must be stored and used later.
3042 m_EM.StoreEnergySourceIDs( b1, b2, b3, b4 );
3043 m_EM.RestorePlugState(true);
3044 }
3045 }
3046
3047 if (b_is_on)
3048 {
3049 m_EM.SwitchOn();
3050 }
3051 }
3052
3053 if (version >= 140)
3054 {
3055 // variable management system
3056 if (!LoadVariables(ctx, version))
3057 return false;
3058 }
3059
3060 return true;
3061 }
void HandleStoreLoad(ParamsReadContext ctx, int version)
ComponentEnergyManager m_EM
bool LoadVariables(ParamsReadContext ctx, int version=-1)
ConstructionBasic GetConstructionBasic()
Construction itself is defined on module 4. Workaround. Don't forget to cast!

Перекрестные ссылки GetConstructionBasic(), ConstructionBasic::HandleStoreLoad(), LoadVariables(), m_EM и Serializer::Read().