Add CloakTypes to prevent ships from detecting cloaked non-submarine units etc
This commit is contained in:
@@ -29,6 +29,8 @@ namespace OpenRA.Mods.RA
|
||||
public readonly string UncloakSound = null;
|
||||
public readonly string Palette = "cloak";
|
||||
|
||||
public readonly string[] CloakTypes = { "Cloak" };
|
||||
|
||||
public object Create(ActorInitializer init) { return new Cloak(init.self, this); }
|
||||
}
|
||||
|
||||
@@ -109,9 +111,14 @@ namespace OpenRA.Mods.RA
|
||||
if (!Cloaked || self.Owner.IsAlliedWith(viewer))
|
||||
return true;
|
||||
|
||||
var centerPosition = self.CenterPosition;
|
||||
return self.World.ActorsWithTrait<DetectCloaked>().Any(a => a.Actor.Owner.IsAlliedWith(viewer) &&
|
||||
(centerPosition - a.Actor.CenterPosition).Length < WRange.FromCells(a.Actor.Info.Traits.Get<DetectCloakedInfo>().Range).Range);
|
||||
return self.World.ActorsWithTrait<DetectCloaked>().Any(a =>
|
||||
{
|
||||
var dc = a.Actor.Info.Traits.Get<DetectCloakedInfo>();
|
||||
|
||||
return a.Actor.Owner.IsAlliedWith(viewer)
|
||||
&& Info.CloakTypes.Intersect(dc.CloakTypes).Any()
|
||||
&& (self.CenterPosition - a.Actor.CenterPosition).Length <= WRange.FromCells(dc.Range).Range;
|
||||
});
|
||||
}
|
||||
|
||||
public Color RadarColorOverride(Actor self)
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
class DetectCloakedInfo : TraitInfo<DetectCloaked>
|
||||
{
|
||||
public readonly string[] CloakTypes = { "Cloak" };
|
||||
public readonly int Range = 5;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ SS:
|
||||
CloakedTargetTypes: Underwater
|
||||
RenderUnit:
|
||||
Cloak:
|
||||
CloakTypes: Underwater
|
||||
InitialDelay: 0
|
||||
CloakDelay: 50
|
||||
CloakSound: subshow1.aud
|
||||
@@ -71,6 +72,7 @@ MSUB:
|
||||
TargetTypes: Ground, Water
|
||||
CloakedTargetTypes: Underwater
|
||||
Cloak:
|
||||
CloakTypes: Underwater
|
||||
InitialDelay: 0
|
||||
CloakDelay: 100
|
||||
CloakSound: subshow1.aud
|
||||
@@ -131,6 +133,7 @@ DD:
|
||||
IronCurtainable:
|
||||
RepairableNear:
|
||||
DetectCloaked:
|
||||
CloakTypes: Underwater
|
||||
Range: 4
|
||||
RenderDetectionCircle:
|
||||
|
||||
@@ -265,6 +268,7 @@ PT:
|
||||
IronCurtainable:
|
||||
RepairableNear:
|
||||
DetectCloaked:
|
||||
CloakTypes: Underwater
|
||||
Range: 4
|
||||
RenderDetectionCircle:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user