Re-implement the insufficient funds warning in a simpler manner
This commit is contained in:
@@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", repairsUnits.StartRepairingNotification, self.Owner.Faction.InternalName);
|
||||
}
|
||||
|
||||
if (!self.Owner.PlayerActor.Trait<PlayerResources>().TakeCash(cost))
|
||||
if (!self.Owner.PlayerActor.Trait<PlayerResources>().TakeCash(cost, true))
|
||||
{
|
||||
remainingTicks = 1;
|
||||
return this;
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var cost = Math.Max(1, (hpToRepair * Info.RepairPercent * buildingValue) / (health.MaxHP * 100));
|
||||
|
||||
// TakeCash will return false if the player can't pay, and will stop him from contributing this Tick
|
||||
var activePlayers = Repairers.Count(player => player.PlayerActor.Trait<PlayerResources>().TakeCash(cost));
|
||||
var activePlayers = Repairers.Count(player => player.PlayerActor.Trait<PlayerResources>().TakeCash(cost, true));
|
||||
|
||||
RepairActive = activePlayers > 0;
|
||||
|
||||
|
||||
@@ -458,7 +458,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
var costThisFrame = RemainingCost / RemainingTime;
|
||||
if (costThisFrame != 0 && !pr.TakeCash(costThisFrame))
|
||||
if (costThisFrame != 0 && !pr.TakeCash(costThisFrame, true))
|
||||
return;
|
||||
|
||||
RemainingCost -= costThisFrame;
|
||||
|
||||
Reference in New Issue
Block a user