1[
ComponentEditorProps(
category:
"GameScripted/Editor (Editables)", description:
"", icon:
"WBData/ComponentEditorProps/componentEditor.png")]
5 static override bool GetEntitySourceBudgetCost(
IEntityComponentSource editableEntitySource, out notnull array<ref SCR_EntityBudgetValue> budgetValues)
18 protected ref array<ref SCR_ArsenalItemCountConfig> m_MaxCountPerItemType;
39 private bool m_bQueuedSpawnpointChanges =
false;
40 private bool m_bQueuedTaskCountChanged =
false;
45 void SetFactionIndex(
int index)
66 FactionManager factionManager =
GetGame().GetFactionManager();
136 factionManager.SetFactionsFriendly(refFaction, scrFaction, updateAIs:
false);
163 factionManager.SetFactionFriendlyOneWay(scrFaction, refFaction);
190 factionManager.SetFactionsHostile(refFaction, scrFaction, updateAIs:
false);
214 QueueSpawnPointChanged(
m_Faction.GetFactionKey());
220 private void QueueSpawnPointChanged(
FactionKey faction)
223 if(m_bQueuedSpawnpointChanges)
226 m_bQueuedSpawnpointChanges =
true;
235 if (factionKey !=
m_Faction.GetFactionKey())
238 QueueSpawnPointChanged(factionKey);
247 m_bQueuedSpawnpointChanges =
false;
265 if (spawnPointCount == 0)
268 SCR_NotificationsComponent.SendToUnlimitedEditorPlayers(
ENotification.EDITOR_FACTION_NO_SPAWNS, thisRplId);
295 array<SCR_Task> tasks = {};
327 if(m_bQueuedTaskCountChanged)
337 array<string> factionKeys =
task.GetOwnerFactionKeys();
338 if (factionKeys.IsEmpty() || !factionKeys.Contains(
m_Faction.GetFactionKey()))
341 m_bQueuedTaskCountChanged =
true;
352 m_bQueuedTaskCountChanged =
false;
358 array<SCR_Task> tasks = {};
361 int tasksCount = tasks.Count();
459 override bool CanDuplicate(out notnull set<SCR_EditableEntityComponent> outRecipients)
486 super.OnPostInit(owner);
496 if (!super.RplSave(writer))
518 array<Faction> factions = {};
519 factionManager.GetFactionsList(factions);
527 int factionsCount = 0;
528 foreach (
Faction faction : factions)
536 writer.WriteInt(factionsCount);
539 foreach (
Faction faction : factions)
546 writer.WriteBool(isFriendly);
555 if (!super.RplLoad(reader))
558 int spawnPointCount, taskCount;
562 reader.ReadInt(spawnPointCount);
563 reader.ReadInt(taskCount);
564 reader.ReadBool(isPlayable);
571 int factionsCntServer = 0;
572 reader.ReadInt(factionsCntServer);
573 if (factionsCntServer == 0)
581 for (
int i=0; i<factionsCntServer; ++i)
582 reader.ReadBool(dummy);
592 for (
int i=0; i<factionsCntServer; ++i)
593 reader.ReadBool(dummy);
598 array<Faction> factions = {};
599 factionManager.GetFactionsList(factions);
600 int factionManagerFactionCnt = factions.Count();
601 if (factionManagerFactionCnt != factionsCntServer)
603 Print(
string.Format(
"Factions count mismatch. Local:%1, server:%2", factionManagerFactionCnt, factionsCntServer),
LogLevel.WARNING);
607 for (
int i=0; i<factionsCntServer; ++i)
608 reader.ReadBool(dummy);
618 foreach (
Faction faction : factions)
627 if (factionsCnt != factionsCntServer)
629 Print(
string.Format(
"SCR_Faction factions count mismatch. Local:%1, server:%2", factionsCnt, factionsCntServer),
LogLevel.WARNING);
633 for (
int i=0; i<factionsCntServer; ++i)
634 reader.ReadBool(dummy);
640 foreach (
Faction faction : factions)
646 reader.ReadBool(isFriendly);
649 factionManager.SetFactionFriendlyOneWay(factionRef, scrFaction);
651 factionManager.SetFactionsHostile(factionRef, scrFaction);
string FactionKey
Faction unique identifier type.
ArmaReforgerScripted GetGame()
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
ref SCR_HintUIInfo m_Info
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
void SetAllowedArsenalItemTypes(SCR_EArsenalItemType allowedArsenalItemTypes)
void QueueTaskCountChanges(notnull SCR_Task task)
void OnFactionplayableChangedBroadcast(bool factionPlayable)
void OnTaskAdded(notnull SCR_Task task)
void OnSpawnPointsChanged(string factionKey)
void OnTaskCountChanged()
void SetFactionHostileBroadcast(int FactionIndex)
void InitTaskCountBroadcast(int factionTaskCount)
ref ScriptInvoker Event_OnSpawnPointCountChanged
void SetFactionFriendly_S(int FactionIndex)
void SetFactionFriendlyOneWay_S(int FactionIndex)
void SetFactionHostile_S(int FactionIndex)
void RpcDo_SetFactionFriendlyOneWayBroadcast(int FactionIndex)
void OnTaskCountChangedBroadcast(int factionTaskCount)
ref map< SCR_EArsenalItemType, int > m_aCurrentItemTaken
void ~SCR_EditableFactionComponent()
ScriptInvoker GetOnSpawnPointCountChanged()
SCR_EArsenalItemType m_AllowedArsenalItemTypes
void SetFactionFriendlyBroadcast(int FactionIndex)
ref ScriptInvoker Event_OnTaskCountChanged
void InitSpawnPointCount()
void ProcessQueuedSpawnPointChanges()
int GetFactionSpawnPointCount()
void OnTaskRemoved(notnull SCR_Task task)
SCR_EArsenalItemType GetAllowedArsenalItemTypes()
int GetFactionTasksCount()
ScriptInvoker GetOnTaskCountChanged()
void InitSpawnPointCountBroadcast(int spawnPointCount)
void OnSpawnPointCountChanged(string factionKey)
void OnSpawnpointFactionChanged(SCR_SpawnPoint spawnPoint)
void SetFactionIndexBroadcast(int index)
void SetFactionPlayableServer(bool factionPlayable)
void OnSpawnPointCountChangedBroadcast(int spawnPointCount)
void SCR_FactionManager(IEntitySource src, IEntity parent)
void SCR_Task(IEntitySource src, IEntity parent)
void Rpc(func method, void p0=NULL, void p1=NULL, void p2=NULL, void p3=NULL, void p4=NULL, void p5=NULL, void p6=NULL, void p7=NULL)
proto external EntityFlags SetFlags(EntityFlags flags, bool recursively=false)
void SetFactionDelegate(Faction faction, SCR_EditableFactionComponent delegate)
static SCR_DelegateFactionManagerComponent GetInstance()
void SetVisible(bool show)
void SetInfoInstance(SCR_UIInfo info)
bool GetPos(out vector pos)
override bool RplLoad(ScriptBitReader reader)
bool CanDuplicate(out notnull set< SCR_EditableEntityComponent > outRecipients)
override bool RplSave(ScriptBitWriter writer)
bool GetEntityBudgetCost(out notnull array< ref SCR_EntityBudgetValue > outBudgets, IEntity owner=null)
override bool DoCheckIfFactionFriendly(Faction faction)
Spawn point entity defines positions on which players can possibly spawn.
static SCR_UIInfo CreateInfo(UIInfo source)
IEntity GetOwner()
Owner entity of the fuel tank.
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
SCR_FieldOfViewSettings Attribute
EntityFlags
Various entity flags.
void RplRpc(RplChannel channel, RplRcver rcver, RplCondition condition=RplCondition.None, string customConditionName="")
RplChannel
Communication channel. Reliable is guaranteed to be delivered. Unreliable not.