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_AICombatComponentSerializer.c
Go to the documentation of this file.
1
class
SCR_AICombatComponentSerializer
:
ScriptedComponentSerializer
2
{
3
//------------------------------------------------------------------------------------------------
4
override
static
typename
GetTargetType
()
5
{
6
return
SCR_AICombatComponent;
7
}
8
9
//------------------------------------------------------------------------------------------------
10
override
protected
ESerializeResult
Serialize
(notnull
IEntity
owner, notnull
GenericComponent
component, notnull
SaveContext
context)
11
{
12
const
SCR_AICombatComponent aiCombat = SCR_AICombatComponent.Cast(component);
13
14
const
EAISkill skill = aiCombat.GetAISkill();
15
const
EAISkill skillDefault = aiCombat.GetAISkillDefault();
16
const
float
perceptionFactor = aiCombat.GetPerceptionFactor();
17
18
if
(skill == skillDefault &&
float
.AlmostEqual(perceptionFactor, 1.0))
19
return
ESerializeResult
.DEFAULT;
20
21
context.WriteValue(
"version"
, 1);
22
context.WriteDefault(skill, skillDefault);
23
context.WriteDefault(perceptionFactor, 1.0);
24
return
ESerializeResult
.OK;
25
}
26
27
//------------------------------------------------------------------------------------------------
28
override
protected
bool
Deserialize
(notnull
IEntity
owner, notnull
GenericComponent
component, notnull
LoadContext
context)
29
{
30
auto
aiCombat = SCR_AICombatComponent.Cast(component);
31
32
int
version;
33
context.Read(version);
34
35
const
EAISkill skillDefault = aiCombat.GetAISkillDefault();
36
EAISkill skill;
37
context.ReadDefault(skill, skillDefault);
38
39
float
perceptionFactor;
40
context.ReadDefault(perceptionFactor, 1.0);
41
42
if
(skill != skillDefault)
43
aiCombat.SetAISkill(skill);
44
45
if
(!
float
.AlmostEqual(perceptionFactor, 1.0))
46
aiCombat.SetPerceptionFactor(perceptionFactor);
47
48
return
true
;
49
}
50
}
GetTargetType
class SCR_PersistentThreatSector GetTargetType()
Definition
AIControlComponentSerializer.c:12
GenericComponent
Definition
GenericComponent.c:13
IEntity
Definition
IEntity.c:13
LoadContext
Definition
LoadContext.c:17
SCR_AICombatComponentSerializer
Definition
SCR_AICombatComponentSerializer.c:2
SCR_AICombatComponentSerializer::Serialize
ESerializeResult Serialize(notnull IEntity owner, notnull GenericComponent component, notnull SaveContext context)
Definition
SCR_AICombatComponentSerializer.c:10
SCR_AICombatComponentSerializer::Deserialize
bool Deserialize(notnull IEntity owner, notnull GenericComponent component, notnull LoadContext context)
Definition
SCR_AICombatComponentSerializer.c:28
SaveContext
Definition
SaveContext.c:17
ScriptedComponentSerializer
Definition
ScriptedComponentSerializer.c:13
ESerializeResult
ESerializeResult
Definition
ESerializeResult.c:13
scripts
Game
Plugins
Persistence
System
Serializers
Components
AI
SCR_AICombatComponentSerializer.c
Generated by
1.17.0