Harvesters deliver to the correct cell, even if it's blocked.

This commit is contained in:
Bob
2009-11-05 13:45:29 +13:00
parent edc4a8e6e7
commit 33e6cb70ea
3 changed files with 28 additions and 9 deletions

View File

@@ -10,10 +10,34 @@ namespace OpenRa.Game.Traits.Activities
public Activity NextActivity { get; set; }
bool isDone;
Actor refinery;
public DeliverOre( Actor refinery )
{
this.refinery = refinery;
}
static readonly int2 refineryDeliverOffset = new int2( 1, 2 );
public void Tick(Actor self, Mobile mobile)
{
if (isDone)
if( self.Location != refinery.Location + refineryDeliverOffset )
{
var move = new Move( refinery.Location + refineryDeliverOffset, 0 );
mobile.InternalSetActivity( move );
mobile.QueueActivity( this );
move.Tick( self, mobile );
return;
}
else if( mobile.facing != 64 )
{
var turn = new Turn( 64 );
mobile.InternalSetActivity( turn );
mobile.QueueActivity( this );
turn.Tick( self, mobile );
return;
}
else if (isDone)
{
var harv = self.traits.Get<Harvester>();