diff --git a/OpenRA.Mods.Common/Lint/CheckRangeLimit.cs b/OpenRA.Mods.Common/Lint/CheckRangeLimit.cs index 228df13261..5dd323c662 100644 --- a/OpenRA.Mods.Common/Lint/CheckRangeLimit.cs +++ b/OpenRA.Mods.Common/Lint/CheckRangeLimit.cs @@ -11,7 +11,7 @@ using System; using System.Linq; -using OpenRA.Mods.Common.Effects; +using OpenRA.Mods.Common.Projectiles; using OpenRA.Mods.Common.Traits; using OpenRA.Traits; diff --git a/OpenRA.Mods.Common/Lint/CheckTargetHealthRadius.cs b/OpenRA.Mods.Common/Lint/CheckTargetHealthRadius.cs index cc6d46e3fe..65b711f907 100644 --- a/OpenRA.Mods.Common/Lint/CheckTargetHealthRadius.cs +++ b/OpenRA.Mods.Common/Lint/CheckTargetHealthRadius.cs @@ -11,7 +11,7 @@ using System; using System.Linq; -using OpenRA.Mods.Common.Effects; +using OpenRA.Mods.Common.Projectiles; using OpenRA.Mods.Common.Traits; using OpenRA.Mods.Common.Warheads; using OpenRA.Traits; diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj index 0ca80cb6c1..40650878aa 100644 --- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj +++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj @@ -147,21 +147,21 @@ - - - - - + + + + + diff --git a/OpenRA.Mods.Common/Effects/AreaBeam.cs b/OpenRA.Mods.Common/Projectiles/AreaBeam.cs similarity index 98% rename from OpenRA.Mods.Common/Effects/AreaBeam.cs rename to OpenRA.Mods.Common/Projectiles/AreaBeam.cs index d1c53e3de2..5e38dd48f8 100644 --- a/OpenRA.Mods.Common/Effects/AreaBeam.cs +++ b/OpenRA.Mods.Common/Projectiles/AreaBeam.cs @@ -15,11 +15,12 @@ using System.Drawing; using OpenRA.Effects; using OpenRA.GameRules; using OpenRA.Graphics; +using OpenRA.Mods.Common.Effects; using OpenRA.Mods.Common.Graphics; using OpenRA.Mods.Common.Traits; using OpenRA.Traits; -namespace OpenRA.Mods.Common.Effects +namespace OpenRA.Mods.Common.Projectiles { public class AreaBeamInfo : IProjectileInfo { diff --git a/OpenRA.Mods.Common/Effects/Bullet.cs b/OpenRA.Mods.Common/Projectiles/Bullet.cs similarity index 91% rename from OpenRA.Mods.Common/Effects/Bullet.cs rename to OpenRA.Mods.Common/Projectiles/Bullet.cs index 0c0d72e698..ba1aebdc4a 100644 --- a/OpenRA.Mods.Common/Effects/Bullet.cs +++ b/OpenRA.Mods.Common/Projectiles/Bullet.cs @@ -15,11 +15,12 @@ using System.Drawing; using OpenRA.Effects; using OpenRA.GameRules; using OpenRA.Graphics; +using OpenRA.Mods.Common.Effects; using OpenRA.Mods.Common.Graphics; using OpenRA.Mods.Common.Traits; using OpenRA.Traits; -namespace OpenRA.Mods.Common.Effects +namespace OpenRA.Mods.Common.Projectiles { public class BulletInfo : IProjectileInfo { @@ -32,7 +33,7 @@ namespace OpenRA.Mods.Common.Effects [Desc("Image to display.")] public readonly string Image = null; - [Desc("Loop these sequences of Image while this projectile is moving.")] + [Desc("Loop a randomly chosen sequence of Image from this list while this projectile is moving.")] [SequenceReference("Image")] public readonly string[] Sequences = { "idle" }; [Desc("The palette used to draw this projectile.")] @@ -45,10 +46,10 @@ namespace OpenRA.Mods.Common.Effects [PaletteReference] public readonly string ShadowPalette = "shadow"; [Desc("Trail animation.")] - public readonly string Trail = null; + public readonly string TrailImage = null; - [Desc("Loop these sequences of Trail while this projectile is moving.")] - [SequenceReference("Trail")] public readonly string[] TrailSequences = { "idle" }; + [Desc("Loop a randomly chosen sequence of TrailImage from this list while this projectile is moving.")] + [SequenceReference("TrailImage")] public readonly string[] TrailSequences = { "idle" }; [Desc("Is this blocked by actors with BlocksProjectiles trait.")] public readonly bool Blockable = true; @@ -68,7 +69,10 @@ namespace OpenRA.Mods.Common.Effects [Desc("Delay in ticks until trail animation is spawned.")] public readonly int TrailDelay = 1; + [Desc("Palette used to render the trail sequence.")] [PaletteReference("TrailUsePlayerPalette")] public readonly string TrailPalette = "effect"; + + [Desc("Use the Player Palette to render the trail sequence.")] public readonly bool TrailUsePlayerPalette = false; public readonly int ContrailLength = 0; @@ -179,11 +183,12 @@ namespace OpenRA.Mods.Common.Effects shouldExplode = true; } - if (!string.IsNullOrEmpty(info.Trail) && --smokeTicks < 0) + if (!string.IsNullOrEmpty(info.TrailImage) && --smokeTicks < 0) { var delayedPos = WPos.LerpQuadratic(args.Source, target, angle, ticks - info.TrailDelay, length); - world.AddFrameEndTask(w => w.Add(new SpriteEffect(delayedPos, w, info.Trail, info.TrailSequences.Random(world.SharedRandom), + world.AddFrameEndTask(w => w.Add(new SpriteEffect(delayedPos, w, info.TrailImage, info.TrailSequences.Random(world.SharedRandom), trailPalette, false, false, GetEffectiveFacing()))); + smokeTicks = info.TrailInterval; } diff --git a/OpenRA.Mods.Common/Effects/GravityBomb.cs b/OpenRA.Mods.Common/Projectiles/GravityBomb.cs similarity index 83% rename from OpenRA.Mods.Common/Effects/GravityBomb.cs rename to OpenRA.Mods.Common/Projectiles/GravityBomb.cs index 952094724f..1d1589d6fa 100644 --- a/OpenRA.Mods.Common/Effects/GravityBomb.cs +++ b/OpenRA.Mods.Common/Projectiles/GravityBomb.cs @@ -13,16 +13,17 @@ using System.Collections.Generic; using OpenRA.Effects; using OpenRA.GameRules; using OpenRA.Graphics; +using OpenRA.Mods.Common.Effects; using OpenRA.Traits; -namespace OpenRA.Mods.Common.Effects +namespace OpenRA.Mods.Common.Projectiles { public class GravityBombInfo : IProjectileInfo { public readonly string Image = null; - [Desc("Sequence to loop while falling.")] - [SequenceReference("Image")] public readonly string Sequence = "idle"; + [Desc("Loop a randomly chosen sequence of Image from this list while falling.")] + [SequenceReference("Image")] public readonly string[] Sequences = { "idle" }; [Desc("Sequence to play when launched. Skipped if null or empty.")] [SequenceReference("Image")] public readonly string OpenSequence = null; @@ -33,9 +34,9 @@ namespace OpenRA.Mods.Common.Effects [PaletteReference] public readonly string ShadowPalette = "shadow"; - public readonly WDist Velocity = WDist.Zero; + public readonly WDist Speed = WDist.Zero; - [Desc("Value added to velocity every tick.")] + [Desc("Value added to speed every tick.")] public readonly WDist Acceleration = new WDist(15); public IEffect Create(ProjectileArgs args) { return new GravityBomb(this, args); } @@ -55,7 +56,7 @@ namespace OpenRA.Mods.Common.Effects this.info = info; this.args = args; pos = args.Source; - velocity = new WVec(WDist.Zero, WDist.Zero, -info.Velocity); + velocity = new WVec(WDist.Zero, WDist.Zero, -info.Speed); acceleration = new WVec(WDist.Zero, WDist.Zero, info.Acceleration); if (!string.IsNullOrEmpty(info.Image)) @@ -63,9 +64,9 @@ namespace OpenRA.Mods.Common.Effects anim = new Animation(args.SourceActor.World, info.Image); if (!string.IsNullOrEmpty(info.OpenSequence)) - anim.PlayThen(info.OpenSequence, () => anim.PlayRepeating(info.Sequence)); + anim.PlayThen(info.OpenSequence, () => anim.PlayRepeating(info.Sequences.Random(args.SourceActor.World.SharedRandom))); else - anim.PlayRepeating(info.Sequence); + anim.PlayRepeating(info.Sequences.Random(args.SourceActor.World.SharedRandom)); } } diff --git a/OpenRA.Mods.Common/Effects/LaserZap.cs b/OpenRA.Mods.Common/Projectiles/LaserZap.cs similarity index 95% rename from OpenRA.Mods.Common/Effects/LaserZap.cs rename to OpenRA.Mods.Common/Projectiles/LaserZap.cs index f984f143a6..c5928ffa17 100644 --- a/OpenRA.Mods.Common/Effects/LaserZap.cs +++ b/OpenRA.Mods.Common/Projectiles/LaserZap.cs @@ -14,13 +14,14 @@ using System.Drawing; using OpenRA.Effects; using OpenRA.GameRules; using OpenRA.Graphics; +using OpenRA.Mods.Common.Effects; using OpenRA.Mods.Common.Graphics; using OpenRA.Traits; -namespace OpenRA.Mods.Common.Effects +namespace OpenRA.Mods.Common.Projectiles { [Desc("Not a sprite, but an engine effect.")] - class LaserZapInfo : IProjectileInfo + public class LaserZapInfo : IProjectileInfo { [Desc("The width of the zap.")] public readonly WDist Width = new WDist(86); @@ -53,7 +54,7 @@ namespace OpenRA.Mods.Common.Effects } } - class LaserZap : IEffect + public class LaserZap : IEffect { readonly ProjectileArgs args; readonly LaserZapInfo info; diff --git a/OpenRA.Mods.Common/Effects/Missile.cs b/OpenRA.Mods.Common/Projectiles/Missile.cs similarity index 97% rename from OpenRA.Mods.Common/Effects/Missile.cs rename to OpenRA.Mods.Common/Projectiles/Missile.cs index de0f81dfdb..cfdd9b2c20 100644 --- a/OpenRA.Mods.Common/Effects/Missile.cs +++ b/OpenRA.Mods.Common/Projectiles/Missile.cs @@ -16,20 +16,20 @@ using System.Linq; using OpenRA.Effects; using OpenRA.GameRules; using OpenRA.Graphics; -using OpenRA.Mods.Common; +using OpenRA.Mods.Common.Effects; using OpenRA.Mods.Common.Graphics; using OpenRA.Mods.Common.Traits; using OpenRA.Traits; -namespace OpenRA.Mods.Common.Effects +namespace OpenRA.Mods.Common.Projectiles { public class MissileInfo : IProjectileInfo { [Desc("Name of the image containing the projectile sequence.")] public readonly string Image = null; - [Desc("Projectile sequence name.")] - [SequenceReference("Image")] public readonly string Sequence = "idle"; + [Desc("Loop a randomly chosen sequence of Image from this list while this projectile is moving.")] + [SequenceReference("Image")] public readonly string[] Sequences = { "idle" }; [Desc("Palette used to render the projectile sequence.")] [PaletteReference] public readonly string Palette = "effect"; @@ -100,19 +100,19 @@ namespace OpenRA.Mods.Common.Effects [Desc("Image that contains the trail animation.")] public readonly string TrailImage = null; - [Desc("Smoke sequence name.")] - [SequenceReference("TrailImage")] public readonly string TrailSequence = "idle"; + [Desc("Loop a randomly chosen sequence of TrailImage from this list while this projectile is moving.")] + [SequenceReference("TrailImage")] public readonly string[] TrailSequences = { "idle" }; - [Desc("Palette used to render the smoke sequence.")] + [Desc("Palette used to render the trail sequence.")] [PaletteReference("TrailUsePlayerPalette")] public readonly string TrailPalette = "effect"; - [Desc("Use the Player Palette to render the smoke sequence.")] + [Desc("Use the Player Palette to render the trail sequence.")] public readonly bool TrailUsePlayerPalette = false; - [Desc("Interval in ticks between spawning smoke animation.")] + [Desc("Interval in ticks between spawning trail animation.")] public readonly int TrailInterval = 2; - [Desc("Should smoke animation be spawned when the propulsion is not activated.")] + [Desc("Should trail animation be spawned when the propulsion is not activated.")] public readonly bool TrailWhenDeactivated = false; public readonly int ContrailLength = 0; @@ -222,7 +222,7 @@ namespace OpenRA.Mods.Common.Effects if (!string.IsNullOrEmpty(info.Image)) { anim = new Animation(world, info.Image, () => renderFacing); - anim.PlayRepeating(info.Sequence); + anim.PlayRepeating(info.Sequences.Random(world.SharedRandom)); } if (info.ContrailLength > 0) @@ -817,10 +817,12 @@ namespace OpenRA.Mods.Common.Effects shouldExplode = true; } - // Create the smoke trail effect + // Create the sprite trail effect if (!string.IsNullOrEmpty(info.TrailImage) && --ticksToNextSmoke < 0 && (state != States.Freefall || info.TrailWhenDeactivated)) { - world.AddFrameEndTask(w => w.Add(new SpriteEffect(pos - 3 * move / 2, w, info.TrailImage, info.TrailSequence, trailPalette, false, false, renderFacing))); + world.AddFrameEndTask(w => w.Add(new SpriteEffect(pos - 3 * move / 2, w, info.TrailImage, info.TrailSequences.Random(world.SharedRandom), + trailPalette, false, false, renderFacing))); + ticksToNextSmoke = info.TrailInterval; } diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs index fdf1d12cd5..f3470a259d 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs @@ -159,6 +159,22 @@ namespace OpenRA.Mods.Common.UtilityCommands } } + // Streamline some projectile property names and functionality + if (engineVersion < 20160601) + { + if (node.Key == "Sequence") + node.Key = "Sequences"; + + if (node.Key == "TrailSequence") + node.Key = "TrailSequences"; + + if (node.Key == "Trail") + node.Key = "TrailImage"; + + if (node.Key == "Velocity") + node.Key = "Speed"; + } + UpgradeWeaponRules(engineVersion, ref node.Value.Nodes, node, depth + 1); } } diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index 64a0b7e57d..686c4ac219 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -82,7 +82,7 @@ - + diff --git a/OpenRA.Mods.RA/Effects/TeslaZap.cs b/OpenRA.Mods.RA/Projectiles/TeslaZap.cs similarity index 94% rename from OpenRA.Mods.RA/Effects/TeslaZap.cs rename to OpenRA.Mods.RA/Projectiles/TeslaZap.cs index b4ea7e9d5d..eec43c0780 100644 --- a/OpenRA.Mods.RA/Effects/TeslaZap.cs +++ b/OpenRA.Mods.RA/Projectiles/TeslaZap.cs @@ -16,9 +16,9 @@ using OpenRA.Graphics; using OpenRA.Mods.RA.Graphics; using OpenRA.Traits; -namespace OpenRA.Mods.RA.Effects +namespace OpenRA.Mods.RA.Projectiles { - class TeslaZapInfo : IProjectileInfo + public class TeslaZapInfo : IProjectileInfo { public readonly string Image = "litning"; @@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA.Effects public IEffect Create(ProjectileArgs args) { return new TeslaZap(this, args); } } - class TeslaZap : IEffect + public class TeslaZap : IEffect { readonly ProjectileArgs args; readonly TeslaZapInfo info; diff --git a/mods/cnc/weapons/missiles.yaml b/mods/cnc/weapons/missiles.yaml index d8d8f5b4e8..b23d602cce 100644 --- a/mods/cnc/weapons/missiles.yaml +++ b/mods/cnc/weapons/missiles.yaml @@ -184,7 +184,7 @@ MammothMissiles: Image: DRAGON RateOfTurn: 2 ContrailLength: 10 - Trail: smokey + TrailImage: smokey Speed: 341 Warhead@1Dam: SpreadDamage Spread: 683 @@ -342,7 +342,7 @@ HonestJohn: Shadow: true Inaccuracy: 213 Image: patriot - Trail: smokey + TrailImage: smokey Speed: 187 RangeLimit: 35 Angle: 88 diff --git a/mods/d2k/weapons/debris.yaml b/mods/d2k/weapons/debris.yaml index a689ee70b6..8d809ada5a 100644 --- a/mods/d2k/weapons/debris.yaml +++ b/mods/d2k/weapons/debris.yaml @@ -38,7 +38,7 @@ Debris2: Angle: 30, 90 Inaccuracy: 1c256 Image: shrapnel2 - Trail: bazooka_trail + TrailImage: bazooka_trail TrailPalette: effect75alpha TrailInterval: 2 Warhead@1Dam: SpreadDamage @@ -72,7 +72,7 @@ Debris3: Angle: 30, 90 Inaccuracy: 1c256 Image: shrapnel3 - Trail: large_trail + TrailImage: large_trail TrailPalette: effect75alpha TrailInterval: 1 Warhead@1Dam: SpreadDamage @@ -106,7 +106,7 @@ Debris4: Angle: 30, 90 Inaccuracy: 1c256 Image: shrapnel4 - Trail: large_trail + TrailImage: large_trail TrailPalette: effect75alpha TrailInterval: 1 Warhead@1Dam: SpreadDamage diff --git a/mods/d2k/weapons/other.yaml b/mods/d2k/weapons/other.yaml index 2e87345fef..ac589ddf59 100644 --- a/mods/d2k/weapons/other.yaml +++ b/mods/d2k/weapons/other.yaml @@ -265,7 +265,7 @@ SpiceExplosion: Speed: 50, 75 Blockable: false Angle: 60, 90 - Trail: large_trail + TrailImage: large_trail Image: 120mm Warhead@1Dam: SpreadDamage Spread: 320 diff --git a/mods/ra/maps/drop-zone-w/weapons.yaml b/mods/ra/maps/drop-zone-w/weapons.yaml index a4e8eb126a..3c39f60a4b 100644 --- a/mods/ra/maps/drop-zone-w/weapons.yaml +++ b/mods/ra/maps/drop-zone-w/weapons.yaml @@ -41,7 +41,7 @@ SubMissile: Angle: 62 Inaccuracy: 2c938 Image: MISSILE - Trail: smokey + TrailImage: smokey ContrailLength: 30 Warhead: SpreadDamage Spread: 426 diff --git a/mods/ra/maps/soviet-07/weapons.yaml b/mods/ra/maps/soviet-07/weapons.yaml index d03c74575c..98de71bba4 100644 --- a/mods/ra/maps/soviet-07/weapons.yaml +++ b/mods/ra/maps/soviet-07/weapons.yaml @@ -27,7 +27,7 @@ FireballLauncherInterior: BurstDelay: 20 Projectile: Bullet Speed: 204 - Trail: fb2 + TrailImage: fb2 Image: FB1 Warhead@1Dam: SpreadDamage Spread: 213 diff --git a/mods/ra/weapons/missiles.yaml b/mods/ra/weapons/missiles.yaml index fffb0f2d81..12722da0c3 100644 --- a/mods/ra/weapons/missiles.yaml +++ b/mods/ra/weapons/missiles.yaml @@ -256,7 +256,7 @@ SubMissile: Angle: 165 Inaccuracy: 2c938 Image: MISSILE - Trail: smokey + TrailImage: smokey ContrailLength: 30 Warhead@1Dam: SpreadDamage Spread: 426 @@ -409,7 +409,7 @@ SCUD: Speed: 170 Blockable: false Shadow: false - Trail: smokey + TrailImage: smokey TrailDelay: 5 Inaccuracy: 213 Image: V2 diff --git a/mods/ra/weapons/other.yaml b/mods/ra/weapons/other.yaml index 8d389c6cc0..32b043dc06 100644 --- a/mods/ra/weapons/other.yaml +++ b/mods/ra/weapons/other.yaml @@ -6,7 +6,7 @@ FireballLauncher: BurstDelay: 20 Projectile: Bullet Speed: 204 - Trail: fb2 + TrailImage: fb2 Image: FB1 Warhead@1Dam: SpreadDamage Spread: 213 @@ -33,7 +33,7 @@ Flamer: BurstDelay: 1 Projectile: Bullet Speed: 170 - Trail: fb4 + TrailImage: fb4 Image: fb3 Angle: 62 Inaccuracy: 853 diff --git a/mods/ra/weapons/superweapons.yaml b/mods/ra/weapons/superweapons.yaml index a5be7f3f8c..228e996dc5 100644 --- a/mods/ra/weapons/superweapons.yaml +++ b/mods/ra/weapons/superweapons.yaml @@ -5,7 +5,7 @@ ParaBomb: Projectile: GravityBomb Image: PARABOMB OpenSequence: open - Velocity: 86 + Speed: 86 Acceleration: 0 Warhead@1Dam: SpreadDamage Spread: 768