Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_LoadoutManager.c File Reference

Go to the source code of this file.

Data Structures

class  SCR_LoadoutManagerClass
 

Functions

SCR_BasePlayerLoadout GetPlayerLoadout (int playerId)
 
SCR_BasePlayerLoadout GetLocalPlayerLoadout ()
 
int GetLoadoutPlayerCount (SCR_BasePlayerLoadout loadout)
 
protected void OnPlayerLoadoutInfoChanged ()
 Update local player loadout mapping. More...
 
protected void OnPlayerLoadoutCountChanged (SCR_BasePlayerLoadout loadout, int newCount)
 
protected void OnPlayerLoadoutSet_S (SCR_PlayerLoadoutComponent playerComponent, SCR_BasePlayerLoadout loadout)
 
void UpdatePlayerLoadout_S (SCR_PlayerLoadoutComponent playerLoadoutComponent)
 
bool CanAssignLoadout_S (SCR_PlayerLoadoutComponent playerLoadoutComponent, SCR_BasePlayerLoadout loadout)
 
array< ref SCR_BasePlayerLoadoutGetPlayerLoadouts ()
 
int GetLoadoutCount ()
 Returns the number of loadouts provided by this manager or 0 if none. More...
 
int GetLoadoutIndex (SCR_BasePlayerLoadout loadout)
 
SCR_BasePlayerLoadout GetLoadoutByIndex (int index)
 
SCR_BasePlayerLoadout GetLoadoutByName (string name)
 
SCR_BasePlayerLoadout GetRandomFactionLoadout (Faction faction)
 
int GetPlayerLoadoutsByFaction (Faction faction, out notnull array< ref SCR_BasePlayerLoadout > outLoadouts)
 
int GetPlayerLoadouts (out notnull array< SCR_BasePlayerLoadout > outLoadouts)
 
int GetRandomLoadoutIndex (Faction faction)
 
int GetRandomLoadoutIndex ()
 
SCR_BasePlayerLoadout GetRandomLoadout ()
 
ScriptInvoker GetOnMappedPlayerLoadoutInfoChanged ()
 
void SCR_LoadoutManager (IEntitySource src, IEntity parent)
 
void ~SCR_LoadoutManager ()
 destructor More...
 

Variables

SCR_LoadoutManagerClass INVALID_LOADOUT_INDEX = -1
 
protected ref array< ref SCR_BasePlayerLoadoutm_aPlayerLoadouts
 
protected ref array< ref SCR_PlayerLoadoutInfom_aPlayerLoadoutInfo = {}
 List of all player loadout infos in no particular order. Maintained by the authority. More...
 
protected ref map< int, intm_PreviousPlayerLoadouts = new map<int, int>()
 Map of previous player <playerId : loadoutIndex>. More...
 
protected ref set< intm_ChangedLoadouts = new set<int>()
 List of indices of loadouts whose count has changed since last update. More...
 
protected ref map< int, ref SCR_PlayerLoadoutInfom_MappedPlayerLoadoutInfo = new map<int, ref SCR_PlayerLoadoutInfo>()
 Local mapping of playerId to player loadout info. More...
 
protected ref map< int, intm_PlayerCount = new map<int, int>()
 Mapping of loadout id:player count. More...
 
protected ref ScriptInvoker< SCR_BasePlayerLoadout, intm_OnMappedPlayerLoadoutInfoChanged
 

Function Documentation

◆ CanAssignLoadout_S()

bool CanAssignLoadout_S ( SCR_PlayerLoadoutComponent  playerLoadoutComponent,
SCR_BasePlayerLoadout  loadout 
)

Authority: Return whether provided loadout can be set for the requesting player. Game logic can be implemented here, e.g. maximum slots.

Parameters
[in]playerLoadoutComponent
[in]loadout
Returns

Definition at line 278 of file SCR_LoadoutManager.c.

◆ GetLoadoutByIndex()

SCR_BasePlayerLoadout GetLoadoutByIndex ( int  index)

Returns loadout at provided index or null if none.

Parameters
[in]index
Returns

Definition at line 318 of file SCR_LoadoutManager.c.

◆ GetLoadoutByName()

SCR_BasePlayerLoadout GetLoadoutByName ( string  name)

Returns the first loadout with the provided name, or null if none were found.

Parameters
[in]name
Returns

Definition at line 330 of file SCR_LoadoutManager.c.

◆ GetLoadoutCount()

int GetLoadoutCount ( )

Returns the number of loadouts provided by this manager or 0 if none.

Definition at line 292 of file SCR_LoadoutManager.c.

◆ GetLoadoutIndex()

int GetLoadoutIndex ( SCR_BasePlayerLoadout  loadout)

Returns index of provided loadout or -1 if none.

Parameters
[in]loadout

Definition at line 303 of file SCR_LoadoutManager.c.

◆ GetLoadoutPlayerCount()

int GetLoadoutPlayerCount ( SCR_BasePlayerLoadout  loadout)

Returns current count of players assigned to the provided loadout.

Parameters
[in]loadout
Returns
Number of players or always 0 if no loadout is provided.

Definition at line 86 of file SCR_LoadoutManager.c.

◆ GetLocalPlayerLoadout()

SCR_BasePlayerLoadout GetLocalPlayerLoadout ( )

Return loadout of of local player.

Exceptions
Exceptionif no SCR_LoadoutManager is present in the world.
Returns
SCR_BasePlayerLoadout instance if loadout is assigned, null otherwise.

Definition at line 64 of file SCR_LoadoutManager.c.

◆ GetOnMappedPlayerLoadoutInfoChanged()

ScriptInvoker GetOnMappedPlayerLoadoutInfoChanged ( )
Returns

Definition at line 464 of file SCR_LoadoutManager.c.

◆ GetPlayerLoadout()

SCR_BasePlayerLoadout GetPlayerLoadout ( int  playerId)

Return assigned loadout of provided player by their id.

Parameters
[in]playerIdId of target player corresponding to PlayerController/PlayerManager player id.
Returns
loadout instance if loadout is assigned, null otherwise.

Definition at line 35 of file SCR_LoadoutManager.c.

◆ GetPlayerLoadouts() [1/2]

array<ref SCR_BasePlayerLoadout> GetPlayerLoadouts ( )
Returns

Definition at line 285 of file SCR_LoadoutManager.c.

◆ GetPlayerLoadouts() [2/2]

int GetPlayerLoadouts ( out notnull array< SCR_BasePlayerLoadout outLoadouts)
Parameters
[out]outLoadouts
Returns

Definition at line 402 of file SCR_LoadoutManager.c.

◆ GetPlayerLoadoutsByFaction()

int GetPlayerLoadoutsByFaction ( Faction  faction,
out notnull array< ref SCR_BasePlayerLoadout outLoadouts 
)
Parameters
[in]faction
[out]outLoadouts
Returns

Definition at line 360 of file SCR_LoadoutManager.c.

◆ GetRandomFactionLoadout()

SCR_BasePlayerLoadout GetRandomFactionLoadout ( Faction  faction)

Returns random loadout that belongs to provided faction or null if none.

Parameters
[in]faction

Definition at line 347 of file SCR_LoadoutManager.c.

◆ GetRandomLoadout()

SCR_BasePlayerLoadout GetRandomLoadout ( )
Returns

Definition at line 453 of file SCR_LoadoutManager.c.

◆ GetRandomLoadoutIndex() [1/2]

int GetRandomLoadoutIndex ( )
Returns

Definition at line 439 of file SCR_LoadoutManager.c.

◆ GetRandomLoadoutIndex() [2/2]

int GetRandomLoadoutIndex ( Faction  faction)
Parameters
[in]faction
Returns

Definition at line 423 of file SCR_LoadoutManager.c.

◆ OnPlayerLoadoutCountChanged()

protected void OnPlayerLoadoutCountChanged ( SCR_BasePlayerLoadout  loadout,
int  newCount 
)

Anyone: Event raised when provided faction's player count changes.

Note: Order of changes is not fully deterministic, e.g. when changing faction from A to B, this method might be invoked in the order B, A instead.

Parameters
[in]loadoutThe loadout for which affiliated player count changed.
[in]newCountThe new number of players that are using this loadout.

Definition at line 176 of file SCR_LoadoutManager.c.

◆ OnPlayerLoadoutInfoChanged()

protected void OnPlayerLoadoutInfoChanged ( )

Update local player loadout mapping.

Definition at line 111 of file SCR_LoadoutManager.c.

◆ OnPlayerLoadoutSet_S()

protected void OnPlayerLoadoutSet_S ( SCR_PlayerLoadoutComponent  playerComponent,
SCR_BasePlayerLoadout  loadout 
)

Authority: Event raised when provided player component has a loadout set.

Definition at line 191 of file SCR_LoadoutManager.c.

◆ SCR_LoadoutManager()

void SCR_LoadoutManager ( IEntitySource  src,
IEntity  parent 
)
Parameters
[in]src
[in]parent

Definition at line 500 of file SCR_LoadoutManager.c.

◆ UpdatePlayerLoadout_S()

void UpdatePlayerLoadout_S ( SCR_PlayerLoadoutComponent  playerLoadoutComponent)

Authority: Update player loadout info for target player with their up-to-date state.

Parameters
[in]playerLoadoutComponent

Definition at line 202 of file SCR_LoadoutManager.c.

◆ ~SCR_LoadoutManager()

void ~SCR_LoadoutManager ( )

destructor

Definition at line 511 of file SCR_LoadoutManager.c.

Variable Documentation

◆ INVALID_LOADOUT_INDEX

SCR_LoadoutManagerClass INVALID_LOADOUT_INDEX = -1

◆ m_aPlayerLoadoutInfo

protected ref array<ref SCR_PlayerLoadoutInfo> m_aPlayerLoadoutInfo = {}

List of all player loadout infos in no particular order. Maintained by the authority.

Definition at line 15 of file SCR_LoadoutManager.c.

◆ m_aPlayerLoadouts

protected ref array<ref SCR_BasePlayerLoadout> m_aPlayerLoadouts

Definition at line 11 of file SCR_LoadoutManager.c.

◆ m_ChangedLoadouts

protected ref set<int> m_ChangedLoadouts = new set<int>()

List of indices of loadouts whose count has changed since last update.

Definition at line 21 of file SCR_LoadoutManager.c.

◆ m_MappedPlayerLoadoutInfo

protected ref map<int, ref SCR_PlayerLoadoutInfo> m_MappedPlayerLoadoutInfo = new map<int, ref SCR_PlayerLoadoutInfo>()

Local mapping of playerId to player loadout info.

Definition at line 24 of file SCR_LoadoutManager.c.

◆ m_OnMappedPlayerLoadoutInfoChanged

protected ref ScriptInvoker<SCR_BasePlayerLoadout, int> m_OnMappedPlayerLoadoutInfoChanged

Definition at line 29 of file SCR_LoadoutManager.c.

◆ m_PlayerCount

protected ref map<int, int> m_PlayerCount = new map<int, int>()

Mapping of loadout id:player count.

Definition at line 27 of file SCR_LoadoutManager.c.

◆ m_PreviousPlayerLoadouts

protected ref map<int, int> m_PreviousPlayerLoadouts = new map<int, int>()

Map of previous player <playerId : loadoutIndex>.

Definition at line 18 of file SCR_LoadoutManager.c.