From fef4f3eb79bd184ce1bb09b53892e4a84f9f6ad8 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sat, 28 May 2016 14:42:33 +0200 Subject: [PATCH 01/10] Move projectiles to their own namespace and folder While they are (currently) technically effects, this makes the actual purpose and wiki more clear. --- OpenRA.Mods.Common/Lint/CheckRangeLimit.cs | 2 +- OpenRA.Mods.Common/Lint/CheckTargetHealthRadius.cs | 2 +- OpenRA.Mods.Common/OpenRA.Mods.Common.csproj | 10 +++++----- .../{Effects => Projectiles}/AreaBeam.cs | 3 ++- OpenRA.Mods.Common/{Effects => Projectiles}/Bullet.cs | 3 ++- .../{Effects => Projectiles}/GravityBomb.cs | 3 ++- .../{Effects => Projectiles}/LaserZap.cs | 3 ++- OpenRA.Mods.Common/{Effects => Projectiles}/Missile.cs | 4 ++-- OpenRA.Mods.RA/OpenRA.Mods.RA.csproj | 2 +- OpenRA.Mods.RA/{Effects => Projectiles}/TeslaZap.cs | 2 +- 10 files changed, 19 insertions(+), 15 deletions(-) rename OpenRA.Mods.Common/{Effects => Projectiles}/AreaBeam.cs (98%) rename OpenRA.Mods.Common/{Effects => Projectiles}/Bullet.cs (98%) rename OpenRA.Mods.Common/{Effects => Projectiles}/GravityBomb.cs (97%) rename OpenRA.Mods.Common/{Effects => Projectiles}/LaserZap.cs (97%) rename OpenRA.Mods.Common/{Effects => Projectiles}/Missile.cs (99%) rename OpenRA.Mods.RA/{Effects => Projectiles}/TeslaZap.cs (98%) 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 e817174245..cd9a0c8ff9 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 98% rename from OpenRA.Mods.Common/Effects/Bullet.cs rename to OpenRA.Mods.Common/Projectiles/Bullet.cs index 0c0d72e698..f6c4526b1c 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 { diff --git a/OpenRA.Mods.Common/Effects/GravityBomb.cs b/OpenRA.Mods.Common/Projectiles/GravityBomb.cs similarity index 97% rename from OpenRA.Mods.Common/Effects/GravityBomb.cs rename to OpenRA.Mods.Common/Projectiles/GravityBomb.cs index 952094724f..0340dd337b 100644 --- a/OpenRA.Mods.Common/Effects/GravityBomb.cs +++ b/OpenRA.Mods.Common/Projectiles/GravityBomb.cs @@ -13,9 +13,10 @@ 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 { diff --git a/OpenRA.Mods.Common/Effects/LaserZap.cs b/OpenRA.Mods.Common/Projectiles/LaserZap.cs similarity index 97% rename from OpenRA.Mods.Common/Effects/LaserZap.cs rename to OpenRA.Mods.Common/Projectiles/LaserZap.cs index f984f143a6..36abdc4945 100644 --- a/OpenRA.Mods.Common/Effects/LaserZap.cs +++ b/OpenRA.Mods.Common/Projectiles/LaserZap.cs @@ -14,10 +14,11 @@ 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 diff --git a/OpenRA.Mods.Common/Effects/Missile.cs b/OpenRA.Mods.Common/Projectiles/Missile.cs similarity index 99% rename from OpenRA.Mods.Common/Effects/Missile.cs rename to OpenRA.Mods.Common/Projectiles/Missile.cs index de0f81dfdb..b2f7050377 100644 --- a/OpenRA.Mods.Common/Effects/Missile.cs +++ b/OpenRA.Mods.Common/Projectiles/Missile.cs @@ -16,12 +16,12 @@ 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 { 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 98% rename from OpenRA.Mods.RA/Effects/TeslaZap.cs rename to OpenRA.Mods.RA/Projectiles/TeslaZap.cs index b4ea7e9d5d..450ced7e34 100644 --- a/OpenRA.Mods.RA/Effects/TeslaZap.cs +++ b/OpenRA.Mods.RA/Projectiles/TeslaZap.cs @@ -16,7 +16,7 @@ using OpenRA.Graphics; using OpenRA.Mods.RA.Graphics; using OpenRA.Traits; -namespace OpenRA.Mods.RA.Effects +namespace OpenRA.Mods.RA.Projectiles { class TeslaZapInfo : IProjectileInfo { From e34c8f06509f043193fd236d452da27f973d1935 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sat, 28 May 2016 15:01:28 +0200 Subject: [PATCH 02/10] Bullet style and description fixes --- OpenRA.Mods.Common/Projectiles/Bullet.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Projectiles/Bullet.cs b/OpenRA.Mods.Common/Projectiles/Bullet.cs index f6c4526b1c..95814d95b1 100644 --- a/OpenRA.Mods.Common/Projectiles/Bullet.cs +++ b/OpenRA.Mods.Common/Projectiles/Bullet.cs @@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Projectiles [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.")] @@ -48,8 +48,8 @@ namespace OpenRA.Mods.Common.Projectiles [Desc("Trail animation.")] public readonly string Trail = 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.")] [Desc("Is this blocked by actors with BlocksProjectiles trait.")] public readonly bool Blockable = true; @@ -69,7 +69,10 @@ namespace OpenRA.Mods.Common.Projectiles [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; @@ -185,6 +188,7 @@ namespace OpenRA.Mods.Common.Projectiles 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), trailPalette, false, false, GetEffectiveFacing()))); + smokeTicks = info.TrailInterval; } From 170fdc89e393c6038e2370abe4907cfc7aee1d6a Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sat, 28 May 2016 15:01:46 +0200 Subject: [PATCH 03/10] Rename Bullet Trail to TrailImage --- OpenRA.Mods.Common/Projectiles/Bullet.cs | 8 ++++---- mods/cnc/weapons/missiles.yaml | 4 ++-- mods/d2k/weapons/debris.yaml | 6 +++--- mods/d2k/weapons/other.yaml | 2 +- mods/ra/maps/drop-zone-w/weapons.yaml | 2 +- mods/ra/maps/soviet-07/weapons.yaml | 2 +- mods/ra/weapons/missiles.yaml | 4 ++-- mods/ra/weapons/other.yaml | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/OpenRA.Mods.Common/Projectiles/Bullet.cs b/OpenRA.Mods.Common/Projectiles/Bullet.cs index 95814d95b1..ba1aebdc4a 100644 --- a/OpenRA.Mods.Common/Projectiles/Bullet.cs +++ b/OpenRA.Mods.Common/Projectiles/Bullet.cs @@ -46,10 +46,10 @@ namespace OpenRA.Mods.Common.Projectiles [PaletteReference] public readonly string ShadowPalette = "shadow"; [Desc("Trail animation.")] - public readonly string Trail = null; + public readonly string TrailImage = null; - [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; @@ -183,10 +183,10 @@ namespace OpenRA.Mods.Common.Projectiles 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/mods/cnc/weapons/missiles.yaml b/mods/cnc/weapons/missiles.yaml index 75f5829297..2ff65ff115 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 5cfa0f8dcd..81667cf395 100644 --- a/mods/ra/weapons/missiles.yaml +++ b/mods/ra/weapons/missiles.yaml @@ -258,7 +258,7 @@ SubMissile: Angle: 165 Inaccuracy: 2c938 Image: MISSILE - Trail: smokey + TrailImage: smokey ContrailLength: 30 Warhead@1Dam: SpreadDamage Spread: 426 @@ -411,7 +411,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 2f9a7f6e42..a35a3b7157 100644 --- a/mods/ra/weapons/other.yaml +++ b/mods/ra/weapons/other.yaml @@ -5,7 +5,7 @@ FireballLauncher: BurstDelay: 20 Projectile: Bullet Speed: 204 - Trail: fb2 + TrailImage: fb2 Image: FB1 Warhead@1Dam: SpreadDamage Spread: 213 @@ -30,7 +30,7 @@ Flamer: BurstDelay: 1 Projectile: Bullet Speed: 170 - Trail: fb4 + TrailImage: fb4 Image: fb3 Angle: 62 Inaccuracy: 853 From 3d2855c3b98fecfc661b70c38187c8d7da378424 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sat, 28 May 2016 15:02:33 +0200 Subject: [PATCH 04/10] Missile description fixes --- OpenRA.Mods.Common/Projectiles/Missile.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/OpenRA.Mods.Common/Projectiles/Missile.cs b/OpenRA.Mods.Common/Projectiles/Missile.cs index b2f7050377..dde8199619 100644 --- a/OpenRA.Mods.Common/Projectiles/Missile.cs +++ b/OpenRA.Mods.Common/Projectiles/Missile.cs @@ -100,19 +100,19 @@ namespace OpenRA.Mods.Common.Projectiles [Desc("Image that contains the trail animation.")] public readonly string TrailImage = null; - [Desc("Smoke sequence name.")] + [Desc("Trail sequence name.")] [SequenceReference("TrailImage")] public readonly string TrailSequence = "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; @@ -817,7 +817,7 @@ namespace OpenRA.Mods.Common.Projectiles 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))); From 386b1429130bad6ce0f7316707c1baf327ad2274 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sat, 28 May 2016 15:04:02 +0200 Subject: [PATCH 05/10] Add random sequences support to Missile --- OpenRA.Mods.Common/Projectiles/Missile.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/OpenRA.Mods.Common/Projectiles/Missile.cs b/OpenRA.Mods.Common/Projectiles/Missile.cs index dde8199619..cfdd9b2c20 100644 --- a/OpenRA.Mods.Common/Projectiles/Missile.cs +++ b/OpenRA.Mods.Common/Projectiles/Missile.cs @@ -28,8 +28,8 @@ namespace OpenRA.Mods.Common.Projectiles [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,8 +100,8 @@ namespace OpenRA.Mods.Common.Projectiles [Desc("Image that contains the trail animation.")] public readonly string TrailImage = null; - [Desc("Trail 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 trail sequence.")] [PaletteReference("TrailUsePlayerPalette")] public readonly string TrailPalette = "effect"; @@ -222,7 +222,7 @@ namespace OpenRA.Mods.Common.Projectiles 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) @@ -820,7 +820,9 @@ namespace OpenRA.Mods.Common.Projectiles // 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; } From a320ca89a62abc7d5702a2bddf5e32256280423d Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sat, 28 May 2016 15:18:07 +0200 Subject: [PATCH 06/10] Rename GravityBomb Velocity to Speed Mostly to make switching between projectiles a little easier for modders, and to potentially save some upgrade rule overhead if sprite projectiles are refactored to share a common code base. --- OpenRA.Mods.Common/Projectiles/GravityBomb.cs | 6 +++--- mods/ra/weapons/superweapons.yaml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/Projectiles/GravityBomb.cs b/OpenRA.Mods.Common/Projectiles/GravityBomb.cs index 0340dd337b..99e3e8930e 100644 --- a/OpenRA.Mods.Common/Projectiles/GravityBomb.cs +++ b/OpenRA.Mods.Common/Projectiles/GravityBomb.cs @@ -34,9 +34,9 @@ namespace OpenRA.Mods.Common.Projectiles [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); } @@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Projectiles 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)) diff --git a/mods/ra/weapons/superweapons.yaml b/mods/ra/weapons/superweapons.yaml index 796f91c68f..68acb6f83e 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 From af8e81a99d49e62508e75b4fdabe64d9ede5e9e1 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sat, 28 May 2016 15:18:27 +0200 Subject: [PATCH 07/10] Add random Sequences support to GravityBomb --- OpenRA.Mods.Common/Projectiles/GravityBomb.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/Projectiles/GravityBomb.cs b/OpenRA.Mods.Common/Projectiles/GravityBomb.cs index 99e3e8930e..1d1589d6fa 100644 --- a/OpenRA.Mods.Common/Projectiles/GravityBomb.cs +++ b/OpenRA.Mods.Common/Projectiles/GravityBomb.cs @@ -22,8 +22,8 @@ namespace OpenRA.Mods.Common.Projectiles { 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; @@ -64,9 +64,9 @@ namespace OpenRA.Mods.Common.Projectiles 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)); } } From 2e94a23d9efaed68d18a06648d5325bd42f33437 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Tue, 31 May 2016 14:30:52 +0200 Subject: [PATCH 08/10] Make LaserZap classes public --- OpenRA.Mods.Common/Projectiles/LaserZap.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Projectiles/LaserZap.cs b/OpenRA.Mods.Common/Projectiles/LaserZap.cs index 36abdc4945..c5928ffa17 100644 --- a/OpenRA.Mods.Common/Projectiles/LaserZap.cs +++ b/OpenRA.Mods.Common/Projectiles/LaserZap.cs @@ -21,7 +21,7 @@ using OpenRA.Traits; 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); @@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Projectiles } } - class LaserZap : IEffect + public class LaserZap : IEffect { readonly ProjectileArgs args; readonly LaserZapInfo info; From 1db96262f3b05a3f3ba3aa5d9fe4a4eaa4d21e83 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Tue, 31 May 2016 14:44:33 +0200 Subject: [PATCH 09/10] Make TeslaZap classes public --- OpenRA.Mods.RA/Projectiles/TeslaZap.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.RA/Projectiles/TeslaZap.cs b/OpenRA.Mods.RA/Projectiles/TeslaZap.cs index 450ced7e34..eec43c0780 100644 --- a/OpenRA.Mods.RA/Projectiles/TeslaZap.cs +++ b/OpenRA.Mods.RA/Projectiles/TeslaZap.cs @@ -18,7 +18,7 @@ using OpenRA.Traits; 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.Projectiles public IEffect Create(ProjectileArgs args) { return new TeslaZap(this, args); } } - class TeslaZap : IEffect + public class TeslaZap : IEffect { readonly ProjectileArgs args; readonly TeslaZapInfo info; From e423f965cf706bf6aeb6f5f5ede0de13fe6cacdc Mon Sep 17 00:00:00 2001 From: reaperrr Date: Tue, 31 May 2016 14:45:20 +0200 Subject: [PATCH 10/10] Projectile property names upgrade rules --- .../UtilityCommands/UpgradeRules.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs index 4fa6ad33ba..f9567a83bb 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs @@ -865,6 +865,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); } }