Enable paying upfront

Fix tab availability on low money

Co-Authored-By: Gustas <37534529+PunkPun@users.noreply.github.com>
This commit is contained in:
N.N
2024-01-10 15:30:52 +01:00
committed by Gustas
parent 2a3271b0d0
commit ccb1bd7a74
4 changed files with 90 additions and 15 deletions

View File

@@ -338,8 +338,11 @@ namespace OpenRA.Mods.Common.Widgets
if (buildable != null)
{
// Queue a new item
if (CurrentQueue.Info.PayUpFront && currentQueue.GetProductionCost(buildable) > CurrentQueue.Actor.Owner.PlayerActor.Trait<PlayerResources>().GetCashAndResources())
return false;
Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Sounds", ClickSound, null);
// Queue a new item
var canQueue = CurrentQueue.CanQueue(buildable, out var notification, out var textNotification);
if (!CurrentQueue.AllQueued().Any())
@@ -366,7 +369,7 @@ namespace OpenRA.Mods.Common.Widgets
Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Sounds", ClickSound, null);
if (CurrentQueue.Info.DisallowPaused || item.Paused || item.Done || item.TotalCost == item.RemainingCost)
if (CurrentQueue.Info.DisallowPaused || item.Paused || item.Done || item.TotalCost == item.RemainingCost || !item.Started)
{
// Instantly cancel items that haven't started, have finished, or if the queue doesn't support pausing
Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", CurrentQueue.Info.CancelledAudio, World.LocalPlayer.Faction.InternalName);