allow AppearsOnRadar to use Location rather than OccupiedCells, for things that don't occupy any cells
This commit is contained in:
@@ -15,16 +15,29 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
public class AppearsOnRadarInfo : TraitInfo<AppearsOnRadar> {}
|
public class AppearsOnRadarInfo : TraitInfo<AppearsOnRadar>
|
||||||
|
{
|
||||||
|
public readonly bool UseLocation = false;
|
||||||
|
}
|
||||||
|
|
||||||
public class AppearsOnRadar : IRadarSignature
|
public class AppearsOnRadar : IRadarSignature
|
||||||
{
|
{
|
||||||
|
AppearsOnRadarInfo info;
|
||||||
IOccupySpace Space;
|
IOccupySpace Space;
|
||||||
|
|
||||||
public IEnumerable<int2> RadarSignatureCells(Actor self)
|
public IEnumerable<int2> RadarSignatureCells(Actor self)
|
||||||
{
|
{
|
||||||
if (Space == null)
|
if (info == null)
|
||||||
Space = self.Trait<IOccupySpace>();
|
info = self.Info.Traits.Get<AppearsOnRadarInfo>();
|
||||||
return Space.OccupiedCells();
|
|
||||||
|
if (info.UseLocation)
|
||||||
|
return new int2[] { self.Location };
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Space == null)
|
||||||
|
Space = self.Trait<IOccupySpace>();
|
||||||
|
return Space.OccupiedCells();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Color RadarSignatureColor(Actor self)
|
public Color RadarSignatureColor(Actor self)
|
||||||
|
|||||||
@@ -58,6 +58,7 @@
|
|||||||
|
|
||||||
^Helicopter:
|
^Helicopter:
|
||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
|
UseLocation: yes
|
||||||
Targetable:
|
Targetable:
|
||||||
TargetTypes: Air
|
TargetTypes: Air
|
||||||
Selectable:
|
Selectable:
|
||||||
@@ -135,6 +136,7 @@
|
|||||||
|
|
||||||
^Plane:
|
^Plane:
|
||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
|
UseLocation: yes
|
||||||
Selectable:
|
Selectable:
|
||||||
Voice: GenericVoice
|
Voice: GenericVoice
|
||||||
Targetable:
|
Targetable:
|
||||||
|
|||||||
@@ -104,6 +104,7 @@
|
|||||||
|
|
||||||
^Plane:
|
^Plane:
|
||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
|
UseLocation: yes
|
||||||
Selectable:
|
Selectable:
|
||||||
Voice: GenericVoice
|
Voice: GenericVoice
|
||||||
TargetableAircraft:
|
TargetableAircraft:
|
||||||
|
|||||||
Reference in New Issue
Block a user