Arma Reforger Script API
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
SCR_LoadoutManager Interface Reference
Inheritance diagram for SCR_LoadoutManager:
[legend]

Public Member Functions

SCR_BasePlayerLoadout GetPlayerLoadout (int playerId)
 Return assigned loadout of provided player by their id.
 
SCR_BasePlayerLoadout GetLocalPlayerLoadout ()
 Return loadout of of local player.
 
int GetLoadoutPlayerCount (SCR_BasePlayerLoadout loadout)
 Returns current count of players assigned to the provided loadout.
 
void UpdatePlayerLoadout_S (SCR_PlayerLoadoutComponent playerLoadoutComponent)
 Authority: Update player loadout info for target player with their up-to-date state.
 
bool CanAssignLoadout_S (SCR_PlayerLoadoutComponent playerLoadoutComponent, SCR_BasePlayerLoadout loadout)
 Authority: Return whether provided loadout can be set for the requesting player.
 
array< ref SCR_BasePlayerLoadoutGetPlayerLoadouts ()
 
int GetLoadoutCount ()
 Returns the number of loadouts provided by this manager or 0 if none.
 
int GetLoadoutIndex (SCR_BasePlayerLoadout loadout)
 Returns index of provided loadout or -1 if none.
 
SCR_BasePlayerLoadout GetLoadoutByIndex (int index)
 Returns loadout at provided index or null if none.
 
SCR_BasePlayerLoadout GetLoadoutByName (string name)
 Returns the first loadout with the provided name, or null if none were found.
 
SCR_BasePlayerLoadout GetRandomFactionLoadout (Faction faction)
 Returns random loadout that belongs to provided faction or null if none.
 
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
 

Static Public Member Functions

static SCR_BasePlayerLoadout SGetPlayerLoadout (int playerId)
 Return loadout of provided player by their id.
 
static SCR_BasePlayerLoadout SGetLocalPlayerLoadout ()
 Return loadout of local player.
 
static int SGetLoadoutPlayerCount (SCR_BasePlayerLoadout loadout)
 Return count of players assigned to the provided loadout.
 

Protected Member Functions

void OnPlayerLoadoutInfoChanged ()
 Update local player loadout mapping.
 
void OnPlayerLoadoutCountChanged (SCR_BasePlayerLoadout loadout, int newCount)
 Anyone: Event raised when provided faction's player count changes.
 
void OnPlayerLoadoutSet_S (SCR_PlayerLoadoutComponent playerComponent, SCR_BasePlayerLoadout loadout)
 Authority: Event raised when provided player component has a loadout set.
 

Protected Attributes

ref array< ref SCR_BasePlayerLoadoutm_aPlayerLoadouts
 
ref array< ref SCR_PlayerLoadoutInfom_aPlayerLoadoutInfo = {}
 List of all player loadout infos in no particular order. Maintained by the authority.
 
ref map< int, int > m_PreviousPlayerLoadouts = new map<int, int>()
 Map of previous player <playerId : loadoutIndex>.
 
ref set< int > m_ChangedLoadouts = new set<int>()
 List of indices of loadouts whose count has changed since last update.
 
ref map< int, ref SCR_PlayerLoadoutInfom_MappedPlayerLoadoutInfo = new map<int, ref SCR_PlayerLoadoutInfo>()
 Local mapping of playerId to player loadout info.
 
ref map< int, int > m_PlayerCount = new map<int, int>()
 Mapping of loadout id:player count.
 
ref ScriptInvoker< SCR_BasePlayerLoadout, int > m_OnMappedPlayerLoadoutInfoChanged
 

Static Protected Attributes

static const int INVALID_LOADOUT_INDEX = -1
 

Constructor & Destructor Documentation

◆ SCR_LoadoutManager()

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

◆ ~SCR_LoadoutManager()

void SCR_LoadoutManager.~SCR_LoadoutManager ( )

destructor

Member Function Documentation

◆ CanAssignLoadout_S()

bool SCR_LoadoutManager.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

◆ GetLoadoutByIndex()

SCR_BasePlayerLoadout SCR_LoadoutManager.GetLoadoutByIndex ( int  index)

Returns loadout at provided index or null if none.

Parameters
[in]index
Returns

◆ GetLoadoutByName()

SCR_BasePlayerLoadout SCR_LoadoutManager.GetLoadoutByName ( string  name)

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

Parameters
[in]name
Returns

◆ GetLoadoutCount()

int SCR_LoadoutManager.GetLoadoutCount ( )

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

◆ GetLoadoutIndex()

int SCR_LoadoutManager.GetLoadoutIndex ( SCR_BasePlayerLoadout  loadout)

Returns index of provided loadout or -1 if none.

Parameters
[in]loadout

◆ GetLoadoutPlayerCount()

int SCR_LoadoutManager.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.

◆ GetLocalPlayerLoadout()

SCR_BasePlayerLoadout SCR_LoadoutManager.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.

◆ GetOnMappedPlayerLoadoutInfoChanged()

ScriptInvoker SCR_LoadoutManager.GetOnMappedPlayerLoadoutInfoChanged ( )
Returns

◆ GetPlayerLoadout()

SCR_BasePlayerLoadout SCR_LoadoutManager.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.

◆ GetPlayerLoadouts() [1/2]

array< ref SCR_BasePlayerLoadout > SCR_LoadoutManager.GetPlayerLoadouts ( )
Returns

◆ GetPlayerLoadouts() [2/2]

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

◆ GetPlayerLoadoutsByFaction()

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

◆ GetRandomFactionLoadout()

SCR_BasePlayerLoadout SCR_LoadoutManager.GetRandomFactionLoadout ( Faction  faction)

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

Parameters
[in]faction

◆ GetRandomLoadout()

SCR_BasePlayerLoadout SCR_LoadoutManager.GetRandomLoadout ( )
Returns

◆ GetRandomLoadoutIndex() [1/2]

int SCR_LoadoutManager.GetRandomLoadoutIndex ( )
Returns

◆ GetRandomLoadoutIndex() [2/2]

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

◆ OnPlayerLoadoutCountChanged()

void SCR_LoadoutManager.OnPlayerLoadoutCountChanged ( SCR_BasePlayerLoadout  loadout,
int  newCount 
)
protected

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.

◆ OnPlayerLoadoutInfoChanged()

void SCR_LoadoutManager.OnPlayerLoadoutInfoChanged ( )
protected

Update local player loadout mapping.

◆ OnPlayerLoadoutSet_S()

void SCR_LoadoutManager.OnPlayerLoadoutSet_S ( SCR_PlayerLoadoutComponent  playerComponent,
SCR_BasePlayerLoadout  loadout 
)
protected

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

◆ SGetLoadoutPlayerCount()

static int SCR_LoadoutManager.SGetLoadoutPlayerCount ( SCR_BasePlayerLoadout  loadout)
static

Return count of players assigned to the provided loadout.

Static variant of SCR_LoadoutManager.GetLoadoutPlayerCount that uses registered FactionManager from the ArmaReforgerScripted game instance.

Exceptions
Exceptionif no FactionManager is present in the world.
Parameters
[in]loadout
Returns
Player count for provided loadout or 0 if no loadout is provided.

◆ SGetLocalPlayerLoadout()

static SCR_BasePlayerLoadout SCR_LoadoutManager.SGetLocalPlayerLoadout ( )
static

Return loadout of local player.

Static variant of SCR_LoadoutManager.GetLocalPlayerLoadout that uses registered SCR_LoadoutManager from the ArmaReforgerScripted game instance.

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

◆ SGetPlayerLoadout()

static SCR_BasePlayerLoadout SCR_LoadoutManager.SGetPlayerLoadout ( int  playerId)
static

Return loadout of provided player by their id.

Static variant of SCR_LoadoutManager.GetPlayerLoadout that uses registered SCR_LoadoutManager from the ArmaReforgerScripted game instance.

Parameters
[in]playerIdId of target player corresponding to PlayerController/PlayerManager player id.
Exceptions
Exceptionif no SCR_LoadoutManager is present in the world.
Returns
SCR_BasePlayerLoadout instance if loadout is assigned, null otherwise.

◆ UpdatePlayerLoadout_S()

void SCR_LoadoutManager.UpdatePlayerLoadout_S ( SCR_PlayerLoadoutComponent  playerLoadoutComponent)

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

Parameters
[in]playerLoadoutComponent

Member Data Documentation

◆ INVALID_LOADOUT_INDEX

const int SCR_LoadoutManager.INVALID_LOADOUT_INDEX = -1
staticprotected

◆ m_aPlayerLoadoutInfo

ref array<ref SCR_PlayerLoadoutInfo> SCR_LoadoutManager.m_aPlayerLoadoutInfo = {}
protected

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

◆ m_aPlayerLoadouts

ref array<ref SCR_BasePlayerLoadout> SCR_LoadoutManager.m_aPlayerLoadouts
protected

◆ m_ChangedLoadouts

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

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

◆ m_MappedPlayerLoadoutInfo

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

Local mapping of playerId to player loadout info.

◆ m_OnMappedPlayerLoadoutInfoChanged

ref ScriptInvoker<SCR_BasePlayerLoadout, int> SCR_LoadoutManager.m_OnMappedPlayerLoadoutInfoChanged
protected

◆ m_PlayerCount

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

Mapping of loadout id:player count.

◆ m_PreviousPlayerLoadouts

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

Map of previous player <playerId : loadoutIndex>.


The documentation for this interface was generated from the following file: