7 protected int m_iPlayersWillBeKilled = 0;
8 protected ref array<int> m_aStartingDisabledFactions = {};
10 protected FactionManager m_FactionManager;
14 protected SCR_RespawnSystemComponent m_RespawnSystemComponent;
20 super.InitDynamicDescription(attribute);
24 Print(
"'SCR_PlayableFactionDisabledAttributeDynamicDescription' is not attached to the 'SCR_PlayableFactionEditorAttribute' nor 'SCR_PlayableFactionsEditorAttribute'!", LogLevel.ERROR);
33 Print(
"'SCR_PlayableFactionDisabledAttributeDynamicDescription' is used for 'SCR_PlayableFactionsEditorAttribute' but attribute UI does not inherent from SCR_ButtonBoxAttributeUIComponent!", LogLevel.ERROR);
37 m_ToolBoxComponent = buttonBoxUI.GetToolboxComponent();
38 if (!m_ToolBoxComponent)
40 Print(
"'SCR_PlayableFactionDisabledAttributeDynamicDescription' is used for 'SCR_PlayableFactionsEditorAttribute' but could not find SCR_ToolboxComponent!", LogLevel.ERROR);
44 m_ButtonBoxData = buttonBoxUI.GetButtonBoxData();
47 Print(
"'SCR_PlayableFactionDisabledAttributeDynamicDescription' is used for 'SCR_PlayableFactionsEditorAttribute' but could not find m_ButtonBoxData!", LogLevel.ERROR);
58 if (!m_PlayerDelegateManager)
62 m_aStartingDisabledFactions.Clear();
63 GetDisabledFactions(attribute, m_aStartingDisabledFactions);
69 if (!super.IsValid(attribute, attributeUi))
80 if (!m_ToolBoxComponent || !m_ButtonBoxData)
87 UpdateTotalToBeKilledPlayers(attribute);
89 return m_iPlayersWillBeKilled > 0;
95 UpdateTotalToBeKilledPlayers(attribute);
97 uiInfo = m_DescriptionDisplayInfo;
98 param1 = m_iPlayersWillBeKilled.ToString();
104 array<int> disabledFactions = {};
105 m_iPlayersWillBeKilled = 0;
112 GetDisabledFactions(attribute, disabledFactions);
116 if (!disabledFactions.IsEmpty())
122 array<int> players =
new array<int>;
123 GetGame().GetPlayerManager().GetPlayers(players);
124 SCR_EditablePlayerDelegateComponent playerEditorDelegate;
126 foreach (
int playerId: players)
129 if(!SCR_PossessingManagerComponent.GetPlayerMainEntity(playerId))
132 playerFaction = factionManager.GetPlayerFaction(playerId);
136 int factionIndex = factionManager.GetFactionIndex(playerFaction);
138 if (!disabledFactions.Contains(factionIndex) || m_aStartingDisabledFactions.Contains(factionIndex))
153 m_iPlayersWillBeKilled++;
168 vector value = var.GetVector();
171 disabledFactions.Insert((
int)value[1]);
180 int count = m_ButtonBoxData.GetValueCount();
186 for(
int i = 0; i < count; i++)
188 if (!m_ToolBoxComponent.IsItemSelected(i))
190 factionIndex = m_ButtonBoxData.GetEntryFloatValue(i);
197 if (scrFaction && scrFaction.IsPlayable())
198 disabledFactions.Insert(factionIndex);