Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AdditionalGameModeSettingsComponentSerializer.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 {
13 const BaseContainer source = settings.GetComponentSource(owner);
14
15 const bool vehicleSalvageEnabled = settings.IsVehicleSalvageEnabled();
16 bool vehicleSalvageEnabledDefault = true;
17 if (source)
18 source.Get("m_bEnableVehicleSalvage", vehicleSalvageEnabledDefault);
19
20 const bool entityRefundingActionAllowed = settings.IsEntityRefundingActionAllowed();
21 bool entityRefundingActionAllowedDefault = true;
22 if (source)
23 source.Get("m_bAllowEntityRefundingAction", entityRefundingActionAllowedDefault);
24
25 const bool teamKillingPunished = settings.IsTeamKillingPunished();
26 bool teamKillingPunishedDefault = true;
27 if (source)
28 source.Get("m_bEnableTeamKillPunishment", teamKillingPunishedDefault);
29
30 const bool projectileBallisticInfoVisibility = settings.GetProjectileBallisticInfoVisibility();
31 bool projectileBallisticInfoVisibilityDefault = true;
32 if (source)
33 source.Get("m_bProjectileBallisticInfoVisibility", projectileBallisticInfoVisibilityDefault);
34
35 const SCR_ENametagControllerFilter nametagControllerFilters = settings.GetNametagControllerFilters();
36 SCR_ENametagControllerFilter nametagControllerFiltersDefault = SCR_ENametagControllerFilter.SHOW_AI | SCR_ENametagControllerFilter.SHOW_PLAYERS;
37 if (source)
38 source.Get("m_eNametagControllerFilters", nametagControllerFiltersDefault);
39
40 const SCR_ENametagRelationFilter nametagRelationFilters = settings.GetNametagRelationFilters();
41 SCR_ENametagRelationFilter nametagRelationFiltersDefault = SCR_ENametagRelationFilter.SHOW_SAME_FACTION | SCR_ENametagRelationFilter.SHOW_GROUP_MEMBERS | SCR_ENametagRelationFilter.SHOW_MILITARY_ALLIES;
42 if (source)
43 source.Get("m_eNametagRelationFilters", nametagRelationFiltersDefault);
44
45 // Not directly on component but we save it here anyway
46 const float fuelConsumptionScale = SCR_FuelConsumptionComponent.GetGlobalFuelConsumptionScale();
47 const float fuelConsumptionScaleDefault = 8.0;
48
49 if (vehicleSalvageEnabled == vehicleSalvageEnabledDefault &&
50 entityRefundingActionAllowed == entityRefundingActionAllowedDefault &&
51 teamKillingPunished == teamKillingPunishedDefault &&
52 projectileBallisticInfoVisibility == projectileBallisticInfoVisibilityDefault &&
53 nametagControllerFilters == nametagControllerFiltersDefault &&
54 fuelConsumptionScale == fuelConsumptionScaleDefault)
55 return ESerializeResult.DEFAULT;
56
57 context.WriteValue("version", 1);
58 context.WriteDefault(vehicleSalvageEnabled, vehicleSalvageEnabledDefault);
59 context.WriteDefault(entityRefundingActionAllowed, entityRefundingActionAllowedDefault);
60 context.WriteDefault(teamKillingPunished, teamKillingPunishedDefault);
61 context.WriteDefault(projectileBallisticInfoVisibility, projectileBallisticInfoVisibilityDefault);
62 context.WriteDefault(nametagControllerFilters, nametagControllerFiltersDefault);
63 context.WriteDefault(nametagRelationFilters, nametagRelationFiltersDefault);
64 context.WriteDefault(fuelConsumptionScale, fuelConsumptionScaleDefault);
65 return ESerializeResult.OK;
66 }
67
68 //------------------------------------------------------------------------------------------------
69 override protected bool Deserialize(notnull IEntity owner, notnull GenericComponent component, notnull LoadContext context)
70 {
72
73 int version;
74 context.Read(version);
75
76 bool vehicleSalvageEnabled;
77 if (context.Read(vehicleSalvageEnabled))
78 settings.SetEnableVehicleSalvage_S(vehicleSalvageEnabled);
79
80 bool entityRefundingActionAllowed;
81 if (context.Read(entityRefundingActionAllowed))
82 settings.SetAllowEntityRefundingAction_S(entityRefundingActionAllowed);
83
84 bool teamKillingPunished;
85 if (context.Read(teamKillingPunished))
86 settings.SetEnableTeamKillPunishment_S(teamKillingPunished);
87
88 bool projectileBallisticInfoVisibility;
89 if (context.Read(projectileBallisticInfoVisibility))
90 settings.SetProjectileBallisticInfoVisibility_S(projectileBallisticInfoVisibility);
91
92 SCR_ENametagControllerFilter nametagControllerFilters;
93 if (context.Read(nametagControllerFilters))
94 settings.SetNametagControllerFilters(nametagControllerFilters);
95
96 SCR_ENametagControllerFilter nametagRelationFilters;
97 if (context.Read(nametagRelationFilters))
98 settings.SetNametagRelationFilters(nametagRelationFilters);
99
100 float fuelConsumptionScale;
101 if (context.Read(fuelConsumptionScale))
102 SCR_FuelConsumptionComponent.SetGlobalFuelConsumptionScale(fuelConsumptionScale);
103
104 return true;
105 }
106}
class SCR_PersistentThreatSector GetTargetType()
void SCR_AdditionalGameModeSettingsComponent(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