Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_TaskExecutorEntity.c
Go to the documentation of this file.
2{
3 [Attribute()]
5
6 //------------------------------------------------------------------------------------------------
7 override bool IsClonedBy(SCR_TaskExecutor executor)
8 {
9 if (!super.IsClonedBy(executor))
10 return false;
11
12 SCR_TaskExecutorEntity executorEntity = SCR_TaskExecutorEntity.Cast(executor);
13 if (!executorEntity)
14 return false;
15
16 RplComponent rpl = RplComponent.Cast(GetEntity().FindComponent(RplComponent));
17 if (!rpl)
18 return false;
19
20 RplId rplID = rpl.Id();
21 if (!rplID.IsValid())
22 return false;
23
24 rpl = RplComponent.Cast(executorEntity.GetEntity().FindComponent(RplComponent));
25 if (!rpl)
26 return false;
27
28 RplId otherRplID = rpl.Id();
29 if (!otherRplID.IsValid())
30 return false;
31
32 if (rplID != otherRplID)
33 return false;
34
35 return true;
36 }
37
38 //------------------------------------------------------------------------------------------------
40 {
41 RplComponent rpl = RplComponent.Cast(Replication.FindItem(m_EntityRplID));
42 if (!rpl)
43 return null;
44
45 return rpl.GetEntity();
46 }
47
48 //------------------------------------------------------------------------------------------------
50 {
51 RplComponent rpl = RplComponent.Cast(ent.FindComponent(RplComponent));
52 if (!rpl)
53 return;
54
55 RplId rplID = rpl.Id();
56 if (!rplID)
57 return;
58
59 m_EntityRplID = rplID;
60 }
61
62 //------------------------------------------------------------------------------------------------
64 {
65 IEntity entity = GetEntity();
66 if (!entity)
67 return FactionKey.Empty;
68
69 FactionAffiliationComponent factionAffiliationComponent = FactionAffiliationComponent.Cast(entity.FindComponent(FactionAffiliationComponent));
70 if (!factionAffiliationComponent)
71 return FactionKey.Empty;
72
73 return factionAffiliationComponent.GetAffiliatedFactionKey();
74 }
75
76 //------------------------------------------------------------------------------------------------
77 override int GetGroupID()
78 {
79 IEntity entity = GetEntity();
80 if (!entity)
81 return -1;
82
83 SCR_AICombatComponent aiCombatComponent = SCR_AICombatComponent.Cast(entity.FindComponent(SCR_AICombatComponent));
84 if (!aiCombatComponent)
85 return -1;
86
87 SCR_ChimeraAIAgent agent = aiCombatComponent.GetAiAgent();
88 if (!agent)
89 return -1;
90
91 SCR_AIGroup group = SCR_AIGroup.Cast(agent.GetParentGroup());
92 if (!group)
93 return -1;
94
95 return group.GetGroupID();
96 }
97
98 //------------------------------------------------------------------------------------------------
99 static bool Extract(SCR_TaskExecutorEntity instance, ScriptCtx ctx, SSnapSerializerBase snapshot)
100 {
101 snapshot.SerializeBytes(instance.m_EntityRplID, 4);
102 return true;
103 }
104
105 //------------------------------------------------------------------------------------------------
106 static bool Inject(SSnapSerializerBase snapshot, ScriptCtx ctx, SCR_TaskExecutorEntity instance)
107 {
108 snapshot.SerializeBytes(instance.m_EntityRplID, 4);
109 return true;
110 }
111
112 //------------------------------------------------------------------------------------------------
113 static void Encode(SSnapSerializerBase snapshot, ScriptCtx ctx, ScriptBitSerializer packet)
114 {
115 RplId entityRplID;
116 snapshot.SerializeBytes(entityRplID, 4);
117 packet.Serialize(entityRplID, 32);
118 }
119
120 //------------------------------------------------------------------------------------------------
121 static bool Decode(ScriptBitSerializer packet, ScriptCtx ctx, SSnapSerializerBase snapshot)
122 {
123 RplId entityRplID;
124 packet.Serialize(entityRplID, 32);
125 snapshot.SerializeBytes(entityRplID, 4);
126
127 return true;
128 }
129
130 //------------------------------------------------------------------------------------------------
132 {
133 return lhs.CompareSnapshots(rhs, 4);
134 }
135
136 //------------------------------------------------------------------------------------------------
138 {
139 return snapshot.Compare(instance.m_EntityRplID, 4);
140 }
141}
proto external Managed FindComponent(typename typeName)
Main replication API.
Definition Replication.c:14
Replication item identifier.
Definition RplId.c:14
int GetGroupID()
override FactionKey GetFactionKey()
static bool PropCompare(SCR_TaskExecutorEntity instance, SSnapSerializerBase snapshot, ScriptCtx ctx)
static bool Extract(SCR_TaskExecutorEntity instance, ScriptCtx ctx, SSnapSerializerBase snapshot)
static bool SnapCompare(SSnapSerializerBase lhs, SSnapSerializerBase rhs, ScriptCtx ctx)
static bool Inject(SSnapSerializerBase snapshot, ScriptCtx ctx, SCR_TaskExecutorEntity instance)
static void Encode(SSnapSerializerBase snapshot, ScriptCtx ctx, ScriptBitSerializer packet)
static bool Decode(ScriptBitSerializer packet, ScriptCtx ctx, SSnapSerializerBase snapshot)
override bool IsClonedBy(SCR_TaskExecutor executor)
SCR_FieldOfViewSettings Attribute