13 protected static const int UNLIMITED_PROP_BUDGET = -1;
19 m_CampaignBuildingComponent = SCR_CampaignBuildingEditorComponent.Cast(FindEditorComponent(SCR_CampaignBuildingEditorComponent,
true,
true));
25 array<ref SCR_RankID> ranks = factionManager.GetAllAvailableRanks();
31 SCR_RankID highestRankID = ranks[ranks.Count() - 1];
43 m_CampaignBuildingComponent = SCR_CampaignBuildingEditorComponent.Cast(FindEditorComponent(SCR_CampaignBuildingEditorComponent,
true,
true));
73 [
Obsolete(
"SCR_CampaignBuildingBudgetEditorComponent.RefreshResourcesComponent() should be used instead.")]
107 [
Obsolete(
"SCR_CampaignBuildingBudgetEditorComponent.OnBaseResourcesChanged() should be used instead.")]
130 maxBudget = consumer.GetAggregatedMaxResourceValue();
159 AIWorld aiWorld =
GetGame().GetAIWorld();
163 maxBudget = aiWorld.GetLimitOfActiveAIs();
174 if (!providerComponent)
187 return consumer.GetAggregatedMaxResourceValue() - consumer.GetAggregatedResourceValue();
196 return providerComponent.GetCurrentPropValue();
202 return providerComponent.GetCurrentAIValue();
205 AIWorld aiWorld =
GetGame().GetAIWorld();
209 return aiWorld.GetCurrentNumOfActiveAIs();
220 return UNLIMITED_PROP_BUDGET;
223 if (!providerComponent)
224 return UNLIMITED_PROP_BUDGET;
226 return providerComponent.GetMaxBudgetValue(budget);
237 if (!providerComponent)
243 return providerComponent.HasCooldownSet(m_Manager.GetPlayerID());
253 if (!providerComponent)
256 return providerComponent.GetCooldownValue(m_Manager.GetPlayerID());
265 PlayerController playerController =
GetGame().GetPlayerManager().GetPlayerController(playerId);
266 if (!playerController)
273 [
RplRpc(RplChannel.Reliable, RplRcver.Owner)]
291 if (consumer.GetAggregatedResourceValue() - budgetChange <= 0)
292 Event_OnBudgetMaxReached.Invoke(entityBudget,
true);
307 SCR_CampaignBuildingProviderComponent providerComponent = SCR_CampaignBuildingProviderComponent.Cast(
m_CampaignBuildingComponent.GetProviderComponent());
308 if (!providerComponent)
311 array<ref EEditableEntityBudget> budgetsType = {};
312 providerComponent.GetBudgetTypesToEvaluate(budgetsType);
316 for (
int i = budgetsType.Count() - 1; i >= 0; i--)
323 m_BudgetSettingsMap.Insert(budgetType, budget);
332 bool canPlace =
true;
335 array<ref SCR_EntityBudgetValue> budgetCosts = {};
336 if (!GetEntitySourcePreviewBudgetCosts(editableEntitySource, budgetCosts))
344 UpdatePreviewCost(budgetCosts);
346 canPlace = canPlace &&
CanPlace(budgetCosts, blockingBudget);
354 if (showNotification)
365 [
RplRpc(RplChannel.Reliable, RplRcver.Owner)]
370 switch (blockingBudget)
374 GetManager().SendNotification(
ENotification.EDITOR_PLACING_NO_ENOUGH_SUPPLIES);
392 GetManager().SendNotification(
ENotification.EDITOR_PLACING_NO_MORE_COMPOSITIONS_AT_BASE);
404 SCR_NotificationsComponent.SendLocal(
ENotification.EDITOR_AILIMIT);
410 SCR_NotificationsComponent.SendLocal(
ENotification.EDITOR_PLACING_BUDGET_MAX);
422 if (maxBudget.GetBudgetType() !=
type)
438 newMaxBudget = consumer.GetAggregatedResourceValue();
474 AIWorld aiWorld =
GetGame().GetAIWorld();
478 newMaxBudget = aiWorld.GetLimitOfActiveAIs();
483 maxBudget.SetBudgetValue(newMaxBudget);
499 array<EEditableEntityBudget> blockingBudgets = {};
500 int initialPriorityOrder = -1;
505 if (!
CanPlace(budgetCost, blockingBudget))
515 if (!budgetUIInfo && initialPriorityOrder == -1)
517 blockingBudgetCandidate = blockingBudget;
525 if (initialPriorityOrder < budgetUIInfo.GetPriorityOrder())
527 blockingBudgetCandidate = blockingBudget;
528 initialPriorityOrder = budgetUIInfo.GetPriorityOrder();
534 if (blockingBudgetCandidate == -1)
537 blockingBudget = blockingBudgetCandidate;
552 if (!providerComponent)
555 return providerComponent.IsBudgetToEvaluate(blockingBudget);
567 entityUIInfo.GetEntityAndChildrenBudgetCost(budgetCosts);
569 if (!entityUIInfo.GetEntityBudgetCost(budgetCosts))
570 GetEntityTypeBudgetCost(entityUIInfo.GetEntityType(), budgetCosts);
574 array<ref SCR_EntityBudgetValue> entityChildrenBudgetCosts = {};
576 if (!entityUIInfo.GetEntityBudgetCost(budgetCosts))
577 GetEntityTypeBudgetCost(entityUIInfo.GetEntityType(), budgetCosts);
579 entityUIInfo.GetEntityChildrenBudgetCost(entityChildrenBudgetCosts);
584 FilterAvailableBudgets(budgetCosts);