14 [
RplProp(onRplName:
"OnPlayerLoadoutInfoChanged")]
54 static SCR_BasePlayerLoadout SGetPlayerLoadout(
int playerId)
57 return loadoutManager.GetPlayerLoadout(playerId);
76 static SCR_BasePlayerLoadout SGetLocalPlayerLoadout()
79 return loadoutManager.GetLocalPlayerLoadout();
103 static int SGetLoadoutPlayerCount(SCR_BasePlayerLoadout
loadout)
106 return loadoutManager.GetLoadoutPlayerCount(
loadout);
118 int loadoutIndex = -1;
120 loadoutIndex = loadoutInfo.GetLoadoutIndex();
135 if (playerLoadoutIndex != -1)
143 int previousLoadoutIndex;
145 previousLoadoutIndex = -1;
147 if (previousLoadoutIndex != playerLoadoutIndex)
158 if (loadoutIndex == -1)
181 #ifdef _ENABLE_RESPAWN_LOGS
193 #ifdef _ENABLE_RESPAWN_LOGS
218 if (previousIndex != -1)
222 int newCount = previousCount - 1;
232 if (targetLoadoutIndex != -1)
236 int newCount = previousCount + 1;
256 if (targetLoadoutIndex != -1)
260 int newCount = previousCount + 1;
334 if (candidate.GetLoadoutName() == name)
337 if (faction && factionLoadout && factionLoadout.GetFactionKey() != faction)
352 array<ref SCR_BasePlayerLoadout> loadouts = {};
356 return loadouts.GetRandomElement();
362 FactionKey factionKey = faction.GetFactionKey();
370 if (playerLoadout.GetFactionKey() == factionKey)
392 FactionManager factionManager =
game.GetFactionManager();
399 for (
int i = 0; i < count; i++)
401#ifdef DISABLE_ARSENAL_LOADOUTS
408 Faction ldFaction = factionManager.GetFactionByKey(factionLoadout.m_sAffiliatedFaction);
409 if (faction == ldFaction)
411 outLoadouts.Insert(factionLoadout);
436 FactionManager factionManager =
game.GetFactionManager();
449#ifdef DISABLE_ARSENAL_LOADOUTS
457 ldFaction = factionManager.GetFactionByKey(factionLoadout.m_sAffiliatedFaction);
458 if (faction == ldFaction && group.IsLoadoutInGroup(factionLoadout))
460 outLoadouts.Insert(factionLoadout);
480 for (
int i = 0; i < count; i++)
497 array<ref SCR_BasePlayerLoadout> loadouts = {};
502 return Math.RandomInt(0, count);
517 return Math.RandomInt(0, count);
548 super.EOnDiag(owner, timeSlice);
550 if (!DiagMenu.GetBool(
SCR_DebugMenuID.DEBUGUI_RESPAWN_PLAYER_LOADOUT_DIAG))
553 DbgUI.Begin(
"SCR_LoadoutManager");
555 DbgUI.Text(
"* Loadout Player Count *");
571 GetGame().RegisterLoadoutManager(
this);
574 ConnectToDiagSystem();
583 DisconnectFromDiagSystem();
585 GetGame().UnregisterLoadoutManager(
this);
ArmaReforgerScripted GetGame()
ref map< UUID, ref SCR_ArsenalPlayerLoadout > m_aPlayerLoadouts
SCR_CacheNoteComponentClass ScriptComponentClass RplProp()] protected ref array< string > m_aLines
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
ref map< int, int > m_PlayerCount
Mapping of faction id : player count.
int GetLoadoutPlayerCount(SCR_BasePlayerLoadout loadout)
ref ScriptInvoker< SCR_BasePlayerLoadout, int > m_OnMappedPlayerLoadoutInfoChanged
ScriptInvoker GetOnMappedPlayerLoadoutInfoChanged()
int GetLoadoutIndex(SCR_BasePlayerLoadout loadout)
void OnPlayerLoadoutCountChanged(SCR_BasePlayerLoadout loadout, int newCount)
int GetPlayerLoadoutsByFaction(Faction faction, out notnull array< ref SCR_BasePlayerLoadout > outLoadouts)
SCR_BasePlayerLoadout GetPlayerLoadout(int playerId)
ref map< int, ref SCR_PlayerLoadoutInfo > m_MappedPlayerLoadoutInfo
Local mapping of playerId to player loadout info.
SCR_BasePlayerLoadout GetLocalPlayerLoadout()
SCR_LoadoutManagerClass INVALID_LOADOUT_INDEX
SCR_BasePlayerLoadout GetRandomLoadout()
SCR_BasePlayerLoadout GetLoadoutByName(string name, FactionKey faction=string.Empty)
bool IsFactionSupportingCsutomLoadouts(notnull Faction faction)
SCR_BasePlayerLoadout GetRandomFactionLoadout(Faction faction)
void OnPlayerLoadoutInfoChanged()
Update local player loadout mapping.
void SCR_LoadoutManager(IEntitySource src, IEntity parent)
SCR_BasePlayerLoadout GetLoadoutByIndex(int index)
int GetRandomLoadoutIndex()
void OnPlayerLoadoutSet_S(SCR_PlayerLoadoutComponent playerComponent, SCR_BasePlayerLoadout loadout)
void ~SCR_LoadoutManager()
destructor
ref array< ref SCR_PlayerLoadoutInfo > m_aPlayerLoadoutInfo
List of all player loadout infos in no particular order. Maintained by the authority.
ref set< int > m_ChangedLoadouts
List of indices of loadouts whose count has changed since last update.
ref map< int, int > m_PreviousPlayerLoadouts
Map of previous player <playerId : loadoutIndex>.
int GetPlayerLoadoutsByGroup(notnull SCR_AIGroup group, notnull Faction faction, out notnull array< ref SCR_BasePlayerLoadout > outLoadouts)
bool CanAssignLoadout_S(SCR_PlayerLoadoutComponent playerLoadoutComponent, SCR_BasePlayerLoadout loadout)
void UpdatePlayerLoadout_S(SCR_PlayerLoadoutComponent playerLoadoutComponent)
array< ref SCR_BasePlayerLoadout > GetPlayerLoadouts()
int GetLoadoutCount()
Returns the number of loadouts provided by this manager or 0 if none.
enum EVehicleType IEntity
static int GetLocalPlayerId()
Returns either a valid ID of local player or 0.
PlayerController GetPlayerController()
SCR_BasePlayerLoadout GetAssignedLoadout()
static SCR_PlayerLoadoutInfo Create(int playerId)
void SetLoadoutIndex(int loadoutIndex)
override void EOnDiag(IEntity owner, float timeSlice)
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)
SCR_FieldOfViewSettings Attribute
proto external string ToString()
Plain C++ pointer, no weak pointers, no memory management.