diff --git a/OpenRA.Mods.Cnc/Traits/AttackPopupTurreted.cs b/OpenRA.Mods.Cnc/Traits/AttackPopupTurreted.cs index 15db5c91ef..9299513e60 100644 --- a/OpenRA.Mods.Cnc/Traits/AttackPopupTurreted.cs +++ b/OpenRA.Mods.Cnc/Traits/AttackPopupTurreted.cs @@ -15,15 +15,25 @@ using OpenRA.Traits; namespace OpenRA.Mods.Cnc.Traits { [Desc("Actor's turret rises from the ground before attacking.")] - class AttackPopupTurretedInfo : AttackTurretedInfo, Requires, Requires + class AttackPopupTurretedInfo : AttackTurretedInfo, Requires, Requires { [Desc("How many game ticks should pass before closing the actor's turret.")] public int CloseDelay = 125; + public int DefaultFacing = 0; [Desc("The percentage of damage that is received while this actor is closed.")] public int ClosedDamageMultiplier = 50; + [Desc("Sequence to play when opening.")] + [SequenceReference] public string OpeningSequence = "opening"; + + [Desc("Sequence to play when closing.")] + [SequenceReference] public string ClosingSequence = "closing"; + + [Desc("Idle sequence to play when closed.")] + [SequenceReference] public string ClosedIdleSequence = "closed-idle"; + public override object Create(ActorInitializer init) { return new AttackPopupTurreted(init, this); } } @@ -32,11 +42,11 @@ namespace OpenRA.Mods.Cnc.Traits enum PopupState { Open, Rotating, Transitioning, Closed } readonly AttackPopupTurretedInfo info; - RenderBuilding rb; + readonly WithSpriteBody wsb; + readonly Turreted turret; int idleTicks = 0; PopupState state = PopupState.Open; - Turreted turret; bool skippedMakeAnimation; public AttackPopupTurreted(ActorInitializer init, AttackPopupTurretedInfo info) @@ -44,7 +54,7 @@ namespace OpenRA.Mods.Cnc.Traits { this.info = info; turret = turrets.FirstOrDefault(); - rb = init.Self.Trait(); + wsb = init.Self.Trait(); skippedMakeAnimation = init.Contains(); } @@ -60,10 +70,10 @@ namespace OpenRA.Mods.Cnc.Traits if (state == PopupState.Closed) { state = PopupState.Transitioning; - rb.PlayCustomAnimThen(self, "opening", () => + wsb.PlayCustomAnimation(self, info.OpeningSequence, () => { state = PopupState.Open; - rb.PlayCustomAnimRepeating(self, "idle"); + wsb.PlayCustomAnimationRepeating(self, wsb.Info.Sequence); }); return false; } @@ -81,10 +91,10 @@ namespace OpenRA.Mods.Cnc.Traits else if (state == PopupState.Rotating && turret.TurretFacing == info.DefaultFacing) { state = PopupState.Transitioning; - rb.PlayCustomAnimThen(self, "closing", () => + wsb.PlayCustomAnimation(self, info.ClosingSequence, () => { state = PopupState.Closed; - rb.PlayCustomAnimRepeating(self, "closed-idle"); + wsb.PlayCustomAnimationRepeating(self, info.ClosedIdleSequence); turret.DesiredFacing = null; }); } @@ -95,7 +105,7 @@ namespace OpenRA.Mods.Cnc.Traits if (skippedMakeAnimation) { state = PopupState.Closed; - rb.PlayCustomAnimRepeating(self, "closed-idle"); + wsb.PlayCustomAnimationRepeating(self, info.ClosedIdleSequence); turret.DesiredFacing = null; } } diff --git a/OpenRA.Mods.Cnc/Traits/Render/WithDeliveryAnimation.cs b/OpenRA.Mods.Cnc/Traits/Render/WithDeliveryAnimation.cs index 5b6b3613e7..e043fb802f 100644 --- a/OpenRA.Mods.Cnc/Traits/Render/WithDeliveryAnimation.cs +++ b/OpenRA.Mods.Cnc/Traits/Render/WithDeliveryAnimation.cs @@ -14,7 +14,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Cnc.Traits { [Desc("Building animation to play when ProductionAirdrop is used to deliver units.")] - public class WithDeliveryAnimationInfo : ITraitInfo, Requires + public class WithDeliveryAnimationInfo : ITraitInfo, Requires { public readonly string ActiveSequence = "active"; @@ -26,23 +26,23 @@ namespace OpenRA.Mods.Cnc.Traits public class WithDeliveryAnimation : INotifyDelivery { readonly WithDeliveryAnimationInfo info; - readonly RenderBuilding building; + readonly WithSpriteBody wsb; public WithDeliveryAnimation(Actor self, WithDeliveryAnimationInfo info) { - building = self.Trait(); + wsb = self.Trait(); this.info = info; } public void IncomingDelivery(Actor self) { - building.PlayCustomAnimRepeating(self, info.ActiveSequence); + wsb.PlayCustomAnimationRepeating(self, info.ActiveSequence); } public void Delivered(Actor self) { - building.PlayCustomAnimRepeating(self, info.IdleSequence); + wsb.PlayCustomAnimationRepeating(self, info.IdleSequence); } } } \ No newline at end of file diff --git a/OpenRA.Mods.Common/Activities/Rearm.cs b/OpenRA.Mods.Common/Activities/Rearm.cs index 6c4bace567..f8b4c065af 100644 --- a/OpenRA.Mods.Common/Activities/Rearm.cs +++ b/OpenRA.Mods.Common/Activities/Rearm.cs @@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Activities continue; // HACK to check if we are on the helipad/airfield/etc. - var hostBuilding = self.World.ActorMap.GetUnitsAt(self.Location).FirstOrDefault(a => a.HasTrait()); + var hostBuilding = self.World.ActorMap.GetUnitsAt(self.Location).FirstOrDefault(a => a.HasTrait()); if (hostBuilding == null || !hostBuilding.IsInWorld) return NextActivity; @@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Activities if (!pool.GiveAmmo()) continue; - hostBuilding.Trait().PlayCustomAnim(hostBuilding, "active"); + hostBuilding.Trait().PlayCustomAnimation(hostBuilding, "active"); var sound = pool.Info.RearmSound; if (sound != null) diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj index 1e9fe87ae3..aa9da4dc8c 100644 --- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj +++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj @@ -403,15 +403,12 @@ - - - + - - + @@ -423,8 +420,10 @@ + + diff --git a/OpenRA.Mods.Common/Traits/Buildings/Refinery.cs b/OpenRA.Mods.Common/Traits/Buildings/Refinery.cs index f152a180c4..6312b6395f 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Refinery.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Refinery.cs @@ -18,7 +18,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { - public class RefineryInfo : ITraitInfo + public class RefineryInfo : ITraitInfo, Requires { [Desc("Actual harvester facing when docking, 0-255 counter-clock-wise.")] public readonly int DockAngle = 0; @@ -47,6 +47,7 @@ namespace OpenRA.Mods.Common.Traits { readonly Actor self; readonly RefineryInfo info; + readonly WithSpriteBody wsb; PlayerResources playerResources; int currentDisplayTick = 0; @@ -69,6 +70,7 @@ namespace OpenRA.Mods.Common.Traits this.info = info; playerResources = self.Owner.PlayerActor.Trait(); currentDisplayTick = info.TickRate; + wsb = self.Trait(); } public virtual Activity DockSequence(Actor harv, Actor self) @@ -105,7 +107,7 @@ namespace OpenRA.Mods.Common.Traits // Harvester was killed while unloading if (dockedHarv != null && dockedHarv.IsDead) { - self.Trait().CancelCustomAnim(self); + wsb.PlayCustomAnimation(self, wsb.Info.Sequence); dockedHarv = null; } diff --git a/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs b/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs index 7b5140d034..e3689bfdca 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs @@ -8,15 +8,17 @@ */ #endregion +using System.Collections.Generic; using System.Linq; using OpenRA.Effects; +using OpenRA.Graphics; using OpenRA.Primitives; using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Allows the player to execute build orders.", " Attach this to the player actor.")] - public class PlaceBuildingInfo : ITraitInfo + public class PlaceBuildingInfo : ITraitInfo, IPlaceBuildingDecoration { [Desc("Palette to use for rendering the placement sprite.")] [PaletteReference] public readonly string Palette = "terrain"; @@ -28,6 +30,16 @@ namespace OpenRA.Mods.Common.Traits public readonly string NewOptionsNotification = "NewOptions"; public object Create(ActorInitializer init) { return new PlaceBuilding(this); } + + public IEnumerable Render(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition) + { + if (!ai.Traits.Get().RequiresBaseProvider) + yield break; + + foreach (var a in w.ActorsWithTrait()) + foreach (var r in a.Trait.RenderAfterWorld(wr)) + yield return r; + } } public class PlaceBuilding : IResolveOrder diff --git a/OpenRA.Mods.Common/Traits/Render/RenderBuilding.cs b/OpenRA.Mods.Common/Traits/Render/RenderBuilding.cs deleted file mode 100644 index 15612e5588..0000000000 --- a/OpenRA.Mods.Common/Traits/Render/RenderBuilding.cs +++ /dev/null @@ -1,91 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2015 The OpenRA Developers (see AUTHORS) - * 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. For more information, - * see COPYING. - */ -#endregion - -using System; -using System.Collections.Generic; -using System.Linq; -using OpenRA.Graphics; -using OpenRA.Traits; - -namespace OpenRA.Mods.Common.Traits -{ - [Desc("Render trait for stationary objects that can be placed from the build palette.")] - public class RenderBuildingInfo : RenderSimpleInfo, Requires, IPlaceBuildingDecoration - { - public readonly bool PauseOnLowPower = false; - - public override object Create(ActorInitializer init) { return new RenderBuilding(init, this); } - - public IEnumerable Render(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition) - { - if (!ai.Traits.Get().RequiresBaseProvider) - yield break; - - foreach (var a in w.ActorsWithTrait()) - foreach (var r in a.Trait.RenderAfterWorld(wr)) - yield return r; - } - } - - public class RenderBuilding : RenderSimple, INotifyDamageStateChanged, INotifyBuildComplete - { - RenderBuildingInfo info; - - public RenderBuilding(ActorInitializer init, RenderBuildingInfo info) - : this(init, info, () => 0) { } - - public RenderBuilding(ActorInitializer init, RenderBuildingInfo info, Func baseFacing) - : base(init, info, baseFacing) - { - var self = init.Self; - this.info = info; - - DefaultAnimation.PlayRepeating(NormalizeSequence(self, info.Sequence)); - } - - public virtual void BuildingComplete(Actor self) - { - DefaultAnimation.PlayRepeating(NormalizeSequence(self, info.Sequence)); - - if (info.PauseOnLowPower) - DefaultAnimation.Paused = () => - self.IsDisabled() && DefaultAnimation.CurrentSequence.Name == NormalizeSequence(self, info.Sequence); - } - - public void PlayCustomAnimThen(Actor self, string name, Action a) - { - DefaultAnimation.PlayThen(NormalizeSequence(self, name), - () => { DefaultAnimation.PlayRepeating(NormalizeSequence(self, info.Sequence)); a(); }); - } - - public void PlayCustomAnimRepeating(Actor self, string name) - { - DefaultAnimation.PlayThen(NormalizeSequence(self, name), - () => PlayCustomAnimRepeating(self, name)); - } - - public void PlayCustomAnimBackwards(Actor self, string name, Action a) - { - DefaultAnimation.PlayBackwardsThen(NormalizeSequence(self, name), - () => { DefaultAnimation.PlayRepeating(NormalizeSequence(self, info.Sequence)); a(); }); - } - - public void CancelCustomAnim(Actor self) - { - DefaultAnimation.PlayRepeating(NormalizeSequence(self, info.Sequence)); - } - - public virtual void DamageStateChanged(Actor self, AttackInfo e) - { - if (DefaultAnimation.CurrentSequence != null) - DefaultAnimation.ReplaceAnim(NormalizeSequence(self, DefaultAnimation.CurrentSequence.Name)); - } - } -} diff --git a/OpenRA.Mods.Common/Traits/Render/RenderBuildingCharge.cs b/OpenRA.Mods.Common/Traits/Render/RenderBuildingCharge.cs deleted file mode 100644 index f1f5104620..0000000000 --- a/OpenRA.Mods.Common/Traits/Render/RenderBuildingCharge.cs +++ /dev/null @@ -1,39 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2015 The OpenRA Developers (see AUTHORS) - * 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. For more information, - * see COPYING. - */ -#endregion - -using OpenRA.Traits; - -namespace OpenRA.Mods.Common.Traits -{ - [Desc("Used for tesla coil and obelisk.")] - public class RenderBuildingChargeInfo : RenderBuildingInfo - { - [Desc("Sequence to use for building charge animation.")] - [SequenceReference] public readonly string ChargeSequence = "active"; - - public override object Create(ActorInitializer init) { return new RenderBuildingCharge(init, this); } - } - - public class RenderBuildingCharge : RenderBuilding, INotifyCharging - { - RenderBuildingChargeInfo info; - - public RenderBuildingCharge(ActorInitializer init, RenderBuildingChargeInfo info) - : base(init, info) - { - this.info = info; - } - - public void Charging(Actor self, Target target) - { - PlayCustomAnim(self, info.ChargeSequence); - } - } -} diff --git a/OpenRA.Mods.Common/Traits/Render/RenderBuildingSilo.cs b/OpenRA.Mods.Common/Traits/Render/RenderBuildingSilo.cs deleted file mode 100644 index 0652818378..0000000000 --- a/OpenRA.Mods.Common/Traits/Render/RenderBuildingSilo.cs +++ /dev/null @@ -1,61 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2015 The OpenRA Developers (see AUTHORS) - * 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. For more information, - * see COPYING. - */ -#endregion - -using System.Collections.Generic; -using OpenRA.Graphics; -using OpenRA.Mods.Common.Graphics; -using OpenRA.Traits; - -namespace OpenRA.Mods.Common.Traits -{ - [Desc("Render trait for buildings that change the sprite according to the remaining resource storage capacity across all depots.")] - class RenderBuildingSiloInfo : RenderBuildingInfo - { - public override object Create(ActorInitializer init) { return new RenderBuildingSilo(init, this); } - - public override IEnumerable RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p) - { - // Show a static frame instead of animating all of the fullness states - var anim = new Animation(init.World, image, () => 0); - anim.PlayFetchIndex(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence), () => 0); - - yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale); - } - } - - class RenderBuildingSilo : RenderBuilding, INotifyBuildComplete, INotifyOwnerChanged - { - readonly RenderBuildingSiloInfo info; - PlayerResources playerResources; - - public RenderBuildingSilo(ActorInitializer init, RenderBuildingSiloInfo info) - : base(init, info) - { - this.info = info; - playerResources = init.Self.Owner.PlayerActor.Trait(); - } - - public override void BuildingComplete(Actor self) - { - var animation = RenderSprites.NormalizeSequence(DefaultAnimation, self.GetDamageState(), info.Sequence); - - DefaultAnimation.PlayFetchIndex(animation, - () => playerResources.ResourceCapacity != 0 - ? ((10 * DefaultAnimation.CurrentSequence.Length - 1) * playerResources.Resources) / (10 * playerResources.ResourceCapacity) - : 0); - } - - public override void OnOwnerChanged(Actor self, Player oldOwner, Player newOwner) - { - playerResources = newOwner.PlayerActor.Trait(); - base.OnOwnerChanged(self, oldOwner, newOwner); - } - } -} diff --git a/OpenRA.Mods.Common/Traits/Render/WithActiveAnimation.cs b/OpenRA.Mods.Common/Traits/Render/WithActiveAnimation.cs index da1c054ff8..2357568be9 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithActiveAnimation.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithActiveAnimation.cs @@ -16,7 +16,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Replaces the idle animation of a building.")] - public class WithActiveAnimationInfo : ITraitInfo, Requires + public class WithActiveAnimationInfo : ITraitInfo, Requires { [Desc("Sequence name to use")] [SequenceReference] public readonly string Sequence = "active"; @@ -31,11 +31,11 @@ namespace OpenRA.Mods.Common.Traits public class WithActiveAnimation : ITick, INotifyBuildComplete, INotifySold { readonly WithActiveAnimationInfo info; - readonly RenderBuilding renderBuilding; + readonly WithSpriteBody wsb; public WithActiveAnimation(Actor self, WithActiveAnimationInfo info) { - renderBuilding = self.Trait(); + wsb = self.Trait(); this.info = info; } @@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Traits if (--ticks <= 0) { if (!(info.PauseOnLowPower && self.IsDisabled())) - renderBuilding.PlayCustomAnim(self, info.Sequence); + wsb.PlayCustomAnimation(self, info.Sequence); ticks = info.Interval; } } diff --git a/OpenRA.Mods.Common/Traits/Render/WithBuildingPlacedAnimation.cs b/OpenRA.Mods.Common/Traits/Render/WithBuildingPlacedAnimation.cs index 0e5b19bd93..5b6294fe0b 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithBuildingPlacedAnimation.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithBuildingPlacedAnimation.cs @@ -13,10 +13,10 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Changes the animation when the actor constructed a building.")] - public class WithBuildingPlacedAnimationInfo : ITraitInfo, Requires + public class WithBuildingPlacedAnimationInfo : ITraitInfo, Requires { - [Desc("Sequence name to use")] - [SequenceReference] public readonly string Sequence = "build"; + [Desc("Sequence name to use"), SequenceReference] + public readonly string Sequence = "build"; public object Create(ActorInitializer init) { return new WithBuildingPlacedAnimation(init.Self, this); } } @@ -24,13 +24,13 @@ namespace OpenRA.Mods.Common.Traits public class WithBuildingPlacedAnimation : INotifyBuildingPlaced, INotifyBuildComplete { readonly WithBuildingPlacedAnimationInfo info; - readonly RenderSimple renderSimple; + readonly WithSpriteBody wsb; bool buildComplete; public WithBuildingPlacedAnimation(Actor self, WithBuildingPlacedAnimationInfo info) { this.info = info; - renderSimple = self.Trait(); + wsb = self.Trait(); buildComplete = !self.HasTrait(); } @@ -42,7 +42,7 @@ namespace OpenRA.Mods.Common.Traits public void BuildingPlaced(Actor self) { if (buildComplete) - renderSimple.PlayCustomAnim(self, info.Sequence); + wsb.PlayCustomAnimation(self, info.Sequence, () => wsb.CancelCustomAnimation(self)); } } } \ No newline at end of file diff --git a/OpenRA.Mods.Common/Traits/Render/WithChargeAnimation.cs b/OpenRA.Mods.Common/Traits/Render/WithChargeAnimation.cs new file mode 100644 index 0000000000..b48b9733d2 --- /dev/null +++ b/OpenRA.Mods.Common/Traits/Render/WithChargeAnimation.cs @@ -0,0 +1,40 @@ +#region Copyright & License Information +/* + * Copyright 2007-2015 The OpenRA Developers (see AUTHORS) + * 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. For more information, + * see COPYING. + */ +#endregion + +using OpenRA.Traits; + +namespace OpenRA.Mods.Common.Traits +{ + [Desc("This actor displays a charge-up animation before firing.")] + public class WithChargeAnimationInfo : ITraitInfo, Requires, Requires + { + [Desc("Sequence to use for charge animation.")] + [SequenceReference] public readonly string ChargeSequence = "active"; + + public object Create(ActorInitializer init) { return new WithChargeAnimation(init, this); } + } + + public class WithChargeAnimation : INotifyCharging + { + readonly WithChargeAnimationInfo info; + readonly WithSpriteBody wsb; + + public WithChargeAnimation(ActorInitializer init, WithChargeAnimationInfo info) + { + this.info = info; + wsb = init.Self.Trait(); + } + + public void Charging(Actor self, Target target) + { + wsb.PlayCustomAnimation(self, info.ChargeSequence); + } + } +} diff --git a/OpenRA.Mods.Common/Traits/Render/WithMakeAnimation.cs b/OpenRA.Mods.Common/Traits/Render/WithMakeAnimation.cs index e12da66ff4..b502c6584a 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithMakeAnimation.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithMakeAnimation.cs @@ -18,7 +18,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Replaces the sprite during construction.")] - public class WithMakeAnimationInfo : ITraitInfo, Requires, Requires + public class WithMakeAnimationInfo : ITraitInfo, Requires { [Desc("Sequence name to use")] [SequenceReference] public readonly string Sequence = "make"; @@ -29,18 +29,18 @@ namespace OpenRA.Mods.Common.Traits public class WithMakeAnimation { readonly WithMakeAnimationInfo info; - readonly RenderBuilding renderBuilding; + readonly WithSpriteBody wsb; public WithMakeAnimation(ActorInitializer init, WithMakeAnimationInfo info) { this.info = info; var self = init.Self; - renderBuilding = self.Trait(); + wsb = self.Trait(); - var building = self.Trait(); - if (!building.SkipMakeAnimation) + var building = self.TraitOrDefault(); + if (building != null && !building.SkipMakeAnimation) { - renderBuilding.PlayCustomAnimThen(self, info.Sequence, () => + wsb.PlayCustomAnimation(self, info.Sequence, () => { building.NotifyBuildingComplete(self); }); @@ -49,10 +49,10 @@ namespace OpenRA.Mods.Common.Traits public void Reverse(Actor self, Activity activity, bool queued = true) { - renderBuilding.PlayCustomAnimBackwards(self, info.Sequence, () => + wsb.PlayCustomAnimationBackwards(self, info.Sequence, () => { // avoids visual glitches as we wait for the actor to get destroyed - renderBuilding.DefaultAnimation.PlayFetchIndex(info.Sequence, () => 0); + wsb.DefaultAnimation.PlayFetchIndex(info.Sequence, () => 0); self.QueueActivity(queued, activity); }); } diff --git a/OpenRA.Mods.Common/Traits/Render/WithRepairAnimation.cs b/OpenRA.Mods.Common/Traits/Render/WithRepairAnimation.cs index d42abf1a1a..5aa6b86d39 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithRepairAnimation.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithRepairAnimation.cs @@ -15,7 +15,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Replaces the building animation when it repairs a unit.")] - public class WithRepairAnimationInfo : ITraitInfo, Requires + public class WithRepairAnimationInfo : ITraitInfo, Requires { [Desc("Sequence name to use")] [SequenceReference] public readonly string Sequence = "active"; @@ -36,9 +36,9 @@ namespace OpenRA.Mods.Common.Traits public void Repairing(Actor self, Actor host) { - var building = host.TraitOrDefault(); - if (building != null && !(info.PauseOnLowPower && self.IsDisabled())) - building.PlayCustomAnim(host, info.Sequence); + var spriteBody = host.TraitOrDefault(); + if (spriteBody != null && !(info.PauseOnLowPower && self.IsDisabled())) + spriteBody.PlayCustomAnimation(host, info.Sequence); } } } \ No newline at end of file diff --git a/OpenRA.Mods.Common/Traits/Render/WithResources.cs b/OpenRA.Mods.Common/Traits/Render/WithResources.cs index 8f5540b957..46bc33f62d 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithResources.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithResources.cs @@ -14,7 +14,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Displays the fill status of PlayerResources with an extra sprite overlay on the actor.")] - class WithResourcesInfo : ITraitInfo, Requires + class WithResourcesInfo : ITraitInfo, Requires, Requires { [Desc("Sequence name to use")] [SequenceReference] public readonly string Sequence = "resources"; @@ -26,7 +26,8 @@ namespace OpenRA.Mods.Common.Traits { readonly WithResourcesInfo info; readonly AnimationWithOffset anim; - readonly RenderSimple rs; + readonly RenderSprites rs; + readonly WithSpriteBody wsb; PlayerResources playerResources; bool buildComplete; @@ -34,7 +35,8 @@ namespace OpenRA.Mods.Common.Traits public WithResources(Actor self, WithResourcesInfo info) { this.info = info; - rs = self.Trait(); + rs = self.Trait(); + wsb = self.Trait(); playerResources = self.Owner.PlayerActor.Trait(); var a = new Animation(self.World, rs.GetImage(self)); @@ -55,7 +57,7 @@ namespace OpenRA.Mods.Common.Traits public void DamageStateChanged(Actor self, AttackInfo e) { if (anim.Animation.CurrentSequence != null) - anim.Animation.ReplaceAnim(rs.NormalizeSequence(self, info.Sequence)); + anim.Animation.ReplaceAnim(wsb.NormalizeSequence(self, info.Sequence)); } public void OnOwnerChanged(Actor self, Player oldOwner, Player newOwner) diff --git a/OpenRA.Mods.Common/Traits/Render/WithSiloAnimation.cs b/OpenRA.Mods.Common/Traits/Render/WithSiloAnimation.cs new file mode 100644 index 0000000000..91eb2ea3aa --- /dev/null +++ b/OpenRA.Mods.Common/Traits/Render/WithSiloAnimation.cs @@ -0,0 +1,55 @@ +#region Copyright & License Information +/* + * Copyright 2007-2015 The OpenRA Developers (see AUTHORS) + * 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. For more information, + * see COPYING. + */ +#endregion + +using System.Collections.Generic; +using OpenRA.Graphics; +using OpenRA.Mods.Common.Graphics; +using OpenRA.Traits; + +namespace OpenRA.Mods.Common.Traits +{ + [Desc("Render trait for buildings that change the sprite according to the remaining resource storage capacity across all depots.")] + class WithSiloAnimationInfo : ITraitInfo, Requires, Requires + { + public readonly int Stages = 10; + + public object Create(ActorInitializer init) { return new WithSiloAnimation(init, this); } + } + + class WithSiloAnimation : INotifyBuildComplete, INotifyOwnerChanged + { + readonly WithSiloAnimationInfo info; + readonly WithSpriteBody wsb; + PlayerResources playerResources; + + public WithSiloAnimation(ActorInitializer init, WithSiloAnimationInfo info) + { + this.info = info; + wsb = init.Self.Trait(); + playerResources = init.Self.Owner.PlayerActor.Trait(); + } + + public void BuildingComplete(Actor self) + { + var animation = wsb.NormalizeSequence(self, wsb.Info.Sequence); + + wsb.DefaultAnimation.PlayFetchIndex(animation, + () => playerResources.ResourceCapacity != 0 + ? ((info.Stages * wsb.DefaultAnimation.CurrentSequence.Length - 1) * playerResources.Resources) / (info.Stages * playerResources.ResourceCapacity) + : 0); + } + + public void OnOwnerChanged(Actor self, Player oldOwner, Player newOwner) + { + playerResources = newOwner.PlayerActor.Trait(); + OnOwnerChanged(self, oldOwner, newOwner); + } + } +} diff --git a/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs b/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs index c4861111ce..b7b5cdc42f 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs @@ -19,11 +19,14 @@ namespace OpenRA.Mods.Common.Traits [Desc("Default trait for rendering sprite-based actors.")] public class WithSpriteBodyInfo : UpgradableTraitInfo, IRenderActorPreviewSpritesInfo, Requires { - [Desc("Animation to play when the actor is created.")] - [SequenceReference] public readonly string StartSequence = null; + [Desc("Animation to play when the actor is created."), SequenceReference] + public readonly string StartSequence = null; - [Desc("Animation to play when the actor is idle.")] - [SequenceReference] public readonly string Sequence = "idle"; + [Desc("Animation to play when the actor is idle."), SequenceReference] + public readonly string Sequence = "idle"; + + [Desc("Pause animation when actor is disabled.")] + public readonly bool PauseAnimationWhenDisabled = false; public override object Create(ActorInitializer init) { return new WithSpriteBody(init, this); } @@ -36,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits } } - public class WithSpriteBody : UpgradableTrait, ISpriteBody, INotifyDamageStateChanged + public class WithSpriteBody : UpgradableTrait, ISpriteBody, INotifyDamageStateChanged, INotifyBuildComplete { public readonly Animation DefaultAnimation; @@ -56,6 +59,10 @@ namespace OpenRA.Mods.Common.Traits () => PlayCustomAnimationRepeating(init.Self, info.Sequence)); else DefaultAnimation.PlayRepeating(NormalizeSequence(init.Self, info.Sequence)); + + if (info.PauseAnimationWhenDisabled) + DefaultAnimation.Paused = () => + init.Self.IsDisabled() && DefaultAnimation.CurrentSequence.Name == NormalizeSequence(init.Self, Info.Sequence); } public string NormalizeSequence(Actor self, string sequence) @@ -63,6 +70,12 @@ namespace OpenRA.Mods.Common.Traits return RenderSprites.NormalizeSequence(DefaultAnimation, self.GetDamageState(), sequence); } + // TODO: Get rid of INotifyBuildComplete in favor of using the upgrade system + public virtual void BuildingComplete(Actor self) + { + DefaultAnimation.PlayRepeating(NormalizeSequence(self, Info.Sequence)); + } + public void PlayCustomAnimation(Actor self, string name, Action after = null) { DefaultAnimation.PlayThen(NormalizeSequence(self, name), () => diff --git a/OpenRA.Mods.Common/Traits/Render/RenderBuildingTurreted.cs b/OpenRA.Mods.Common/Traits/Render/WithTurretedSpriteBody.cs similarity index 75% rename from OpenRA.Mods.Common/Traits/Render/RenderBuildingTurreted.cs rename to OpenRA.Mods.Common/Traits/Render/WithTurretedSpriteBody.cs index 413ee3f180..36e7327f67 100644 --- a/OpenRA.Mods.Common/Traits/Render/RenderBuildingTurreted.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithTurretedSpriteBody.cs @@ -17,24 +17,25 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { - class RenderBuildingTurretedInfo : RenderBuildingInfo, Requires + [Desc("This actor has turret art with facings baked into the sprite.")] + public class WithTurretedSpriteBodyInfo : WithSpriteBodyInfo, Requires, Requires { - public override object Create(ActorInitializer init) { return new RenderBuildingTurreted(init, this); } + public override object Create(ActorInitializer init) { return new WithTurretedSpriteBody(init, this); } public override IEnumerable RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p) { - var t = init.Actor.Traits.WithInterface() - .FirstOrDefault(); + var t = init.Actor.Traits.WithInterface().FirstOrDefault(); + var wsb = init.Actor.Traits.WithInterface().FirstOrDefault(); // Show the correct turret facing var anim = new Animation(init.World, image, () => t.InitialFacing); - anim.PlayRepeating(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence)); + anim.PlayRepeating(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), wsb.Sequence)); yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale); } } - class RenderBuildingTurreted : RenderBuilding + public class WithTurretedSpriteBody : WithSpriteBody { readonly Turreted turreted; @@ -45,7 +46,7 @@ namespace OpenRA.Mods.Common.Traits return () => turreted.TurretFacing; } - public RenderBuildingTurreted(ActorInitializer init, RenderBuildingInfo info) + public WithTurretedSpriteBody(ActorInitializer init, WithSpriteBodyInfo info) : base(init, info, MakeTurretFacingFunc(init.Self)) { turreted = init.Self.TraitsImplementing().FirstOrDefault(); diff --git a/OpenRA.Mods.Common/Traits/Render/RenderBuildingWall.cs b/OpenRA.Mods.Common/Traits/Render/WithWallSpriteBody.cs similarity index 80% rename from OpenRA.Mods.Common/Traits/Render/RenderBuildingWall.cs rename to OpenRA.Mods.Common/Traits/Render/WithWallSpriteBody.cs index 29160a0e85..8976ef6742 100644 --- a/OpenRA.Mods.Common/Traits/Render/RenderBuildingWall.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithWallSpriteBody.cs @@ -17,11 +17,11 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Render trait for actors that change sprites if neighbors with the same trait are present.")] - class RenderBuildingWallInfo : RenderBuildingInfo + class WithWallSpriteBodyInfo : WithSpriteBodyInfo { public readonly string Type = "wall"; - public override object Create(ActorInitializer init) { return new RenderBuildingWall(init, this); } + public override object Create(ActorInitializer init) { return new WithWallSpriteBody(init, this); } public override IEnumerable RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p) { @@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits var haveNeighbour = false; foreach (var n in kv.Value) { - var rb = init.World.Map.Rules.Actors[n].Traits.GetOrDefault(); + var rb = init.World.Map.Rules.Actors[n].Traits.GetOrDefault(); if (rb != null && rb.Type == Type) { haveNeighbour = true; @@ -68,33 +68,26 @@ namespace OpenRA.Mods.Common.Traits } } - class RenderBuildingWall : RenderBuilding, INotifyAddedToWorld, INotifyRemovedFromWorld + class WithWallSpriteBody : WithSpriteBody, INotifyAddedToWorld, INotifyRemovedFromWorld, ITick { - readonly RenderBuildingWallInfo info; + readonly WithWallSpriteBodyInfo wallInfo; int adjacent = 0; bool dirty = true; - public RenderBuildingWall(ActorInitializer init, RenderBuildingWallInfo info) - : base(init, info) + public WithWallSpriteBody(ActorInitializer init, WithWallSpriteBodyInfo info) + : base(init, info, () => 0) { - this.info = info; - } - - public override void BuildingComplete(Actor self) - { - DefaultAnimation.PlayFetchIndex(info.Sequence, () => adjacent); - UpdateNeighbours(self); + wallInfo = info; + DefaultAnimation.PlayFetchIndex(NormalizeSequence(init.Self, Info.Sequence), () => adjacent); } public override void DamageStateChanged(Actor self, AttackInfo e) { - DefaultAnimation.PlayFetchIndex(NormalizeSequence(DefaultAnimation, e.DamageState, info.Sequence), () => adjacent); + DefaultAnimation.PlayFetchIndex(NormalizeSequence(self, Info.Sequence), () => adjacent); } - public override void Tick(Actor self) + public void Tick(Actor self) { - base.Tick(self); - if (!dirty) return; @@ -105,8 +98,8 @@ namespace OpenRA.Mods.Common.Traits adjacent = 0; foreach (var a in adjacentActors) { - var rb = a.TraitOrDefault(); - if (rb == null || rb.info.Type != info.Type) + var rb = a.TraitOrDefault(); + if (rb == null || rb.wallInfo.Type != wallInfo.Type) continue; var location = self.Location; @@ -129,7 +122,7 @@ namespace OpenRA.Mods.Common.Traits { var adjacentActors = CVec.Directions.SelectMany(dir => self.World.ActorMap.GetUnitsAt(self.Location + dir)) - .Select(a => a.TraitOrDefault()) + .Select(a => a.TraitOrDefault()) .Where(a => a != null); foreach (var rb in adjacentActors) @@ -138,6 +131,7 @@ namespace OpenRA.Mods.Common.Traits public void AddedToWorld(Actor self) { + DefaultAnimation.PlayFetchIndex(NormalizeSequence(self, Info.Sequence), () => adjacent); UpdateNeighbours(self); } diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/GrantUpgradePower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/GrantUpgradePower.cs index 1e7f7a1109..02961e2bb9 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/GrantUpgradePower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/GrantUpgradePower.cs @@ -30,6 +30,9 @@ namespace OpenRA.Mods.Common.Traits public readonly int Range = 1; public readonly string GrantUpgradeSound = "ironcur9.aud"; + [Desc("Sequence to play for granting actor when activated."), SequenceReference] + public readonly string GrantUpgradeSequence = "active"; + public override object Create(ActorInitializer init) { return new GrantUpgradePower(init.Self, this); } } @@ -53,7 +56,7 @@ namespace OpenRA.Mods.Common.Traits { base.Activate(self, order, manager); - self.Trait().PlayCustomAnim(self, "active"); + self.Trait().PlayCustomAnimation(self, info.GrantUpgradeSequence); Sound.Play(info.GrantUpgradeSound, self.World.Map.CenterOfCell(order.TargetLocation)); diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs index cf4d141ab7..bf7663fe86 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs @@ -47,6 +47,10 @@ namespace OpenRA.Mods.Common.Traits public readonly string FlashType = null; + [SequenceReference] + [Desc("Sequence the launching actor should play when activating this power.")] + public readonly string ActivationSequence = "active"; + public override object Create(ActorInitializer init) { return new NukePower(init.Self, this); } } @@ -71,8 +75,11 @@ namespace OpenRA.Mods.Common.Traits else Sound.Play(Info.IncomingSound); - var rb = self.Trait(); - rb.PlayCustomAnim(self, "active"); + if (!string.IsNullOrEmpty(info.ActivationSequence)) + { + var wsb = self.Trait(); + wsb.PlayCustomAnimation(self, info.ActivationSequence); + } var targetPosition = self.World.Map.CenterOfCell(order.TargetLocation); var missile = new NukeLaunch(self.Owner, info.MissileWeapon, diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs index f08947cf3b..ab12a839f0 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs @@ -1810,6 +1810,161 @@ namespace OpenRA.Mods.Common.UtilityCommands } } + if (engineVersion < 20150826) + { + // Replaced RenderBuildingCharge with RenderSprites + WithSpriteBody + WithChargeAnimation (+AutoSelectionSize) + if (depth == 0) + { + var childKeySequence = new[] { "ChargeSequence" }; + var childKeysExcludeFromRS = new[] { "Sequence", "ChargeSequence", "PauseOnLowPower" }; + + var rb = node.Value.Nodes.FirstOrDefault(n => n.Key.StartsWith("RenderBuildingCharge")); + if (rb != null) + { + rb.Key = "WithChargeAnimation"; + + var rsNodes = rb.Value.Nodes.Where(n => !childKeysExcludeFromRS.Contains(n.Key)).ToList(); + var wsbNodes = rb.Value.Nodes.Where(n => childKeySequence.Contains(n.Key)).ToList(); + + if (rsNodes.Any()) + node.Value.Nodes.Add(new MiniYamlNode("RenderSprites", new MiniYaml("", rsNodes))); + else + node.Value.Nodes.Add(new MiniYamlNode("RenderSprites", "")); + + node.Value.Nodes.Add(new MiniYamlNode("AutoSelectionSize", "")); + + rb.Value.Nodes.RemoveAll(n => rsNodes.Contains(n)); + rb.Value.Nodes.RemoveAll(n => wsbNodes.Contains(n)); + } + + var rrb = node.Value.Nodes.FirstOrDefault(n => n.Key.StartsWith("-RenderBuildingCharge")); + if (rrb != null) + rrb.Key = "-WithChargeAnimation"; + } + + // Replaced RenderBuildingSilo with RenderSprites + WithSpriteBody + WithSiloAnimation (+AutoSelectionSize) + if (depth == 0) + { + var childKeySequence = new[] { "Sequence", "PauseOnLowPower" }; + + var rb = node.Value.Nodes.FirstOrDefault(n => n.Key.StartsWith("RenderBuildingSilo")); + if (rb != null) + { + rb.Key = "WithSiloAnimation"; + + var rsNodes = rb.Value.Nodes.Where(n => !childKeySequence.Contains(n.Key)).ToList(); + var wsbNodes = rb.Value.Nodes.Where(n => childKeySequence.Contains(n.Key)).ToList(); + + if (rsNodes.Any()) + node.Value.Nodes.Add(new MiniYamlNode("RenderSprites", new MiniYaml("", rsNodes))); + else + node.Value.Nodes.Add(new MiniYamlNode("RenderSprites", "")); + + if (wsbNodes.Any()) + node.Value.Nodes.Add(new MiniYamlNode("WithSpriteBody", new MiniYaml("", wsbNodes))); + else + node.Value.Nodes.Add(new MiniYamlNode("WithSpriteBody", "")); + + node.Value.Nodes.Add(new MiniYamlNode("AutoSelectionSize", "")); + + rb.Value.Nodes.RemoveAll(n => rsNodes.Contains(n)); + rb.Value.Nodes.RemoveAll(n => wsbNodes.Contains(n)); + } + + var rrb = node.Value.Nodes.FirstOrDefault(n => n.Key.StartsWith("-RenderBuildingSilo")); + if (rrb != null) + rrb.Key = "-WithSiloAnimation"; + } + + // Replaced RenderBuildingTurreted with RenderSprites + WithTurretedSpriteBody (+AutoSelectionSize) + if (depth == 0) + { + var childKeysExcludeFromRS = new[] { "Sequence", "PauseOnLowPower" }; + + var rb = node.Value.Nodes.FirstOrDefault(n => n.Key.StartsWith("RenderBuildingTurreted")); + if (rb != null) + { + rb.Key = "WithTurretedSpriteBody"; + + var rsNodes = rb.Value.Nodes.Where(n => !childKeysExcludeFromRS.Contains(n.Key)).ToList(); + + if (rsNodes.Any()) + node.Value.Nodes.Add(new MiniYamlNode("RenderSprites", new MiniYaml("", rsNodes))); + else + node.Value.Nodes.Add(new MiniYamlNode("RenderSprites", "")); + + node.Value.Nodes.Add(new MiniYamlNode("AutoSelectionSize", "")); + + rb.Value.Nodes.RemoveAll(n => rsNodes.Contains(n)); + } + + var rrb = node.Value.Nodes.FirstOrDefault(n => n.Key.StartsWith("-RenderBuildingTurreted")); + if (rrb != null) + rrb.Key = "-WithTurretedSpriteBody"; + } + + // Replaced RenderBuildingWall with RenderSprites + WithWallSpriteBody (+AutoSelectionSize) + if (depth == 0) + { + var childKeysExcludeFromRS = new[] { "Sequence", "Type" }; + + var rb = node.Value.Nodes.FirstOrDefault(n => n.Key.StartsWith("RenderBuildingWall")); + if (rb != null) + { + rb.Key = "WithWallSpriteBody"; + + var rsNodes = rb.Value.Nodes.Where(n => !childKeysExcludeFromRS.Contains(n.Key)).ToList(); + + if (rsNodes.Any()) + node.Value.Nodes.Add(new MiniYamlNode("RenderSprites", new MiniYaml("", rsNodes))); + else + node.Value.Nodes.Add(new MiniYamlNode("RenderSprites", "")); + + node.Value.Nodes.Add(new MiniYamlNode("AutoSelectionSize", "")); + + rb.Value.Nodes.RemoveAll(n => rsNodes.Contains(n)); + } + + var rrb = node.Value.Nodes.FirstOrDefault(n => n.Key.StartsWith("-RenderBuildingWall")); + if (rrb != null) + rrb.Key = "-WithWallSpriteBody"; + } + } + + if (engineVersion < 20150828) + { + // Replaced RenderBuilding with RenderSprites + WithSpriteBody (+AutoSelectionSize) + if (depth == 0) + { + var childKeysExcludeFromRS = new[] { "Sequence", "PauseOnLowPower" }; + + var rb = node.Value.Nodes.FirstOrDefault(n => n.Key.StartsWith("RenderBuilding")); + if (rb != null) + { + rb.Key = "WithSpriteBody"; + + var rsNodes = rb.Value.Nodes.Where(n => !childKeysExcludeFromRS.Contains(n.Key)).ToList(); + + if (rsNodes.Any()) + node.Value.Nodes.Add(new MiniYamlNode("RenderSprites", new MiniYaml("", rsNodes))); + else + node.Value.Nodes.Add(new MiniYamlNode("RenderSprites", "")); + + node.Value.Nodes.Add(new MiniYamlNode("AutoSelectionSize", "")); + + rb.Value.Nodes.RemoveAll(n => rsNodes.Contains(n)); + } + + var rrb = node.Value.Nodes.FirstOrDefault(n => n.Key.StartsWith("-RenderBuilding")); + if (rrb != null) + rrb.Key = "-WithSpriteBody"; + + if (depth == 2 && node.Key == "PauseOnLowPower" && (parentKey == "WithSpriteBody" + || parentKey == "WithTurretedSpriteBody" || parentKey == "WithWallSpriteBody")) + node.Key = "PauseAnimationWhenDisabled"; + } + } + UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1); } } diff --git a/OpenRA.Mods.RA/Activities/Teleport.cs b/OpenRA.Mods.RA/Activities/Teleport.cs index 958b791013..21384d8c0b 100644 --- a/OpenRA.Mods.RA/Activities/Teleport.cs +++ b/OpenRA.Mods.RA/Activities/Teleport.cs @@ -92,9 +92,9 @@ namespace OpenRA.Mods.RA.Activities if (teleporter != null && self != teleporter && !teleporter.Disposed) { - var building = teleporter.TraitOrDefault(); + var building = teleporter.TraitOrDefault(); if (building != null) - building.PlayCustomAnim(teleporter, "active"); + building.PlayCustomAnimation(teleporter, "active"); } return NextActivity; diff --git a/mods/cnc/rules/civilian.yaml b/mods/cnc/rules/civilian.yaml index fc02e60d23..ce160cf1bd 100644 --- a/mods/cnc/rules/civilian.yaml +++ b/mods/cnc/rules/civilian.yaml @@ -287,7 +287,7 @@ BARB: NodeTypes: barbwire LineBuildNode: Types: barbwire - RenderBuildingWall: + WithWallSpriteBody: Type: barbwire WOOD: @@ -303,7 +303,7 @@ WOOD: NodeTypes: woodfence LineBuildNode: Types: woodfence - RenderBuildingWall: + WithWallSpriteBody: Type: woodfence BRIDGE1: diff --git a/mods/cnc/rules/defaults.yaml b/mods/cnc/rules/defaults.yaml index 6369541f62..f5ef357ec2 100644 --- a/mods/cnc/rules/defaults.yaml +++ b/mods/cnc/rules/defaults.yaml @@ -432,7 +432,9 @@ DamagedSounds: xplos.aud DestroyedSounds: crumble.aud QuantizeFacingsFromSequence: - RenderBuilding: + RenderSprites: + WithSpriteBody: + AutoSelectionSize: WithBuildingExplosion: Delay: 1 CaptureNotification: @@ -489,7 +491,9 @@ Dimensions: 1,1 Footprint: x QuantizeFacingsFromSequence: - RenderBuilding: + RenderSprites: + WithSpriteBody: + AutoSelectionSize: Tooltip: Name: Civilian Building (Destroyed) GenericVisibility: None @@ -518,8 +522,10 @@ -WithBuildingExplosion: -TargetableBuilding: -Demolishable: - RenderBuilding: + RenderSprites: Palette: terrain + WithSpriteBody: + AutoSelectionSize: ^CivFieldHusk: AppearsOnRadar: @@ -560,8 +566,10 @@ Types: wall BodyOrientation: QuantizedFacings: 1 - RenderBuildingWall: + RenderSprites: Palette: staticterrain + WithWallSpriteBody: + AutoSelectionSize: GivesExperience: AutoTargetIgnore: Sellable: @@ -599,8 +607,10 @@ Name: Blossom Tree BodyOrientation: QuantizedFacings: 1 - RenderBuilding: + RenderSprites: Palette: staticterrain + WithSpriteBody: + AutoSelectionSize: Building: Footprint: x Dimensions: 1,1 diff --git a/mods/cnc/rules/misc.yaml b/mods/cnc/rules/misc.yaml index bb064e94e9..c1c7bcc29d 100644 --- a/mods/cnc/rules/misc.yaml +++ b/mods/cnc/rules/misc.yaml @@ -47,7 +47,7 @@ waypoint: ^fact.colorpicker: Inherits: FACT - RenderBuilding: + RenderSprites: Image: fact Palette: colorpicker diff --git a/mods/cnc/rules/structures.yaml b/mods/cnc/rules/structures.yaml index 85d52d76f2..6b78945766 100644 --- a/mods/cnc/rules/structures.yaml +++ b/mods/cnc/rules/structures.yaml @@ -72,7 +72,7 @@ FACT: FACT.GDI: Inherits: FACT - RenderBuilding: + RenderSprites: Image: fact Buildable: Queue: Building.GDI, Building.Nod @@ -84,7 +84,7 @@ FACT.GDI: FACT.NOD: Inherits: FACT - RenderBuilding: + RenderSprites: Image: fact Buildable: Queue: Building.GDI, Building.Nod @@ -210,12 +210,14 @@ SILO: Range: 4c0 Bib: HasMinibib: Yes - RenderBuildingSilo: + RenderSprites: + WithSpriteBody: + AutoSelectionSize: + WithSiloAnimation: StoresResources: PipCount: 10 PipColor: Green Capacity: 2000 - -RenderBuilding: -EmitInfantryOnSell: Power: Amount: -10 @@ -459,8 +461,8 @@ HQ: RequiresPower: CanPowerDown: DisabledOverlay: - RenderBuilding: - PauseOnLowPower: yes + WithSpriteBody: + PauseAnimationWhenDisabled: true Health: HP: 700 RevealsShroud: @@ -545,8 +547,8 @@ EYE: RequiresPower: CanPowerDown: DisabledOverlay: - RenderBuilding: - PauseOnLowPower: yes + WithSpriteBody: + PauseAnimationWhenDisabled: true Health: HP: 1200 RevealsShroud: @@ -650,14 +652,14 @@ GUN: Turreted: ROT: 12 InitialFacing: 50 - RenderBuildingTurreted: + -WithSpriteBody: + WithTurretedSpriteBody: Armament: Weapon: TurretGun LocalOffset: 512,0,112 MuzzleSequence: muzzle AttackTurreted: WithMuzzleFlash: - -RenderBuilding: -WithDeathAnimation: DetectCloaked: Range: 3 @@ -691,13 +693,14 @@ SAM: Turreted: ROT: 10 InitialFacing: 0 - RenderBuildingTurreted: + -WithSpriteBody: + WithTurretedSpriteBody: + AutoSelectionSize: Armament: Weapon: SAMMissile MuzzleSequence: muzzle AttackPopupTurreted: WithMuzzleFlash: - -RenderBuilding: -RenderDetectionCircle: Power: Amount: -20 @@ -732,7 +735,7 @@ OBLI: Range: 8c0 Bib: HasMinibib: Yes - RenderBuildingCharge: + WithChargeAnimation: Armament: Weapon: Laser LocalOffset: 0,0,725 @@ -741,7 +744,6 @@ OBLI: ChargeAudio: obelpowr.aud ReloadTime: 40 InitialChargeDelay: 50 - -RenderBuilding: -EmitInfantryOnSell: DetectCloaked: Range: 5 @@ -854,7 +856,7 @@ SBAG: NodeTypes: sandbag LineBuildNode: Types: sandbag - RenderBuildingWall: + WithWallSpriteBody: Type: sandbag CYCL: @@ -879,7 +881,7 @@ CYCL: NodeTypes: chain LineBuildNode: Types: chain - RenderBuildingWall: + WithWallSpriteBody: Type: chain BRIK: @@ -909,7 +911,7 @@ BRIK: NodeTypes: concrete LineBuildNode: Types: concrete - RenderBuildingWall: + WithWallSpriteBody: Type: concrete BARRACKS: diff --git a/mods/cnc/rules/tech.yaml b/mods/cnc/rules/tech.yaml index dc99ad30da..e230c4711a 100644 --- a/mods/cnc/rules/tech.yaml +++ b/mods/cnc/rules/tech.yaml @@ -11,7 +11,6 @@ V19: V19.Husk: Inherits: ^CivBuildingHusk - -RenderBuilding: AutoSelectionSize: RenderSprites: BodyOrientation: @@ -88,7 +87,6 @@ BIO.Husk: MISS: Inherits: ^CivBuilding - RenderBuilding: Building: Footprint: xxx xxx Dimensions: 3,2 diff --git a/mods/cnc/rules/trees.yaml b/mods/cnc/rules/trees.yaml index 3d44a050cf..b31a0d9b9a 100644 --- a/mods/cnc/rules/trees.yaml +++ b/mods/cnc/rules/trees.yaml @@ -7,7 +7,7 @@ SPLIT2: SPLIT3: Inherits: ^TibTree - RenderBuilding: + RenderSprites: Image: split2 SeedsResource: ResourceType: Tiberium @@ -16,7 +16,7 @@ SPLIT3: SPLITBLUE: Inherits: ^TibTree - RenderBuilding: + RenderSprites: Image: split3 SeedsResource: ResourceType: BlueTiberium diff --git a/mods/d2k/rules/arrakis.yaml b/mods/d2k/rules/arrakis.yaml index 8e84ccdde1..2b442e5c74 100644 --- a/mods/d2k/rules/arrakis.yaml +++ b/mods/d2k/rules/arrakis.yaml @@ -1,6 +1,8 @@ spicebloom: HiddenUnderShroud: - RenderBuilding: + RenderSprites: + WithSpriteBody: + AutoSelectionSize: Building: Footprint: x Dimensions: 1,1 diff --git a/mods/d2k/rules/defaults.yaml b/mods/d2k/rules/defaults.yaml index 00da36ee6f..a00606d90d 100644 --- a/mods/d2k/rules/defaults.yaml +++ b/mods/d2k/rules/defaults.yaml @@ -275,7 +275,9 @@ DamagedSounds: EXPLSML1.WAV DestroyedSounds: EXPLHG1.WAV QuantizeFacingsFromSequence: - RenderBuilding: + RenderSprites: + WithSpriteBody: + AutoSelectionSize: WithBuildingExplosion: RepairableBuilding: EmitInfantryOnSell: @@ -311,8 +313,10 @@ -GivesBuildableArea: -WithCrumbleOverlay: -WithMakeAnimation: - -RenderBuilding: - RenderBuildingWall: + -WithSpriteBody: + RenderSprites: + WithWallSpriteBody: + AutoSelectionSize: LineBuildNode: Types: turret MustBeDestroyed: diff --git a/mods/d2k/rules/structures.yaml b/mods/d2k/rules/structures.yaml index ff1979c926..d1fe88a150 100644 --- a/mods/d2k/rules/structures.yaml +++ b/mods/d2k/rules/structures.yaml @@ -67,7 +67,7 @@ conyard: ProductionBar: Power: Amount: 20 - RenderBuilding: + RenderSprites: Image: conyard.harkonnen FactionImages: atreides: conyard.atreides @@ -99,7 +99,7 @@ power: Type: Wood RevealsShroud: Range: 4c0 - RenderBuilding: + RenderSprites: Image: power.harkonnen FactionImages: atreides: power.atreides @@ -160,7 +160,7 @@ barracks: Factions: atreides, ordos Power: Amount: -20 - RenderBuilding: + RenderSprites: Image: barracks.harkonnen FactionImages: atreides: barracks.atreides @@ -205,7 +205,7 @@ refinery: DeliveryOffset: 2,2 DeliveringActor: carryall.reinforce Facing: 160 - RenderBuilding: + RenderSprites: Image: refinery.harkonnen FactionImages: atreides: refinery.atreides @@ -241,12 +241,13 @@ silo: Type: Wood RevealsShroud: Range: 4c0 - -RenderBuilding: - RenderBuildingSilo: + RenderSprites: Image: silo.harkonnen FactionImages: atreides: silo.atreides ordos: silo.ordos + WithSpriteBody: + WithSiloAnimation: StoresResources: PipColor: green PipCount: 5 @@ -280,7 +281,7 @@ light: Type: Wood RevealsShroud: Range: 4c0 - RenderBuilding: + RenderSprites: Image: light.harkonnen FactionImages: atreides: light.atreides @@ -358,7 +359,7 @@ heavy: ProvidesPrerequisite@missiletank: Prerequisite: heavy.missiletank Factions: atreides, harkonnen - RenderBuilding: + RenderSprites: Image: heavy.harkonnen FactionImages: atreides: heavy.atreides @@ -404,7 +405,7 @@ radar: DetectCloaked: Range: 6 RenderDetectionCircle: - RenderBuilding: + RenderSprites: Image: radar.harkonnen FactionImages: atreides: radar.atreides @@ -449,7 +450,7 @@ starport: ProductionAirdrop: Produces: Starport ActorType: frigate - RenderBuilding: + RenderSprites: Image: starport.harkonnen FactionImages: atreides: starport.atreides @@ -510,7 +511,9 @@ wall: Types: wall TargetableBuilding: TargetTypes: Ground, Wall - RenderBuildingWall: + RenderSprites: + WithWallSpriteBody: + AutoSelectionSize: AutoTargetIgnore: Sellable: SellSounds: CHUNG.WAV @@ -637,7 +640,7 @@ repair: FinishRepairingNotification: UnitRepaired RallyPoint: Offset: 1,3 - RenderBuilding: + RenderSprites: Image: repair.harkonnen FactionImages: atreides: repair.atreides @@ -676,7 +679,7 @@ hightech: Type: Wood RevealsShroud: Range: 4c0 - RenderBuilding: + RenderSprites: Image: hightech.harkonnen FactionImages: atreides: hightech.atreides @@ -737,7 +740,7 @@ research: Type: Wood RevealsShroud: Range: 4c0 - RenderBuilding: + RenderSprites: Image: research.harkonnen FactionImages: atreides: research.atreides @@ -774,7 +777,7 @@ palace: Type: Wood RevealsShroud: Range: 8c0 - RenderBuilding: + RenderSprites: Image: palace.harkonnen FactionImages: atreides: palace.atreides @@ -805,6 +808,7 @@ palace: DisplayBeacon: True DisplayRadarPing: True CameraActor: camera + ActivationSequence: CanPowerDown: DisabledOverlay: RequiresPower: @@ -818,7 +822,7 @@ conyard.atreides: BuildPaletteOrder: 1000 Prerequisites: ~disabled ForceFaction: atreides - RenderBuilding: + RenderSprites: Image: conyard.atreides -FactionImages: @@ -829,7 +833,7 @@ conyard.harkonnen: BuildPaletteOrder: 1000 Prerequisites: ~disabled ForceFaction: harkonnen - RenderBuilding: + RenderSprites: Image: conyard.harkonnen -FactionImages: @@ -840,7 +844,7 @@ conyard.ordos: BuildPaletteOrder: 1000 Prerequisites: ~disabled ForceFaction: ordos - RenderBuilding: + RenderSprites: Image: conyard.ordos -FactionImages: diff --git a/mods/d2k/sequences/structures.yaml b/mods/d2k/sequences/structures.yaml index 3244787801..d310ff9724 100644 --- a/mods/d2k/sequences/structures.yaml +++ b/mods/d2k/sequences/structures.yaml @@ -82,11 +82,13 @@ conyard.atreides: Length: 14 Offset: -48,64 Tick: 80 + ZOffset: 1023 damaged-crane-overlay: DATA.R8 Start: 4436 Length: 14 Offset: -48,64 Tick: 80 + ZOffset: 1023 bib: BLOXBASE.R8 Frames: 611, 612, 613, 631, 632, 633 Length: 6 @@ -590,6 +592,7 @@ light.atreides: Offset: -48,64 Tick: 200 BlendMode: Additive + ZOffset: 1023 bib: BLOXBASE.R8 Frames: 611, 612, 613, 631, 632, 633 Length: 6 @@ -632,6 +635,7 @@ heavy.atreides: Offset: -48,80 Tick: 200 BlendMode: Additive + ZOffset: 511 bib: BLOXBASE.R8 Frames: 611, 612, 613, 631, 632, 633 Length: 6 @@ -665,11 +669,13 @@ conyard.harkonnen: Length: 14 Offset: -48,64 Tick: 80 + ZOffset: 1023 damaged-crane-overlay: DATA.R8 Start: 4450 Length: 14 Offset: -48,64 Tick: 80 + ZOffset: 1023 bib: BLOXBASE.R8 Frames: 611, 612, 613, 631, 632, 633 Length: 6 @@ -983,6 +989,7 @@ light.harkonnen: Offset: -48,64 Tick: 200 BlendMode: Additive + ZOffset: 1023 bib: BLOXBASE.R8 Frames: 611, 612, 613, 631, 632, 633 Length: 6 @@ -1025,6 +1032,7 @@ heavy.harkonnen: Offset: -48,80 Tick: 200 BlendMode: Additive + ZOffset: 511 bib: BLOXBASE.R8 Frames: 611, 612, 613, 631, 632, 633 Length: 6 @@ -1058,11 +1066,13 @@ conyard.ordos: Length: 14 Offset: -48,64 Tick: 80 + ZOffset: 1023 damaged-crane-overlay: DATA.R8 Start: 4464 Length: 14 Offset: -48,64 Tick: 80 + ZOffset: 1023 bib: BLOXBASE.R8 Frames: 611, 612, 613, 631, 632, 633 Length: 6 @@ -1368,6 +1378,7 @@ light.ordos: Offset: -48,64 Tick: 200 BlendMode: Additive + ZOffset: 1023 bib: BLOXBASE.R8 Frames: 611, 612, 613, 631, 632, 633 Length: 6 @@ -1410,6 +1421,7 @@ heavy.ordos: Offset: -48,80 Tick: 200 BlendMode: Additive + ZOffset: 511 bib: BLOXBASE.R8 Frames: 611, 612, 613, 631, 632, 633 Length: 6 diff --git a/mods/ra/maps/allies-05a/map.yaml b/mods/ra/maps/allies-05a/map.yaml index de13891713..48e58ce393 100644 --- a/mods/ra/maps/allies-05a/map.yaml +++ b/mods/ra/maps/allies-05a/map.yaml @@ -1729,14 +1729,14 @@ Rules: Turreted: ROT: 15 InitialFacing: 224 - RenderBuildingTurreted: + RenderSprites: Image: AGUN + WithTurretedSpriteBody: Armament: Weapon: MissionColt LocalOffset: 432,150,-30, 432,-150,-30 AttackTurreted: AutoTarget: - -RenderBuilding: -Selectable: E1.Autotarget: Inherits: E1 diff --git a/mods/ra/maps/bomber-john/map.yaml b/mods/ra/maps/bomber-john/map.yaml index 4a0036553f..50984054c2 100644 --- a/mods/ra/maps/bomber-john/map.yaml +++ b/mods/ra/maps/bomber-john/map.yaml @@ -877,6 +877,7 @@ Rules: EndChargeSound: ironrdy1.aud Range: 1 Upgrades: invulnerability + GrantUpgradeSequence: idle Power: Amount: 0 MINVV: @@ -893,9 +894,10 @@ Rules: Cost: 30 Health: HP: 200 - RenderBuilding: + RenderSprites: Image: miner - HasMakeAnimation: false + WithSpriteBody: + AutoSelectionSize: Tooltip: Name: Bomb Description: Bomb (Hotkey B) @@ -943,6 +945,7 @@ Rules: EndChargeSound: ironrdy1.aud Range: 1 Upgrades: invulnerability + GrantUpgradeSequence: idle Sequences: miner: diff --git a/mods/ra/maps/center-of-attention-redux-2/map.yaml b/mods/ra/maps/center-of-attention-redux-2/map.yaml index 6fc7d42db9..1218c71539 100644 --- a/mods/ra/maps/center-of-attention-redux-2/map.yaml +++ b/mods/ra/maps/center-of-attention-redux-2/map.yaml @@ -891,13 +891,13 @@ Rules: Inherits: OILB Health: HP: 6000 - RenderBuilding: + RenderSprites: Image: OILB OILB.Weak: Inherits: OILB Health: HP: 900 - RenderBuilding: + RenderSprites: Image: OILB Sequences: diff --git a/mods/ra/maps/monster-tank-madness/map.yaml b/mods/ra/maps/monster-tank-madness/map.yaml index f82be63892..011807840e 100644 --- a/mods/ra/maps/monster-tank-madness/map.yaml +++ b/mods/ra/maps/monster-tank-madness/map.yaml @@ -2238,7 +2238,7 @@ Rules: Inherits: DOME Buildable: Prerequisites: ~disabled - RenderBuilding: + RenderSprites: Image: DOME -InfiltrateForExploration: TargetableBuilding: diff --git a/mods/ra/maps/soviet-05/map.yaml b/mods/ra/maps/soviet-05/map.yaml index 35227cf143..296e656f0f 100644 --- a/mods/ra/maps/soviet-05/map.yaml +++ b/mods/ra/maps/soviet-05/map.yaml @@ -721,7 +721,7 @@ Rules: Prerequisites: ~disabled DOME.IGNORE: Inherits: DOME - RenderBuilding: + RenderSprites: Image: DOME AutoTargetIgnore: Buildable: diff --git a/mods/ra/maps/survival01/map.yaml b/mods/ra/maps/survival01/map.yaml index de9d7e1d10..9740347103 100644 --- a/mods/ra/maps/survival01/map.yaml +++ b/mods/ra/maps/survival01/map.yaml @@ -1273,7 +1273,7 @@ Rules: -ParatroopersPower@paratroopers: -AirstrikePower@parabombs: -SupportPowerChargeBar: - RenderBuilding: + RenderSprites: Image: AFLD ATEK.mission: Inherits: ATEK @@ -1285,7 +1285,7 @@ Rules: -TargetableBuilding: -GivesBuildableArea: -Huntable: - RenderBuilding: + RenderSprites: Image: ATEK GUN: Valued: diff --git a/mods/ra/rules/civilian.yaml b/mods/ra/rules/civilian.yaml index 07cecaec62..d9b74437af 100644 --- a/mods/ra/rules/civilian.yaml +++ b/mods/ra/rules/civilian.yaml @@ -232,7 +232,6 @@ V19.Husk: ExcludeTilesets: DESERT Tooltip: Name: Husk (Oil Pump) - -RenderBuilding: AutoSelectionSize: RenderSprites: BodyOrientation: @@ -628,7 +627,7 @@ SNOWHUT: Building: Footprint: x x Dimensions: 1,2 - RenderBuilding: + RenderSprites: Scale: 0.7 LHUS: diff --git a/mods/ra/rules/defaults.yaml b/mods/ra/rules/defaults.yaml index 59c584a3aa..1d39ccdaea 100644 --- a/mods/ra/rules/defaults.yaml +++ b/mods/ra/rules/defaults.yaml @@ -396,7 +396,9 @@ DamagedSounds: kaboom1.aud DestroyedSounds: kaboom22.aud QuantizeFacingsFromSequence: - RenderBuilding: + RenderSprites: + AutoSelectionSize: + WithSpriteBody: WithBuildingExplosion: CaptureNotification: ShakeOnDeath: @@ -462,8 +464,9 @@ Types: wall TargetableBuilding: TargetTypes: Ground, DetonateAttack, Wall - RenderBuildingWall: + RenderSprites: Palette: effect + WithWallSpriteBody: GivesExperience: AutoTargetIgnore: ProximityCaptor: @@ -520,7 +523,7 @@ ^CivBuilding: Inherits: ^TechBuilding - RenderBuilding: + RenderSprites: Palette: terrain EditorTilesetFilter: ExcludeTilesets: INTERIOR @@ -664,7 +667,7 @@ ^DesertCivBuilding: Inherits: ^CivBuilding - RenderBuilding: + RenderSprites: Palette: terrain EditorTilesetFilter: RequireTilesets: DESERT diff --git a/mods/ra/rules/fakes.yaml b/mods/ra/rules/fakes.yaml index 7be63993e0..ee8d3226a6 100644 --- a/mods/ra/rules/fakes.yaml +++ b/mods/ra/rules/fakes.yaml @@ -15,7 +15,7 @@ FACF: Footprint: xxx xxx xxx Dimensions: 3,3 Bib: - RenderBuilding: + RenderSprites: Image: FACT Valued: Cost: 250 @@ -37,7 +37,7 @@ WEAF: Footprint: xxx xxx Dimensions: 3,2 Bib: - RenderBuilding: + RenderSprites: Image: WEAP WithProductionDoorOverlay: Sequence: build-top @@ -64,7 +64,7 @@ SYRF: Dimensions: 3,3 Adjacent: 8 TerrainTypes: Water - RenderBuilding: + RenderSprites: Image: SYRD Valued: Cost: 100 @@ -91,7 +91,7 @@ SPEF: Dimensions: 3,3 Adjacent: 8 TerrainTypes: Water - RenderBuilding: + RenderSprites: Image: SPEN Valued: Cost: 100 @@ -115,7 +115,7 @@ DOMF: Footprint: xx xx Dimensions: 2,2 Bib: - RenderBuilding: + RenderSprites: Image: DOME Valued: Cost: 180 @@ -139,7 +139,7 @@ ATEF: Footprint: xx xx Dimensions: 2,2 Bib: - RenderBuilding: + RenderSprites: Image: ATEK Valued: Cost: 150 @@ -163,7 +163,7 @@ PDOF: Building: Footprint: xx xx Dimensions: 2,2 - RenderBuilding: + RenderSprites: Image: PDOX Bib: HasMinibib: Yes @@ -189,7 +189,7 @@ MSLF: Building: Footprint: xx Dimensions: 2,1 - RenderBuilding: + RenderSprites: Image: MSLO Valued: Cost: 250 diff --git a/mods/ra/rules/misc.yaml b/mods/ra/rules/misc.yaml index 9e329f55ef..ecf82012b5 100644 --- a/mods/ra/rules/misc.yaml +++ b/mods/ra/rules/misc.yaml @@ -415,7 +415,7 @@ waypoint: ^fact.colorpicker: Inherits: FACT - RenderBuilding: + RenderSprites: Image: fact Palette: colorpicker diff --git a/mods/ra/rules/structures.yaml b/mods/ra/rules/structures.yaml index fb4105f562..851f536b3c 100644 --- a/mods/ra/rules/structures.yaml +++ b/mods/ra/rules/structures.yaml @@ -69,8 +69,8 @@ GAP: RequiresPower: CanPowerDown: DisabledOverlay: - RenderBuilding: - PauseOnLowPower: yes + WithSpriteBody: + PauseAnimationWhenDisabled: true Health: HP: 1000 Armor: @@ -401,7 +401,7 @@ TSLA: Range: 8c0 Bib: HasMinibib: Yes - RenderBuildingCharge: + WithChargeAnimation: Armament: Weapon: TeslaZap LocalOffset: 0,0,427 @@ -409,7 +409,6 @@ TSLA: ChargeAudio: tslachg2.aud MaxCharges: 3 ReloadTime: 120 - -RenderBuilding: Power: Amount: -100 DetectCloaked: @@ -448,14 +447,14 @@ AGUN: Turreted: ROT: 15 InitialFacing: 224 - RenderBuildingTurreted: + -WithSpriteBody: + WithTurretedSpriteBody: Armament: Weapon: ZSU-23 LocalOffset: 432,150,-30, 432,-150,-30 MuzzleSequence: muzzle AttackTurreted: WithMuzzleFlash: - -RenderBuilding: RenderRangeCircle: RangeCircleType: aa Power: @@ -607,14 +606,14 @@ GUN: Turreted: ROT: 12 InitialFacing: 50 - RenderBuildingTurreted: + -WithSpriteBody: + WithTurretedSpriteBody: Armament: Weapon: TurretGun LocalOffset: 512,0,112 MuzzleSequence: muzzle AttackTurreted: WithMuzzleFlash: - -RenderBuilding: Power: Amount: -40 DetectCloaked: @@ -683,13 +682,13 @@ SAM: Turreted: ROT: 30 InitialFacing: 0 - RenderBuildingTurreted: + -WithSpriteBody: + WithTurretedSpriteBody: Armament: Weapon: Nike MuzzleSequence: muzzle AttackTurreted: WithMuzzleFlash: - -RenderBuilding: RenderRangeCircle: RangeCircleType: aa Power: @@ -979,11 +978,10 @@ SILO: Range: 4c0 Bib: HasMinibib: Yes - RenderBuildingSilo: + WithSiloAnimation: StoresResources: PipCount: 5 Capacity: 1500 - -RenderBuilding: -EmitInfantryOnSell: Power: Amount: -10 @@ -1502,7 +1500,7 @@ SBAG: NodeTypes: sandbag LineBuildNode: Types: sandbag - RenderBuildingWall: + WithWallSpriteBody: Type: sandbag FENC: @@ -1527,7 +1525,7 @@ FENC: NodeTypes: fence LineBuildNode: Types: fence - RenderBuildingWall: + WithWallSpriteBody: Type: fence BRIK: @@ -1557,7 +1555,7 @@ BRIK: NodeTypes: concrete LineBuildNode: Types: concrete - RenderBuildingWall: + WithWallSpriteBody: Type: concrete CYCL: @@ -1572,7 +1570,7 @@ CYCL: NodeTypes: chain LineBuildNode: Types: chain - RenderBuildingWall: + WithWallSpriteBody: Type: chain BARB: @@ -1587,7 +1585,7 @@ BARB: NodeTypes: barbwire LineBuildNode: Types: barbwire - RenderBuildingWall: + WithWallSpriteBody: Type: barbwire WOOD: @@ -1602,7 +1600,7 @@ WOOD: NodeTypes: woodfence LineBuildNode: Types: woodfence - RenderBuildingWall: + WithWallSpriteBody: Type: woodfence BARRACKS: diff --git a/mods/ts/rules/civilian-structures.yaml b/mods/ts/rules/civilian-structures.yaml index 5bcf6c83e8..0b52a3629e 100644 --- a/mods/ts/rules/civilian-structures.yaml +++ b/mods/ts/rules/civilian-structures.yaml @@ -261,7 +261,7 @@ AMMOCRAT: Type: none Health: HP: 1 - RenderBuilding: + RenderSprites: Palette: player BBOARD01: @@ -625,7 +625,7 @@ CAARAY: Type: concrete Health: HP: 400 - RenderBuilding: + RenderSprites: Palette: player CAARMR: @@ -639,7 +639,7 @@ CAARMR: Type: concrete Health: HP: 800 - RenderBuilding: + RenderSprites: Palette: player ProvidesPrerequisite: Prerequisite: barracks.upgraded @@ -655,7 +655,7 @@ CABHUT: Dimensions: 1, 1 Health: HP: 2000 - RenderBuilding: + RenderSprites: Palette: player CACRSH01: @@ -729,7 +729,7 @@ CAHOSP: Type: concrete Health: HP: 800 - RenderBuilding: + RenderSprites: Palette: player CAPYR01: @@ -1130,7 +1130,7 @@ GAKODK: Type: heavy Health: HP: 1500 - RenderBuilding: + RenderSprites: Palette: player WithIdleOverlay@LARGELIGHTS: Sequence: large-lights @@ -1150,7 +1150,7 @@ GAOLDCC1: Type: heavy Health: HP: 400 - RenderBuilding: + RenderSprites: Palette: player GAOLDCC2: @@ -1164,7 +1164,7 @@ GAOLDCC2: Type: heavy Health: HP: 400 - RenderBuilding: + RenderSprites: Palette: player GAOLDCC3: @@ -1178,7 +1178,7 @@ GAOLDCC3: Type: heavy Health: HP: 400 - RenderBuilding: + RenderSprites: Palette: player GAOLDCC4: @@ -1192,7 +1192,7 @@ GAOLDCC4: Type: heavy Health: HP: 400 - RenderBuilding: + RenderSprites: Palette: player GAOLDCC5: @@ -1206,7 +1206,7 @@ GAOLDCC5: Type: heavy Health: HP: 400 - RenderBuilding: + RenderSprites: Palette: player GAOLDCC6: @@ -1220,7 +1220,7 @@ GAOLDCC6: Type: heavy Health: HP: 400 - RenderBuilding: + RenderSprites: Palette: player GASAND: @@ -1247,7 +1247,7 @@ GASAND: NodeTypes: sandbags LineBuildNode: Types: sandbags - RenderBuildingWall: + WithWallSpriteBody: Type: sandbags GASPOT: @@ -1283,7 +1283,7 @@ GALITE: Cost: 200 Tooltip: Name: Light Post - RenderBuilding: + RenderSprites: Palette: terraindecoration -WithMakeAnimation: -WithDeathAnimation: @@ -1340,7 +1340,7 @@ NAMNTK: Type: heavy Health: HP: 1500 - RenderBuilding: + RenderSprites: Palette: player WithIdleOverlay@LIGHTS: Sequence: idle-lights @@ -1358,7 +1358,7 @@ NTPYRA: Type: heavy Health: HP: 1500 - RenderBuilding: + RenderSprites: Palette: player WithIdleOverlay@LIGHTS: Sequence: idle-lights @@ -1368,7 +1368,7 @@ UFO: Building: Dimensions: 6, 4 Footprint: xxxxxx xxxxxx xxxxxx xxxxxx - RenderBuilding: + RenderSprites: Palette: terraindecoration Selectable: Bounds: 144, 72, 0, 0 diff --git a/mods/ts/rules/defaults.yaml b/mods/ts/rules/defaults.yaml index 8e441a34cc..7be22e3350 100644 --- a/mods/ts/rules/defaults.yaml +++ b/mods/ts/rules/defaults.yaml @@ -84,7 +84,9 @@ DamagedSounds: expnew01.aud DestroyedSounds: crmble2.aud QuantizeFacingsFromSequence: - RenderBuilding: + RenderSprites: + WithSpriteBody: + AutoSelectionSize: WithBuildingExplosion: Sequences: building, large_bang, large_brnl, verylarge_clsn, large_tumu EngineerRepairable: @@ -136,7 +138,7 @@ Range: 4c0 Tooltip: Description: Civilian Building - RenderBuilding: + RenderSprites: Palette: terraindecoration ^CivBillboard: @@ -187,7 +189,9 @@ Types: wall TargetableBuilding: TargetTypes: Ground, Wall, C4 - RenderBuildingWall: + RenderSprites: + AutoSelectionSize: + WithWallSpriteBody: Type: wall GivesExperience: AutoTargetIgnore: @@ -532,8 +536,10 @@ ^BlossomTree: Tooltip: Name: Blossom Tree - RenderBuilding: + RenderSprites: Palette: player + WithSpriteBody: + AutoSelectionSize: Building: Footprint: x Dimensions: 1,1 @@ -638,7 +644,9 @@ Dimensions: 1,1 Footprint: x TerrainTypes: Clear, Road, DirtRoad, Rough - RenderBuilding: + RenderSprites: + WithSpriteBody: + AutoSelectionSize: WithMakeAnimation: SelectionDecorations: Palette: pips diff --git a/mods/ts/rules/gdi-structures.yaml b/mods/ts/rules/gdi-structures.yaml index 5be2744b0b..19c49c311a 100644 --- a/mods/ts/rules/gdi-structures.yaml +++ b/mods/ts/rules/gdi-structures.yaml @@ -247,7 +247,7 @@ GADEPT: ProvidesPrerequisite@buildingname: SelectionDecorations: VisualBounds: 98, 68, -6, -6 - RenderBuilding: + RenderSprites: Image: gadept.gdi FactionImages: gdi: gadept.gdi @@ -348,7 +348,6 @@ GAPLUG: CanPowerDown: IndicatorPalette: mouse DisabledOverlay: - RenderBuilding: WithIdleOverlay@DISH: Sequence: idle-dish WithIdleOverlay@LIGHTS: diff --git a/mods/ts/rules/gdi-support.yaml b/mods/ts/rules/gdi-support.yaml index 46e34401e5..a0e7342a6e 100644 --- a/mods/ts/rules/gdi-support.yaml +++ b/mods/ts/rules/gdi-support.yaml @@ -25,6 +25,9 @@ GAWALL: GACTWR: Inherits: ^Defense + -WithSpriteBody: + WithWallSpriteBody: + Type: wall Valued: Cost: 600 Tooltip: @@ -102,9 +105,6 @@ GACTWR: Sequence: idle-lights LineBuildNode: Types: turret - -RenderBuilding: - RenderBuildingWall: - Type: wall Power@base: Amount: -10 Power@turrets: diff --git a/mods/ts/rules/nod-support.yaml b/mods/ts/rules/nod-support.yaml index 9aa73c9b87..47b8a19d48 100644 --- a/mods/ts/rules/nod-support.yaml +++ b/mods/ts/rules/nod-support.yaml @@ -206,7 +206,6 @@ GAARTY: MuzzleSequence: muzzle BodyOrientation: QuantizedFacings: 32 - RenderBuilding: RenderVoxels: LightAmbientColor: 0.4, 0.4, 0.4 WithVoxelBarrel: diff --git a/mods/ts/rules/shared-structures.yaml b/mods/ts/rules/shared-structures.yaml index ff6b9f2d33..768bef216e 100644 --- a/mods/ts/rules/shared-structures.yaml +++ b/mods/ts/rules/shared-structures.yaml @@ -97,7 +97,7 @@ PROC: ProvidesPrerequisite@buildingname: SelectionDecorations: VisualBounds: 134, 122, 0, -18 - RenderBuilding: + RenderSprites: Image: proc.gdi FactionImages: gdi: proc.gdi @@ -126,12 +126,13 @@ GASILO: Type: Wood RevealsShroud: Range: 4c0 - -RenderBuilding: - RenderBuildingSilo: + RenderSprites: Image: gasilo.gdi FactionImages: gdi: gasilo.gdi nod: gasilo.nod + WithSpriteBody: + WithSiloAnimation: WithIdleOverlay@UNDERLAY: Sequence: idle-underlay WithIdleOverlay@LIGHTS: diff --git a/mods/ts/rules/shared-support.yaml b/mods/ts/rules/shared-support.yaml index acdd128e52..58a58593bb 100644 --- a/mods/ts/rules/shared-support.yaml +++ b/mods/ts/rules/shared-support.yaml @@ -60,7 +60,7 @@ NAPULS: Amount: -150 SelectionDecorations: VisualBounds: 78, 54, 0, -12 - RenderBuilding: + RenderSprites: Image: napuls.gdi FactionImages: gdi: napuls.gdi diff --git a/mods/ts/rules/trees.yaml b/mods/ts/rules/trees.yaml index 10eabe334a..849ef705ce 100644 --- a/mods/ts/rules/trees.yaml +++ b/mods/ts/rules/trees.yaml @@ -11,7 +11,7 @@ BIGBLUE: Inherits: ^BlossomTree Tooltip: Name: Large Blue Tiberium Crystal - RenderBuilding: + RenderSprites: Palette: bluetiberium RadarColorFromTerrain: Terrain: BlueTiberium diff --git a/mods/ts/sequences/structures.yaml b/mods/ts/sequences/structures.yaml index d53950bec2..cd8840f55f 100644 --- a/mods/ts/sequences/structures.yaml +++ b/mods/ts/sequences/structures.yaml @@ -16,11 +16,14 @@ gacnst: ShadowStart: 24 crane-overlay: gtcnst_d Length: 20 + ZOffset: 1023 damaged-crane-overlay: gtcnst_d Length: 20 + ZOffset: 1023 critical-crane-overlay: gtcnst_d Start: 20 Length: 20 + ZOffset: 1023 idle-top: gtcnst_c Length: 15 Tick: 200 @@ -109,10 +112,12 @@ gapile: production-lights: gtpile_a Length: 7 Tick: 200 + ZOffset: 1023 damaged-production-lights: gtpile_a Start:7 Length: 7 Tick: 200 + ZOffset: 1023 idle-light: gtpile_b Length: 7 Tick: 200 @@ -273,10 +278,12 @@ nahand: production-light: nthand_a Length: 5 Tick: 100 + ZOffset: 1023 damaged-production-light: nthand_a Start: 5 Length: 5 Tick: 100 + ZOffset: 1023 idle-lights: nthand_b Length: 8 Tick: 200 @@ -1163,10 +1170,10 @@ namisl: make: ntmislmk Length: 18 ShadowStart: 18 - active: ntmisl_a + active: ntmisl_a # TODO: This is an overlay, but currently used as animation Length: 10 Tick: 80 - damaged-active: ntmisl_a + damaged-active: ntmisl_a # TODO: This is an overlay, but currently used as animation Start: 10 Length: 10 Tick: 80