diff --git a/OpenRA.Mods.Cnc/Activities/HarvesterDockSequence.cs b/OpenRA.Mods.Cnc/Activities/HarvesterDockSequence.cs index 2be7776aff..e861777370 100644 --- a/OpenRA.Mods.Cnc/Activities/HarvesterDockSequence.cs +++ b/OpenRA.Mods.Cnc/Activities/HarvesterDockSequence.cs @@ -34,6 +34,7 @@ namespace OpenRA.Mods.Cnc readonly Actor proc; readonly Harvester harv; + readonly HarvesterDocking dock; readonly RenderBuilding rb; State state; @@ -44,6 +45,7 @@ namespace OpenRA.Mods.Cnc this.proc = proc; state = State.Turn; harv = self.Trait(); + dock = self.Trait(); rb = proc.Trait(); startDock = self.Trait().PxPosition; endDock = proc.Trait().PxPosition + new int2(-15,8); @@ -62,7 +64,7 @@ namespace OpenRA.Mods.Cnc state = State.Dock; return Util.SequenceActivities(new Drag(startDock, endDock, 12), this); case State.Dock: - harv.Visible = false; + dock.Visible = false; rb.PlayCustomAnimThen(proc, "dock-start", () => {rb.PlayCustomAnimRepeating(proc, "dock-loop"); state = State.Loop;}); state = State.Wait; return this; @@ -71,7 +73,7 @@ namespace OpenRA.Mods.Cnc state = State.Undock; return this; case State.Undock: - rb.PlayCustomAnimThen(proc, "dock-end", () => {harv.Visible = true; state = State.Dragout;}); + rb.PlayCustomAnimThen(proc, "dock-end", () => {dock.Visible = true; state = State.Dragout;}); state = State.Wait; return this; case State.Dragout: diff --git a/OpenRA.Mods.Cnc/TiberiumRefinery.cs b/OpenRA.Mods.Cnc/TiberiumRefinery.cs index 615430abf5..5401d15dc5 100644 --- a/OpenRA.Mods.Cnc/TiberiumRefinery.cs +++ b/OpenRA.Mods.Cnc/TiberiumRefinery.cs @@ -15,14 +15,16 @@ using OpenRA.Mods.RA.Render; using OpenRA.Traits; using OpenRA.Traits.Activities; using OpenRA.Mods.RA.Move; +using System.Collections.Generic; namespace OpenRA.Mods.Cnc { - class TiberiumRefineryInfo : OreRefineryInfo + public class TiberiumRefineryInfo : OreRefineryInfo { public override object Create(ActorInitializer init) { return new TiberiumRefinery(init.self, this); } } - class TiberiumRefinery : OreRefinery + + public class TiberiumRefinery : OreRefinery { public TiberiumRefinery(Actor self, TiberiumRefineryInfo info) : base(self, info as OreRefineryInfo) {} @@ -32,4 +34,16 @@ namespace OpenRA.Mods.Cnc return new HarvesterDockSequence(harv, self); } } + + public class HarvesterDockingInfo : TraitInfo { } + public class HarvesterDocking : IRenderModifier + { + [Sync] + public bool Visible = true; + + public IEnumerable ModifyRender(Actor self, IEnumerable r) + { + return Visible ? r : new Renderable[] { }; + } + } } diff --git a/OpenRA.Mods.RA/Harvester.cs b/OpenRA.Mods.RA/Harvester.cs index 3d97efea75..e444ca1baa 100644 --- a/OpenRA.Mods.RA/Harvester.cs +++ b/OpenRA.Mods.RA/Harvester.cs @@ -30,14 +30,10 @@ namespace OpenRA.Mods.RA } public class Harvester : IIssueOrder, IResolveOrder, IPips, - IRenderModifier, IExplodeModifier, IOrderVoice, - ISpeedModifier, ISync + IExplodeModifier, IOrderVoice, ISpeedModifier, ISync { Dictionary contents = new Dictionary(); - - [Sync] - public bool Visible = true; - + [Sync] public Actor LinkedProc = null; @@ -210,11 +206,6 @@ namespace OpenRA.Mods.RA for (int i = 0; i < numPips; i++) yield return GetPipAt(i); } - - public IEnumerable ModifyRender(Actor self, IEnumerable r) - { - return Visible ? r : new Renderable[] { }; - } public bool ShouldExplode(Actor self) { return !IsEmpty; } diff --git a/mods/cnc/rules/vehicles.yaml b/mods/cnc/rules/vehicles.yaml index 27f396bd25..05e90e7eb8 100644 --- a/mods/cnc/rules/vehicles.yaml +++ b/mods/cnc/rules/vehicles.yaml @@ -50,6 +50,7 @@ HARV: Resources: Tiberium, Blue Tiberium PipCount: 5 Capacity: 28 + HarvesterDocking: Mobile: Speed: 6 Health: