Remove TiberianSunRefinery
Also add IDockClientBody interface, move WithDockingOverlay cnc -> common, remove HarvesterDockSequence implementing classes
This commit is contained in:
committed by
Matthias Mailänder
parent
3f0c3a8b9c
commit
049d0283f9
@@ -1,70 +0,0 @@
|
|||||||
#region Copyright & License Information
|
|
||||||
/*
|
|
||||||
* Copyright (c) The OpenRA Developers and Contributors
|
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
|
||||||
* available to you under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation, either version 3 of
|
|
||||||
* the License, or (at your option) any later version. For more
|
|
||||||
* information, see COPYING.
|
|
||||||
*/
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
using OpenRA.Mods.Cnc.Traits.Render;
|
|
||||||
using OpenRA.Mods.Common.Activities;
|
|
||||||
using OpenRA.Mods.Common.Traits;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.Cnc.Activities
|
|
||||||
{
|
|
||||||
public class VoxelHarvesterDockSequence : HarvesterDockSequence
|
|
||||||
{
|
|
||||||
readonly WithVoxelUnloadBody body;
|
|
||||||
readonly WithDockingOverlay spriteOverlay;
|
|
||||||
|
|
||||||
public VoxelHarvesterDockSequence(Actor self, Actor refineryActor, Refinery refinery)
|
|
||||||
: base(self, refineryActor, refinery)
|
|
||||||
{
|
|
||||||
body = self.Trait<WithVoxelUnloadBody>();
|
|
||||||
spriteOverlay = RefineryActor.TraitOrDefault<WithDockingOverlay>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnStateDock(Actor self)
|
|
||||||
{
|
|
||||||
body.Docked = true;
|
|
||||||
|
|
||||||
if (spriteOverlay != null && !spriteOverlay.Visible)
|
|
||||||
{
|
|
||||||
spriteOverlay.Visible = true;
|
|
||||||
spriteOverlay.WithOffset.Animation.PlayThen(spriteOverlay.Info.Sequence, () =>
|
|
||||||
{
|
|
||||||
dockingState = DockingState.Loop;
|
|
||||||
spriteOverlay.Visible = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else
|
|
||||||
dockingState = DockingState.Loop;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnStateUndock(Actor self)
|
|
||||||
{
|
|
||||||
// If body.Docked wasn't set, we didn't actually dock and have to skip the undock overlay
|
|
||||||
if (!body.Docked)
|
|
||||||
dockingState = DockingState.Complete;
|
|
||||||
else if (RefineryActor.IsInWorld && !RefineryActor.IsDead && spriteOverlay != null && !spriteOverlay.Visible)
|
|
||||||
{
|
|
||||||
dockingState = DockingState.Wait;
|
|
||||||
spriteOverlay.Visible = true;
|
|
||||||
spriteOverlay.WithOffset.Animation.PlayBackwardsThen(spriteOverlay.Info.Sequence, () =>
|
|
||||||
{
|
|
||||||
dockingState = DockingState.Complete;
|
|
||||||
body.Docked = false;
|
|
||||||
spriteOverlay.Visible = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dockingState = DockingState.Complete;
|
|
||||||
body.Docked = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
#region Copyright & License Information
|
|
||||||
/*
|
|
||||||
* Copyright (c) The OpenRA Developers and Contributors
|
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
|
||||||
* available to you under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation, either version 3 of
|
|
||||||
* the License, or (at your option) any later version. For more
|
|
||||||
* information, see COPYING.
|
|
||||||
*/
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
using OpenRA.Activities;
|
|
||||||
using OpenRA.Mods.Cnc.Activities;
|
|
||||||
using OpenRA.Mods.Common.Traits;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.Cnc.Traits
|
|
||||||
{
|
|
||||||
public class TiberianSunRefineryInfo : RefineryInfo
|
|
||||||
{
|
|
||||||
public override object Create(ActorInitializer init) { return new TiberianSunRefinery(init.Self, this); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class TiberianSunRefinery : Refinery
|
|
||||||
{
|
|
||||||
public TiberianSunRefinery(Actor self, RefineryInfo info)
|
|
||||||
: base(self, info) { }
|
|
||||||
|
|
||||||
public override Activity DockSequence(Actor harv, Actor self)
|
|
||||||
{
|
|
||||||
return new VoxelHarvesterDockSequence(harv, self, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -45,9 +45,9 @@ namespace OpenRA.Mods.Cnc.Traits.Render
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WithVoxelUnloadBody : IAutoMouseBounds
|
public class WithVoxelUnloadBody : IAutoMouseBounds, IDockClientBody
|
||||||
{
|
{
|
||||||
public bool Docked;
|
bool docked;
|
||||||
|
|
||||||
readonly ModelAnimation modelAnimation;
|
readonly ModelAnimation modelAnimation;
|
||||||
readonly RenderVoxels rv;
|
readonly RenderVoxels rv;
|
||||||
@@ -60,7 +60,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
|
|||||||
var idleModel = self.World.ModelCache.GetModelSequence(rv.Image, info.IdleSequence);
|
var idleModel = self.World.ModelCache.GetModelSequence(rv.Image, info.IdleSequence);
|
||||||
modelAnimation = new ModelAnimation(idleModel, () => WVec.Zero,
|
modelAnimation = new ModelAnimation(idleModel, () => WVec.Zero,
|
||||||
() => body.QuantizeOrientation(self.Orientation),
|
() => body.QuantizeOrientation(self.Orientation),
|
||||||
() => Docked,
|
() => docked,
|
||||||
() => 0, info.ShowShadow);
|
() => 0, info.ShowShadow);
|
||||||
|
|
||||||
rv.Add(modelAnimation);
|
rv.Add(modelAnimation);
|
||||||
@@ -68,10 +68,22 @@ namespace OpenRA.Mods.Cnc.Traits.Render
|
|||||||
var unloadModel = self.World.ModelCache.GetModelSequence(rv.Image, info.UnloadSequence);
|
var unloadModel = self.World.ModelCache.GetModelSequence(rv.Image, info.UnloadSequence);
|
||||||
rv.Add(new ModelAnimation(unloadModel, () => WVec.Zero,
|
rv.Add(new ModelAnimation(unloadModel, () => WVec.Zero,
|
||||||
() => body.QuantizeOrientation(self.Orientation),
|
() => body.QuantizeOrientation(self.Orientation),
|
||||||
() => !Docked,
|
() => !docked,
|
||||||
() => 0, info.ShowShadow));
|
() => 0, info.ShowShadow));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IDockClientBody.PlayDockAnimation(Actor self, Action after)
|
||||||
|
{
|
||||||
|
docked = true;
|
||||||
|
after();
|
||||||
|
}
|
||||||
|
|
||||||
|
void IDockClientBody.PlayReverseDockAnimation(Actor self, Action after)
|
||||||
|
{
|
||||||
|
docked = false;
|
||||||
|
after();
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle IAutoMouseBounds.AutoMouseoverBounds(Actor self, WorldRenderer wr)
|
Rectangle IAutoMouseBounds.AutoMouseoverBounds(Actor self, WorldRenderer wr)
|
||||||
{
|
{
|
||||||
return modelAnimation.ScreenBounds(self.CenterPosition, wr, rv.Info.Scale);
|
return modelAnimation.ScreenBounds(self.CenterPosition, wr, rv.Info.Scale);
|
||||||
|
|||||||
@@ -14,18 +14,21 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Activities;
|
using OpenRA.Activities;
|
||||||
using OpenRA.Mods.Common.Traits;
|
using OpenRA.Mods.Common.Traits;
|
||||||
|
using OpenRA.Mods.Common.Traits.Render;
|
||||||
using OpenRA.Primitives;
|
using OpenRA.Primitives;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Activities
|
namespace OpenRA.Mods.Common.Activities
|
||||||
{
|
{
|
||||||
public abstract class HarvesterDockSequence : Activity
|
public class HarvesterDockSequence : Activity
|
||||||
{
|
{
|
||||||
protected enum DockingState { Wait, Turn, Drag, Dock, Loop, Undock, Complete }
|
protected enum DockingState { Wait, Turn, Drag, Dock, Loop, Undock, Complete }
|
||||||
|
|
||||||
protected readonly Actor RefineryActor;
|
protected readonly Actor RefineryActor;
|
||||||
protected readonly Refinery Refinery;
|
protected readonly Refinery Refinery;
|
||||||
|
protected readonly WithDockingOverlay DockHostSpriteOverlay;
|
||||||
protected readonly Harvester Harv;
|
protected readonly Harvester Harv;
|
||||||
|
protected readonly IDockClientBody DockClientBody;
|
||||||
protected readonly WAngle DockAngle;
|
protected readonly WAngle DockAngle;
|
||||||
protected readonly bool IsDragRequired;
|
protected readonly bool IsDragRequired;
|
||||||
protected readonly WVec DragOffset;
|
protected readonly WVec DragOffset;
|
||||||
@@ -38,16 +41,20 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
readonly INotifyDockClient[] notifyDockClients;
|
readonly INotifyDockClient[] notifyDockClients;
|
||||||
readonly INotifyDockHost[] notifyDockHosts;
|
readonly INotifyDockHost[] notifyDockHosts;
|
||||||
|
|
||||||
|
bool dockInitiated = false;
|
||||||
|
|
||||||
public HarvesterDockSequence(Actor self, Actor refineryActor, Refinery refinery)
|
public HarvesterDockSequence(Actor self, Actor refineryActor, Refinery refinery)
|
||||||
{
|
{
|
||||||
dockingState = DockingState.Turn;
|
dockingState = DockingState.Turn;
|
||||||
Refinery = refinery;
|
Refinery = refinery;
|
||||||
RefineryActor = refineryActor;
|
RefineryActor = refineryActor;
|
||||||
|
DockHostSpriteOverlay = refineryActor.TraitOrDefault<WithDockingOverlay>();
|
||||||
DockAngle = refinery.DeliveryAngle;
|
DockAngle = refinery.DeliveryAngle;
|
||||||
IsDragRequired = refinery.IsDragRequired;
|
IsDragRequired = refinery.IsDragRequired;
|
||||||
DragOffset = refinery.DragOffset;
|
DragOffset = refinery.DragOffset;
|
||||||
DragLength = refinery.DragLength;
|
DragLength = refinery.DragLength;
|
||||||
Harv = self.Trait<Harvester>();
|
Harv = self.Trait<Harvester>();
|
||||||
|
DockClientBody = self.TraitOrDefault<IDockClientBody>();
|
||||||
StartDrag = self.CenterPosition;
|
StartDrag = self.CenterPosition;
|
||||||
EndDrag = refineryActor.CenterPosition + DragOffset;
|
EndDrag = refineryActor.CenterPosition + DragOffset;
|
||||||
notifyDockClients = self.TraitsImplementing<INotifyDockClient>().ToArray();
|
notifyDockClients = self.TraitsImplementing<INotifyDockClient>().ToArray();
|
||||||
@@ -79,7 +86,8 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
case DockingState.Dock:
|
case DockingState.Dock:
|
||||||
if (!IsCanceling && RefineryActor.IsInWorld && !RefineryActor.IsDead && !Harv.IsTraitDisabled)
|
if (!IsCanceling && RefineryActor.IsInWorld && !RefineryActor.IsDead && !Harv.IsTraitDisabled)
|
||||||
{
|
{
|
||||||
OnStateDock(self);
|
dockInitiated = true;
|
||||||
|
PlayDockAnimations(self);
|
||||||
NotifyDocked(self);
|
NotifyDocked(self);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -94,7 +102,11 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
case DockingState.Undock:
|
case DockingState.Undock:
|
||||||
OnStateUndock(self);
|
if (dockInitiated)
|
||||||
|
PlayUndockAnimations(self);
|
||||||
|
else
|
||||||
|
dockingState = DockingState.Complete;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case DockingState.Complete:
|
case DockingState.Complete:
|
||||||
@@ -110,19 +122,65 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
throw new InvalidOperationException("Invalid harvester dock state");
|
throw new InvalidOperationException("Invalid harvester dock state");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<Target> GetTargets(Actor self)
|
public virtual void PlayDockAnimations(Actor self)
|
||||||
{
|
{
|
||||||
yield return Target.FromActor(RefineryActor);
|
PlayDockCientAnimation(self, () =>
|
||||||
|
{
|
||||||
|
if (DockHostSpriteOverlay != null && !DockHostSpriteOverlay.Visible)
|
||||||
|
{
|
||||||
|
dockingState = DockingState.Wait;
|
||||||
|
DockHostSpriteOverlay.Visible = true;
|
||||||
|
DockHostSpriteOverlay.WithOffset.Animation.PlayThen(DockHostSpriteOverlay.Info.Sequence, () =>
|
||||||
|
{
|
||||||
|
dockingState = DockingState.Loop;
|
||||||
|
DockHostSpriteOverlay.Visible = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
dockingState = DockingState.Loop;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<TargetLineNode> TargetLineNodes(Actor self)
|
public virtual void PlayDockCientAnimation(Actor self, Action after)
|
||||||
{
|
{
|
||||||
yield return new TargetLineNode(Target.FromActor(RefineryActor), Color.Green);
|
if (DockClientBody != null)
|
||||||
|
{
|
||||||
|
dockingState = DockingState.Wait;
|
||||||
|
DockClientBody.PlayDockAnimation(self, () => after());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
after();
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void OnStateDock(Actor self);
|
public virtual void PlayUndockAnimations(Actor self)
|
||||||
|
{
|
||||||
|
if (RefineryActor.IsInWorld && !RefineryActor.IsDead && DockHostSpriteOverlay != null && !DockHostSpriteOverlay.Visible)
|
||||||
|
{
|
||||||
|
dockingState = DockingState.Wait;
|
||||||
|
DockHostSpriteOverlay.Visible = true;
|
||||||
|
DockHostSpriteOverlay.WithOffset.Animation.PlayBackwardsThen(DockHostSpriteOverlay.Info.Sequence, () =>
|
||||||
|
{
|
||||||
|
PlayUndockClientAnimation(self, () =>
|
||||||
|
{
|
||||||
|
dockingState = DockingState.Complete;
|
||||||
|
DockHostSpriteOverlay.Visible = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
PlayUndockClientAnimation(self, () => dockingState = DockingState.Complete);
|
||||||
|
}
|
||||||
|
|
||||||
public abstract void OnStateUndock(Actor self);
|
public virtual void PlayUndockClientAnimation(Actor self, Action after)
|
||||||
|
{
|
||||||
|
if (DockClientBody != null)
|
||||||
|
{
|
||||||
|
dockingState = DockingState.Wait;
|
||||||
|
DockClientBody.PlayReverseDockAnimation(self, () => after());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
after();
|
||||||
|
}
|
||||||
|
|
||||||
void NotifyDocked(Actor self)
|
void NotifyDocked(Actor self)
|
||||||
{
|
{
|
||||||
@@ -142,5 +200,15 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
foreach (var nd in notifyDockHosts)
|
foreach (var nd in notifyDockHosts)
|
||||||
nd.Undocked(RefineryActor, self);
|
nd.Undocked(RefineryActor, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override IEnumerable<Target> GetTargets(Actor self)
|
||||||
|
{
|
||||||
|
yield return Target.FromActor(RefineryActor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IEnumerable<TargetLineNode> TargetLineNodes(Actor self)
|
||||||
|
{
|
||||||
|
yield return new TargetLineNode(Target.FromActor(RefineryActor), Color.Green);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,56 +0,0 @@
|
|||||||
#region Copyright & License Information
|
|
||||||
/*
|
|
||||||
* Copyright (c) The OpenRA Developers and Contributors
|
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
|
||||||
* available to you under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation, either version 3 of
|
|
||||||
* the License, or (at your option) any later version. For more
|
|
||||||
* information, see COPYING.
|
|
||||||
*/
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
using OpenRA.Mods.Common.Traits;
|
|
||||||
using OpenRA.Mods.Common.Traits.Render;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Activities
|
|
||||||
{
|
|
||||||
public class SpriteHarvesterDockSequence : HarvesterDockSequence
|
|
||||||
{
|
|
||||||
readonly WithSpriteBody wsb;
|
|
||||||
readonly WithDockingAnimationInfo wda;
|
|
||||||
protected bool dockAnimPlayed;
|
|
||||||
|
|
||||||
public SpriteHarvesterDockSequence(Actor self, Actor refineryActor, Refinery refinery)
|
|
||||||
: base(self, refineryActor, refinery)
|
|
||||||
{
|
|
||||||
wsb = self.Trait<WithSpriteBody>();
|
|
||||||
wda = self.Info.TraitInfoOrDefault<WithDockingAnimationInfo>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnStateDock(Actor self)
|
|
||||||
{
|
|
||||||
if (wda != null)
|
|
||||||
wsb.PlayCustomAnimation(self, wda.DockSequence, () => wsb.PlayCustomAnimationRepeating(self, wda.DockLoopSequence));
|
|
||||||
|
|
||||||
dockAnimPlayed = true;
|
|
||||||
dockingState = DockingState.Loop;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnStateUndock(Actor self)
|
|
||||||
{
|
|
||||||
// If dock animation hasn't played, we didn't actually dock and have to skip the undock anim and notification
|
|
||||||
if (!dockAnimPlayed)
|
|
||||||
{
|
|
||||||
dockingState = DockingState.Complete;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dockingState = DockingState.Wait;
|
|
||||||
|
|
||||||
if (wda == null)
|
|
||||||
dockingState = DockingState.Complete;
|
|
||||||
else
|
|
||||||
wsb.PlayCustomAnimationBackwards(self, wda.DockSequence, () => dockingState = DockingState.Complete);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -89,11 +89,6 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
resourceValueModifiers = self.TraitsImplementing<IResourceValueModifier>().ToArray().Select(m => m.GetResourceValueModifier());
|
resourceValueModifiers = self.TraitsImplementing<IResourceValueModifier>().ToArray().Select(m => m.GetResourceValueModifier());
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual Activity DockSequence(Actor harv, Actor self)
|
|
||||||
{
|
|
||||||
return new SpriteHarvesterDockSequence(harv, self, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<TraitPair<Harvester>> GetLinkedHarvesters()
|
public IEnumerable<TraitPair<Harvester>> GetLinkedHarvesters()
|
||||||
{
|
{
|
||||||
return self.World.ActorsWithTrait<Harvester>()
|
return self.World.ActorsWithTrait<Harvester>()
|
||||||
@@ -171,7 +166,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (!preventDock)
|
if (!preventDock)
|
||||||
{
|
{
|
||||||
dockOrder.QueueChild(new CallFunc(() => dockedHarv = harv, false));
|
dockOrder.QueueChild(new CallFunc(() => dockedHarv = harv, false));
|
||||||
dockOrder.QueueChild(DockSequence(harv, self));
|
dockOrder.QueueChild(new HarvesterDockSequence(harv, self, this));
|
||||||
dockOrder.QueueChild(new CallFunc(() => dockedHarv = null, false));
|
dockOrder.QueueChild(new CallFunc(() => dockedHarv = null, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,11 +9,12 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits.Render
|
namespace OpenRA.Mods.Common.Traits.Render
|
||||||
{
|
{
|
||||||
public class WithDockingAnimationInfo : TraitInfo<WithDockingAnimation>, Requires<WithSpriteBodyInfo>, Requires<HarvesterInfo>
|
public class WithDockingAnimationInfo : TraitInfo, Requires<WithSpriteBodyInfo>, Requires<HarvesterInfo>
|
||||||
{
|
{
|
||||||
[SequenceReference]
|
[SequenceReference]
|
||||||
[Desc("Displayed when docking to refinery.")]
|
[Desc("Displayed when docking to refinery.")]
|
||||||
@@ -22,7 +23,29 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
[SequenceReference]
|
[SequenceReference]
|
||||||
[Desc("Looped while unloading at refinery.")]
|
[Desc("Looped while unloading at refinery.")]
|
||||||
public readonly string DockLoopSequence = "dock-loop";
|
public readonly string DockLoopSequence = "dock-loop";
|
||||||
|
|
||||||
|
public override object Create(ActorInitializer init) { return new WithDockingAnimation(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WithDockingAnimation { }
|
public class WithDockingAnimation : IDockClientBody
|
||||||
|
{
|
||||||
|
readonly WithDockingAnimationInfo info;
|
||||||
|
readonly WithSpriteBody wsb;
|
||||||
|
|
||||||
|
public WithDockingAnimation(Actor self, WithDockingAnimationInfo info)
|
||||||
|
{
|
||||||
|
this.info = info;
|
||||||
|
wsb = self.Trait<WithSpriteBody>();
|
||||||
|
}
|
||||||
|
|
||||||
|
void IDockClientBody.PlayDockAnimation(Actor self, Action after)
|
||||||
|
{
|
||||||
|
wsb.PlayCustomAnimation(self, info.DockSequence, () => { wsb.PlayCustomAnimationRepeating(self, info.DockLoopSequence); after(); });
|
||||||
|
}
|
||||||
|
|
||||||
|
void IDockClientBody.PlayReverseDockAnimation(Actor self, Action after)
|
||||||
|
{
|
||||||
|
wsb.PlayCustomAnimationBackwards(self, info.DockSequence, () => after());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,9 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Mods.Common.Traits;
|
|
||||||
using OpenRA.Mods.Common.Traits.Render;
|
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Cnc.Traits.Render
|
namespace OpenRA.Mods.Common.Traits.Render
|
||||||
{
|
{
|
||||||
[Desc("Rendered on the refinery when a voxel harvester is docking and undocking.")]
|
[Desc("Rendered on the refinery when a voxel harvester is docking and undocking.")]
|
||||||
public class WithDockingOverlayInfo : PausableConditionalTraitInfo, Requires<RenderSpritesInfo>, Requires<BodyOrientationInfo>
|
public class WithDockingOverlayInfo : PausableConditionalTraitInfo, Requires<RenderSpritesInfo>, Requires<BodyOrientationInfo>
|
||||||
@@ -273,6 +273,12 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
bool AllowDocking { get; }
|
bool AllowDocking { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface IDockClientBody
|
||||||
|
{
|
||||||
|
void PlayDockAnimation(Actor self, Action after);
|
||||||
|
void PlayReverseDockAnimation(Actor self, Action after);
|
||||||
|
}
|
||||||
|
|
||||||
public interface IProvidesAssetBrowserPalettes
|
public interface IProvidesAssetBrowserPalettes
|
||||||
{
|
{
|
||||||
IEnumerable<string> PaletteNames { get; }
|
IEnumerable<string> PaletteNames { get; }
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright (c) The OpenRA Developers and Contributors
|
||||||
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
|
* available to you under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation, either version 3 of
|
||||||
|
* the License, or (at your option) any later version. For more
|
||||||
|
* information, see COPYING.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||||
|
{
|
||||||
|
public class RemoveTSRefinery : UpdateRule
|
||||||
|
{
|
||||||
|
public override string Name => "TiberianSunRefinery removed.";
|
||||||
|
|
||||||
|
public override string Description => "TiberianSunRefinery was removed, use Refinery instead.";
|
||||||
|
|
||||||
|
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||||
|
{
|
||||||
|
actorNode.RenameChildrenMatching("TiberianSunRefinery", "Refinery");
|
||||||
|
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -105,7 +105,8 @@ namespace OpenRA.Mods.Common.UpdateRules
|
|||||||
new TextNotificationsDisplayWidgetRemoveTime(),
|
new TextNotificationsDisplayWidgetRemoveTime(),
|
||||||
new ExplicitSequenceFilenames(),
|
new ExplicitSequenceFilenames(),
|
||||||
new RenameEngineerRepair(),
|
new RenameEngineerRepair(),
|
||||||
new ProductionTabsWidgetAddTabButtonCollection()
|
new ProductionTabsWidgetAddTabButtonCollection(),
|
||||||
|
new RemoveTSRefinery(),
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -584,7 +584,7 @@ NAWAST:
|
|||||||
RevealsShroud:
|
RevealsShroud:
|
||||||
Range: 6c0
|
Range: 6c0
|
||||||
MaxHeightDelta: 3
|
MaxHeightDelta: 3
|
||||||
TiberianSunRefinery:
|
Refinery:
|
||||||
DockAngle: 640
|
DockAngle: 640
|
||||||
DockOffset: 2,1
|
DockOffset: 2,1
|
||||||
StoresResources:
|
StoresResources:
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ PROC:
|
|||||||
RevealsShroud:
|
RevealsShroud:
|
||||||
Range: 6c0
|
Range: 6c0
|
||||||
MaxHeightDelta: 3
|
MaxHeightDelta: 3
|
||||||
TiberianSunRefinery:
|
Refinery:
|
||||||
DockAngle: 640
|
DockAngle: 640
|
||||||
DockOffset: 2,1
|
DockOffset: 2,1
|
||||||
DiscardExcessResources: true
|
DiscardExcessResources: true
|
||||||
|
|||||||
Reference in New Issue
Block a user