Optionally discard resources when silo capacity has been reached
This commit is contained in:
@@ -35,6 +35,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("In how many steps to perform the dragging?")]
|
[Desc("In how many steps to perform the dragging?")]
|
||||||
public readonly int DragLength = 0;
|
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 bool ShowTicks = true;
|
||||||
public readonly int TickLifetime = 30;
|
public readonly int TickLifetime = 30;
|
||||||
public readonly int TickVelocity = 2;
|
public readonly int TickVelocity = 2;
|
||||||
@@ -84,10 +87,12 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
.Where(a => a.Trait.LinkedProc == self);
|
.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)
|
public void GiveResource(int amount)
|
||||||
{
|
{
|
||||||
|
if (info.DiscardExcessResources)
|
||||||
|
amount = Math.Min(amount, playerResources.ResourceCapacity - playerResources.Resources);
|
||||||
playerResources.GiveResources(amount);
|
playerResources.GiveResources(amount);
|
||||||
if (info.ShowTicks)
|
if (info.ShowTicks)
|
||||||
currentDisplayValue += amount;
|
currentDisplayValue += amount;
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ PROC:
|
|||||||
TiberianSunRefinery:
|
TiberianSunRefinery:
|
||||||
DockAngle: 160
|
DockAngle: 160
|
||||||
DockOffset: 2,1
|
DockOffset: 2,1
|
||||||
|
DiscardExcessResources: true
|
||||||
StoresResources:
|
StoresResources:
|
||||||
PipColor: Green
|
PipColor: Green
|
||||||
PipCount: 15
|
PipCount: 15
|
||||||
|
|||||||
Reference in New Issue
Block a user