DayZ 1.28
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).
Определения 3_Game/Entities/EntityAI.c:2942
proto bool Read(void value_in)
Serializer ParamsReadContext
Определения gameplay.c:15

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

2943 {
2944 // Restoring of energy related states
2945 if ( m_EM )
2946 {
2947 // Load energy amount
2948 float f_energy = 0;
2949 if ( !ctx.Read( f_energy ) )
2950 f_energy = 0;
2951 m_EM.SetEnergy(f_energy);
2952
2953 // Load passive/active state
2954 bool b_is_passive = false;
2955 if ( !ctx.Read( b_is_passive ) )
2956 return false;
2957 m_EM.SetPassiveState(b_is_passive);
2958
2959 // Load ON/OFF state
2960 bool b_is_on = false;
2961 if ( !ctx.Read( b_is_on ) )
2962 {
2963 m_EM.SwitchOn();
2964 return false;
2965 }
2966
2967 // Load plugged/unplugged state
2968 bool b_is_plugged = false;
2969 if ( !ctx.Read( b_is_plugged ) )
2970 return false;
2971
2972 // ENERGY SOURCE
2973 if ( version <= 103 )
2974 {
2975 // Load energy source ID low
2976 int i_energy_source_ID_low = 0; // Even 0 can be valid ID!
2977 if ( !ctx.Read( i_energy_source_ID_low ) )
2978 return false;
2979
2980 // Load energy source ID high
2981 int i_energy_source_ID_high = 0; // Even 0 can be valid ID!
2982 if ( !ctx.Read( i_energy_source_ID_high ) )
2983 return false;
2984 }
2985 else
2986 {
2987 int b1 = 0;
2988 int b2 = 0;
2989 int b3 = 0;
2990 int b4 = 0;
2991
2992 if ( !ctx.Read(b1) ) return false;
2993 if ( !ctx.Read(b2) ) return false;
2994 if ( !ctx.Read(b3) ) return false;
2995 if ( !ctx.Read(b4) ) return false;
2996
2997 if ( b_is_plugged )
2998 {
2999 // Because function GetEntityByPersitentID() cannot be called here, ID values must be stored and used later.
3000 m_EM.StoreEnergySourceIDs( b1, b2, b3, b4 );
3001 m_EM.RestorePlugState(true);
3002 }
3003 }
3004
3005 if (b_is_on)
3006 {
3007 m_EM.SwitchOn();
3008 }
3009 }
3010
3011 if (version >= 140)
3012 {
3013 // variable management system
3014 if (!LoadVariables(ctx, version))
3015 return false;
3016 }
3017
3018 return true;
3019 }
ComponentEnergyManager m_EM
Определения 3_Game/Entities/EntityAI.c:306
bool LoadVariables(ParamsReadContext ctx, int version=-1)
Определения 3_Game/Entities/EntityAI.c:3132

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