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_PlayerLoadoutComponentSerializer.c
Go to the documentation of this file.
1
class
SCR_PlayerLoadoutComponentSerializer
:
ScriptedComponentSerializer
2
{
3
//------------------------------------------------------------------------------------------------
4
override
static
typename
GetTargetType
()
5
{
6
return
SCR_PlayerLoadoutComponent
;
7
}
8
9
//------------------------------------------------------------------------------------------------
10
override
protected
ESerializeResult
Serialize
(notnull
IEntity
owner, notnull
GenericComponent
component, notnull
SaveContext
context)
11
{
12
SCR_ArsenalManagerComponent arsenalManager;
13
if
(!SCR_ArsenalManagerComponent.GetArsenalManager(arsenalManager))
14
return
ESerializeResult
.DEFAULT;
15
16
const
PlayerController controller = PlayerController.Cast(owner);
17
const
UUID
uuid =
SCR_PlayerIdentityUtils
.GetPlayerIdentityId(controller.GetPlayerId());
18
19
SCR_ArsenalPlayerLoadout
arsenalLoadout;
20
if
(!arsenalManager.GetPlayerArsenalLoadout(uuid, arsenalLoadout))
21
return
ESerializeResult
.DEFAULT;
22
23
context.WriteValue(
"version"
, 1);
24
context.Write(arsenalLoadout);
25
return
ESerializeResult
.OK;
26
}
27
28
//------------------------------------------------------------------------------------------------
29
override
protected
bool
Deserialize
(notnull
IEntity
owner, notnull
GenericComponent
component, notnull
LoadContext
context)
30
{
31
auto
fastTravel =
SCR_PlayerLoadoutComponent
.Cast(component);
32
auto
world =
ChimeraWorld
.CastFrom(owner.GetWorld());
33
34
int
version;
35
context.Read(version);
36
37
SCR_ArsenalPlayerLoadout
arsenalLoadout;
38
if
(!context.Read(arsenalLoadout))
39
return
false
;
40
41
SCR_ArsenalManagerComponent arsenalManager;
42
if
(SCR_ArsenalManagerComponent.GetArsenalManager(arsenalManager))
43
{
44
const
PlayerController controller = PlayerController.Cast(owner);
45
const
int
playerId = controller.GetPlayerId();
46
const
UUID
uuid =
SCR_PlayerIdentityUtils
.GetPlayerIdentityId(playerId);
47
arsenalManager.DoSetPlayerLoadout(uuid, arsenalLoadout);
48
arsenalManager.SyncPlayerloadout(playerId, arsenalLoadout);
49
}
50
51
return
true
;
52
}
53
}
GetTargetType
class SCR_PersistentThreatSector GetTargetType()
Definition
AIControlComponentSerializer.c:12
ChimeraWorld
Definition
ChimeraWorld.c:13
GenericComponent
Definition
GenericComponent.c:13
IEntity
Definition
IEntity.c:13
LoadContext
Definition
LoadContext.c:17
SCR_ArsenalPlayerLoadout
Definition
SCR_ArsenalManagerComponent.c:2
SCR_PlayerIdentityUtils
Definition
SCR_PlayerIdentityUtils.c:2
SCR_PlayerLoadoutComponent
Definition
SCR_PlayerLoadoutComponent.c:17
SCR_PlayerLoadoutComponentSerializer
Definition
SCR_PlayerLoadoutComponentSerializer.c:2
SCR_PlayerLoadoutComponentSerializer::Serialize
ESerializeResult Serialize(notnull IEntity owner, notnull GenericComponent component, notnull SaveContext context)
Definition
SCR_PlayerLoadoutComponentSerializer.c:10
SCR_PlayerLoadoutComponentSerializer::Deserialize
bool Deserialize(notnull IEntity owner, notnull GenericComponent component, notnull LoadContext context)
Definition
SCR_PlayerLoadoutComponentSerializer.c:29
SaveContext
Definition
SaveContext.c:17
ScriptedComponentSerializer
Definition
ScriptedComponentSerializer.c:13
UUID
Definition
UUID.c:28
ESerializeResult
ESerializeResult
Definition
ESerializeResult.c:13
scripts
Game
Plugins
Persistence
System
Serializers
Components
PlayerController
SCR_PlayerLoadoutComponentSerializer.c
Generated by
1.17.0