Pull Visible crap out of Harvester
This commit is contained in:
@@ -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<Harvester>();
|
||||
dock = self.Trait<HarvesterDocking>();
|
||||
rb = proc.Trait<RenderBuilding>();
|
||||
startDock = self.Trait<IHasLocation>().PxPosition;
|
||||
endDock = proc.Trait<IHasLocation>().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:
|
||||
|
||||
@@ -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<HarvesterDocking> { }
|
||||
public class HarvesterDocking : IRenderModifier
|
||||
{
|
||||
[Sync]
|
||||
public bool Visible = true;
|
||||
|
||||
public IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> r)
|
||||
{
|
||||
return Visible ? r : new Renderable[] { };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user