Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_CallsignBaseComponent.c
Go to the documentation of this file.
1[ComponentEditorProps(category: "GameScripted/Callsign", description: "")]
5
6//~ ScriptInvokers
7void SCR_CallsignBaseComponent_OnCallsignChanged(int companyIndex, int platoonIndex, int squadIndex, int characterNumber, ERoleCallsign characterRole);
9
12{
13 protected Faction m_Faction;
15
16 //Callsign IDs(Broadcast)
17 protected int m_iCompanyCallsign = -1;
18 protected int m_iPlatoonCallsign = -1;
19 protected int m_iSquadCallsign = -1;
20
21 //State
22 protected bool m_bIsServer;
23
24 //Ref
26
27 //Will always return int Company, int Platoon, int squad, int character number and character role (See GetCallsignIndexes() comments for more information). Also called when assigning callsigns for first time
28 protected ref ScriptInvokerBase<SCR_CallsignBaseComponent_OnCallsignChanged> Event_OnCallsignChanged = new ScriptInvokerBase<SCR_CallsignBaseComponent_OnCallsignChanged>();
29
30 //------------------------------------------------------------------------------------------------
38 bool GetCallsignNames(out string company, out string platoon, out string squad, out string character, out string format)
39 {
40 return false;
41 }
42
43 //------------------------------------------------------------------------------------------------
51 bool GetCallsignIndexes(out int companyIndex, out int platoonIndex, out int squadIndex, out int characterNumber = -1, out ERoleCallsign characterRole = ERoleCallsign.NONE)
52 {
53 }
54
55 //------------------------------------------------------------------------------------------------
56 protected void ClearCallsigns()
57 {
58 m_CallsignInfo = null;
59
63 }
64
65 //------------------------------------------------------------------------------------------------
66 protected bool SetCallsignInfo()
67 {
68 Faction currentFaction;
69
70 SCR_AIGroup group = SCR_AIGroup.Cast(GetOwner());
71 if (group && group.IsPlayable())
72 currentFaction = group.GetFaction();
73 else
74 {
76 if (editableEntityComponent)
77 currentFaction = editableEntityComponent.GetFaction();
78 }
79
80 if (m_Faction != currentFaction && currentFaction != null)
81 {
82 m_Faction = currentFaction;
83 m_CallsignInfo = null;
84 }
85 else
86 {
88 return true;
89 }
90
91 SCR_Faction scrFaction = SCR_Faction.Cast(m_Faction);
92
93 if (!scrFaction)
94 return false;
95
96 m_CallsignInfo = scrFaction.GetCallsignInfo();
97 return m_CallsignInfo != null;
98 }
99
100 //------------------------------------------------------------------------------------------------
102 ScriptInvokerBase<SCR_CallsignBaseComponent_OnCallsignChanged> GetOnCallsignChanged()
103 {
105 }
106
107 //------------------------------------------------------------------------------------------------
108 protected void InitOnServer(IEntity owner)
109 {
110 }
111
112 //------------------------------------------------------------------------------------------------
113 override void EOnInit(IEntity owner)
114 {
115 if (SCR_Global.IsEditMode(owner))
116 return;
117
118 BaseGameMode gameMode = GetGame().GetGameMode();
119 if (!gameMode)
120 return;
121
124 return;
125
127 if (editableEntityComponent)
128 m_Faction = editableEntityComponent.GetFaction();
129 m_bIsServer = Replication.IsServer();
130
131 if (!m_bIsServer)
132 return;
133
134 GetGame().GetCallqueue().CallLater(InitOnServer, 1, false, owner);
135 }
136
137 //------------------------------------------------------------------------------------------------
138 override void OnPostInit(IEntity owner)
139 {
140 SetEventMask(owner, EntityEvent.INIT);
141 }
142}
ERoleCallsign
ArmaReforgerScripted GetGame()
Definition game.c:1398
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
func SCR_CallsignBaseComponent_OnCallsignChanged
proto external int SetEventMask(notnull IEntity owner, int mask)
Main replication API.
Definition Replication.c:14
Faction GetFaction()
bool IsPlayable()
Component of assigning and storing squad names.
SCR_CallsignManagerComponent m_CallsignManager
bool GetCallsignNames(out string company, out string platoon, out string squad, out string character, out string format)
SCR_FactionCallsignInfo m_CallsignInfo
override void OnPostInit(IEntity owner)
bool GetCallsignIndexes(out int companyIndex, out int platoonIndex, out int squadIndex, out int characterNumber=-1, out ERoleCallsign characterRole=ERoleCallsign.NONE)
override void EOnInit(IEntity owner)
ScriptInvokerBase< SCR_CallsignBaseComponent_OnCallsignChanged > GetOnCallsignChanged()
ref ScriptInvokerBase< SCR_CallsignBaseComponent_OnCallsignChanged > Event_OnCallsignChanged
static SCR_EditableEntityComponent GetEditableEntity(IEntity owner)
SCR_FactionCallsignInfo GetCallsignInfo()
static bool IsEditMode()
Definition Functions.c:1566
proto external GenericEntity GetOwner()
Get owner entity.
EntityEvent
Various entity events.
Definition EntityEvent.c:14