Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_BaseTriggerComponentSerializer.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 SCR_BaseTriggerComponent trigger = SCR_BaseTriggerComponent.Cast(component);
13 const BaseContainer source = component.GetComponentSource(owner);
14
15 const bool active = trigger.IsActivated();
16 const bool activeDefault = trigger.IsActivatedByDefault();
17
18 if (active == activeDefault)
19 return ESerializeResult.DEFAULT;
20
21 context.WriteValue("version", 1);
22 context.WriteDefault(active, activeDefault);
23 return ESerializeResult.OK;
24 }
25
26 //------------------------------------------------------------------------------------------------
27 override protected bool Deserialize(notnull IEntity owner, notnull GenericComponent component, notnull LoadContext context)
28 {
29 SCR_BaseTriggerComponent trigger = SCR_BaseTriggerComponent.Cast(component);
30
31 int version;
32 context.Read(version);
33
34 bool active;
35 if (context.Read(active))
36 {
37 if (active)
38 trigger.ActivateTrigger();
39 else
40 trigger.DisarmTrigger();
41 }
42
43 return true;
44 }
45}
class SCR_PersistentThreatSector GetTargetType()
void SCR_BaseTriggerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
bool Deserialize(notnull IEntity owner, notnull GenericComponent component, notnull LoadContext context)
ESerializeResult Serialize(notnull IEntity owner, notnull GenericComponent component, notnull SaveContext context)
ESerializeResult