Add StartSequence to WithIdleOverlay & change V19.Husk

This commit is contained in:
atlimit8
2015-07-24 23:15:19 -05:00
parent d9d37d54c8
commit 4976f9fec9
6 changed files with 26 additions and 5 deletions

View File

@@ -19,6 +19,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Renders a decorative animation on units and buildings.")] [Desc("Renders a decorative animation on units and buildings.")]
public class WithIdleOverlayInfo : UpgradableTraitInfo, IRenderActorPreviewSpritesInfo, Requires<RenderSpritesInfo>, Requires<IBodyOrientationInfo> public class WithIdleOverlayInfo : UpgradableTraitInfo, IRenderActorPreviewSpritesInfo, Requires<RenderSpritesInfo>, Requires<IBodyOrientationInfo>
{ {
[Desc("Animation to play when the actor is created.")]
[SequenceReference] public readonly string StartSequence = null;
[Desc("Sequence name to use")] [Desc("Sequence name to use")]
[SequenceReference] public readonly string Sequence = "idle-overlay"; [SequenceReference] public readonly string Sequence = "idle-overlay";
@@ -67,7 +70,11 @@ namespace OpenRA.Mods.Common.Traits
buildComplete = !self.HasTrait<Building>(); // always render instantly for units buildComplete = !self.HasTrait<Building>(); // always render instantly for units
overlay = new Animation(self.World, rs.GetImage(self)); overlay = new Animation(self.World, rs.GetImage(self));
overlay.PlayRepeating(RenderSprites.NormalizeSequence(overlay, self.GetDamageState(), info.Sequence)); if (info.StartSequence != null)
overlay.PlayThen(RenderSprites.NormalizeSequence(overlay, self.GetDamageState(), info.StartSequence),
() => overlay.PlayRepeating(RenderSprites.NormalizeSequence(overlay, self.GetDamageState(), info.Sequence)));
else
overlay.PlayRepeating(RenderSprites.NormalizeSequence(overlay, self.GetDamageState(), info.Sequence));
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))),

View File

@@ -57,11 +57,11 @@ namespace OpenRA.Mods.Common.Traits
DefaultAnimation = new Animation(init.World, rs.GetImage(init.Self), baseFacing); DefaultAnimation = new Animation(init.World, rs.GetImage(init.Self), baseFacing);
rs.Add(new AnimationWithOffset(DefaultAnimation, null, () => IsTraitDisabled)); rs.Add(new AnimationWithOffset(DefaultAnimation, null, () => IsTraitDisabled));
if (Info.StartSequence != null) if (info.StartSequence != null)
PlayCustomAnimation(init.Self, Info.StartSequence, PlayCustomAnimation(init.Self, info.StartSequence,
() => DefaultAnimation.PlayRepeating(NormalizeSequence(init.Self, Info.Sequence))); () => PlayCustomAnimationRepeating(init.Self, info.Sequence));
else else
DefaultAnimation.PlayRepeating(NormalizeSequence(init.Self, Info.Sequence)); DefaultAnimation.PlayRepeating(NormalizeSequence(init.Self, info.Sequence));
} }
public string NormalizeSequence(Actor self, string sequence) public string NormalizeSequence(Actor self, string sequence)

View File

@@ -11,8 +11,13 @@ V19:
V19.Husk: V19.Husk:
Inherits: ^CivBuildingHusk Inherits: ^CivBuildingHusk
-RenderBuilding:
AutoSelectionSize:
RenderSprites: RenderSprites:
BodyOrientation:
QuantizedFacings: 1
WithSpriteBody: WithSpriteBody:
WithIdleOverlay:
StartSequence: fire-start StartSequence: fire-start
Sequence: fire-loop Sequence: fire-loop
Building: Building:

View File

@@ -667,10 +667,12 @@ v19.husk:
fire-start: flmspt fire-start: flmspt
Length: * Length: *
Offset: 7,-15 Offset: 7,-15
ZOffset: 1
fire-loop: flmspt fire-loop: flmspt
Start: 50 Start: 50
Length: * Length: *
Offset: 7,-15 Offset: 7,-15
ZOffset: 1
v20: v20:
Defaults: Defaults:

View File

@@ -232,8 +232,13 @@ V19.Husk:
ExcludeTilesets: DESERT ExcludeTilesets: DESERT
Tooltip: Tooltip:
Name: Husk (Oil Pump) Name: Husk (Oil Pump)
-RenderBuilding:
AutoSelectionSize:
RenderSprites: RenderSprites:
BodyOrientation:
QuantizedFacings: 1
WithSpriteBody: WithSpriteBody:
WithIdleOverlay:
StartSequence: fire-start StartSequence: fire-start
Sequence: fire-loop Sequence: fire-loop
-Health: -Health:

View File

@@ -514,10 +514,12 @@ v19.husk:
fire-start: flmspt fire-start: flmspt
Length: * Length: *
Offset: 7,-15 Offset: 7,-15
ZOffset: 1
fire-loop: flmspt fire-loop: flmspt
Start: 50 Start: 50
Length: * Length: *
Offset: 7,-15 Offset: 7,-15
ZOffset: 1
utilpol1: utilpol1:
idle: idle: