diff --git a/OpenRA.Mods.Common/Traits/Buildings/Refinery.cs b/OpenRA.Mods.Common/Traits/Buildings/Refinery.cs index e1d33418da..b444668176 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Refinery.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Refinery.cs @@ -35,6 +35,9 @@ namespace OpenRA.Mods.Common.Traits [Desc("In how many steps to perform the dragging?")] public readonly int DragLength = 0; + [Desc("Discard resources once silo capacity has been reached.")] + public readonly bool DiscardExcessResources = false; + public readonly bool ShowTicks = true; public readonly int TickLifetime = 30; public readonly int TickVelocity = 2; @@ -84,10 +87,12 @@ namespace OpenRA.Mods.Common.Traits .Where(a => a.Trait.LinkedProc == self); } - public bool CanGiveResource(int amount) { return playerResources.CanGiveResources(amount); } + public bool CanGiveResource(int amount) { return info.DiscardExcessResources || playerResources.CanGiveResources(amount); } public void GiveResource(int amount) { + if (info.DiscardExcessResources) + amount = Math.Min(amount, playerResources.ResourceCapacity - playerResources.Resources); playerResources.GiveResources(amount); if (info.ShowTicks) currentDisplayValue += amount; diff --git a/mods/ts/rules/shared-structures.yaml b/mods/ts/rules/shared-structures.yaml index 53673819e4..f90ab5ed2b 100644 --- a/mods/ts/rules/shared-structures.yaml +++ b/mods/ts/rules/shared-structures.yaml @@ -76,6 +76,7 @@ PROC: TiberianSunRefinery: DockAngle: 160 DockOffset: 2,1 + DiscardExcessResources: true StoresResources: PipColor: Green PipCount: 15