Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_FactionManager.c File Reference

Go to the source code of this file.

Classes

class  SCR_FactionManagerClass

Typedefs

typedef func SCR_FactionManager_PlayerFactionChanged

Functions

void SCR_FactionManager_PlayerFactionChanged (int playerId, SCR_PlayerFactionAffiliationComponent playerFactionAffiliationComponent, Faction faction)
SCR_FactionManagerClass FactionManagerClass Attribute (defvalue:"1", desc:"Whether or not the isPlayable state of a faction can be changed on run time")
 List of all player faction infos in no particular order. Maintained by the authority.
ScriptInvoker GetOnPlayerFactionCountChanged ()
ScriptInvokerFaction GetOnFactionTasksEnabledChanged ()
ScriptInvokerBase< SCR_FactionManager_PlayerFactionChangedGetOnPlayerFactionChanged_S ()
 return Script invoker on player faction changed (Server only)
void UpdateCustomLoadoutSupportState (SCR_LoadoutManager loadoutMgr)
 Forces all factions to reevaluate if they support players saving custom loadouts.
void OnPlayerFactionInfoChanged ()
 Update local player faction mapping.
void RPC_UpdatePlayerLimit (FactionKey factionKey, int playerLimit)
 Update server player limit to clients.
void OnPlayerFactionSet_S (SCR_PlayerFactionAffiliationComponent playerComponent, Faction faction)
void OnPlayerFactionCountChanged (Faction faction, int newCount)
bool SetPlayerFaction (notnull SCR_ChimeraCharacter character, notnull Faction faction)
SCR_RankContainer GetFactionRanks (int playerId)
Faction GetPlayerFaction (int playerId)
Faction GetLocalPlayerFaction ()
int GetFactionPlayerCount (Faction faction)
int GetSortedFactionsList (out notnull SCR_SortedArray< SCR_Faction > outFactions)
override void EOnInit (IEntity owner)
void EOnFixedFrame (IEntity owner, float timeSlice)
void SCR_FactionManager (IEntitySource src, IEntity parent)
void ~SCR_FactionManager ()
bool CanChangeFactionsPlayable ()
void SetFactionTasksEnabled (notnull SCR_Faction faction, bool isTasksEnabled)
void RpcDo_SetFactionTasksEnabled (string factionKey, bool isTasksEnabled)
void SetFactionsFriendly (notnull SCR_Faction factionA, notnull SCR_Faction factionB, int playerChanged=-1, bool updateAIs=true)
void SetFactionFriendlyOneWay (notnull SCR_Faction factionA, notnull SCR_Faction factionB, bool updateAIs=true)
void SetFactionsHostile (notnull SCR_Faction factionA, notnull SCR_Faction factionB, int playerChanged=-1, bool updateAIs=true)
void UpdatePlayerFaction_S (SCR_PlayerFactionAffiliationComponent playerFactionComponent)
void OnPlayerDisconnected (int playerId, KickCauseCode cause, int timeout)
bool RplSave (ScriptBitWriter writer)
bool RplLoad (ScriptBitReader reader)
map< FactionKey, intGetFactionLimitMapCLI ()

Variables

ref map< int, intm_PreviousPlayerFactions = new map<int, int>()
 Map of previous players <playerId : factionIndex>.
ref set< intm_ChangedFactions = new set<int>()
 List of indices of factions whose count has changed since last update.
ref map< int, ref SCR_PlayerFactionInfom_MappedPlayerFactionInfo = new map<int, ref SCR_PlayerFactionInfo>()
 Local mapping of playerId to player faction info.
ref map< int, intm_PlayerCount = new map<int, int>()
 Mapping of faction id : player count.
ref ScriptInvoker s_OnPlayerFactionCountChanged = new ScriptInvoker()
ref ScriptInvokerFaction m_OnFactionTaskEnabledChanged
ref ScriptInvokerBase< SCR_FactionManager_PlayerFactionChangedm_OnPlayerFactionChanged
ref map< FactionKey, intm_mPendingLimitUpdates

Typedef Documentation

◆ SCR_FactionManager_PlayerFactionChanged

Function Documentation

◆ Attribute()

SCR_FactionManagerClass FactionManagerClass Attribute ( defvalue:"1" ,
desc:"Whether or not the isPlayable state of a faction can be changed on run time"  )

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

Definition at line 3 of file SCR_FactionManager.c.

◆ CanChangeFactionsPlayable()

bool CanChangeFactionsPlayable ( )
protected

Check if the faction is playable. Non-playable factions will not appear in the respawn menu.

Returns
True when playable

Definition at line 541 of file SCR_FactionManager.c.

◆ EOnFixedFrame()

void EOnFixedFrame ( IEntity owner,
float timeSlice )
protected

Definition at line 455 of file SCR_FactionManager.c.

◆ GetFactionLimitMapCLI()

map< FactionKey, int > GetFactionLimitMapCLI ( )
protected

Authority: Retrieves player limit for listed factions from command line Format is Faction:Limit seperated by comma, e.g. -playerLimits "US:15" or -playerLimits "US:15,USSR:0"

Definition at line 867 of file SCR_FactionManager.c.

◆ GetFactionPlayerCount()

int GetFactionPlayerCount ( Faction faction)
protected

Returns current count of players assigned to the provided faction.

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

Definition at line 313 of file SCR_FactionManager.c.

◆ GetFactionRanks()

SCR_RankContainer GetFactionRanks ( int playerId)
protected

Return affiliated ranks of a faction the player is affiliated with.

Parameters
[in]playerIdId of target player corresponding to PlayerController/PlayerManager player id.
Returns
SCR_FactionRanks instance if faction is assigned, returns a default value otherwise.

Definition at line 224 of file SCR_FactionManager.c.

◆ GetLocalPlayerFaction()

Faction GetLocalPlayerFaction ( )
protected

Return affiliated faction of local player.

Exceptions
Exceptionif no FactionManager is present in the world.
Returns
Faction instance if faction is assigned, null otherwise.

Definition at line 288 of file SCR_FactionManager.c.

◆ GetOnFactionTasksEnabledChanged()

ScriptInvokerFaction GetOnFactionTasksEnabledChanged ( )
protected
Returns

Definition at line 59 of file SCR_FactionManager.c.

◆ GetOnPlayerFactionChanged_S()

ScriptInvokerBase< SCR_FactionManager_PlayerFactionChanged > GetOnPlayerFactionChanged_S ( )
protected

return Script invoker on player faction changed (Server only)

Definition at line 69 of file SCR_FactionManager.c.

◆ GetOnPlayerFactionCountChanged()

ScriptInvoker GetOnPlayerFactionCountChanged ( )
protected
Returns

Definition at line 49 of file SCR_FactionManager.c.

◆ GetPlayerFaction()

Faction GetPlayerFaction ( int playerId)
protected

Return affiliated faction of provided player by their id.

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

Definition at line 243 of file SCR_FactionManager.c.

◆ GetSortedFactionsList()

int GetSortedFactionsList ( out notnull SCR_SortedArray< SCR_Faction > outFactions)
protected

Get factions sorted according to their own custom order.

Parameters
[out]outFactionsArray to be filled with factions
Returns
Number of factions

Definition at line 355 of file SCR_FactionManager.c.

◆ OnPlayerDisconnected()

void OnPlayerDisconnected ( int playerId,
KickCauseCode cause,
int timeout )
protected

Authority: Handle disconnected player.

Parameters
[in]playerId
[in]cause
[in]timeout

Called after a player is disconnected.

Parameters
[in]playerIdPlayerId of disconnected player.
[in]causeReason player disconnected
[in]timeoutTimeout for when players are allowed to connect again. -1 means Ban without an assigned timeout

What happens when a player disconnects.

Parameters
[in]playerIDis a unique player identifier that defines which player has disconnected.
[in]cause
[in]timeout

Definition at line 809 of file SCR_FactionManager.c.

◆ OnPlayerFactionCountChanged()

void OnPlayerFactionCountChanged ( Faction faction,
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]factionThe faction for which affiliated player count changed.
[in]newCountThe new number of players that are part of this faction.

Definition at line 185 of file SCR_FactionManager.c.

◆ OnPlayerFactionInfoChanged()

void OnPlayerFactionInfoChanged ( )
protected

Update local player faction mapping.

Definition at line 94 of file SCR_FactionManager.c.

◆ OnPlayerFactionSet_S()

void OnPlayerFactionSet_S ( SCR_PlayerFactionAffiliationComponent playerComponent,
Faction faction )
protected

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

Definition at line 167 of file SCR_FactionManager.c.

◆ RPC_UpdatePlayerLimit()

void RPC_UpdatePlayerLimit ( FactionKey factionKey,
int playerLimit )
protected

Update server player limit to clients.

Definition at line 155 of file SCR_FactionManager.c.

◆ RpcDo_SetFactionTasksEnabled()

void RpcDo_SetFactionTasksEnabled ( string factionKey,
bool isTasksEnabled )
protected

Set whether a faction should receive tasks/objectives for the whole server

Parameters
[in]factionfaction to enable/disable tasks for
[in]isTasksEnabledwhether to enable/disable tasks for the faction

Definition at line 566 of file SCR_FactionManager.c.

◆ RplLoad()

bool RplLoad ( ScriptBitReader reader)
protected

Definition at line 846 of file SCR_FactionManager.c.

◆ RplSave()

bool RplSave ( ScriptBitWriter writer)
protected

Definition at line 827 of file SCR_FactionManager.c.

◆ SCR_FactionManager()

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

Definition at line 498 of file SCR_FactionManager.c.

◆ SCR_FactionManager_PlayerFactionChanged()

void SCR_FactionManager_PlayerFactionChanged ( int playerId,
SCR_PlayerFactionAffiliationComponent playerFactionAffiliationComponent,
Faction faction )

◆ SetFactionFriendlyOneWay()

void SetFactionFriendlyOneWay ( notnull SCR_Faction factionA,
notnull SCR_Faction factionB,
bool updateAIs = true )
protected

Sets first faction to be friendly to the second faction, ONE WAY ONLY! (Replicated if called by server) Resulting effect will be faction B being rewarded for killing A, but faction A getting friendly fire penalties on faction B.

Parameters
[in]factionAfaction to set friendly to factionB
[in]factionBfaction factionA becomes friendly to

Definition at line 644 of file SCR_FactionManager.c.

◆ SetFactionsFriendly()

void SetFactionsFriendly ( notnull SCR_Faction factionA,
notnull SCR_Faction factionB,
int playerChanged = -1,
bool updateAIs = true )
protected

Set given factions friendly towards eachother (Replicated if called by server) It is possible to set the same faction friendly towards itself to prevent faction infighting

Parameters
[in]factionAfaction to set friendly to factionB
[in]factionBfaction to set friendly to factionA
[in]playerChangedid of player who changed it to show notification. Leave -1 to not show notification
[in]updateAIsIf true it will update all AI in the world. This is rather expensive so call RequestUpdateAllTargetsFactions() separately to update all AI if setting multiple factions friendly (or hostile)

Definition at line 591 of file SCR_FactionManager.c.

◆ SetFactionsHostile()

void SetFactionsHostile ( notnull SCR_Faction factionA,
notnull SCR_Faction factionB,
int playerChanged = -1,
bool updateAIs = true )
protected

Set given factions hostile towards eachother (Replicated if called by server) It is possible to set the same faction hostile towards itself to allow faction infighting

Parameters
[in]factionAfaction to set hostile to factionB
[in]factionBfaction to set hostile to factionA
[in]playerChangedid of player who changed it to show notification. Leave -1 to not show notification
[in]updateAIsIf true it will update all AI in the world. This is rather expensive so call RequestUpdateAllTargetsFactions() separately to update all AI if setting multiple factions hostile (or friendly)

Definition at line 676 of file SCR_FactionManager.c.

◆ SetFactionTasksEnabled()

void SetFactionTasksEnabled ( notnull SCR_Faction faction,
bool isTasksEnabled )
protected

Set whether a faction should receive tasks/objectives

Parameters
[in]factionfaction to enable/disable tasks for
[in]isTasksEnabledwhether to enable/disable tasks for the faction

Definition at line 550 of file SCR_FactionManager.c.

◆ SetPlayerFaction()

bool SetPlayerFaction ( notnull SCR_ChimeraCharacter character,
notnull Faction faction )
protected
Returns
true if the request went through to the server, otherwise false

Definition at line 202 of file SCR_FactionManager.c.

◆ UpdateCustomLoadoutSupportState()

void UpdateCustomLoadoutSupportState ( SCR_LoadoutManager loadoutMgr)
protected

Forces all factions to reevaluate if they support players saving custom loadouts.

Definition at line 79 of file SCR_FactionManager.c.

◆ UpdatePlayerFaction_S()

void UpdatePlayerFaction_S ( SCR_PlayerFactionAffiliationComponent playerFactionComponent)
protected

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

Parameters
[in]playerFactionComponent

Definition at line 736 of file SCR_FactionManager.c.

◆ ~SCR_FactionManager()

void ~SCR_FactionManager ( )
protected

Definition at line 530 of file SCR_FactionManager.c.

Variable Documentation

◆ m_ChangedFactions

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

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

Definition at line 29 of file SCR_FactionManager.c.

◆ m_MappedPlayerFactionInfo

ref map<int, ref SCR_PlayerFactionInfo> m_MappedPlayerFactionInfo = new map<int, ref SCR_PlayerFactionInfo>()
protected

Local mapping of playerId to player faction info.

Definition at line 32 of file SCR_FactionManager.c.

◆ m_mPendingLimitUpdates

ref map<FactionKey, int> m_mPendingLimitUpdates
protected

Definition at line 45 of file SCR_FactionManager.c.

◆ m_OnFactionTaskEnabledChanged

ref ScriptInvokerFaction m_OnFactionTaskEnabledChanged
protected

Definition at line 39 of file SCR_FactionManager.c.

◆ m_OnPlayerFactionChanged

ref ScriptInvokerBase<SCR_FactionManager_PlayerFactionChanged> m_OnPlayerFactionChanged
protected

Definition at line 42 of file SCR_FactionManager.c.

◆ m_PlayerCount

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

Mapping of faction id : player count.

Definition at line 35 of file SCR_FactionManager.c.

◆ m_PreviousPlayerFactions

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

Map of previous players <playerId : factionIndex>.

Definition at line 26 of file SCR_FactionManager.c.

◆ s_OnPlayerFactionCountChanged

ref ScriptInvoker s_OnPlayerFactionCountChanged = new ScriptInvoker()
protected

Definition at line 38 of file SCR_FactionManager.c.