Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_GadgetManagerComponentSerializer.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_GadgetManagerComponent gadgetManager = SCR_GadgetManagerComponent.Cast(component);
13
14 const UUID gadgetId = GetSystem().GetId(gadgetManager.GetHeldGadget());
15 if (gadgetId.IsNull())
16 return ESerializeResult.DEFAULT;
17
18 context.Write(gadgetId);
19 return ESerializeResult.OK;
20 }
21
22 //------------------------------------------------------------------------------------------------
23 override protected bool Deserialize(notnull IEntity owner, notnull GenericComponent component, notnull LoadContext context)
24 {
25 auto gadgetManager = SCR_GadgetManagerComponent.Cast(component);
26
27 UUID gadgetId;
28 if (context.Read(gadgetId) && !gadgetId.IsNull())
29 {
30 Tuple1<SCR_GadgetManagerComponent> ctx(gadgetManager);
32 GetSystem().WhenAvailable(gadgetId, task);
33 }
34
35 return true;
36 }
37
38 //------------------------------------------------------------------------------------------------
39 protected static void OnGadgetAvailable(Managed instance, PersistenceDeferredDeserializeTask task, bool expired, Managed context)
40 {
41 auto gadget = IEntity.Cast(instance);
42 if (!gadget)
43 return;
44
45 auto ctx = Tuple1<SCR_GadgetManagerComponent>.Cast(context);
46 if (ctx.param1)
47 ctx.param1.HandleInput(gadget, 1);
48 }
49}
class SCR_PersistentThreatSector GetTargetType()
static void OnGadgetAvailable(Managed instance, PersistenceDeferredDeserializeTask task, bool expired, Managed context)
ESerializeResult Serialize(notnull IEntity owner, notnull GenericComponent component, notnull SaveContext context)
bool Deserialize(notnull IEntity owner, notnull GenericComponent component, notnull LoadContext context)
Definition UUID.c:28
ESerializeResult
void Tuple1(T1 p1)
Definition tuple.c:37