Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_CampaignBuildingProviderComponentSerializer.c
Go to the documentation of this file.
2{
3 //------------------------------------------------------------------------------------------------
4 override static typename GetTargetType()
5 {
6 return SCR_CampaignBuildingProviderComponent;
7 }
8
9 //------------------------------------------------------------------------------------------------
10 override protected ESerializeResult Serialize(notnull IEntity owner, notnull GenericComponent component, notnull SaveContext context)
11 {
12 const SCR_CampaignBuildingProviderComponent provider = SCR_CampaignBuildingProviderComponent.Cast(component);
13
14 const int objectBudget = provider.GetCurrentPropValue();
15 const int aiBudget = provider.GetCurrentAIValue();
16
17 if (objectBudget == 0 && aiBudget == 0)
18 return ESerializeResult.DEFAULT;
19
20 context.WriteValue("version", 1);
21 context.WriteDefault(objectBudget, 0);
22 context.WriteDefault(aiBudget, 0);
23 return ESerializeResult.OK;
24 }
25
26 //------------------------------------------------------------------------------------------------
27 override protected bool Deserialize(notnull IEntity owner, notnull GenericComponent component, notnull LoadContext context)
28 {
29 SCR_CampaignBuildingProviderComponent provider = SCR_CampaignBuildingProviderComponent.Cast(component);
30
31 int version;
32 context.Read(version);
33
34 int objectBudget;
35 if (context.Read(objectBudget))
36 GetGame().GetCallqueue().Call(provider.SetPropValue, objectBudget);
37
38 int aiBudget;
39 if (context.Read(aiBudget))
40 GetGame().GetCallqueue().Call(provider.SetAIValue, aiBudget);
41
42 return true;
43 }
44}
class SCR_PersistentThreatSector GetTargetType()
ArmaReforgerScripted GetGame()
Definition game.c:1398
bool Deserialize(notnull IEntity owner, notnull GenericComponent component, notnull LoadContext context)
ESerializeResult Serialize(notnull IEntity owner, notnull GenericComponent component, notnull SaveContext context)
ESerializeResult