From fd14ebddb8272b9ca0a39eb8b79373c03d886300 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 1 Oct 2014 21:39:39 +1300 Subject: [PATCH] Remove the now-redundant ScriptInvulnerable trait. --- OpenRA.Mods.RA/OpenRA.Mods.RA.csproj | 1 - .../Scripting/Properties/HealthProperties.cs | 18 ------------ .../Scripting/ScriptInvulnerable.cs | 28 ------------------- .../maps/desert-shellmap/desert-shellmap.lua | 4 +-- mods/ra/maps/desert-shellmap/map.yaml | 18 ++++++++---- mods/ra/maps/fort-lonestar/fort-lonestar.lua | 2 +- mods/ra/maps/fort-lonestar/map.yaml | 3 +- 7 files changed, 17 insertions(+), 57 deletions(-) delete mode 100644 OpenRA.Mods.RA/Scripting/ScriptInvulnerable.cs diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index 3d4967f001..57dba908c2 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -502,7 +502,6 @@ - diff --git a/OpenRA.Mods.RA/Scripting/Properties/HealthProperties.cs b/OpenRA.Mods.RA/Scripting/Properties/HealthProperties.cs index 445622cee2..c11867ff9e 100644 --- a/OpenRA.Mods.RA/Scripting/Properties/HealthProperties.cs +++ b/OpenRA.Mods.RA/Scripting/Properties/HealthProperties.cs @@ -33,22 +33,4 @@ namespace OpenRA.Mods.RA.Scripting [Desc("Maximum health of the actor.")] public int MaxHealth { get { return health.MaxHP; } } } - - [ScriptPropertyGroup("General")] - public class InvulnerableProperties : ScriptActorProperties, Requires - { - ScriptInvulnerable invulnerable; - public InvulnerableProperties(ScriptContext context, Actor self) - : base(context, self) - { - invulnerable = self.Trait(); - } - - [Desc("Set or query unit invulnerablility.")] - public bool Invulnerable - { - get { return invulnerable.Invulnerable; } - set { invulnerable.Invulnerable = value; } - } - } } \ No newline at end of file diff --git a/OpenRA.Mods.RA/Scripting/ScriptInvulnerable.cs b/OpenRA.Mods.RA/Scripting/ScriptInvulnerable.cs deleted file mode 100644 index f2c8e5f067..0000000000 --- a/OpenRA.Mods.RA/Scripting/ScriptInvulnerable.cs +++ /dev/null @@ -1,28 +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 OpenRA.GameRules; -using OpenRA.Traits; - -namespace OpenRA.Mods.RA -{ - [Desc("Allows map scripts to make this actor invulnerable via actor.Invulnerable = true.")] - class ScriptInvulnerableInfo : TraitInfo {} - - class ScriptInvulnerable : IDamageModifier - { - public bool Invulnerable = false; - - public int GetDamageModifier(Actor attacker, DamageWarhead warhead) - { - return Invulnerable ? 0 : 100; - } - } -} diff --git a/mods/ra/maps/desert-shellmap/desert-shellmap.lua b/mods/ra/maps/desert-shellmap/desert-shellmap.lua index cc8b82f733..404ad46fc6 100644 --- a/mods/ra/maps/desert-shellmap/desert-shellmap.lua +++ b/mods/ra/maps/desert-shellmap/desert-shellmap.lua @@ -109,8 +109,8 @@ end SetupAlliedUnits = function() Utils.Do(Map.NamedActors, function(a) - if a.Owner == allies and a.HasProperty("Invulnerable") then - a.Invulnerable = true + if a.Owner == allies and a.HasProperty("AcceptsUpgrade") and a.AcceptsUpgrade("unkillable") then + a.GrantUpgrade("unkillable") a.Stance = "Defend" end end) diff --git a/mods/ra/maps/desert-shellmap/map.yaml b/mods/ra/maps/desert-shellmap/map.yaml index 9410038d01..711f967fa9 100644 --- a/mods/ra/maps/desert-shellmap/map.yaml +++ b/mods/ra/maps/desert-shellmap/map.yaml @@ -1295,19 +1295,20 @@ Rules: Health: HP: 200 ^Vehicle: - ScriptInvulnerable: GivesBounty: Percentage: 0 GainsExperience: Upgrades: + InvulnerabilityUpgrade@UNKILLABLE: + RequiresUpgrade: unkillable ^Tank: - ScriptInvulnerable: GivesBounty: Percentage: 0 GainsExperience: Upgrades: + InvulnerabilityUpgrade@UNKILLABLE: + RequiresUpgrade: unkillable ^Infantry: - ScriptInvulnerable: GivesBounty: Percentage: 0 GainsExperience: @@ -1318,20 +1319,25 @@ Rules: VolumeMultiplier: 0.1 DeathSounds@ZAPPED: VolumeMultiplier: 0.1 + InvulnerabilityUpgrade@UNKILLABLE: + RequiresUpgrade: unkillable ^Ship: - ScriptInvulnerable: GivesBounty: Percentage: 0 GainsExperience: Upgrades: + InvulnerabilityUpgrade@UNKILLABLE: + RequiresUpgrade: unkillable ^Plane: - ScriptInvulnerable: GivesBounty: Percentage: 0 + InvulnerabilityUpgrade@UNKILLABLE: + RequiresUpgrade: unkillable ^Building: - ScriptInvulnerable: GivesBounty: Percentage: 0 + InvulnerabilityUpgrade@UNKILLABLE: + RequiresUpgrade: unkillable Sequences: diff --git a/mods/ra/maps/fort-lonestar/fort-lonestar.lua b/mods/ra/maps/fort-lonestar/fort-lonestar.lua index d75e196207..a6f22481cb 100644 --- a/mods/ra/maps/fort-lonestar/fort-lonestar.lua +++ b/mods/ra/maps/fort-lonestar/fort-lonestar.lua @@ -147,7 +147,7 @@ WorldLoaded = function() Utils.Do(Snipers, function(a) if a.Owner == soviets then - a.Invulnerable = true + a.GrantUpgrade("unkillable") end end) diff --git a/mods/ra/maps/fort-lonestar/map.yaml b/mods/ra/maps/fort-lonestar/map.yaml index fdc907b7c1..d6130c546c 100644 --- a/mods/ra/maps/fort-lonestar/map.yaml +++ b/mods/ra/maps/fort-lonestar/map.yaml @@ -665,7 +665,8 @@ Rules: HP: 200 AutoTarget: InitialStance: Defend - ScriptInvulnerable: + InvulnerabilityUpgrade@UNKILLABLE: + RequiresUpgrade: unkillable SPY: Inherits: ^Infantry Buildable: