24 protected ref ScriptInvokerBase<SCR_GroupsManagerComponent_OnPlayerCallsignChanged>
m_OnPlayerCallsignChanged =
new ScriptInvokerBase<SCR_GroupsManagerComponent_OnPlayerCallsignChanged>();
40 bool GetEntityCallsignIndexes(
IEntity entity, out
int companyCallsignIndex, out
int platoonCallsignIndex, out
int squadCallsignIndex, out
int characterCallsignIndex)
44 return callsignComponent && callsignComponent.
GetCallsignIndexes(companyCallsignIndex, platoonCallsignIndex, squadCallsignIndex, characterCallsignIndex);
58 return GetEntityCallsignIndexes(editableEntity.GetOwner(), companyCallsignIndex, platoonCallsignIndex, squadCallsignIndex, characterCallsignIndex);
71 bool GetEntityCallsignNames(
IEntity entity, out
string companyCallsignName, out
string platoonCallsignName, out
string squadCallsignName, out
string characterCallsignName, out
string format)
75 if (!callsignComponent)
78 return callsignComponent.
GetCallsignNames(companyCallsignName, platoonCallsignName, squadCallsignName, characterCallsignName, format);
93 return GetEntityCallsignNames(editableEntity.GetOwner(), companyCallsignName, platoonCallsignName, squadCallsignName, characterCallsignName, format);
110 if (masterCallsignComponent)
112 masterCallsignComponent.GetCallsignIndexes(companyIndex, platoonIndex, squadIndex);
156 Print(
string.Format(
"All available callsigns are taken for faction '%1', so a random duplicate is assigned instead. If this happenes a lot then more callsigns should be added for this faction!", faction.GetFactionName()),
LogLevel.WARNING);
175 Print(
string.Format(
"All available callsigns are taken for faction '%1', so a random duplicate is assigned instead. If this happenes a lot then more callsigns should be added for this faction!", faction.GetFactionName()),
LogLevel.WARNING);
199 PrintFormat(
"All available callsigns are taken for faction '%1', so a random duplicate is assigned instead. If this happenes a lot then more callsigns should be added for this faction!", faction.GetFactionName(), level:
LogLevel.WARNING);
222 Print(
string.Format(
"All available callsigns are taken for faction '%1', so a random duplicate is assigned instead. If this happenes a lot then more callsigns should be added for this faction!", faction.GetFactionName()),
LogLevel.WARNING);
240 for(
int i = 0; i < count; i++)
254 factionCallsignData.
AddCallsign(companyIndex, platoonIndex, squadIndex);
264 factionCallsignData.
RemoveCallsign(companyIndex, platoonIndex, squadIndex);
276 if (!factionCallsignInfo)
281 array<int> duplicateCallsign = {};
282 duplicateCallsign.Insert(company);
283 duplicateCallsign.Insert(platoon);
284 duplicateCallsign.Insert(squad);
297 SCR_CallsignCharacterComponent characterCallsign = SCR_CallsignCharacterComponent.Cast(playerEntity.
FindComponent(SCR_CallsignCharacterComponent));
298 if (!characterCallsign)
302 characterCallsign.InitPlayerOnServer(playerId);
315 playerGroup = master;
318 int companyIndex, platoonIndex, squadIndex, characterNumber;
322 if (!
GetPlayerCallsign(playerId, companyIndex, platoonIndex, squadIndex, characterNumber, characterRole))
326 characterCallsign.AssignCharacterCallsign(playerGroup.
GetFaction(), companyIndex, platoonIndex, squadIndex, characterNumber, characterRole, playerGroup.
GetPlayerAndAgentCount(
true) <= 1);
340 Print(
"'SetPlayerCallsign': Invalid player ID: " + playerId,
LogLevel.ERROR);
351 playerCallsignData.
SetPlayerCallsignIndexes(companyIndex, platoonIndex, squadIndex, characterNumber, characterRole);
377 return playerCallsignData.
GetPlayerCallsignIndexes(companyIndex, platoonIndex, squadIndex, characterNumber, characterRole);
392 array<Faction> factions = {};
393 FactionManager factionManager =
GetGame().GetFactionManager();
398 factionManager.GetFactionsList(factions);
400 foreach (
Faction faction: factions)
409 if (!factionCallsignInfo)
412 array<ref SCR_CallsignInfo> companyArray = {};
413 array<ref SCR_CallsignInfo> platoonArray = {};
414 array<ref SCR_CallsignInfo> squadArray = {};
417 if (companyArray.IsEmpty())
421 if (platoonArray.IsEmpty())
425 if (squadArray.IsEmpty())
437 super.EOnInit(owner);
445 Debug.Error2(
"SCR_CallsignManagerComponent: EOnInit",
"Could not find SCR_GroupsManagerComponent!");
455 super.OnPostInit(owner);
ArmaReforgerScripted GetGame()
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
SCR_BaseGameMode GetGameMode()
void SCR_BaseGameModeComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
func SCR_GroupsManagerComponent_OnPlayerCallsignChanged
void SCR_GroupsManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
proto external Managed FindComponent(typename typeName)
int GetPlayerAndAgentCount(bool checkMasterAndSlaves=false)
ScriptInvokerBase< SCR_BaseGameMode_OnPlayerDisconnected > GetOnPlayerDisconnected()
ScriptInvokerBase< SCR_BaseGameMode_PlayerIdAndEntity > GetOnPlayerSpawned()
Component of assigning and storing squad names.
bool GetCallsignNames(out string company, out string platoon, out string squad, out string character, out string format)
bool GetCallsignIndexes(out int companyIndex, out int platoonIndex, out int squadIndex, out int characterNumber=-1, out ERoleCallsign characterRole=ERoleCallsign.NONE)
Manages available callsigns for each faction.
ref map< Faction, ref SCR_FactionCallsignData > m_mAvailableCallsigns
All available callsigns are stored here.
void AssignRandomGroupCallsigns(Faction faction, out int companyIndex, out int platoonIndex, out int squadIndex)
ref ScriptInvokerBase< SCR_GroupsManagerComponent_OnPlayerCallsignChanged > m_OnPlayerCallsignChanged
SCR_GroupsManagerComponent m_GroupManager
void AssignRandomDuplicateCallsign(Faction faction, out int company, out int platoon, out int squad)
If all callsigns are taken then assign a random callsign. This is an edge case safety as otherwise en...
void SetPlayerCallsign(int playerId, int companyIndex, int platoonIndex, int squadIndex, int characterNumber, ERoleCallsign characterRole=ERoleCallsign.NONE)
void AssignCompanySpecificGroupCallsign(Faction faction, out int specificCompanyIndex, out int platoonIndex, out int squadIndex)
ref array< ref array< int > > m_aDuplicateCallsigns
Assigned Duplicate callsigns. If all callsigns are assigned then this stores any assigned dupplicates...
bool GetEntityCallsignIndexes(IEntity entity, out int companyCallsignIndex, out int platoonCallsignIndex, out int squadCallsignIndex, out int characterCallsignIndex)
bool GetEntityCallsignNames(IEntity entity, out string companyCallsignName, out string platoonCallsignName, out string squadCallsignName, out string characterCallsignName, out string format)
bool GetPlayerCallsign(int playerId, out int companyIndex, out int platoonIndex, out int squadIndex, out int characterNumber=-1, out ERoleCallsign characterRole=ERoleCallsign.NONE)
void OnPlayerSpawn(int playerId, IEntity playerEntity)
Assign callsign for players when they are spawned (Server Only).
override void EOnInit(IEntity owner)
override void OnPostInit(IEntity owner)
bool GetEntityCallsignNames(SCR_EditableEntityComponent editableEntity, out string companyCallsignName, out string platoonCallsignName, out string squadCallsignName, out string characterCallsignName, out string format)
void AssignGroupRoleSpecificGroupCallsign(Faction faction, notnull SCR_AIGroup group, out int companyIndex, out int platoonIndex, out int squadIndex)
void ~SCR_CallsignManagerComponent()
bool GetEntityCallsignIndexes(SCR_EditableEntityComponent editableEntity, out int companyCallsignIndex, out int platoonCallsignIndex, out int squadCallsignIndex, out int characterCallsignIndex)
ScriptInvokerBase< SCR_GroupsManagerComponent_OnPlayerCallsignChanged > GetOnPlayerCallsignChanged()
Returns ScriptInvoker on player callsign changed.
void AssignCallGroupCallsign(notnull SCR_AIGroup group, Faction faction, SCR_CallsignGroupComponent masterCallsignComponent, out int companyIndex, out int platoonIndex, out int squadIndex)
void AssignFirstAvailableGroupCallsign(Faction faction, out int companyIndex, out int platoonIndex, out int squadIndex)
void RemoveAvailableGroupCallsign(Faction faction, int companyIndex, int platoonIndex, int squadIndex)
void MakeGroupCallsignAvailible(Faction faction, int companyIndex, int platoonIndex, int squadIndex)
void FillAvailableCallsigns()
void OnPlayerLeftGame(int playerId)
ref map< int, ref SCR_PlayerCallsignData > m_mPlayerCallsignData
Holds all the callsigns that are assigned to players.
For each faction, holds available companies, which in turn hold available platoons,...
void AddCallsign(int companyIndex, int platoonIndex, int squadIndex)
bool GetRandomCallsign(out int company, out int platoon, out int squad)
bool GetSpecificCompanyCallsign(out int company, out int platoon, out int squad)
void RemoveCallsign(int companyIndex, int platoonIndex, int squadIndex)
bool GetGroupRoleSpecificCompanyCallsign(notnull SCR_AIGroup group, out int company, out int platoon, out int squad)
bool GetFirstAvailibleCallsign(out int firstAvailableCompany, out int firstAvailablePlatoon, out int firstAvailableSquad)
void GetSquadArray(notnull array< ref SCR_CallsignInfo > squadArray)
void GetPlatoonArray(notnull array< ref SCR_CallsignInfo > platoonArray)
bool GetIsAssignedRandomly()
bool GetAssignCallsignBasedOnGroupRole()
void GetCompanyArray(notnull array< ref SCR_CallsignInfo > companyArray)
bool GetRandomCallsign(out int company, out int platoon, out int squad)
SCR_FactionCallsignInfo GetCallsignInfo()
void SetPlayerCallsignIndexes(int company, int platoon, int squad, int character, ERoleCallsign role)
bool GetPlayerCallsignIndexes(out int company, out int platoon, out int squad, out int character, out ERoleCallsign role)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
proto void PrintFormat(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL, LogLevel level=LogLevel.NORMAL)
EntityEvent
Various entity events.