Allow setting separate close sequence for landing crafts

This commit is contained in:
reaperrr
2015-07-05 00:09:15 +02:00
parent 8ee26738a9
commit 632d8cd898
2 changed files with 8 additions and 3 deletions

View File

@@ -18,6 +18,7 @@ namespace OpenRA.Mods.RA.Traits
{ {
public readonly string[] OpenTerrainTypes = { "Clear" }; public readonly string[] OpenTerrainTypes = { "Clear" };
[SequenceReference] public readonly string OpenSequence = "open"; [SequenceReference] public readonly string OpenSequence = "open";
[SequenceReference] public readonly string CloseSequence = "close";
[SequenceReference] public readonly string UnloadSequence = "unload"; [SequenceReference] public readonly string UnloadSequence = "unload";
public object Create(ActorInitializer init) { return new WithLandingCraftAnimation(init, this); } public object Create(ActorInitializer init) { return new WithLandingCraftAnimation(init, this); }
@@ -43,7 +44,7 @@ namespace OpenRA.Mods.RA.Traits
public bool ShouldBeOpen() public bool ShouldBeOpen()
{ {
if (self.CenterPosition.Z > 0 || move.IsMoving) if (move.IsMoving || self.CenterPosition.Z > 0)
return false; return false;
return cargo.CurrentAdjacentCells.Any(c => self.World.Map.Contains(c) return cargo.CurrentAdjacentCells.Any(c => self.World.Map.Contains(c)
@@ -65,11 +66,11 @@ namespace OpenRA.Mods.RA.Traits
void Close() void Close()
{ {
if (!open || !wsb.DefaultAnimation.HasSequence(info.OpenSequence)) if (!open || !wsb.DefaultAnimation.HasSequence(info.CloseSequence))
return; return;
open = false; open = false;
wsb.PlayCustomAnimationBackwards(self, info.OpenSequence, null); wsb.PlayCustomAnimation(self, info.CloseSequence);
} }
public void Tick(Actor self) public void Tick(Actor self)

View File

@@ -34,6 +34,10 @@ lst:
Start: 1 Start: 1
Length: 4 Length: 4
Tick: 150 Tick: 150
close:
Frames: 4, 3, 2, 1
Length: 4
Tick: 150
unload: unload:
Start: 4 Start: 4
ZOffset: -511 ZOffset: -511