diff --git a/OpenRA.Mods.Cnc/RenderGunboat.cs b/OpenRA.Mods.Cnc/RenderGunboat.cs index 2370fb6160..29159b846e 100644 --- a/OpenRA.Mods.Cnc/RenderGunboat.cs +++ b/OpenRA.Mods.Cnc/RenderGunboat.cs @@ -19,6 +19,11 @@ namespace OpenRA.Mods.RA.Render [Desc("Turreted 'Turret' key to display")] public readonly string Turret = "primary"; + public readonly string LeftSequence = "left"; + public readonly string RightSequence = "right"; + public readonly string WakeLeftSequence = "wake-left"; + public readonly string WakeRightSequence = "wake-right"; + public override object Create(ActorInitializer init) { return new RenderGunboat(init.self, this); } } @@ -35,28 +40,28 @@ namespace OpenRA.Mods.RA.Render .First(t => t.Name == info.Turret); left = new Animation(self.World, name, () => turret.turretFacing); - left.Play("left"); - Add("left", new AnimationWithOffset(left, null, () => facing.Facing > 128, 0)); + left.Play(info.LeftSequence); + Add(info.LeftSequence, new AnimationWithOffset(left, null, () => facing.Facing > 128, 0)); right = new Animation(self.World, name, () => turret.turretFacing); - right.Play("right"); - Add("right", new AnimationWithOffset(right, null, () => facing.Facing <= 128, 0)); + right.Play(info.RightSequence); + Add(info.RightSequence, new AnimationWithOffset(right, null, () => facing.Facing <= 128, 0)); var leftWake = new Animation(self.World, name); - leftWake.Play("wake-left"); - Add("wake-left", new AnimationWithOffset(leftWake, null, () => facing.Facing > 128, -87)); + leftWake.Play(info.WakeLeftSequence); + Add(info.WakeLeftSequence, new AnimationWithOffset(leftWake, null, () => facing.Facing > 128, -87)); var rightWake = new Animation(self.World, name); - rightWake.Play("wake-right"); - Add("wake-right", new AnimationWithOffset(rightWake, null, () => facing.Facing <= 128, -87)); + rightWake.Play(info.WakeRightSequence); + Add(info.WakeRightSequence, new AnimationWithOffset(rightWake, null, () => facing.Facing <= 128, -87)); self.Trait().SetAutodetectedFacings(2); } public void DamageStateChanged(Actor self, AttackInfo e) { - left.ReplaceAnim(NormalizeSequence(left, e.DamageState, "left")); - right.ReplaceAnim(NormalizeSequence(right, e.DamageState, "right")); + left.ReplaceAnim(NormalizeSequence(left, e.DamageState, left.CurrentSequence.Name)); + right.ReplaceAnim(NormalizeSequence(right, e.DamageState, right.CurrentSequence.Name)); } } } diff --git a/OpenRA.Mods.Cnc/WithCargo.cs b/OpenRA.Mods.Cnc/WithCargo.cs index d3ac02eae9..3b908fc032 100644 --- a/OpenRA.Mods.Cnc/WithCargo.cs +++ b/OpenRA.Mods.Cnc/WithCargo.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -17,10 +17,12 @@ using OpenRA.Traits; namespace OpenRA.Mods.Cnc { + [Desc("Renders the cargo loaded into the unit.")] public class WithCargoInfo : ITraitInfo, Requires, Requires { [Desc("Cargo position relative to turret or body. (forward, right, up) triples")] public readonly WRange[] LocalOffset = { }; + [Desc("Passenger CargoType to display.")] public readonly string[] DisplayTypes = { }; public object Create(ActorInitializer init) { return new WithCargo(init.self, this); } diff --git a/OpenRA.Mods.Cnc/WithDeliveryAnimation.cs b/OpenRA.Mods.Cnc/WithDeliveryAnimation.cs index 4003f0449f..178efc90f6 100644 --- a/OpenRA.Mods.Cnc/WithDeliveryAnimation.cs +++ b/OpenRA.Mods.Cnc/WithDeliveryAnimation.cs @@ -12,6 +12,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Render { + [Desc("Building animation to play when ProductionAirdrop is used to deliver units.")] public class WithDeliveryAnimationInfo : ITraitInfo, Requires { public readonly string ActiveSequence = "active"; diff --git a/OpenRA.Mods.Cnc/WithFire.cs b/OpenRA.Mods.Cnc/WithFire.cs index 7ad29e7f27..ad24efbd45 100644 --- a/OpenRA.Mods.Cnc/WithFire.cs +++ b/OpenRA.Mods.Cnc/WithFire.cs @@ -13,8 +13,12 @@ using OpenRA.Traits; namespace OpenRA.Mods.Cnc { + [Desc("Renders a flame sprite on top of the actor.")] class WithFireInfo : ITraitInfo, Requires { + public readonly string StartSequence = "fire-start"; + public readonly string LoopSequence = "fire-loop"; + public object Create(ActorInitializer init) { return new WithFire(init.self, this); } } @@ -23,9 +27,9 @@ namespace OpenRA.Mods.Cnc public WithFire(Actor self, WithFireInfo info) { var rs = self.Trait(); - var roof = new Animation(self.World, rs.GetImage(self)); - roof.PlayThen("fire-start", () => roof.PlayRepeating("fire-loop")); - rs.Add("fire", new AnimationWithOffset(roof, null, null, 1024)); + var fire = new Animation(self.World, rs.GetImage(self)); + fire.PlayThen(info.StartSequence, () => fire.PlayRepeating(info.LoopSequence)); + rs.Add("fire", new AnimationWithOffset(fire, null, null, 1024)); } } } diff --git a/OpenRA.Mods.Cnc/WithRoof.cs b/OpenRA.Mods.Cnc/WithRoof.cs index cf3497c2ef..b334718a52 100644 --- a/OpenRA.Mods.Cnc/WithRoof.cs +++ b/OpenRA.Mods.Cnc/WithRoof.cs @@ -13,18 +13,21 @@ using OpenRA.Traits; namespace OpenRA.Mods.Cnc { + [Desc("Provides an overlay for the Tiberian Dawn hover craft.")] public class WithRoofInfo : ITraitInfo, Requires { - public object Create(ActorInitializer init) { return new WithRoof(init.self); } + public readonly string Sequence = "roof"; + + public object Create(ActorInitializer init) { return new WithRoof(init.self, this); } } public class WithRoof { - public WithRoof(Actor self) + public WithRoof(Actor self, WithRoofInfo info) { var rs = self.Trait(); var roof = new Animation(self.World, rs.GetImage(self), () => self.Trait().Facing); - roof.Play("roof"); + roof.Play(info.Sequence); rs.Add("roof", new AnimationWithOffset(roof, null, null, 1024)); } } diff --git a/OpenRA.Mods.D2k/DamagedWithoutFoundation.cs b/OpenRA.Mods.D2k/DamagedWithoutFoundation.cs index 2f177dc919..66d34db29b 100644 --- a/OpenRA.Mods.D2k/DamagedWithoutFoundation.cs +++ b/OpenRA.Mods.D2k/DamagedWithoutFoundation.cs @@ -12,8 +12,9 @@ using System.Linq; using OpenRA.GameRules; using OpenRA.Traits; -namespace OpenRA.Mods.Cnc +namespace OpenRA.Mods.D2k { + [Desc("Reduces health points over time when the actor is placed on unsafe terrain.")] class DamagedWithoutFoundationInfo : ITraitInfo, Requires { [WeaponReference] diff --git a/OpenRA.Mods.D2k/Render/WithBuildingPlacedOverlayInfo.cs b/OpenRA.Mods.D2k/Render/WithBuildingPlacedOverlayInfo.cs index cf38f2d7c2..8da0ced61c 100644 --- a/OpenRA.Mods.D2k/Render/WithBuildingPlacedOverlayInfo.cs +++ b/OpenRA.Mods.D2k/Render/WithBuildingPlacedOverlayInfo.cs @@ -14,6 +14,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Render { + [Desc("Rendered when the actor constructed a building.")] public class WithBuildingPlacedOverlayInfo : ITraitInfo, Requires, Requires { [Desc("Sequence name to use")] diff --git a/OpenRA.Mods.D2k/Render/WithCrumbleOverlay.cs b/OpenRA.Mods.D2k/Render/WithCrumbleOverlay.cs index e1c4d882b1..9b4475622b 100644 --- a/OpenRA.Mods.D2k/Render/WithCrumbleOverlay.cs +++ b/OpenRA.Mods.D2k/Render/WithCrumbleOverlay.cs @@ -13,6 +13,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Render { + [Desc("Rendered together with the \"make\" animation.")] public class WithCrumbleOverlayInfo : ITraitInfo, Requires { [Desc("Sequence name to use")] diff --git a/OpenRA.Mods.D2k/Render/WithDeliveryOverlay.cs b/OpenRA.Mods.D2k/Render/WithDeliveryOverlay.cs index 8292506b92..a519013693 100644 --- a/OpenRA.Mods.D2k/Render/WithDeliveryOverlay.cs +++ b/OpenRA.Mods.D2k/Render/WithDeliveryOverlay.cs @@ -15,6 +15,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Render { + [Desc("Rendered when ProductionAirdrop is in progress.")] public class WithDeliveryOverlayInfo : ITraitInfo, Requires, Requires { [Desc("Sequence name to use")] diff --git a/OpenRA.Mods.D2k/Render/WithDockingOverlay.cs b/OpenRA.Mods.D2k/Render/WithDockingOverlay.cs index 44ef03915f..6ec56b741c 100644 --- a/OpenRA.Mods.D2k/Render/WithDockingOverlay.cs +++ b/OpenRA.Mods.D2k/Render/WithDockingOverlay.cs @@ -15,6 +15,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Render { + [Desc("Rendered when a harvester is docked.")] public class WithDockingOverlayInfo : ITraitInfo, Requires, Requires { [Desc("Sequence name to use")] diff --git a/OpenRA.Mods.D2k/Render/WithProductionOverlay.cs b/OpenRA.Mods.D2k/Render/WithProductionOverlay.cs index e27bd7233e..42bbef8a4a 100644 --- a/OpenRA.Mods.D2k/Render/WithProductionOverlay.cs +++ b/OpenRA.Mods.D2k/Render/WithProductionOverlay.cs @@ -16,6 +16,8 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Render { + [Desc("Renders an animation when the Production trait of the actor is activated.", + "Works both with per player ClassicProductionQueue and per building ProductionQueue, but needs any of these.")] public class WithProductionOverlayInfo : ITraitInfo, Requires, Requires { [Desc("Sequence name to use")] diff --git a/OpenRA.Mods.D2k/ThrowsShrapnel.cs b/OpenRA.Mods.D2k/ThrowsShrapnel.cs index a9e31de30a..12e6db72da 100644 --- a/OpenRA.Mods.D2k/ThrowsShrapnel.cs +++ b/OpenRA.Mods.D2k/ThrowsShrapnel.cs @@ -14,6 +14,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.D2k { + [Desc("Throws particles when the actor is destroyed that do damage on impact.")] public class ThrowsShrapnelInfo : ITraitInfo { [WeaponReference] diff --git a/OpenRA.Mods.RA/Render/WithBuildingExplosion.cs b/OpenRA.Mods.RA/Render/WithBuildingExplosion.cs index 7019bc7d6a..7223f47c52 100755 --- a/OpenRA.Mods.RA/Render/WithBuildingExplosion.cs +++ b/OpenRA.Mods.RA/Render/WithBuildingExplosion.cs @@ -14,15 +14,32 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Render { - class WithBuildingExplosionInfo : TraitInfo { } + [Desc("Display explosions over the building footprint when it is destroyed.")] + class WithBuildingExplosionInfo : ITraitInfo, Requires + { + [Desc("Explosion sequence name to use")] + public readonly string Sequence = "building"; + + [Desc("Custom palette name")] + public readonly string Palette = "effect"; + + public object Create(ActorInitializer init) { return new WithBuildingExplosion(this); } + } + class WithBuildingExplosion : INotifyKilled { + WithBuildingExplosionInfo info; + + public WithBuildingExplosion(WithBuildingExplosionInfo info) + { + this.info = info; + } + public void Killed(Actor self, AttackInfo e) { - //TODO: Make palette for this customizable as well - var bi = self.Info.Traits.Get(); - FootprintUtils.UnpathableTiles(self.Info.Name, bi, self.Location).Do( - t => self.World.AddFrameEndTask(w => w.Add(new Explosion(w, w.Map.CenterOfCell(t), "building", "effect")))); + var buildingInfo = self.Info.Traits.Get(); + FootprintUtils.UnpathableTiles(self.Info.Name, buildingInfo, self.Location).Do( + t => self.World.AddFrameEndTask(w => w.Add(new Explosion(w, w.Map.CenterOfCell(t), info.Sequence, info.Palette)))); } } } diff --git a/OpenRA.Mods.RA/Render/WithBuildingPlacedAnimation.cs b/OpenRA.Mods.RA/Render/WithBuildingPlacedAnimation.cs index 7ab1fab3e7..7714785b8b 100644 --- a/OpenRA.Mods.RA/Render/WithBuildingPlacedAnimation.cs +++ b/OpenRA.Mods.RA/Render/WithBuildingPlacedAnimation.cs @@ -12,6 +12,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Render { + [Desc("Changes the animation when the actor constructed a building.")] public class WithBuildingPlacedAnimationInfo : ITraitInfo, Requires { [Desc("Sequence name to use")] diff --git a/OpenRA.Mods.RA/Render/WithCrateBody.cs b/OpenRA.Mods.RA/Render/WithCrateBody.cs index e6523b6e6a..228605ab30 100755 --- a/OpenRA.Mods.RA/Render/WithCrateBody.cs +++ b/OpenRA.Mods.RA/Render/WithCrateBody.cs @@ -15,9 +15,12 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Render { + [Desc("Renders crates with both water and land variants.")] class WithCrateBodyInfo : ITraitInfo, Requires { public readonly string[] Images = { "crate" }; + + [Desc("Easteregg sequences to use in december.")] public readonly string[] XmasImages = { }; public object Create(ActorInitializer init) { return new WithCrateBody(init.self, this); } @@ -35,7 +38,7 @@ namespace OpenRA.Mods.RA.Render var images = info.XmasImages.Any() && DateTime.Today.Month == 12 ? info.XmasImages : info.Images; anim = new Animation(self.World, images.Random(Game.CosmeticRandom)); anim.Play("idle"); - rs.Add("", anim); + rs.Add("crate", anim); } public void OnLanded() diff --git a/OpenRA.Mods.RA/Render/WithHarvestAnimation.cs b/OpenRA.Mods.RA/Render/WithHarvestAnimation.cs index 522316d626..a6081d7f47 100644 --- a/OpenRA.Mods.RA/Render/WithHarvestAnimation.cs +++ b/OpenRA.Mods.RA/Render/WithHarvestAnimation.cs @@ -13,6 +13,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Render { + [Desc("Displays an overlay whenever resources are harvested by the actor.")] class WithHarvestAnimationInfo : ITraitInfo, Requires, Requires { [Desc("Sequence name to use")] diff --git a/OpenRA.Mods.RA/Render/WithIdleOverlay.cs b/OpenRA.Mods.RA/Render/WithIdleOverlay.cs index 02b86f000b..089e4109c7 100644 --- a/OpenRA.Mods.RA/Render/WithIdleOverlay.cs +++ b/OpenRA.Mods.RA/Render/WithIdleOverlay.cs @@ -15,6 +15,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Render { + [Desc("Renders a decorative animation on units and buildings.")] public class WithIdleOverlayInfo : ITraitInfo, Requires, Requires { [Desc("Sequence name to use")] diff --git a/OpenRA.Mods.RA/Render/WithMuzzleFlash.cs b/OpenRA.Mods.RA/Render/WithMuzzleFlash.cs index c79f7eda92..0d6d785082 100644 --- a/OpenRA.Mods.RA/Render/WithMuzzleFlash.cs +++ b/OpenRA.Mods.RA/Render/WithMuzzleFlash.cs @@ -16,6 +16,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Render { + [Desc("Renders the MuzzleSequence from the Armament trait.")] class WithMuzzleFlashInfo : ITraitInfo, Requires, Requires, Requires { [Desc("Ignore the weapon position, and always draw relative to the center of the actor")] diff --git a/OpenRA.Mods.RA/Render/WithRepairAnimation.cs b/OpenRA.Mods.RA/Render/WithRepairAnimation.cs index 0cd5e593d5..720efd600a 100644 --- a/OpenRA.Mods.RA/Render/WithRepairAnimation.cs +++ b/OpenRA.Mods.RA/Render/WithRepairAnimation.cs @@ -14,6 +14,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Render { + [Desc("Replaces the building animation when it repairs a unit.")] public class WithRepairAnimationInfo : ITraitInfo, Requires { [Desc("Sequence name to use")] diff --git a/OpenRA.Mods.RA/Render/WithRepairOverlay.cs b/OpenRA.Mods.RA/Render/WithRepairOverlay.cs index 5b38a217b0..d4788195db 100644 --- a/OpenRA.Mods.RA/Render/WithRepairOverlay.cs +++ b/OpenRA.Mods.RA/Render/WithRepairOverlay.cs @@ -16,6 +16,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Render { + [Desc("Displays an overlay when the building is being repaired by the player.")] public class WithRepairOverlayInfo : ITraitInfo, Requires, Requires { [Desc("Sequence name to use")] diff --git a/OpenRA.Mods.RA/Render/WithResources.cs b/OpenRA.Mods.RA/Render/WithResources.cs index 578720eb00..39cbf37f8d 100644 --- a/OpenRA.Mods.RA/Render/WithResources.cs +++ b/OpenRA.Mods.RA/Render/WithResources.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2013 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -13,6 +13,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Render { + [Desc("Displays the fill status of PlayerResources with an extra sprite overlay on the actor.")] class WithResourcesInfo : ITraitInfo, Requires { [Desc("Sequence name to use")] diff --git a/OpenRA.Mods.RA/Render/WithRotor.cs b/OpenRA.Mods.RA/Render/WithRotor.cs index c03b68ca60..31e196bd14 100755 --- a/OpenRA.Mods.RA/Render/WithRotor.cs +++ b/OpenRA.Mods.RA/Render/WithRotor.cs @@ -13,6 +13,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Render { + [Desc("Displays a helicopter rotor overlay.")] public class WithRotorInfo : ITraitInfo, Requires, Requires { [Desc("Sequence name to use when flying")] @@ -24,6 +25,7 @@ namespace OpenRA.Mods.RA.Render [Desc("Position relative to body")] public readonly WVec Offset = WVec.Zero; + [Desc("Change this when using this trait multiple times on the same actor.")] public readonly string Id = "rotor"; public object Create(ActorInitializer init) { return new WithRotor(init.self, this); } diff --git a/OpenRA.Mods.RA/Render/WithShadow.cs b/OpenRA.Mods.RA/Render/WithShadow.cs index 56ea245b56..182e1ced22 100644 --- a/OpenRA.Mods.RA/Render/WithShadow.cs +++ b/OpenRA.Mods.RA/Render/WithShadow.cs @@ -17,10 +17,23 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Render { - class WithShadowInfo : TraitInfo {} + [Desc("Clones the aircraft sprite with another palette below it.")] + class WithShadowInfo : ITraitInfo + { + public readonly string Palette = "shadow"; + + public object Create(ActorInitializer init) { return new WithShadow(this); } + } class WithShadow : IRenderModifier { + WithShadowInfo info; + + public WithShadow(WithShadowInfo info) + { + this.info = info; + } + public IEnumerable ModifyRender(Actor self, WorldRenderer wr, IEnumerable r) { var ios = self.Trait(); @@ -32,7 +45,7 @@ namespace OpenRA.Mods.RA.Render // Contrails shouldn't cast shadows var shadowSprites = r.Where(s => !s.IsDecoration) - .Select(a => a.WithPalette(wr.Palette("shadow")) + .Select(a => a.WithPalette(wr.Palette(info.Palette)) .OffsetBy(new WVec(0, 0, -a.Pos.Z)) .WithZOffset(a.ZOffset + a.Pos.Z) .AsDecoration()); diff --git a/OpenRA.Mods.RA/Render/WithSmoke.cs b/OpenRA.Mods.RA/Render/WithSmoke.cs index 4c75da50ce..f311ba9aad 100644 --- a/OpenRA.Mods.RA/Render/WithSmoke.cs +++ b/OpenRA.Mods.RA/Render/WithSmoke.cs @@ -13,9 +13,13 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Render { + [Desc("Renders an overlay when the actor is taking heavy damage.")] public class WithSmokeInfo : ITraitInfo, Requires { - public object Create(ActorInitializer init) { return new WithSmoke(init.self); } + [Desc("Needs to define \"idle\", \"loop\" and \"end\" sub-sequences.")] + public readonly string Sequence = "smoke_m"; + + public object Create(ActorInitializer init) { return new WithSmoke(init.self, this); } } public class WithSmoke : INotifyDamage @@ -23,11 +27,11 @@ namespace OpenRA.Mods.RA.Render bool isSmoking; Animation anim; - public WithSmoke(Actor self) + public WithSmoke(Actor self, WithSmokeInfo info) { var rs = self.Trait(); - anim = new Animation(self.World, "smoke_m"); + anim = new Animation(self.World, info.Sequence); rs.Add("smoke", new AnimationWithOffset(anim, null, () => !isSmoking)); } @@ -38,10 +42,10 @@ namespace OpenRA.Mods.RA.Render if (e.DamageState < DamageState.Heavy) return; isSmoking = true; - anim.PlayThen( "idle", - () => anim.PlayThen( "loop", - () => anim.PlayBackwardsThen( "end", - () => isSmoking = false ) ) ); + anim.PlayThen("idle", + () => anim.PlayThen("loop", + () => anim.PlayBackwardsThen("end", + () => isSmoking = false))); } } } diff --git a/OpenRA.Mods.RA/Render/WithTurret.cs b/OpenRA.Mods.RA/Render/WithTurret.cs index 0e13b17b67..5de395019c 100755 --- a/OpenRA.Mods.RA/Render/WithTurret.cs +++ b/OpenRA.Mods.RA/Render/WithTurret.cs @@ -15,6 +15,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Render { + [Desc("Renders barrels for units with the Turreted trait.")] class WithTurretInfo : ITraitInfo, Requires, Requires, Requires { [Desc("Sequence name to use")]