harvest order wired into harvester. crashes with noti since the matching activity is noti.

This commit is contained in:
Chris Forbes
2009-11-03 18:21:02 +13:00
parent 1cb3f1ee10
commit d2ddd40902
4 changed files with 21 additions and 5 deletions

View File

@@ -7,14 +7,22 @@ namespace OpenRa.Game.Traits
{
class Harvester : IOrder
{
const int capacity = 28;
int oreCarried = 0; /* sum of these must not exceed capacity */
int gemsCarried = 0;
bool IsFull { get { return oreCarried + gemsCarried == capacity; } }
bool IsEmpty { get { return oreCarried == 0 && gemsCarried == 0; } }
public Order Order(Actor self, int2 xy, bool lmb, Actor underCursor)
{
if (underCursor != null
&& underCursor.Owner == self.Owner
&& underCursor.traits.Contains<AcceptsOre>())
&& underCursor.traits.Contains<AcceptsOre>() && !IsEmpty)
return OpenRa.Game.Order.DeliverOre(self, underCursor);
/* todo: harvest order when on ore */
if (underCursor == null && Game.map.ContainsResource(xy) && !IsFull)
return OpenRa.Game.Order.Harvest(self, xy);
return null;
}