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_RestrictedDeployableSpawnPointComponentSerializer.c
Go to the documentation of this file.
1
class
SCR_RestrictedDeployableSpawnPointComponentSerializer
:
ScriptedComponentSerializer
2
{
3
//------------------------------------------------------------------------------------------------
4
override
static
typename
GetTargetType
()
5
{
6
return
SCR_RestrictedDeployableSpawnPointComponent
;
7
}
8
9
//------------------------------------------------------------------------------------------------
10
override
protected
ESerializeResult
Serialize
(notnull
IEntity
owner, notnull
GenericComponent
component, notnull
SaveContext
context)
11
{
12
const
SCR_RestrictedDeployableSpawnPointComponent
spawnPoint =
SCR_RestrictedDeployableSpawnPointComponent
.Cast(component);
13
const
BaseContainer
source = component.GetComponentSource(owner);
14
15
const
bool
deployed = spawnPoint.IsDeployed();
16
17
const
SCR_ESpawnPointBudgetType
budgetType = spawnPoint.
GetBudgetType
();
18
SCR_ESpawnPointBudgetType
budgetTypeDefault =
SCR_ESpawnPointBudgetType
.SUPPLIES;
19
if
(source)
20
source.Get(
"m_eRespawnBudgetType"
, budgetTypeDefault);
21
22
const
float
supplies = spawnPoint.
GetSuppliesValue
();
23
float
suppliesDefault = 100;
24
if
(source)
25
source.Get(
"m_fSuppliesValue"
, suppliesDefault);
26
27
const
int
respawnCount = spawnPoint.
GetRespawnCount
();
28
const
int
respawnCountDefault = 0;
29
30
const
int
spawnTicketsMax = spawnPoint.
GetMaxRespawns
();
31
float
spawnTicketsMaxDefault = 5;
32
if
(source)
33
source.Get(
"m_iMaxRespawns"
, spawnTicketsMaxDefault);
34
35
const
int
allowCustomLoadout = spawnPoint.
IsCustomLoadoutsAllowed
();
36
bool
allowCustomLoadoutDefault =
false
;
37
if
(source)
38
source.Get(
"m_bAllowCustomLoadouts"
, allowCustomLoadoutDefault);
39
40
if
(deployed ==
false
&&
41
budgetType == budgetTypeDefault &&
42
supplies == suppliesDefault &&
43
respawnCount == respawnCountDefault &&
44
spawnTicketsMax == spawnTicketsMaxDefault &&
45
allowCustomLoadout == allowCustomLoadoutDefault)
46
{
47
return
ESerializeResult
.DEFAULT;
48
}
49
50
UUID
groupId =
UUID
.NULL_UUID;
51
SCR_GroupsManagerComponent
groupsManager =
SCR_GroupsManagerComponent
.GetInstance();
52
if
(groupsManager)
53
groupId = GetSystem().GetId(groupsManager.FindGroup(spawnPoint.
GetGroupID
()));
54
55
const
UUID
ownerId = GetSystem().GetId(
GetGame
().GetPlayerManager().
GetPlayerController
(spawnPoint.GetItemOwnerID()));
56
57
context.WriteValue(
"version"
, 1);
58
context.WriteDefault(deployed,
false
);
59
context.WriteDefault(supplies, suppliesDefault);
60
context.WriteDefault(respawnCount, respawnCountDefault);
61
context.WriteDefault(spawnTicketsMax, spawnTicketsMax);
62
context.WriteDefault(allowCustomLoadout, allowCustomLoadoutDefault);
63
context.WriteDefault(groupId,
UUID
.NULL_UUID);
64
context.WriteDefault(ownerId,
UUID
.NULL_UUID);
65
return
ESerializeResult
.OK;
66
}
67
68
//------------------------------------------------------------------------------------------------
69
override
protected
bool
Deserialize
(notnull
IEntity
owner, notnull
GenericComponent
component, notnull
LoadContext
context)
70
{
71
SCR_RestrictedDeployableSpawnPointComponent
spawnPoint =
SCR_RestrictedDeployableSpawnPointComponent
.Cast(component);
72
73
int
version;
74
context.Read(version);
75
76
bool
deployed;
77
context.ReadDefault(deployed,
false
);
78
79
float
supplies;
80
if
(context.Read(supplies))
81
spawnPoint.
SetSuppliesValue
(supplies,
false
);
82
83
int
respawnCount;
84
if
(context.Read(respawnCount))
85
spawnPoint.
SetRespawnCount
(respawnCount);
86
87
int
spawnTicketsMax;
88
if
(context.Read(spawnTicketsMax))
89
spawnPoint.
SetRespawnCount
(spawnTicketsMax);
90
91
bool
allowCustomLoadout;
92
if
(context.Read(allowCustomLoadout))
93
spawnPoint.
SetSpawningWithLoadout
(allowCustomLoadout);
94
95
UUID
groupId;
96
context.ReadDefault(groupId,
UUID
.NULL_UUID);
97
98
UUID
ownerId;
99
if
(context.Read(ownerId))
100
{
101
Tuple1<SCR_RestrictedDeployableSpawnPointComponent>
ctx(spawnPoint);
102
PersistenceWhenAvailableTask
task
(
OnOwnerAvailable
, ctx);
103
GetSystem().WhenAvailable(ownerId,
task
);
104
}
105
106
if
(deployed && !groupId.IsNull())
107
{
108
Tuple1<SCR_RestrictedDeployableSpawnPointComponent>
ctx(spawnPoint);
109
PersistenceWhenAvailableTask
task
(
OnGroupAvailable
, ctx);
110
GetSystem().WhenAvailable(groupId,
task
);
111
}
112
113
return
true
;
114
}
115
116
//------------------------------------------------------------------------------------------------
117
protected
static
void
OnGroupAvailable
(Managed instance,
PersistenceDeferredDeserializeTask
task
,
bool
expired, Managed context)
118
{
119
auto
group =
SCR_AIGroup
.Cast(instance);
120
if
(!group)
121
return
;
122
123
auto
ctx =
Tuple1<SCR_RestrictedDeployableSpawnPointComponent>
.Cast(context);
124
if
(ctx.param1)
125
ctx.param1.DeployByGroup(group, reload:
true
);
126
}
127
128
//------------------------------------------------------------------------------------------------
129
protected
static
void
OnOwnerAvailable
(Managed instance,
PersistenceDeferredDeserializeTask
task
,
bool
expired, Managed context)
130
{
131
auto
owner = PlayerController.Cast(instance);
132
if
(!owner)
133
return
;
134
135
auto
ctx =
Tuple1<SCR_RestrictedDeployableSpawnPointComponent>
.Cast(context);
136
if
(ctx.param1)
137
ctx.param1.SetItemOwner(owner.GetPlayerId());
138
}
139
}
GetTargetType
class SCR_PersistentThreatSector GetTargetType()
Definition
AIControlComponentSerializer.c:12
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
SCR_GroupsManagerComponent
void SCR_GroupsManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition
SCR_GroupsManagerComponent.c:1747
SCR_ESpawnPointBudgetType
SCR_ESpawnPointBudgetType
Definition
SCR_RestrictedDeployableSpawnPointComponent.c:2
task
from task
Definition
SCR_TaskNotificationConfigs.c:12
BaseContainer
Definition
BaseContainer.c:13
GenericComponent
Definition
GenericComponent.c:13
IEntity
Definition
IEntity.c:13
LoadContext
Definition
LoadContext.c:17
PersistenceDeferredDeserializeTask
Definition
PersistenceDeferredDeserializeTask.c:13
PersistenceWhenAvailableTask
Definition
PersistenceWhenAvailableTask.c:14
SCR_AIGroup
Definition
SCR_AIGroup.c:75
SCR_RestrictedDeployableSpawnPointComponent
Deployable spawn point with configurable conditions.
Definition
SCR_RestrictedDeployableSpawnPointComponent.c:16
SCR_RestrictedDeployableSpawnPointComponent::GetMaxRespawns
int GetMaxRespawns()
Definition
SCR_RestrictedDeployableSpawnPointComponent.c:717
SCR_RestrictedDeployableSpawnPointComponent::IsCustomLoadoutsAllowed
bool IsCustomLoadoutsAllowed()
Definition
SCR_RestrictedDeployableSpawnPointComponent.c:601
SCR_RestrictedDeployableSpawnPointComponent::SetSuppliesValue
void SetSuppliesValue(float value, bool refreshDeployedContainer=true)
Definition
SCR_RestrictedDeployableSpawnPointComponent.c:752
SCR_RestrictedDeployableSpawnPointComponent::GetBudgetType
SCR_ESpawnPointBudgetType GetBudgetType()
Definition
SCR_RestrictedDeployableSpawnPointComponent.c:746
SCR_RestrictedDeployableSpawnPointComponent::GetRespawnCount
int GetRespawnCount()
Definition
SCR_RestrictedDeployableSpawnPointComponent.c:711
SCR_RestrictedDeployableSpawnPointComponent::GetGroupID
int GetGroupID()
Definition
SCR_RestrictedDeployableSpawnPointComponent.c:691
SCR_RestrictedDeployableSpawnPointComponent::SetRespawnCount
void SetRespawnCount(int respawnCount)
Definition
SCR_RestrictedDeployableSpawnPointComponent.c:705
SCR_RestrictedDeployableSpawnPointComponent::GetSuppliesValue
float GetSuppliesValue(bool refreshFromDeployedContainer=true)
Definition
SCR_RestrictedDeployableSpawnPointComponent.c:769
SCR_RestrictedDeployableSpawnPointComponent::SetSpawningWithLoadout
void SetSpawningWithLoadout(bool allow, IEntity userEntity=null)
Definition
SCR_RestrictedDeployableSpawnPointComponent.c:573
SCR_RestrictedDeployableSpawnPointComponentSerializer
Definition
SCR_RestrictedDeployableSpawnPointComponentSerializer.c:2
SCR_RestrictedDeployableSpawnPointComponentSerializer::OnOwnerAvailable
static void OnOwnerAvailable(Managed instance, PersistenceDeferredDeserializeTask task, bool expired, Managed context)
Definition
SCR_RestrictedDeployableSpawnPointComponentSerializer.c:129
SCR_RestrictedDeployableSpawnPointComponentSerializer::OnGroupAvailable
static void OnGroupAvailable(Managed instance, PersistenceDeferredDeserializeTask task, bool expired, Managed context)
Definition
SCR_RestrictedDeployableSpawnPointComponentSerializer.c:117
SCR_RestrictedDeployableSpawnPointComponentSerializer::Deserialize
bool Deserialize(notnull IEntity owner, notnull GenericComponent component, notnull LoadContext context)
Definition
SCR_RestrictedDeployableSpawnPointComponentSerializer.c:69
SCR_RestrictedDeployableSpawnPointComponentSerializer::Serialize
ESerializeResult Serialize(notnull IEntity owner, notnull GenericComponent component, notnull SaveContext context)
Definition
SCR_RestrictedDeployableSpawnPointComponentSerializer.c:10
SaveContext
Definition
SaveContext.c:17
ScriptedComponentSerializer
Definition
ScriptedComponentSerializer.c:13
UUID
Definition
UUID.c:28
GetPlayerController
proto external PlayerController GetPlayerController()
Definition
SCR_PlayerDeployMenuHandlerComponent.c:307
ESerializeResult
ESerializeResult
Definition
ESerializeResult.c:13
Tuple1
void Tuple1(T1 p1)
Definition
tuple.c:37
scripts
Game
Plugins
Persistence
System
Serializers
Components
Equipment
SCR_RestrictedDeployableSpawnPointComponentSerializer.c
Generated by
1.17.0