Harvesters return to last used field
This commit is contained in:
@@ -58,6 +58,8 @@ namespace OpenRA.Mods.Cnc
|
||||
harv.QueueActivity( new CallFunc( () => harvester.Visible = true, false ) );
|
||||
harv.QueueActivity( new Drag(endDock, startDock, 12) );
|
||||
harv.QueueActivity( new CallFunc( () => dockedHarv = null, false ) );
|
||||
if (harvester.LastHarvestedCell != int2.Zero)
|
||||
harv.QueueActivity( new Move(harvester.LastHarvestedCell, 5) );
|
||||
harv.QueueActivity( new Harvest() );
|
||||
}) );
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
if( NextActivity != null ) return NextActivity;
|
||||
|
||||
var harv = self.traits.Get<Harvester>();
|
||||
harv.LastHarvestedCell = self.Location;
|
||||
|
||||
if( harv.IsFull )
|
||||
return new DeliverResources { NextActivity = NextActivity };
|
||||
|
||||
@@ -47,6 +47,9 @@ namespace OpenRA.Mods.RA
|
||||
[Sync]
|
||||
public Actor LinkedProc = null;
|
||||
|
||||
[Sync]
|
||||
public int2 LastHarvestedCell = int2.Zero;
|
||||
|
||||
readonly HarvesterInfo Info;
|
||||
public Harvester(Actor self, HarvesterInfo info)
|
||||
{
|
||||
|
||||
@@ -34,6 +34,8 @@ namespace OpenRA.Mods.RA
|
||||
public void OnDock(Actor self, Actor harv, DeliverResources dockOrder)
|
||||
{
|
||||
var unit = harv.traits.Get<Unit>();
|
||||
var harvester = harv.traits.Get<Harvester>();
|
||||
|
||||
if (unit.Facing != 64)
|
||||
harv.QueueActivity (new Turn (64));
|
||||
|
||||
@@ -43,8 +45,11 @@ namespace OpenRA.Mods.RA
|
||||
if (renderUnit.anim.CurrentSequence.Name != "empty")
|
||||
renderUnit.PlayCustomAnimation (harv, "empty", () =>
|
||||
{
|
||||
harv.traits.Get<Harvester>().Deliver(harv, self);
|
||||
harv.QueueActivity (new Harvest ());
|
||||
harvester.Deliver(harv, self);
|
||||
if (harvester.LastHarvestedCell != int2.Zero)
|
||||
harv.QueueActivity( new Move(harvester.LastHarvestedCell, 5) );
|
||||
|
||||
harv.QueueActivity( new Harvest() );
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user