Add IgnoresCloak trait
This commit is contained in:
@@ -214,6 +214,7 @@
|
|||||||
<Compile Include="Traits\ExternalCapturable.cs" />
|
<Compile Include="Traits\ExternalCapturable.cs" />
|
||||||
<Compile Include="Traits\ExternalCapturableBar.cs" />
|
<Compile Include="Traits\ExternalCapturableBar.cs" />
|
||||||
<Compile Include="Traits\ExternalCaptures.cs" />
|
<Compile Include="Traits\ExternalCaptures.cs" />
|
||||||
|
<Compile Include="Traits\IgnoresCloak.cs" />
|
||||||
<Compile Include="Traits\IgnoresDisguise.cs" />
|
<Compile Include="Traits\IgnoresDisguise.cs" />
|
||||||
<Compile Include="Traits\DetectCloaked.cs" />
|
<Compile Include="Traits\DetectCloaked.cs" />
|
||||||
<Compile Include="Traits\EngineerRepair.cs" />
|
<Compile Include="Traits\EngineerRepair.cs" />
|
||||||
|
|||||||
18
OpenRA.Mods.Common/Traits/IgnoresCloak.cs
Normal file
18
OpenRA.Mods.Common/Traits/IgnoresCloak.cs
Normal 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 { }
|
||||||
|
}
|
||||||
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public virtual bool TargetableBy(Actor self, Actor viewer)
|
public virtual bool TargetableBy(Actor self, Actor viewer)
|
||||||
{
|
{
|
||||||
if (cloak == null)
|
if (cloak == null || (!viewer.IsDead && viewer.HasTrait<IgnoresCloak>()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return cloak.IsVisible(self, viewer.Owner);
|
return cloak.IsVisible(self, viewer.Owner);
|
||||||
|
|||||||
Reference in New Issue
Block a user