Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_TaskExecutorPlayer.c
Go to the documentation of this file.
2{
3 [Attribute()]
4 protected int m_iPlayerID;
5
6 //------------------------------------------------------------------------------------------------
7 override bool IsClonedBy(SCR_TaskExecutor executor)
8 {
9 if (!super.IsClonedBy(executor))
10 return false;
11
12 SCR_TaskExecutorPlayer executorPlayer = SCR_TaskExecutorPlayer.Cast(executor);
13 if (!executorPlayer)
14 return false;
15
16 if (m_iPlayerID != executorPlayer.GetPlayerID())
17 return false;
18
19 return true;
20 }
21
22 //------------------------------------------------------------------------------------------------
24 {
25 return m_iPlayerID;
26 }
27
28 //------------------------------------------------------------------------------------------------
29 void SetPlayerID(int playerID)
30 {
31 m_iPlayerID = playerID;
32 }
33
34 //------------------------------------------------------------------------------------------------
36 {
37 SCR_FactionManager factionManager = SCR_FactionManager.Cast(GetGame().GetFactionManager());
38 if (!factionManager)
39 return FactionKey.Empty;
40
41 Faction faction = factionManager.GetPlayerFaction(m_iPlayerID);
42 if (!faction)
43 return FactionKey.Empty;
44
45 return faction.GetFactionKey();
46 }
47
48 //------------------------------------------------------------------------------------------------
49 override int GetGroupID()
50 {
51 SCR_GroupsManagerComponent groupsManagerComponent = SCR_GroupsManagerComponent.GetInstance();
52 if (!groupsManagerComponent)
53 return -1;
54
55 SCR_AIGroup group = groupsManagerComponent.GetPlayerGroup(m_iPlayerID);
56 if (!group)
57 return -1;
58
59 return group.GetGroupID();
60 }
61
62 //------------------------------------------------------------------------------------------------
63 static bool Extract(SCR_TaskExecutorPlayer instance, ScriptCtx ctx, SSnapSerializerBase snapshot)
64 {
65 snapshot.SerializeInt(instance.m_iPlayerID);
66 return true;
67 }
68
69 //------------------------------------------------------------------------------------------------
70 static bool Inject(SSnapSerializerBase snapshot, ScriptCtx ctx, SCR_TaskExecutorPlayer instance)
71 {
72 snapshot.SerializeInt(instance.m_iPlayerID);
73 return true;
74 }
75
76 //------------------------------------------------------------------------------------------------
77 static void Encode(SSnapSerializerBase snapshot, ScriptCtx ctx, ScriptBitSerializer packet)
78 {
79 snapshot.EncodeInt(packet);
80 }
81
82 //------------------------------------------------------------------------------------------------
83 static bool Decode(ScriptBitSerializer packet, ScriptCtx ctx, SSnapSerializerBase snapshot)
84 {
85 snapshot.DecodeInt(packet);
86 return true;
87 }
88
89 //------------------------------------------------------------------------------------------------
91 {
92 return lhs.CompareSnapshots(rhs, 4);
93 }
94
95 //------------------------------------------------------------------------------------------------
97 {
98 return snapshot.CompareInt(instance.m_iPlayerID);
99 }
100}
ArmaReforgerScripted GetGame()
Definition game.c:1398
void SCR_FactionManager(IEntitySource src, IEntity parent)
void SCR_GroupsManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
int GetGroupID()
static bool Decode(ScriptBitSerializer packet, ScriptCtx ctx, SSnapSerializerBase snapshot)
static void Encode(SSnapSerializerBase snapshot, ScriptCtx ctx, ScriptBitSerializer packet)
override FactionKey GetFactionKey()
static bool Inject(SSnapSerializerBase snapshot, ScriptCtx ctx, SCR_TaskExecutorPlayer instance)
static bool Extract(SCR_TaskExecutorPlayer instance, ScriptCtx ctx, SSnapSerializerBase snapshot)
override bool IsClonedBy(SCR_TaskExecutor executor)
static bool SnapCompare(SSnapSerializerBase lhs, SSnapSerializerBase rhs, ScriptCtx ctx)
static bool PropCompare(SCR_TaskExecutorPlayer instance, SSnapSerializerBase snapshot, ScriptCtx ctx)
SCR_FieldOfViewSettings Attribute