This commit is contained in:
@@ -65,16 +65,29 @@ namespace OpenRA.Mods.Cnc
|
||||
return Util.SequenceActivities(new Drag(startDock, endDock, 12), this);
|
||||
case State.Dock:
|
||||
dock.Visible = false;
|
||||
rb.PlayCustomAnimThen(proc, "dock-start", () => {rb.PlayCustomAnimRepeating(proc, "dock-loop"); state = State.Loop;});
|
||||
state = State.Wait;
|
||||
if (rb.anim.CurrentSequence.Name == "idle" || rb.anim.CurrentSequence.Name == "damaged-idle")
|
||||
{
|
||||
rb.PlayCustomAnimThen(proc, "dock-start", () => {rb.PlayCustomAnimRepeating(proc, "dock-loop"); state = State.Loop;});
|
||||
state = State.Wait;
|
||||
}
|
||||
else
|
||||
state = State.Loop;
|
||||
return this;
|
||||
case State.Loop:
|
||||
if (harv.TickUnload(self, proc))
|
||||
state = State.Undock;
|
||||
return this;
|
||||
case State.Undock:
|
||||
rb.PlayCustomAnimThen(proc, "dock-end", () => {dock.Visible = true; state = State.Dragout;});
|
||||
state = State.Wait;
|
||||
if (rb.anim.CurrentSequence.Name == "dock-loop" || rb.anim.CurrentSequence.Name == "damaged-dock-loop")
|
||||
{
|
||||
rb.PlayCustomAnimThen(proc, "dock-end", () => {dock.Visible = true; state = State.Dragout;});
|
||||
state = State.Wait;
|
||||
}
|
||||
else
|
||||
{
|
||||
state = State.Dragout;
|
||||
dock.Visible = true;
|
||||
}
|
||||
return this;
|
||||
case State.Dragout:
|
||||
return Util.SequenceActivities(new Drag(endDock, startDock, 12), NextActivity);
|
||||
@@ -85,7 +98,6 @@ namespace OpenRA.Mods.Cnc
|
||||
public override void Cancel(Actor self)
|
||||
{
|
||||
state = State.Undock;
|
||||
base.Cancel(self);
|
||||
}
|
||||
|
||||
public override IEnumerable<Target> GetTargets( Actor self )
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return new EnterOrderTargeter<IAcceptOre>( "Deliver", 5, false, true, _ => true, _ => !IsEmpty );
|
||||
yield return new EnterOrderTargeter<IAcceptOre>("Deliver", 5, false, true, _ => true, proc => !IsEmpty && proc.Trait<IAcceptOre>().AllowDocking);
|
||||
yield return new HarvestOrderTargeter();
|
||||
}
|
||||
}
|
||||
@@ -160,6 +160,10 @@ namespace OpenRA.Mods.RA
|
||||
}
|
||||
else if (order.OrderString == "Deliver")
|
||||
{
|
||||
var iao = order.TargetActor.TraitOrDefault<IAcceptOre>();
|
||||
if (iao == null || !iao.AllowDocking)
|
||||
return;
|
||||
|
||||
if (order.TargetActor != LinkedProc)
|
||||
LinkedProc = order.TargetActor;
|
||||
|
||||
|
||||
@@ -51,13 +51,14 @@ namespace OpenRA.Mods.RA
|
||||
[Sync]
|
||||
bool preventDock = false;
|
||||
|
||||
public bool AllowDocking { get { return !preventDock; } }
|
||||
public int2 DeliverOffset { get { return Info.DockOffset; } }
|
||||
public virtual Activity DockSequence(Actor harv, Actor self)
|
||||
{
|
||||
return new RAHarvesterDockSequence(harv, self);
|
||||
}
|
||||
|
||||
public OreRefinery (Actor self, OreRefineryInfo info)
|
||||
public OreRefinery(Actor self, OreRefineryInfo info)
|
||||
{
|
||||
this.self = self;
|
||||
Info = info;
|
||||
@@ -92,7 +93,7 @@ namespace OpenRA.Mods.RA
|
||||
dockedHarv.CancelActivity();
|
||||
}
|
||||
|
||||
public void Tick (Actor self)
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
// Harvester was killed while unloading
|
||||
if (dockedHarv != null && dockedHarv.IsDead())
|
||||
@@ -111,14 +112,14 @@ namespace OpenRA.Mods.RA
|
||||
}
|
||||
}
|
||||
|
||||
public void Killed (Actor self, AttackInfo e)
|
||||
public void Killed(Actor self, AttackInfo e)
|
||||
{
|
||||
CancelDock(self);
|
||||
foreach (var harv in GetLinkedHarvesters())
|
||||
harv.Trait.UnlinkProc(harv.Actor, self);
|
||||
}
|
||||
|
||||
public void OnDock (Actor harv, DeliverResources dockOrder)
|
||||
public void OnDock(Actor harv, DeliverResources dockOrder)
|
||||
{
|
||||
if (!preventDock)
|
||||
{
|
||||
@@ -130,7 +131,7 @@ namespace OpenRA.Mods.RA
|
||||
}
|
||||
|
||||
|
||||
public void OnCapture (Actor self, Actor captor, Player oldOwner, Player newOwner)
|
||||
public void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner)
|
||||
{
|
||||
// Steal any docked harv too
|
||||
if (dockedHarv != null)
|
||||
@@ -144,8 +145,8 @@ namespace OpenRA.Mods.RA
|
||||
PlayerResources = newOwner.PlayerActor.Trait<PlayerResources>();
|
||||
}
|
||||
|
||||
public void Selling (Actor self) { CancelDock(self); }
|
||||
public void Sold (Actor self)
|
||||
public void Selling(Actor self) { CancelDock(self); }
|
||||
public void Sold(Actor self)
|
||||
{
|
||||
foreach (var harv in GetLinkedHarvesters())
|
||||
harv.Trait.UnlinkProc(harv.Actor, self);
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace OpenRA.Mods.RA
|
||||
void GiveOre(int amount);
|
||||
bool CanGiveOre(int amount);
|
||||
int2 DeliverOffset { get; }
|
||||
bool AllowDocking { get; }
|
||||
}
|
||||
|
||||
public interface IAcceptOreDockAction
|
||||
|
||||
Reference in New Issue
Block a user