Pull Visible crap out of Harvester
This commit is contained in:
@@ -34,6 +34,7 @@ namespace OpenRA.Mods.Cnc
|
|||||||
|
|
||||||
readonly Actor proc;
|
readonly Actor proc;
|
||||||
readonly Harvester harv;
|
readonly Harvester harv;
|
||||||
|
readonly HarvesterDocking dock;
|
||||||
readonly RenderBuilding rb;
|
readonly RenderBuilding rb;
|
||||||
State state;
|
State state;
|
||||||
|
|
||||||
@@ -44,6 +45,7 @@ namespace OpenRA.Mods.Cnc
|
|||||||
this.proc = proc;
|
this.proc = proc;
|
||||||
state = State.Turn;
|
state = State.Turn;
|
||||||
harv = self.Trait<Harvester>();
|
harv = self.Trait<Harvester>();
|
||||||
|
dock = self.Trait<HarvesterDocking>();
|
||||||
rb = proc.Trait<RenderBuilding>();
|
rb = proc.Trait<RenderBuilding>();
|
||||||
startDock = self.Trait<IHasLocation>().PxPosition;
|
startDock = self.Trait<IHasLocation>().PxPosition;
|
||||||
endDock = proc.Trait<IHasLocation>().PxPosition + new int2(-15,8);
|
endDock = proc.Trait<IHasLocation>().PxPosition + new int2(-15,8);
|
||||||
@@ -62,7 +64,7 @@ namespace OpenRA.Mods.Cnc
|
|||||||
state = State.Dock;
|
state = State.Dock;
|
||||||
return Util.SequenceActivities(new Drag(startDock, endDock, 12), this);
|
return Util.SequenceActivities(new Drag(startDock, endDock, 12), this);
|
||||||
case State.Dock:
|
case State.Dock:
|
||||||
harv.Visible = false;
|
dock.Visible = false;
|
||||||
rb.PlayCustomAnimThen(proc, "dock-start", () => {rb.PlayCustomAnimRepeating(proc, "dock-loop"); state = State.Loop;});
|
rb.PlayCustomAnimThen(proc, "dock-start", () => {rb.PlayCustomAnimRepeating(proc, "dock-loop"); state = State.Loop;});
|
||||||
state = State.Wait;
|
state = State.Wait;
|
||||||
return this;
|
return this;
|
||||||
@@ -71,7 +73,7 @@ namespace OpenRA.Mods.Cnc
|
|||||||
state = State.Undock;
|
state = State.Undock;
|
||||||
return this;
|
return this;
|
||||||
case State.Undock:
|
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;
|
state = State.Wait;
|
||||||
return this;
|
return this;
|
||||||
case State.Dragout:
|
case State.Dragout:
|
||||||
|
|||||||
@@ -15,14 +15,16 @@ using OpenRA.Mods.RA.Render;
|
|||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
using OpenRA.Traits.Activities;
|
using OpenRA.Traits.Activities;
|
||||||
using OpenRA.Mods.RA.Move;
|
using OpenRA.Mods.RA.Move;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Cnc
|
namespace OpenRA.Mods.Cnc
|
||||||
{
|
{
|
||||||
class TiberiumRefineryInfo : OreRefineryInfo
|
public class TiberiumRefineryInfo : OreRefineryInfo
|
||||||
{
|
{
|
||||||
public override object Create(ActorInitializer init) { return new TiberiumRefinery(init.self, this); }
|
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)
|
public TiberiumRefinery(Actor self, TiberiumRefineryInfo info)
|
||||||
: base(self, info as OreRefineryInfo) {}
|
: base(self, info as OreRefineryInfo) {}
|
||||||
@@ -32,4 +34,16 @@ namespace OpenRA.Mods.Cnc
|
|||||||
return new HarvesterDockSequence(harv, self);
|
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[] { };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,14 +30,10 @@ namespace OpenRA.Mods.RA
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class Harvester : IIssueOrder, IResolveOrder, IPips,
|
public class Harvester : IIssueOrder, IResolveOrder, IPips,
|
||||||
IRenderModifier, IExplodeModifier, IOrderVoice,
|
IExplodeModifier, IOrderVoice, ISpeedModifier, ISync
|
||||||
ISpeedModifier, ISync
|
|
||||||
{
|
{
|
||||||
Dictionary<ResourceTypeInfo, int> contents = new Dictionary<ResourceTypeInfo, int>();
|
Dictionary<ResourceTypeInfo, int> contents = new Dictionary<ResourceTypeInfo, int>();
|
||||||
|
|
||||||
[Sync]
|
|
||||||
public bool Visible = true;
|
|
||||||
|
|
||||||
[Sync]
|
[Sync]
|
||||||
public Actor LinkedProc = null;
|
public Actor LinkedProc = null;
|
||||||
|
|
||||||
@@ -210,11 +206,6 @@ namespace OpenRA.Mods.RA
|
|||||||
for (int i = 0; i < numPips; i++)
|
for (int i = 0; i < numPips; i++)
|
||||||
yield return GetPipAt(i);
|
yield return GetPipAt(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> r)
|
|
||||||
{
|
|
||||||
return Visible ? r : new Renderable[] { };
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool ShouldExplode(Actor self) { return !IsEmpty; }
|
public bool ShouldExplode(Actor self) { return !IsEmpty; }
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ HARV:
|
|||||||
Resources: Tiberium, Blue Tiberium
|
Resources: Tiberium, Blue Tiberium
|
||||||
PipCount: 5
|
PipCount: 5
|
||||||
Capacity: 28
|
Capacity: 28
|
||||||
|
HarvesterDocking:
|
||||||
Mobile:
|
Mobile:
|
||||||
Speed: 6
|
Speed: 6
|
||||||
Health:
|
Health:
|
||||||
|
|||||||
Reference in New Issue
Block a user