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_RespawnSystemComponentSerializer.c
Go to the documentation of this file.
1
class
SCR_RespawnSystemComponentSerializer
:
ScriptedComponentSerializer
2
{
3
//------------------------------------------------------------------------------------------------
4
override
static
typename
GetTargetType
()
5
{
6
return
SCR_RespawnSystemComponent;
7
}
8
9
//------------------------------------------------------------------------------------------------
10
override
protected
ESerializeResult
Serialize
(notnull
IEntity
owner, notnull
GenericComponent
component, notnull
SaveContext
context)
11
{
12
const
SCR_RespawnSystemComponent respawnSystem = SCR_RespawnSystemComponent.Cast(component);
13
const
BaseContainer
source = respawnSystem.GetComponentSource(owner);
14
15
const
bool
respawnEnabled = respawnSystem.IsRespawnEnabled();
16
bool
respawnEnabledDefault =
true
;
17
if
(source)
18
source.Get(
"m_bEnableRespawn"
, respawnEnabledDefault);
19
20
// Not directly on component but info belongs to it anyway
21
float
respawnTime = 10.0;
22
float
respawnTimeDefault = 10.0;
23
const
SCR_RespawnTimerComponent
respawnTimeComponent =
SCR_RespawnTimerComponent
.Cast(owner.FindComponent(
SCR_RespawnTimerComponent
));
24
if
(respawnTimeComponent)
25
{
26
respawnTime = respawnTimeComponent.GetRespawnTime();
27
const
BaseContainer
timerSource = respawnTimeComponent.GetComponentSource(owner);
28
if
(timerSource)
29
timerSource.Get(
"m_fRespawnTime"
, respawnTimeDefault);
30
}
31
32
if
(respawnEnabled == respawnEnabledDefault &&
float
.AlmostEqual(respawnTime, respawnTimeDefault))
33
return
ESerializeResult
.DEFAULT;
34
35
context.WriteValue(
"version"
, 1);
36
context.WriteDefault(respawnEnabled, respawnEnabledDefault);
37
context.WriteDefault(respawnTime, respawnTimeDefault);
38
return
ESerializeResult
.OK;
39
}
40
41
//------------------------------------------------------------------------------------------------
42
override
protected
bool
Deserialize
(notnull
IEntity
owner, notnull
GenericComponent
component, notnull
LoadContext
context)
43
{
44
SCR_RespawnSystemComponent respawnSystem = SCR_RespawnSystemComponent.Cast(component);
45
46
int
version;
47
context.Read(version);
48
49
bool
respawnEnabled;
50
if
(context.Read(respawnEnabled))
51
respawnSystem.ServerSetEnableRespawn(respawnEnabled);
52
53
float
respawnTime;
54
if
(context.Read(respawnTime))
55
{
56
const
SCR_RespawnTimerComponent
respawnTimeComponent =
SCR_RespawnTimerComponent
.Cast(owner.FindComponent(
SCR_RespawnTimerComponent
));
57
if
(respawnTimeComponent)
58
respawnTimeComponent.SetRespawnTime(respawnTime);
59
}
60
61
return
true
;
62
}
63
}
GetTargetType
class SCR_PersistentThreatSector GetTargetType()
Definition
AIControlComponentSerializer.c:12
SCR_RespawnTimerComponent
void SCR_RespawnTimerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition
SCR_RespawnTimerComponent.c:335
BaseContainer
Definition
BaseContainer.c:13
GenericComponent
Definition
GenericComponent.c:13
IEntity
Definition
IEntity.c:13
LoadContext
Definition
LoadContext.c:17
SCR_RespawnSystemComponentSerializer
Definition
SCR_RespawnSystemComponentSerializer.c:2
SCR_RespawnSystemComponentSerializer::Serialize
ESerializeResult Serialize(notnull IEntity owner, notnull GenericComponent component, notnull SaveContext context)
Definition
SCR_RespawnSystemComponentSerializer.c:10
SCR_RespawnSystemComponentSerializer::Deserialize
bool Deserialize(notnull IEntity owner, notnull GenericComponent component, notnull LoadContext context)
Definition
SCR_RespawnSystemComponentSerializer.c:42
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_RespawnSystemComponentSerializer.c
Generated by
1.17.0