Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_PerceivedFactionManagerComponentSerializer.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_PerceivedFactionManagerComponent perceivedFactionManager = SCR_PerceivedFactionManagerComponent.Cast(component);
13 const BaseContainer source = perceivedFactionManager.GetComponentSource(owner);
14
15 const SCR_EPerceivedFactionOutfitType characterPerceivedFactionOutfitType = perceivedFactionManager.GetCharacterPerceivedFactionOutfitType();
16 SCR_EPerceivedFactionOutfitType characterPerceivedFactionOutfitTypeDefault = SCR_EPerceivedFactionOutfitType.DISABLED;
17 if (source)
18 source.Get("m_eCharacterPerceivedFactionOutfitType", characterPerceivedFactionOutfitTypeDefault);
19
20 const SCR_EDisguisedKillingPunishment punishmentKillingWhileDisguisedFlags = perceivedFactionManager.GetPunishmentKillingWhileDisguisedFlags();
21 SCR_EDisguisedKillingPunishment punishmentKillingWhileDisguisedFlagsDefault = 0;
22 if (source)
23 source.Get("m_ePunishmentKillingWhileDisguised", punishmentKillingWhileDisguisedFlagsDefault);
24
25 if (characterPerceivedFactionOutfitType == characterPerceivedFactionOutfitTypeDefault &&
26 punishmentKillingWhileDisguisedFlags == punishmentKillingWhileDisguisedFlagsDefault)
27 return ESerializeResult.DEFAULT;
28
29 context.WriteValue("version", 1);
30 context.WriteDefault(characterPerceivedFactionOutfitType, characterPerceivedFactionOutfitTypeDefault);
31 context.WriteDefault(punishmentKillingWhileDisguisedFlags, punishmentKillingWhileDisguisedFlagsDefault);
32 return ESerializeResult.OK;
33 }
34
35 //------------------------------------------------------------------------------------------------
36 override protected bool Deserialize(notnull IEntity owner, notnull GenericComponent component, notnull LoadContext context)
37 {
38 SCR_PerceivedFactionManagerComponent perceivedFactionManager = SCR_PerceivedFactionManagerComponent.Cast(component);
39
40 int version;
41 context.Read(version);
42
43 SCR_EDisguisedKillingPunishment characterPerceivedFactionOutfitType;
44 if (context.Read(characterPerceivedFactionOutfitType))
45 perceivedFactionManager.SetCharacterPerceivedFactionOutfitType_S(characterPerceivedFactionOutfitType);
46
47 SCR_EDisguisedKillingPunishment punishmentKillingWhileDisguisedFlags;
48 if (context.Read(punishmentKillingWhileDisguisedFlags))
49 perceivedFactionManager.SetPunishmentKillingWhileDisguisedFlags_S(punishmentKillingWhileDisguisedFlags);
50
51 return true;
52 }
53}
54
class SCR_PersistentThreatSector GetTargetType()
void SCR_PerceivedFactionManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
ESerializeResult Serialize(notnull IEntity owner, notnull GenericComponent component, notnull SaveContext context)
bool Deserialize(notnull IEntity owner, notnull GenericComponent component, notnull LoadContext context)
ESerializeResult