From ea9ebaa08d96aae8d8ef9fddeb1720c3420181c1 Mon Sep 17 00:00:00 2001 From: penev92 Date: Sun, 11 Jan 2015 16:39:16 +0100 Subject: [PATCH] Add IgnoresCloak trait --- OpenRA.Mods.Common/OpenRA.Mods.Common.csproj | 1 + OpenRA.Mods.Common/Traits/IgnoresCloak.cs | 18 ++++++++++++++++++ OpenRA.Mods.Common/Traits/TargetableUnit.cs | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 OpenRA.Mods.Common/Traits/IgnoresCloak.cs diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj index 84c20944bb..e8858e3933 100644 --- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj +++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj @@ -214,6 +214,7 @@ + diff --git a/OpenRA.Mods.Common/Traits/IgnoresCloak.cs b/OpenRA.Mods.Common/Traits/IgnoresCloak.cs new file mode 100644 index 0000000000..d22ee56aff --- /dev/null +++ b/OpenRA.Mods.Common/Traits/IgnoresCloak.cs @@ -0,0 +1,18 @@ +#region Copyright & License Information +/* +* Copyright 2007-2015 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.Traits; + +namespace OpenRA.Mods.Common.Traits +{ + [Desc("This actor does not care about any type of cloak its targets might have, regardless of distance.")] + class IgnoresCloakInfo : TraitInfo { } + class IgnoresCloak { } +} diff --git a/OpenRA.Mods.Common/Traits/TargetableUnit.cs b/OpenRA.Mods.Common/Traits/TargetableUnit.cs index 7b3b00cd45..a38111173a 100644 --- a/OpenRA.Mods.Common/Traits/TargetableUnit.cs +++ b/OpenRA.Mods.Common/Traits/TargetableUnit.cs @@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits public virtual bool TargetableBy(Actor self, Actor viewer) { - if (cloak == null) + if (cloak == null || (!viewer.IsDead && viewer.HasTrait())) return true; return cloak.IsVisible(self, viewer.Owner);