Implement Harvester>BaleUnloadAmount
This commit is contained in:
committed by
Paul Chote
parent
a7702a8ecd
commit
0b0b82bd43
@@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Activities;
|
using OpenRA.Activities;
|
||||||
@@ -38,6 +39,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("How fast it can dump it's carryage.")]
|
[Desc("How fast it can dump it's carryage.")]
|
||||||
public readonly int BaleUnloadDelay = 4;
|
public readonly int BaleUnloadDelay = 4;
|
||||||
|
|
||||||
|
[Desc("How many bales can it dump at once.")]
|
||||||
|
public readonly int BaleUnloadAmount = 1;
|
||||||
|
|
||||||
[Desc("How many squares to show the fill level.")]
|
[Desc("How many squares to show the fill level.")]
|
||||||
public readonly int PipCount = 7;
|
public readonly int PipCount = 7;
|
||||||
|
|
||||||
@@ -323,11 +327,15 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
var type = contents.First().Key;
|
var type = contents.First().Key;
|
||||||
var iao = proc.Trait<IAcceptResources>();
|
var iao = proc.Trait<IAcceptResources>();
|
||||||
if (!iao.CanGiveResource(type.ValuePerUnit))
|
var count = Math.Min(contents[type], Info.BaleUnloadAmount);
|
||||||
|
var value = type.ValuePerUnit * count;
|
||||||
|
|
||||||
|
if (!iao.CanGiveResource(value))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
iao.GiveResource(type.ValuePerUnit);
|
iao.GiveResource(value);
|
||||||
if (--contents[type] == 0)
|
contents[type] -= count;
|
||||||
|
if (contents[type] == 0)
|
||||||
contents.Remove(type);
|
contents.Remove(type);
|
||||||
|
|
||||||
currentUnloadTicks = Info.BaleUnloadDelay;
|
currentUnloadTicks = Info.BaleUnloadDelay;
|
||||||
|
|||||||
Reference in New Issue
Block a user