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

Go to the source code of this file.

Data Structures

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. More...
 
ScriptInvoker GetOnPlayerFactionCountChanged ()
 
ScriptInvokerBase< SCR_FactionManager_PlayerFactionChangedGetOnPlayerFactionChanged_S ()
 return Script invoker on player faction changed (Server only) More...
 
protected void OnPlayerFactionInfoChanged ()
 Update local player faction mapping. More...
 
protected void OnPlayerFactionSet_S (SCR_PlayerFactionAffiliationComponent playerComponent, Faction faction)
 
protected void OnPlayerFactionCountChanged (Faction faction, int newCount)
 
Faction GetPlayerFaction (int playerId)
 
Faction GetLocalPlayerFaction ()
 
int GetFactionPlayerCount (Faction faction)
 
int GetSortedFactionsList (out notnull SCR_SortedArray< SCR_Faction > outFactions)
 
SCR_RankID GetRankByID (SCR_ECharacterRank rankID)
 
array< ref SCR_RankID > GetAllAvailableRanks ()
 
bool IsRankRenegade (SCR_ECharacterRank rankID)
 
int GetRequiredRankXP (SCR_ECharacterRank rankID)
 
protected SCR_ECharacterRank GetRenegadeRank ()
 
SCR_ECharacterRank GetRankByXP (int XP)
 
SCR_ECharacterRank GetRankNext (SCR_ECharacterRank rank)
 
SCR_ECharacterRank GetRankPrev (SCR_ECharacterRank rank)
 
override void EOnInit (IEntity owner)
 
void SCR_FactionManager (IEntitySource src, IEntity parent)
 
void ~SCR_FactionManager ()
 
bool CanChangeFactionsPlayable ()
 
void SetFactionsFriendly (notnull SCR_Faction factionA, notnull SCR_Faction factionB, int playerChanged=-1)
 
void SetFactionsHostile (notnull SCR_Faction factionA, notnull SCR_Faction factionB, int playerChanged=-1)
 
void UpdatePlayerFaction_S (SCR_PlayerFactionAffiliationComponent playerFactionComponent)
 
protected void OnPlayerDisconnected (int playerId, KickCauseCode cause, int timeout)
 

Variables

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

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 11 of file SCR_FactionManager.c.

◆ CanChangeFactionsPlayable()

bool CanChangeFactionsPlayable ( )

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

Returns
True when playable

Definition at line 504 of file SCR_FactionManager.c.

◆ GetAllAvailableRanks()

array<ref SCR_RankID> GetAllAvailableRanks ( )
Returns

Definition at line 266 of file SCR_FactionManager.c.

◆ GetFactionPlayerCount()

int GetFactionPlayerCount ( Faction  faction)

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 215 of file SCR_FactionManager.c.

◆ GetLocalPlayerFaction()

Faction GetLocalPlayerFaction ( )

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 190 of file SCR_FactionManager.c.

◆ GetOnPlayerFactionChanged_S()

ScriptInvokerBase<SCR_FactionManager_PlayerFactionChanged> GetOnPlayerFactionChanged_S ( )

return Script invoker on player faction changed (Server only)

Definition at line 53 of file SCR_FactionManager.c.

◆ GetOnPlayerFactionCountChanged()

ScriptInvoker GetOnPlayerFactionCountChanged ( )
Returns

Definition at line 43 of file SCR_FactionManager.c.

◆ GetPlayerFaction()

Faction GetPlayerFaction ( int  playerId)

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 161 of file SCR_FactionManager.c.

◆ GetRankByID()

SCR_RankID GetRankByID ( SCR_ECharacterRank  rankID)
Parameters
[in]rankID
Returns

Definition at line 250 of file SCR_FactionManager.c.

◆ GetRankByXP()

SCR_ECharacterRank GetRankByXP ( int  XP)
Parameters
[in]XP
Returns

Definition at line 318 of file SCR_FactionManager.c.

◆ GetRankNext()

SCR_ECharacterRank GetRankNext ( SCR_ECharacterRank  rank)
Parameters
[in]rank
Returns
the next higher rank

Definition at line 343 of file SCR_FactionManager.c.

◆ GetRankPrev()

SCR_ECharacterRank GetRankPrev ( SCR_ECharacterRank  rank)
Parameters
[in]rank
Returns
the next lower rank

Definition at line 370 of file SCR_FactionManager.c.

◆ GetRenegadeRank()

protected SCR_ECharacterRank GetRenegadeRank ( )

Definition at line 304 of file SCR_FactionManager.c.

◆ GetRequiredRankXP()

int GetRequiredRankXP ( SCR_ECharacterRank  rankID)
Parameters
[in]rankID
Returns

Definition at line 293 of file SCR_FactionManager.c.

◆ GetSortedFactionsList()

int GetSortedFactionsList ( out notnull SCR_SortedArray< SCR_Faction outFactions)

Get factions sorted according to their own custom order.

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

Definition at line 242 of file SCR_FactionManager.c.

◆ IsRankRenegade()

bool IsRankRenegade ( SCR_ECharacterRank  rankID)
Parameters
[in]rankID
Returns

Definition at line 280 of file SCR_FactionManager.c.

◆ OnPlayerFactionCountChanged()

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

Definition at line 142 of file SCR_FactionManager.c.

◆ OnPlayerFactionInfoChanged()

protected void OnPlayerFactionInfoChanged ( )

Update local player faction mapping.

Definition at line 63 of file SCR_FactionManager.c.

◆ OnPlayerFactionSet_S()

protected void OnPlayerFactionSet_S ( SCR_PlayerFactionAffiliationComponent  playerComponent,
Faction  faction 
)

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

Definition at line 124 of file SCR_FactionManager.c.

◆ SCR_FactionManager()

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

Definition at line 461 of file SCR_FactionManager.c.

◆ SCR_FactionManager_PlayerFactionChanged()

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

◆ SetFactionsFriendly()

void SetFactionsFriendly ( notnull SCR_Faction  factionA,
notnull SCR_Faction  factionB,
int  playerChanged = -1 
)

Set given factions friendly towards eachother (Server Only) 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

Definition at line 517 of file SCR_FactionManager.c.

◆ SetFactionsHostile()

void SetFactionsHostile ( notnull SCR_Faction  factionA,
notnull SCR_Faction  factionB,
int  playerChanged = -1 
)

Set given factions hostile towards eachother (Server Only) 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

Definition at line 550 of file SCR_FactionManager.c.

◆ UpdatePlayerFaction_S()

void UpdatePlayerFaction_S ( SCR_PlayerFactionAffiliationComponent  playerFactionComponent)

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

Parameters
[in]playerFactionComponent

Definition at line 591 of file SCR_FactionManager.c.

◆ ~SCR_FactionManager()

void ~SCR_FactionManager ( )

Definition at line 493 of file SCR_FactionManager.c.

Variable Documentation

◆ m_ChangedFactions

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

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

Definition at line 28 of file SCR_FactionManager.c.

◆ m_MappedPlayerFactionInfo

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

Local mapping of playerId to player faction info.

Definition at line 31 of file SCR_FactionManager.c.

◆ m_OnPlayerFactionChanged_S

protected ref ScriptInvokerBase<SCR_FactionManager_PlayerFactionChanged> m_OnPlayerFactionChanged_S

Definition at line 39 of file SCR_FactionManager.c.

◆ m_PlayerCount

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

Mapping of faction id : player count.

Definition at line 34 of file SCR_FactionManager.c.

◆ m_PreviousPlayerFactions

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

Map of previous players <playerId : factionIndex>.

Definition at line 25 of file SCR_FactionManager.c.

◆ s_OnPlayerFactionCountChanged

protected ref ScriptInvoker s_OnPlayerFactionCountChanged = new ScriptInvoker()

Definition at line 37 of file SCR_FactionManager.c.