diff --git a/OpenRA.Mods.Cnc/Activities/HarvesterDockSequence.cs b/OpenRA.Mods.Cnc/Activities/HarvesterDockSequence.cs index 337438a7fc..b0a27be2cd 100644 --- a/OpenRA.Mods.Cnc/Activities/HarvesterDockSequence.cs +++ b/OpenRA.Mods.Cnc/Activities/HarvesterDockSequence.cs @@ -20,7 +20,8 @@ namespace OpenRA.Mods.Cnc { public class HarvesterDockSequence : Activity { - enum State { Wait, Turn, DragIn, Dock, Loop, Undock, DragOut }; + enum State { Wait, Turn, DragIn, Dock, Loop, Undock, DragOut } + static readonly WVec DockOffset = new WVec(-640, 341, 0); readonly Actor proc; readonly Harvester harv; @@ -34,8 +35,8 @@ namespace OpenRA.Mods.Cnc state = State.Turn; harv = self.Trait(); ru = self.Trait(); - startDock = self.Trait().PxPosition.ToWPos(0); - endDock = (proc.Trait().PxPosition + new PVecInt(-15,8)).ToWPos(0); + startDock = self.CenterPosition; + endDock = proc.CenterPosition + DockOffset; } public override Activity Tick(Actor self) @@ -51,7 +52,7 @@ namespace OpenRA.Mods.Cnc state = State.Dock; return Util.SequenceActivities(new Drag(startDock, endDock, 12), this); case State.Dock: - ru.PlayCustomAnimation(self, "dock", () => {ru.PlayCustomAnimRepeating(self, "dock-loop"); state = State.Loop;}); + ru.PlayCustomAnimation(self, "dock", () => { ru.PlayCustomAnimRepeating(self, "dock-loop"); state = State.Loop; }); state = State.Wait; return this; case State.Loop: @@ -65,6 +66,7 @@ namespace OpenRA.Mods.Cnc case State.DragOut: return Util.SequenceActivities(new Drag(endDock, startDock, 12), NextActivity); } + throw new InvalidOperationException("Invalid harvester dock state"); } @@ -73,10 +75,9 @@ namespace OpenRA.Mods.Cnc state = State.Undock; } - public override IEnumerable GetTargets( Actor self ) + public override IEnumerable GetTargets(Actor self) { yield return Target.FromActor(proc); } } -} - +} \ No newline at end of file