Remove some crap from OreRefinery
This commit is contained in:
@@ -41,8 +41,7 @@ namespace OpenRA.Mods.RA
|
|||||||
[Sync]
|
[Sync]
|
||||||
public Actor LinkedProc = null;
|
public Actor LinkedProc = null;
|
||||||
|
|
||||||
[Sync]
|
public int2? LastHarvestedCell = null;
|
||||||
public int2 LastHarvestedCell = int2.Zero;
|
|
||||||
|
|
||||||
[Sync]
|
[Sync]
|
||||||
public int ContentValue { get { return contents.Sum(c => c.Key.ValuePerUnit*c.Value); } }
|
public int ContentValue { get { return contents.Sum(c => c.Key.ValuePerUnit*c.Value); } }
|
||||||
@@ -62,6 +61,17 @@ namespace OpenRA.Mods.RA
|
|||||||
LinkedProc = ClosestProc(self, ignore);
|
LinkedProc = ClosestProc(self, ignore);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ContinueHarvesting(Actor self)
|
||||||
|
{
|
||||||
|
if (LastHarvestedCell.HasValue)
|
||||||
|
{
|
||||||
|
var mobile = self.Trait<Mobile>();
|
||||||
|
self.QueueActivity( mobile.MoveTo(LastHarvestedCell.Value, 5) );
|
||||||
|
self.SetTargetLine(Target.FromCell(LastHarvestedCell.Value), Color.Red, false);
|
||||||
|
}
|
||||||
|
self.QueueActivity( new Harvest() );
|
||||||
|
}
|
||||||
|
|
||||||
Actor ClosestProc(Actor self, Actor ignore)
|
Actor ClosestProc(Actor self, Actor ignore)
|
||||||
{
|
{
|
||||||
var refs = self.World.ActorsWithTrait<IAcceptOre>()
|
var refs = self.World.ActorsWithTrait<IAcceptOre>()
|
||||||
|
|||||||
@@ -120,27 +120,13 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
public void OnDock (Actor harv, DeliverResources dockOrder)
|
public void OnDock (Actor harv, DeliverResources dockOrder)
|
||||||
{
|
{
|
||||||
var mobile = harv.Trait<Mobile>();
|
|
||||||
var harvester = harv.Trait<Harvester>();
|
|
||||||
|
|
||||||
if (!preventDock)
|
if (!preventDock)
|
||||||
{
|
{
|
||||||
harv.QueueActivity( new CallFunc( () => dockedHarv = harv, false ) );
|
harv.QueueActivity( new CallFunc( () => dockedHarv = harv, false ) );
|
||||||
harv.QueueActivity( DockSequence(harv, self) );
|
harv.QueueActivity( DockSequence(harv, self) );
|
||||||
harv.QueueActivity( new CallFunc( () => dockedHarv = null, false ) );
|
harv.QueueActivity( new CallFunc( () => dockedHarv = null, false ) );
|
||||||
}
|
}
|
||||||
|
harv.QueueActivity( new CallFunc( () => harv.Trait<Harvester>().ContinueHarvesting(harv) ) );
|
||||||
// Tell the harvester to start harvesting
|
|
||||||
// TODO: This belongs on the harv idle activity
|
|
||||||
harv.QueueActivity( new CallFunc( () =>
|
|
||||||
{
|
|
||||||
if (harvester.LastHarvestedCell != int2.Zero)
|
|
||||||
{
|
|
||||||
harv.QueueActivity( mobile.MoveTo(harvester.LastHarvestedCell, 5) );
|
|
||||||
harv.SetTargetLine(Target.FromCell(harvester.LastHarvestedCell), Color.Red, false);
|
|
||||||
}
|
|
||||||
harv.QueueActivity( new Harvest() );
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user