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_CallsignBaseComponentSerializer.c
Go to the documentation of this file.
1
class
SCR_CallsignBaseComponentSerializer
:
ScriptedComponentSerializer
2
{
3
//------------------------------------------------------------------------------------------------
4
override
static
typename
GetTargetType
()
5
{
6
return
SCR_CallsignBaseComponent
;
7
}
8
9
//------------------------------------------------------------------------------------------------
10
override
protected
ESerializeResult
Serialize
(notnull
IEntity
owner, notnull
GenericComponent
component, notnull
SaveContext
context)
11
{
12
const
SCR_CallsignBaseComponent
callsign =
SCR_CallsignBaseComponent
.Cast(component);
13
14
auto
group =
SCR_AIGroup
.Cast(owner);
15
16
int
companyIndex, platoonIndex, squadIndex, characterNumber;
17
ERoleCallsign
characterRole;
18
19
if
((group && group.GetAgentsCount() == 0) || !callsign.
GetCallsignIndexes
(companyIndex, platoonIndex, squadIndex, characterNumber, characterRole))
20
return
ESerializeResult
.DEFAULT;
21
22
context.WriteValue(
"version"
, 1);
23
context.WriteDefault(companyIndex, -1);
24
context.WriteDefault(platoonIndex, -1);
25
context.WriteDefault(squadIndex, -1);
26
27
/*
28
if (!group)
29
{
30
context.WriteDefault(characterNumber, -1);
31
context.WriteDefault(characterRole, ERoleCallsign.NONE);
32
}
33
*/
34
35
return
ESerializeResult
.OK;
36
}
37
38
//------------------------------------------------------------------------------------------------
39
override
protected
bool
Deserialize
(notnull
IEntity
owner, notnull
GenericComponent
component, notnull
LoadContext
context)
40
{
41
SCR_CallsignBaseComponent
callsign =
SCR_CallsignBaseComponent
.Cast(component);
42
43
int
version;
44
context.ReadValue(
"version"
, version);
45
46
int
companyIndex, platoonIndex, squadIndex;
47
context.ReadDefault(companyIndex, -1);
48
context.ReadDefault(platoonIndex, -1);
49
context.ReadDefault(squadIndex, -1);
50
51
auto
group =
SCR_AIGroup
.Cast(owner);
52
if
(group)
53
{
54
auto
callsignManager =
SCR_CallsignManagerComponent
.Cast(
GetGame
().
GetGameMode
().FindComponent(
SCR_CallsignManagerComponent
));
55
callsignManager.
RemoveAvailableGroupCallsign
(group.GetFaction(), companyIndex, platoonIndex, squadIndex);
56
57
auto
groupCallsign = SCR_CallsignGroupComponent.Cast(callsign);
58
if
(!groupCallsign)
59
return
false
;
60
61
groupCallsign.DoAssignCallsign(companyIndex, platoonIndex, squadIndex);
62
}
63
64
// TODO(@langepau): If desired to remember individual callsigns we need to make sure default group inits etc do not run after and reset it again :)
65
// Also we might want to store member callsigns on the group data still as callsigns make no sense on individual chars without groups?
66
/*
67
else
68
{
69
int characterNumber;
70
context.ReadDefault(characterNumber, -1);
71
72
ERoleCallsign characterRole;
73
context.ReadDefault(characterRole, ERoleCallsign.NONE);
74
75
auto factionAffiliation = FactionAffiliationComponent.Cast(owner.FindComponent(FactionAffiliationComponent));
76
if (!factionAffiliation)
77
return false;
78
79
auto charCallsign = SCR_CallsignCharacterComponent.Cast(callsign);
80
if (!charCallsign)
81
return false;
82
83
charCallsign.AssignCharacterCallsign(factionAffiliation.GetAffiliatedFaction(), companyIndex, platoonIndex, squadIndex, characterNumber, characterRole, charCallsign.GetIsCharacterAloneInGroup());
84
}
85
*/
86
87
return
true
;
88
}
89
}
GetTargetType
class SCR_PersistentThreatSector GetTargetType()
Definition
AIControlComponentSerializer.c:12
ERoleCallsign
ERoleCallsign
Definition
ERoleCallsign.c:5
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
GetGameMode
SCR_BaseGameMode GetGameMode()
Definition
SCR_BaseGameModeComponent.c:15
GenericComponent
Definition
GenericComponent.c:13
IEntity
Definition
IEntity.c:13
LoadContext
Definition
LoadContext.c:17
SCR_AIGroup
Definition
SCR_AIGroup.c:75
SCR_CallsignBaseComponent
Component of assigning and storing squad names.
Definition
SCR_CallsignBaseComponent.c:12
SCR_CallsignBaseComponent::GetCallsignIndexes
bool GetCallsignIndexes(out int companyIndex, out int platoonIndex, out int squadIndex, out int characterNumber=-1, out ERoleCallsign characterRole=ERoleCallsign.NONE)
Definition
SCR_CallsignBaseComponent.c:51
SCR_CallsignBaseComponentSerializer
Definition
SCR_CallsignBaseComponentSerializer.c:2
SCR_CallsignBaseComponentSerializer::Serialize
ESerializeResult Serialize(notnull IEntity owner, notnull GenericComponent component, notnull SaveContext context)
Definition
SCR_CallsignBaseComponentSerializer.c:10
SCR_CallsignBaseComponentSerializer::Deserialize
bool Deserialize(notnull IEntity owner, notnull GenericComponent component, notnull LoadContext context)
Definition
SCR_CallsignBaseComponentSerializer.c:39
SCR_CallsignManagerComponent
Definition
SCR_CallsignManagerComponent.c:13
SCR_CallsignManagerComponent::RemoveAvailableGroupCallsign
void RemoveAvailableGroupCallsign(Faction faction, int companyIndex, int platoonIndex, int squadIndex)
Definition
SCR_CallsignManagerComponent.c:260
SaveContext
Definition
SaveContext.c:17
ScriptedComponentSerializer
Definition
ScriptedComponentSerializer.c:13
ESerializeResult
ESerializeResult
Definition
ESerializeResult.c:13
scripts
Game
Plugins
Persistence
System
Serializers
Components
SCR_CallsignBaseComponentSerializer.c
Generated by
1.17.0