Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_ArsenalManagerComponentSerializer.c
Go to the documentation of this file.
1
class
SCR_ArsenalManagerComponentSerializer
:
ScriptedComponentSerializer
2
{
3
//------------------------------------------------------------------------------------------------
4
override
static
typename
GetTargetType
()
5
{
6
return
SCR_ArsenalManagerComponent;
7
}
8
9
//------------------------------------------------------------------------------------------------
10
override
protected
ESerializeResult
Serialize
(notnull
IEntity
owner, notnull
GenericComponent
component, notnull
SaveContext
context)
11
{
12
const
SCR_ArsenalManagerComponent arsenalManager = SCR_ArsenalManagerComponent.Cast(component);
13
const
BaseContainer
source = arsenalManager.GetComponentSource(owner);
14
15
const
float
loadoutSpawnSupplyCostMultiplier = arsenalManager.GetLoadoutSpawnSupplyCostMultiplier();
16
float
loadoutSpawnSupplyCostMultiplierDefault = 0.0;
17
if
(source)
18
source.Get(
"m_fLoadoutSpawnSupplyCostMultiplier"
, loadoutSpawnSupplyCostMultiplierDefault);
19
20
const
SCR_EArsenalGameModeType
gameModeType = arsenalManager.GetArsenalGameModeType();
21
SCR_EArsenalGameModeType
gameModeTypeDefault = -1;
22
if
(source)
23
source.Get(
"m_eArsenalGameModeType"
, gameModeTypeDefault);
24
25
const
SCR_EArsenalTypes enabledTypes = arsenalManager.GetEnabledArsenalTypes();
26
SCR_EArsenalTypes enabledTypesDefault =
SCR_Enum
.GetFlagValues(SCR_EArsenalTypes);
27
if
(source)
28
source.Get(
"m_eArsenalTypesEnabled"
, enabledTypesDefault);
29
30
const
bool
militarySupplyAllocation = SCR_ArsenalManagerComponent.IsMilitarySupplyAllocationEnabled();
31
bool
militarySupplyAllocationDefault =
false
;
32
if
(source)
33
source.Get(
"m_bUseMilitarySupplyAllocation"
, militarySupplyAllocationDefault);
34
35
if
(loadoutSpawnSupplyCostMultiplier == loadoutSpawnSupplyCostMultiplierDefault &&
36
gameModeType == gameModeTypeDefault &&
37
enabledTypes == enabledTypesDefault &&
38
militarySupplyAllocation == militarySupplyAllocationDefault)
39
return
ESerializeResult
.DEFAULT;
40
41
context.WriteValue(
"version"
, 1);
42
context.WriteDefault(loadoutSpawnSupplyCostMultiplier, loadoutSpawnSupplyCostMultiplierDefault);
43
context.WriteDefault(gameModeType, gameModeTypeDefault);
44
context.WriteDefault(enabledTypes, enabledTypesDefault);
45
context.WriteDefault(militarySupplyAllocation, militarySupplyAllocationDefault);
46
return
ESerializeResult
.OK;
47
}
48
49
//------------------------------------------------------------------------------------------------
50
override
protected
bool
Deserialize
(notnull
IEntity
owner, notnull
GenericComponent
component, notnull
LoadContext
context)
51
{
52
SCR_ArsenalManagerComponent arsenalManager = SCR_ArsenalManagerComponent.Cast(component);
53
54
int
version;
55
context.Read(version);
56
57
float
loadoutSpawnSupplyCostMultiplier;
58
if
(context.Read(loadoutSpawnSupplyCostMultiplier))
59
arsenalManager.SetLoadoutSpawnCostMultiplier_S(loadoutSpawnSupplyCostMultiplier);
60
61
SCR_EArsenalGameModeType
gameModeType;
62
if
(context.Read(gameModeType))
63
arsenalManager.SetArsenalGameModeType_S(gameModeType);
64
65
SCR_EArsenalTypes enabledTypes;
66
if
(context.Read(enabledTypes))
67
arsenalManager.SetEnabledArsenalTypes(enabledTypes);
68
69
bool
militarySupplyAllocation;
70
if
(context.Read(militarySupplyAllocation))
71
arsenalManager.SetMilitarySupplyAllocationEnabled(militarySupplyAllocation);
72
73
return
true
;
74
}
75
}
GetTargetType
class SCR_PersistentThreatSector GetTargetType()
Definition
AIControlComponentSerializer.c:12
SCR_EArsenalGameModeType
SCR_EArsenalGameModeType
Definition
SCR_EArsenalGameModeType.c:2
BaseContainer
Definition
BaseContainer.c:13
GenericComponent
Definition
GenericComponent.c:13
IEntity
Definition
IEntity.c:13
LoadContext
Definition
LoadContext.c:17
SCR_ArsenalManagerComponentSerializer
Definition
SCR_ArsenalManagerComponentSerializer.c:2
SCR_ArsenalManagerComponentSerializer::Serialize
ESerializeResult Serialize(notnull IEntity owner, notnull GenericComponent component, notnull SaveContext context)
Definition
SCR_ArsenalManagerComponentSerializer.c:10
SCR_ArsenalManagerComponentSerializer::Deserialize
bool Deserialize(notnull IEntity owner, notnull GenericComponent component, notnull LoadContext context)
Definition
SCR_ArsenalManagerComponentSerializer.c:50
SCR_Enum
Definition
SCR_Enum.c:2
SaveContext
Definition
SaveContext.c:17
ScriptedComponentSerializer
Definition
ScriptedComponentSerializer.c:13
ESerializeResult
ESerializeResult
Definition
ESerializeResult.c:13
scripts
Game
Plugins
Persistence
System
Serializers
Components
GameMode
SCR_ArsenalManagerComponentSerializer.c
Generated by
1.17.0