Add IgnoresCloak trait

This commit is contained in:
penev92
2015-01-11 16:39:16 +01:00
parent 0831b105cb
commit ea9ebaa08d
3 changed files with 20 additions and 1 deletions

View File

@@ -214,6 +214,7 @@
<Compile Include="Traits\ExternalCapturable.cs" />
<Compile Include="Traits\ExternalCapturableBar.cs" />
<Compile Include="Traits\ExternalCaptures.cs" />
<Compile Include="Traits\IgnoresCloak.cs" />
<Compile Include="Traits\IgnoresDisguise.cs" />
<Compile Include="Traits\DetectCloaked.cs" />
<Compile Include="Traits\EngineerRepair.cs" />

View File

@@ -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<IgnoresCloak> { }
class IgnoresCloak { }
}

View File

@@ -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<IgnoresCloak>()))
return true;
return cloak.IsVisible(self, viewer.Owner);