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

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

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

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