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 UncloakSound = null;
|
||||||
public readonly string Palette = "cloak";
|
public readonly string Palette = "cloak";
|
||||||
|
|
||||||
|
public readonly string[] CloakTypes = { "Cloak" };
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new Cloak(init.self, this); }
|
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))
|
if (!Cloaked || self.Owner.IsAlliedWith(viewer))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
var centerPosition = self.CenterPosition;
|
return self.World.ActorsWithTrait<DetectCloaked>().Any(a =>
|
||||||
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);
|
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)
|
public Color RadarColorOverride(Actor self)
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
class DetectCloakedInfo : TraitInfo<DetectCloaked>
|
class DetectCloakedInfo : TraitInfo<DetectCloaked>
|
||||||
{
|
{
|
||||||
|
public readonly string[] CloakTypes = { "Cloak" };
|
||||||
public readonly int Range = 5;
|
public readonly int Range = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ SS:
|
|||||||
CloakedTargetTypes: Underwater
|
CloakedTargetTypes: Underwater
|
||||||
RenderUnit:
|
RenderUnit:
|
||||||
Cloak:
|
Cloak:
|
||||||
|
CloakTypes: Underwater
|
||||||
InitialDelay: 0
|
InitialDelay: 0
|
||||||
CloakDelay: 50
|
CloakDelay: 50
|
||||||
CloakSound: subshow1.aud
|
CloakSound: subshow1.aud
|
||||||
@@ -71,6 +72,7 @@ MSUB:
|
|||||||
TargetTypes: Ground, Water
|
TargetTypes: Ground, Water
|
||||||
CloakedTargetTypes: Underwater
|
CloakedTargetTypes: Underwater
|
||||||
Cloak:
|
Cloak:
|
||||||
|
CloakTypes: Underwater
|
||||||
InitialDelay: 0
|
InitialDelay: 0
|
||||||
CloakDelay: 100
|
CloakDelay: 100
|
||||||
CloakSound: subshow1.aud
|
CloakSound: subshow1.aud
|
||||||
@@ -131,6 +133,7 @@ DD:
|
|||||||
IronCurtainable:
|
IronCurtainable:
|
||||||
RepairableNear:
|
RepairableNear:
|
||||||
DetectCloaked:
|
DetectCloaked:
|
||||||
|
CloakTypes: Underwater
|
||||||
Range: 4
|
Range: 4
|
||||||
RenderDetectionCircle:
|
RenderDetectionCircle:
|
||||||
|
|
||||||
@@ -265,6 +268,7 @@ PT:
|
|||||||
IronCurtainable:
|
IronCurtainable:
|
||||||
RepairableNear:
|
RepairableNear:
|
||||||
DetectCloaked:
|
DetectCloaked:
|
||||||
|
CloakTypes: Underwater
|
||||||
Range: 4
|
Range: 4
|
||||||
RenderDetectionCircle:
|
RenderDetectionCircle:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user