Remove the now-redundant ScriptInvulnerable trait.

This commit is contained in:
Paul Chote
2014-10-01 21:39:39 +13:00
parent b6d17d3034
commit fd14ebddb8
7 changed files with 17 additions and 57 deletions

View File

@@ -502,7 +502,6 @@
<Compile Include="Scripting\Properties\TransportProperties.cs" /> <Compile Include="Scripting\Properties\TransportProperties.cs" />
<Compile Include="Scripting\Global\CameraGlobal.cs" /> <Compile Include="Scripting\Global\CameraGlobal.cs" />
<Compile Include="Scripting\Properties\ChronosphereProperties.cs" /> <Compile Include="Scripting\Properties\ChronosphereProperties.cs" />
<Compile Include="Scripting\ScriptInvulnerable.cs" />
<Compile Include="Console\ChatCommands.cs" /> <Compile Include="Console\ChatCommands.cs" />
<Compile Include="Console\DevCommands.cs" /> <Compile Include="Console\DevCommands.cs" />
<Compile Include="Console\HelpCommand.cs" /> <Compile Include="Console\HelpCommand.cs" />

View File

@@ -33,22 +33,4 @@ namespace OpenRA.Mods.RA.Scripting
[Desc("Maximum health of the actor.")] [Desc("Maximum health of the actor.")]
public int MaxHealth { get { return health.MaxHP; } } public int MaxHealth { get { return health.MaxHP; } }
} }
[ScriptPropertyGroup("General")]
public class InvulnerableProperties : ScriptActorProperties, Requires<ScriptInvulnerableInfo>
{
ScriptInvulnerable invulnerable;
public InvulnerableProperties(ScriptContext context, Actor self)
: base(context, self)
{
invulnerable = self.Trait<ScriptInvulnerable>();
}
[Desc("Set or query unit invulnerablility.")]
public bool Invulnerable
{
get { return invulnerable.Invulnerable; }
set { invulnerable.Invulnerable = value; }
}
}
} }

View File

@@ -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<ScriptInvulnerable> {}
class ScriptInvulnerable : IDamageModifier
{
public bool Invulnerable = false;
public int GetDamageModifier(Actor attacker, DamageWarhead warhead)
{
return Invulnerable ? 0 : 100;
}
}
}

View File

@@ -109,8 +109,8 @@ end
SetupAlliedUnits = function() SetupAlliedUnits = function()
Utils.Do(Map.NamedActors, function(a) Utils.Do(Map.NamedActors, function(a)
if a.Owner == allies and a.HasProperty("Invulnerable") then if a.Owner == allies and a.HasProperty("AcceptsUpgrade") and a.AcceptsUpgrade("unkillable") then
a.Invulnerable = true a.GrantUpgrade("unkillable")
a.Stance = "Defend" a.Stance = "Defend"
end end
end) end)

View File

@@ -1295,19 +1295,20 @@ Rules:
Health: Health:
HP: 200 HP: 200
^Vehicle: ^Vehicle:
ScriptInvulnerable:
GivesBounty: GivesBounty:
Percentage: 0 Percentage: 0
GainsExperience: GainsExperience:
Upgrades: Upgrades:
InvulnerabilityUpgrade@UNKILLABLE:
RequiresUpgrade: unkillable
^Tank: ^Tank:
ScriptInvulnerable:
GivesBounty: GivesBounty:
Percentage: 0 Percentage: 0
GainsExperience: GainsExperience:
Upgrades: Upgrades:
InvulnerabilityUpgrade@UNKILLABLE:
RequiresUpgrade: unkillable
^Infantry: ^Infantry:
ScriptInvulnerable:
GivesBounty: GivesBounty:
Percentage: 0 Percentage: 0
GainsExperience: GainsExperience:
@@ -1318,20 +1319,25 @@ Rules:
VolumeMultiplier: 0.1 VolumeMultiplier: 0.1
DeathSounds@ZAPPED: DeathSounds@ZAPPED:
VolumeMultiplier: 0.1 VolumeMultiplier: 0.1
InvulnerabilityUpgrade@UNKILLABLE:
RequiresUpgrade: unkillable
^Ship: ^Ship:
ScriptInvulnerable:
GivesBounty: GivesBounty:
Percentage: 0 Percentage: 0
GainsExperience: GainsExperience:
Upgrades: Upgrades:
InvulnerabilityUpgrade@UNKILLABLE:
RequiresUpgrade: unkillable
^Plane: ^Plane:
ScriptInvulnerable:
GivesBounty: GivesBounty:
Percentage: 0 Percentage: 0
InvulnerabilityUpgrade@UNKILLABLE:
RequiresUpgrade: unkillable
^Building: ^Building:
ScriptInvulnerable:
GivesBounty: GivesBounty:
Percentage: 0 Percentage: 0
InvulnerabilityUpgrade@UNKILLABLE:
RequiresUpgrade: unkillable
Sequences: Sequences:

View File

@@ -147,7 +147,7 @@ WorldLoaded = function()
Utils.Do(Snipers, function(a) Utils.Do(Snipers, function(a)
if a.Owner == soviets then if a.Owner == soviets then
a.Invulnerable = true a.GrantUpgrade("unkillable")
end end
end) end)

View File

@@ -665,7 +665,8 @@ Rules:
HP: 200 HP: 200
AutoTarget: AutoTarget:
InitialStance: Defend InitialStance: Defend
ScriptInvulnerable: InvulnerabilityUpgrade@UNKILLABLE:
RequiresUpgrade: unkillable
SPY: SPY:
Inherits: ^Infantry Inherits: ^Infantry
Buildable: Buildable: