6class SCR_CharacterFactionAffiliationComponent : FactionAffiliationComponent
10 [
RplProp(onRplName:
"OnPerceivedFactionChanged")]
15 protected ref set<SCR_OutfitFactionDataHolder>
m_CurrentOutfitData =
new set<SCR_OutfitFactionDataHolder>();
64 return outfitFactionValues.Count();
73 return outfitFactionData.Count();
115 array<SCR_OutfitFactionData> outfitDataArray = {};
119 foreach (SCR_OutfitFactionData
data : outfitDataArray)
121 if (!
data || !
data.GetAffiliatedFaction())
171 array<SCR_OutfitFactionData> outfitDataArray = {};
175 foreach (SCR_OutfitFactionData
data : outfitDataArray)
177 if (!
data || !
data.GetAffiliatedFaction())
208 FactionManager factionManager =
GetGame().GetFactionManager();
219 array<SCR_OutfitFactionData> outfitDataArray = {};
244 foreach (SCR_OutfitFactionData
data : outfitDataArray)
246 if (!
data || !
data.GetAffiliatedFaction())
267 Debug.Error2(
"SCR_CharacterFactionAffiliationComponent",
"ChangeFactionOutfitValue trying to add a new faction unform value for '" + faction +
"' but the given value is less than 0!");
278 Debug.Error2(
"SCR_CharacterFactionAffiliationComponent",
"ChangeFactionOutfitValue trying to set a new Outfit value for '" + faction +
"' but the total value became less than 0!");
298 if (!characterStorage)
302 array<typename> blockedSlots = {};
339 array<Faction> highestFactionValues = {};
340 int highestValue = -1;
346 if (highestValue < 0)
348 highestFactionValues.Insert(faction);
349 highestValue = value;
354 if (value > highestValue)
356 highestFactionValues.Clear();
357 highestFactionValues.Insert(faction);
358 highestValue = value;
363 if (value == highestValue)
365 highestFactionValues.Insert(faction);
370 if (highestFactionValues.IsEmpty())
373 FactionManager factionManager =
GetGame().GetFactionManager();
378 if (highestFactionValues.Count() == 1)
379 return factionManager.GetFactionIndex(highestFactionValues[0]);
384 if (defaultFaction && highestFactionValues.Contains(defaultFaction))
385 return factionManager.GetFactionIndex(defaultFaction);
393 foreach (
Faction faction : highestFactionValues)
395 if (!factionCandidate)
397 factionCandidate = faction;
398 scrfactionCandidate =
SCR_Faction.Cast(factionCandidate);
403 if (scrDefaultFaction)
406 if (scrDefaultFaction.IsFactionFriendly(factionCandidate) && scrDefaultFaction.IsFactionEnemy(faction))
408 factionCandidate = faction;
414 if (scrfactionCandidate)
422 factionCandidate = faction;
429 return factionManager.GetFactionIndex(factionCandidate);
540 if (scrAffiliatedFaction)
617 Print(
"SCR_CharacterFactionAffiliationComponent: InitPlayerOutfitFaction, Could not find SCR_PerceivedFactionManagerComponent!",
LogLevel.WARNING);
628 if (!characterInventoryComponent)
630 Print(
"SCR_CharacterFactionAffiliationComponent: InitPlayerOutfitFaction, Could not find SCR_CharacterInventoryStorageComponent!",
LogLevel.ERROR);
ArmaReforgerScripted GetGame()
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
SCR_CacheNoteComponentClass ScriptComponentClass RplProp()] protected ref array< string > m_aLines
int GetCharacterOutfitValues(out notnull map< Faction, int > outfitFactionValues)
Faction GetPerceivedFaction()
int GetCharacterOutfitData(out notnull set< SCR_OutfitFactionDataHolder > outfitFactionData)
paramp[out] Get Set of all outfit data. This data
bool HasPerceivedFaction()
ref OnFactionChangedInvoker m_OnFactionChangedInvoker
void SetPerceivedFaction_S(int OutfitFaction)
int m_iOutfitFactionIndex
void DisableUpdatingPerceivedFaction_S()
Disables perceived faction from updating after the character is destroyed or dead.
void AddFactionOutfitValue(notnull Faction faction, int value, bool updateFaction=true)
OnFactionChangedInvoker GetOnFactionChanged()
SCR_PerceivedFactionManagerComponent m_PerceivedManager
void OnPerceivedFactionOutfitTypeChanged(SCR_EPerceivedFactionOutfitType newType)
SCR_ECharacterDisguiseType m_eDisguiseType
bool IsCharacterWearingFullOutfit()
ScriptInvokerFaction GetOnOnPerceivedFactionChanged()
void OnPerceivedFactionChangesAffectsAIChanged(bool affectsAI)
void InitPlayerOutfitFaction_S()
Called by SCR_PerceivedFactionManagerComponent when player is spawned. Is not called for Non-Players.
void DisableUpdatingPerceivedFaction()
ref set< SCR_OutfitFactionDataHolder > m_CurrentOutfitData
bool m_bHasPerceivedFaction
void OnPerceivedFactionChanged()
void RecalculateOutfitFaction()
Recalculates the perceived faction. Called when the Pervceived faction type is changed and after init...
PerceivableComponent m_PerceivableComponent
void OnNoFactionSlottedItemChanged(bool addedToSlot, IEntity item, bool updateFaction=true)
void SetPerceivedFactionForAI(bool resetToNull=false)
SCR_ECharacterDisguiseType GetCharacterDisguiseType()
int CalculatePerceivedFactionIndex()
ref map< Faction, int > m_mOutfitFactionValues
SCR_CharacterFactionAffiliationComponentClass m_PerceivedFaction
void ~SCR_CharacterFactionAffiliationComponent()
void ChangeFactionOutfitValue(Faction faction, int value, bool updateFaction=true)
ref ScriptInvokerFaction m_OnPerceivedFactionChanged
void RemoveFactionOutfitValue(notnull Faction faction, int value, bool updateFaction=true)
void InitPlayerOutfitFaction()
SCR_ECharacterDisguiseType
Get all prefabs that have the spawner data
ScriptInvokerBase< OnFactionChangeDelegate > OnFactionChangedInvoker
SCR_EPerceivedFactionOutfitType
void OnPerceivedFactionChangesAffectsAIChanged()
void OnPerceivedFactionOutfitTypeChanged()
void SCR_PerceivedFactionManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
ScriptInvokerBase< ScriptInvokerFactionMethod > ScriptInvokerFaction
void GetBlockedSlots(out notnull array< typename > blockedSlots)
void InitCharacterPerceivedOutfitData(notnull SCR_CharacterFactionAffiliationComponent characterAffiliationComponent)
override bool DoCheckIfFactionFriendly(Faction faction)
SCR_OutfitFactionData GetOutfitFactionData(FactionKey faction)
int GetOutfitFactionDataArray(out notnull array< SCR_OutfitFactionData > outfitDataArray)
static IEntity GetLocalMainEntity()
IEntity GetOwner()
Owner entity of the fuel tank.
SCR_CampaignFaction GetAffiliatedFaction()
Returns the affiliated faction or null if none.
proto external Faction GetDefaultAffiliatedFaction()
Returns the default affiliated faction or null if none.
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
void RplRpc(RplChannel channel, RplRcver rcver, RplCondition condition=RplCondition.None, string customConditionName="")
RplChannel
Communication channel. Reliable is guaranteed to be delivered. Unreliable not.