From 60eae9f229c2e3b344abb844db329adebfa4cd98 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sat, 6 Sep 2014 11:43:13 +0200 Subject: [PATCH 1/4] Replace Wall trait with BlocksBullets --- OpenRA.Mods.RA/BlocksBullets.cs | 20 +++++++++++ OpenRA.Mods.RA/Buildings/Wall.cs | 50 ---------------------------- OpenRA.Mods.RA/OpenRA.Mods.RA.csproj | 2 +- 3 files changed, 21 insertions(+), 51 deletions(-) create mode 100644 OpenRA.Mods.RA/BlocksBullets.cs delete mode 100755 OpenRA.Mods.RA/Buildings/Wall.cs diff --git a/OpenRA.Mods.RA/BlocksBullets.cs b/OpenRA.Mods.RA/BlocksBullets.cs new file mode 100644 index 0000000000..0709b28e23 --- /dev/null +++ b/OpenRA.Mods.RA/BlocksBullets.cs @@ -0,0 +1,20 @@ +#region Copyright & License Information +/* + * 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, + * see COPYING. + */ +#endregion + +using System.Linq; +using OpenRA.Traits; + +namespace OpenRA.Mods.RA +{ + //TODO: Add functionality like a customizable Height that is compared to projectile altitude + [Desc("This actor blocks bullets and missiles without 'High' property.")] + public class BlocksBulletsInfo : TraitInfo { } + public class BlocksBullets : IBlocksBullets { } +} diff --git a/OpenRA.Mods.RA/Buildings/Wall.cs b/OpenRA.Mods.RA/Buildings/Wall.cs deleted file mode 100755 index 84e8f3722d..0000000000 --- a/OpenRA.Mods.RA/Buildings/Wall.cs +++ /dev/null @@ -1,50 +0,0 @@ -#region Copyright & License Information -/* - * 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, - * see COPYING. - */ -#endregion - -using System.Linq; -using OpenRA.Traits; - -namespace OpenRA.Mods.RA.Buildings -{ - public class WallInfo : ITraitInfo, Requires - { - public readonly string[] CrushClasses = { }; - public readonly string CrushSound; - public object Create(ActorInitializer init) { return new Wall(init.self, this); } - } - - public class Wall : ICrushable, IBlocksBullets - { - readonly Actor self; - readonly WallInfo info; - - public Wall(Actor self, WallInfo info) - { - this.self = self; - this.info = info; - } - - public void WarnCrush(Actor crusher) {} - - public bool CrushableBy(string[] crushClasses, Player crushOwner) - { - if (crushOwner.Stances[self.Owner] == Stance.Ally) - return false; - - return info.CrushClasses.Intersect(crushClasses).Any(); - } - - public void OnCrush(Actor crusher) - { - self.Kill(crusher); - Sound.Play(info.CrushSound, self.CenterPosition); - } - } -} diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index 0073e0ac83..9cc732919d 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -183,7 +183,7 @@ - + From 8c1ab03623901705706b967c44279e88945d2d39 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sat, 6 Sep 2014 13:39:02 +0200 Subject: [PATCH 2/4] Wall -> Crushable + BlocksBullets yaml changes --- mods/cnc/rules/defaults.yaml | 3 ++- mods/cnc/rules/structures.yaml | 2 +- mods/d2k/rules/structures.yaml | 3 ++- mods/ra/maps/room-convergence/map.yaml | 2 +- mods/ra/rules/defaults.yaml | 3 ++- mods/ra/rules/structures.yaml | 2 +- mods/ts/rules/defaults.yaml | 3 ++- mods/ts/rules/structures.yaml | 4 ++++ 8 files changed, 15 insertions(+), 7 deletions(-) diff --git a/mods/cnc/rules/defaults.yaml b/mods/cnc/rules/defaults.yaml index 703f58ae95..4f9fed8bd9 100644 --- a/mods/cnc/rules/defaults.yaml +++ b/mods/cnc/rules/defaults.yaml @@ -460,9 +460,10 @@ TerrainTypes: Clear,Road TargetableBuilding: TargetTypes: Ground, Wall - Wall: + Crushable: CrushClasses: wall CrushSound: sandbag2.aud + BlocksBullets: LineBuild: Range: 8 NodeTypes: wall diff --git a/mods/cnc/rules/structures.yaml b/mods/cnc/rules/structures.yaml index eff98a89b4..e0465a915c 100644 --- a/mods/cnc/rules/structures.yaml +++ b/mods/cnc/rules/structures.yaml @@ -863,7 +863,7 @@ BRIK: HP: 250 Armor: Type: Heavy - Wall: + Crushable: CrushClasses: heavywall -CrushSound: SoundOnDamageTransition: diff --git a/mods/d2k/rules/structures.yaml b/mods/d2k/rules/structures.yaml index ac7f08519d..5f8f688d2e 100644 --- a/mods/d2k/rules/structures.yaml +++ b/mods/d2k/rules/structures.yaml @@ -417,8 +417,9 @@ CONCRETEB: HP: 300 Armor: Type: Concrete - Wall: + Crushable: CrushClasses: Concretewall + BlocksBullets: LineBuild: Range: 8 NodeTypes: wall, turret diff --git a/mods/ra/maps/room-convergence/map.yaml b/mods/ra/maps/room-convergence/map.yaml index 4448f3155a..3f1999f8c3 100644 --- a/mods/ra/maps/room-convergence/map.yaml +++ b/mods/ra/maps/room-convergence/map.yaml @@ -751,7 +751,7 @@ Rules: SoundOnDamageTransition: DamagedSound: DestroyedSound: - Wall: + Crushable: CrushClasses: heavywall Sequences: diff --git a/mods/ra/rules/defaults.yaml b/mods/ra/rules/defaults.yaml index 7b85139ba5..7cb47ff0ab 100644 --- a/mods/ra/rules/defaults.yaml +++ b/mods/ra/rules/defaults.yaml @@ -332,8 +332,9 @@ SoundOnDamageTransition: DamagedSound: sandbag2.aud DestroyedSound: sandbag2.aud - Wall: + Crushable: CrushClasses: wall + BlocksBullets: LineBuild: Range: 8 NodeTypes: wall diff --git a/mods/ra/rules/structures.yaml b/mods/ra/rules/structures.yaml index 9f41c20d04..978fac4089 100644 --- a/mods/ra/rules/structures.yaml +++ b/mods/ra/rules/structures.yaml @@ -1399,7 +1399,7 @@ BRIK: HP: 500 Armor: Type: Concrete - Wall: + Crushable: CrushClasses: heavywall LineBuild: Range: 8 diff --git a/mods/ts/rules/defaults.yaml b/mods/ts/rules/defaults.yaml index 11021d52bd..f0c4203443 100644 --- a/mods/ts/rules/defaults.yaml +++ b/mods/ts/rules/defaults.yaml @@ -54,8 +54,9 @@ SoundOnDamageTransition: DamagedSound: expnew01.aud DestroyedSound: crmble2.aud - Wall: + Crushable: CrushClasses: wall + BlocksBullets: LineBuild: Range: 8 NodeTypes: wall diff --git a/mods/ts/rules/structures.yaml b/mods/ts/rules/structures.yaml index 15c7bc9d5d..d88a60d027 100644 --- a/mods/ts/rules/structures.yaml +++ b/mods/ts/rules/structures.yaml @@ -395,6 +395,8 @@ GAWALL: HP: 300 Armor: Type: Concrete + Crushable: + CrushClasses: heavywall LineBuild: NodeTypes: wall, turret @@ -419,6 +421,8 @@ NAWALL: HP: 300 Armor: Type: Concrete + Crushable: + CrushClasses: heavywall LineBuild: NodeTypes: wall, turret From 0116bf169aac23cd0829e69345092979cf8c8948 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sun, 14 Sep 2014 00:59:58 +0200 Subject: [PATCH 3/4] Upgrade rule for Wall -> BlocksBullets + Crushable transition --- OpenRA.Utility/UpgradeRules.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/OpenRA.Utility/UpgradeRules.cs b/OpenRA.Utility/UpgradeRules.cs index 692033723b..6917c32c10 100644 --- a/OpenRA.Utility/UpgradeRules.cs +++ b/OpenRA.Utility/UpgradeRules.cs @@ -547,6 +547,22 @@ namespace OpenRA.Utility } } + // Replaced Wall with Crushable + BlocksBullets + if (engineVersion < 20140914) + { + if (depth == 0) + { + var actorTraits = node.Value.Nodes; + var wall = actorTraits.FirstOrDefault(t => t.Key == "Wall"); + if (wall != null) + node.Value.Nodes.Add(new MiniYamlNode("BlocksBullets", new MiniYaml(""))); + + var blocksBullets = actorTraits.FirstOrDefault(t => t.Key == "BlocksBullets"); + if (depth == 1 && node.Key == "Wall" && blocksBullets != null) + node.Key = "Crushable"; + } + } + UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1); } } From e8b9397e1acd7e3f438be2ac36bff908e6d5078d Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sun, 14 Sep 2014 11:53:26 +0200 Subject: [PATCH 4/4] Update Bullet & Missile descriptions for Wall->BlocksBullets --- OpenRA.Mods.RA/Effects/Bullet.cs | 2 +- OpenRA.Mods.RA/Effects/Missile.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.RA/Effects/Bullet.cs b/OpenRA.Mods.RA/Effects/Bullet.cs index 03f54a5808..1de36d10df 100755 --- a/OpenRA.Mods.RA/Effects/Bullet.cs +++ b/OpenRA.Mods.RA/Effects/Bullet.cs @@ -28,7 +28,7 @@ namespace OpenRA.Mods.RA.Effects [Desc("Maximum offset at the maximum range")] public readonly WRange Inaccuracy = WRange.Zero; public readonly string Image = null; - [Desc("Check for whether an actor with Wall: trait blocks fire")] + [Desc("Check for whether an actor with BlocksBullets: trait blocks fire")] public readonly bool High = false; public readonly bool Shadow = false; [Desc("Arc in WAngles, two values indicate variable arc.")] diff --git a/OpenRA.Mods.RA/Effects/Missile.cs b/OpenRA.Mods.RA/Effects/Missile.cs index 222d02474c..c4fe5e2f12 100755 --- a/OpenRA.Mods.RA/Effects/Missile.cs +++ b/OpenRA.Mods.RA/Effects/Missile.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA.Effects public readonly WRange Speed = new WRange(8); public readonly WAngle MaximumPitch = WAngle.FromDegrees(30); public readonly int Arm = 0; - [Desc("Check for whether an actor with Wall: trait blocks fire")] + [Desc("Check for whether an actor with BlocksBullets: trait blocks fire")] public readonly bool High = false; public readonly bool Shadow = false; public readonly string Trail = null;