Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
AIFormationComponentSerializer.c
Go to the documentation of this file.
2{
3 //------------------------------------------------------------------------------------------------
4 override static typename GetTargetType()
5 {
7 }
8
9 //------------------------------------------------------------------------------------------------
10 override protected ESerializeResult Serialize(notnull IEntity owner, notnull GenericComponent component, notnull SaveContext context)
11 {
12 const AIFormationComponent aiFormation = AIFormationComponent.Cast(component);
13 auto formation = aiFormation.GetFormation();
14 if (!formation)
15 return ESerializeResult.DEFAULT;
16
17 string defaultFormation;
18 if (component.GetComponentSource(owner).Get("DefaultFormation", defaultFormation) && defaultFormation == formation.GetName())
19 return ESerializeResult.DEFAULT;
20
21 context.WriteValue("version", 1);
22 context.WriteValue("formation", formation.GetName());
23 return ESerializeResult.OK;
24 }
25
26 //------------------------------------------------------------------------------------------------
27 override protected bool Deserialize(notnull IEntity owner, notnull GenericComponent component, notnull LoadContext context)
28 {
29 AIFormationComponent aiFormation = AIFormationComponent.Cast(component);
30
31 int version;
32 context.Read(version);
33
34 string formation;
35 context.Read(formation);
36
37 aiFormation.SetFormation(formation);
38 return true;
39 }
40}
class SCR_PersistentThreatSector GetTargetType()
bool Deserialize(notnull IEntity owner, notnull GenericComponent component, notnull LoadContext context)
ESerializeResult Serialize(notnull IEntity owner, notnull GenericComponent component, notnull SaveContext context)
ESerializeResult