Merge pull request #9377 from reaperrr/fix-bldplace-overlay

Fixed TS crane overlay's last frame hiding idle overlay
This commit is contained in:
Paul Chote
2015-09-20 12:13:52 +01:00
4 changed files with 16 additions and 7 deletions

View File

@@ -35,6 +35,7 @@ namespace OpenRA.Mods.Common.Traits
{ {
readonly Animation overlay; readonly Animation overlay;
bool buildComplete; bool buildComplete;
bool visible;
public WithBuildingPlacedOverlay(Actor self, WithBuildingPlacedOverlayInfo info) public WithBuildingPlacedOverlay(Actor self, WithBuildingPlacedOverlayInfo info)
{ {
@@ -47,15 +48,16 @@ namespace OpenRA.Mods.Common.Traits
var anim = new AnimationWithOffset(overlay, var anim = new AnimationWithOffset(overlay,
() => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))), () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))),
() => !buildComplete); () => !visible || !buildComplete);
overlay.Play(info.Sequence); overlay.PlayThen(info.Sequence, () => visible = false);
rs.Add(anim, info.Palette, info.IsPlayerPalette); rs.Add(anim, info.Palette, info.IsPlayerPalette);
} }
public void BuildingComplete(Actor self) public void BuildingComplete(Actor self)
{ {
buildComplete = true; buildComplete = true;
visible = false;
} }
public void Sold(Actor self) { } public void Sold(Actor self) { }
@@ -79,7 +81,8 @@ namespace OpenRA.Mods.Common.Traits
public void BuildingPlaced(Actor self) public void BuildingPlaced(Actor self)
{ {
overlay.Play(overlay.CurrentSequence.Name); visible = true;
overlay.PlayThen(overlay.CurrentSequence.Name, () => visible = false);
} }
} }
} }

View File

@@ -39,6 +39,7 @@ namespace OpenRA.Mods.Common.Traits
{ {
readonly Animation overlay; readonly Animation overlay;
bool buildComplete; bool buildComplete;
bool visible;
public WithRepairOverlay(Actor self, WithRepairOverlayInfo info) public WithRepairOverlay(Actor self, WithRepairOverlayInfo info)
{ {
@@ -47,11 +48,11 @@ namespace OpenRA.Mods.Common.Traits
buildComplete = !self.Info.HasTraitInfo<BuildingInfo>(); // always render instantly for units buildComplete = !self.Info.HasTraitInfo<BuildingInfo>(); // always render instantly for units
overlay = new Animation(self.World, rs.GetImage(self)); overlay = new Animation(self.World, rs.GetImage(self));
overlay.Play(info.Sequence); overlay.PlayThen(info.Sequence, () => visible = false);
var anim = new AnimationWithOffset(overlay, var anim = new AnimationWithOffset(overlay,
() => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))), () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))),
() => !buildComplete, () => !visible || !buildComplete,
() => info.PauseOnLowPower && self.IsDisabled(), () => info.PauseOnLowPower && self.IsDisabled(),
p => WithTurret.ZOffsetFromCenter(self, p, 1)); p => WithTurret.ZOffsetFromCenter(self, p, 1));
@@ -77,7 +78,8 @@ namespace OpenRA.Mods.Common.Traits
public void Repairing(Actor self, Actor host) public void Repairing(Actor self, Actor host)
{ {
overlay.Play(overlay.CurrentSequence.Name); visible = true;
overlay.PlayThen(overlay.CurrentSequence.Name, () => visible = false);
} }
} }
} }

View File

@@ -233,7 +233,7 @@ GADEPT:
Sequence: idle-light Sequence: idle-light
WithIdleOverlay@GROUND: WithIdleOverlay@GROUND:
Sequence: ground Sequence: ground
WithRepairOverlay@CIRCUITS: WithIdleOverlay@CIRCUITS:
Sequence: circuits Sequence: circuits
WithRepairOverlay@CRANE: WithRepairOverlay@CRANE:
Sequence: crane Sequence: crane

View File

@@ -1073,10 +1073,12 @@ gadept.gdi:
circuits: gtdept_a circuits: gtdept_a
Length: 5 Length: 5
ZOffset: -1c511 ZOffset: -1c511
Tick: 120
damaged-circuits: gtdept_a damaged-circuits: gtdept_a
Start: 5 Start: 5
Length: 5 Length: 5
ZOffset: -1c511 ZOffset: -1c511
Tick: 120
crane: gtdept_c crane: gtdept_c
Length: 16 Length: 16
platform: gtdept_d platform: gtdept_d
@@ -1129,10 +1131,12 @@ gadept.nod:
circuits: gtdept_a circuits: gtdept_a
Length: 5 Length: 5
ZOffset: -1c511 ZOffset: -1c511
Tick: 120
damaged-circuits: gtdept_a damaged-circuits: gtdept_a
Start: 5 Start: 5
Length: 5 Length: 5
ZOffset: -1c511 ZOffset: -1c511
Tick: 120
crane: gtdept_c crane: gtdept_c
Length: 16 Length: 16
platform: gtdept_d platform: gtdept_d