Don't enforce beacons to be player palettes.
This commit is contained in:
@@ -23,7 +23,8 @@ namespace OpenRA.Mods.Common.Effects
|
||||
|
||||
readonly Player owner;
|
||||
readonly WPos position;
|
||||
readonly string palettePrefix;
|
||||
readonly string beaconPalette;
|
||||
readonly bool isPlayerPalette;
|
||||
readonly string posterPalette;
|
||||
readonly Animation arrow;
|
||||
readonly Animation circles;
|
||||
@@ -34,11 +35,12 @@ namespace OpenRA.Mods.Common.Effects
|
||||
int arrowSpeed = 50;
|
||||
|
||||
// Player-placed beacons are removed after a delay
|
||||
public Beacon(Player owner, WPos position, int duration, string palettePrefix, string beaconCollection, string arrowSprite, string circleSprite)
|
||||
public Beacon(Player owner, WPos position, int duration, string beaconPalette, bool isPlayerPalette, string beaconCollection, string arrowSprite, string circleSprite)
|
||||
{
|
||||
this.owner = owner;
|
||||
this.position = position;
|
||||
this.palettePrefix = palettePrefix;
|
||||
this.beaconPalette = beaconPalette;
|
||||
this.isPlayerPalette = isPlayerPalette;
|
||||
|
||||
arrow = new Animation(owner.World, beaconCollection);
|
||||
circles = new Animation(owner.World, beaconCollection);
|
||||
@@ -51,8 +53,9 @@ namespace OpenRA.Mods.Common.Effects
|
||||
}
|
||||
|
||||
// Support power beacons are expected to clean themselves up
|
||||
public Beacon(Player owner, WPos position, string palettePrefix, string posterCollection, string posterType, string posterPalette, string arrowSequence, string circleSequence,
|
||||
string clockSequence, Func<float> clockFraction) : this(owner, position, -1, palettePrefix, posterCollection, arrowSequence, circleSequence)
|
||||
public Beacon(Player owner, WPos position, bool isPlayerPalette, string palette, string posterCollection, string posterType, string posterPalette,
|
||||
string arrowSequence, string circleSequence, string clockSequence, Func<float> clockFraction)
|
||||
: this(owner, position, -1, palette, isPlayerPalette, posterCollection, arrowSequence, circleSequence)
|
||||
{
|
||||
this.posterPalette = posterPalette;
|
||||
|
||||
@@ -91,7 +94,7 @@ namespace OpenRA.Mods.Common.Effects
|
||||
if (!owner.IsAlliedWith(owner.World.RenderPlayer))
|
||||
yield break;
|
||||
|
||||
var palette = r.Palette(palettePrefix + owner.InternalName);
|
||||
var palette = r.Palette(isPlayerPalette ? beaconPalette + owner.InternalName : beaconPalette);
|
||||
foreach (var a in circles.Render(position, palette))
|
||||
yield return a;
|
||||
|
||||
|
||||
@@ -28,9 +28,9 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
[Desc("Creates a new beacon that stays for the specified time at the specified WPos. " +
|
||||
"Does not remove player set beacons, nor gets removed by placing them.")]
|
||||
public Beacon New(Player owner, WPos position, int duration = 30 * 25, bool showRadarPings = true,
|
||||
string palettePrefix = "player", string beaconCollection = "beacon", string arrowSequence = "arrow", string circleSequence = "circle")
|
||||
string palette = "player", bool isPlayerPalette = true, string beaconCollection = "beacon", string arrowSequence = "arrow", string circleSequence = "circle")
|
||||
{
|
||||
var playerBeacon = new Beacon(owner, position, duration, palettePrefix, beaconCollection, arrowSequence, circleSequence);
|
||||
var playerBeacon = new Beacon(owner, position, duration, palette, isPlayerPalette, beaconCollection, arrowSequence, circleSequence);
|
||||
owner.PlayerActor.World.AddFrameEndTask(w => w.Add(playerBeacon));
|
||||
|
||||
if (showRadarPings && radarPings != null)
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly string NotificationType = "Sounds";
|
||||
public readonly string Notification = "Beacon";
|
||||
|
||||
[PaletteReference(true)]
|
||||
public readonly string PalettePrefix = "player";
|
||||
public readonly bool IsPlayerPalette = true;
|
||||
[PaletteReference("IsPlayerPalette")] public readonly string Palette = "player";
|
||||
|
||||
public readonly string BeaconImage = "beacon";
|
||||
[SequenceReference("BeaconImage")] public readonly string ArrowSequence = "arrow";
|
||||
@@ -56,7 +56,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (playerBeacon != null)
|
||||
self.World.Remove(playerBeacon);
|
||||
|
||||
playerBeacon = new Beacon(self.Owner, pos, info.Duration, info.PalettePrefix, info.BeaconImage, info.ArrowSequence, info.CircleSequence);
|
||||
playerBeacon = new Beacon(self.Owner, pos, info.Duration, info.Palette, info.IsPlayerPalette, info.BeaconImage, info.ArrowSequence, info.CircleSequence);
|
||||
|
||||
self.World.Add(playerBeacon);
|
||||
|
||||
if (self.Owner.IsAlliedWith(self.World.RenderPlayer))
|
||||
|
||||
@@ -169,7 +169,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
beacon = new Beacon(
|
||||
self.Owner,
|
||||
target - new WVec(0, 0, altitude),
|
||||
Info.BeaconPalettePrefix,
|
||||
Info.BeaconPaletteIsPlayerPalette,
|
||||
Info.BeaconPalette,
|
||||
Info.BeaconImage,
|
||||
Info.BeaconPoster,
|
||||
Info.BeaconPosterPalette,
|
||||
|
||||
@@ -134,7 +134,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var beacon = new Beacon(
|
||||
order.Player,
|
||||
targetPosition,
|
||||
Info.BeaconPalettePrefix,
|
||||
Info.BeaconPaletteIsPlayerPalette,
|
||||
Info.BeaconPalette,
|
||||
Info.BeaconImage,
|
||||
Info.BeaconPoster,
|
||||
Info.BeaconPosterPalette,
|
||||
|
||||
@@ -45,7 +45,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
[Desc("Beacons are only supported on the Airstrike and Nuke powers")]
|
||||
public readonly bool DisplayBeacon = false;
|
||||
[PaletteReference(true)] public readonly string BeaconPalettePrefix = "player";
|
||||
|
||||
public readonly bool BeaconPaletteIsPlayerPalette = true;
|
||||
[PaletteReference("BeaconPaletteIsPlayerPalette")] public readonly string BeaconPalette = "player";
|
||||
|
||||
public readonly string BeaconImage = "beacon";
|
||||
[SequenceReference("BeaconImage")] public readonly string BeaconPoster = null;
|
||||
[PaletteReference] public readonly string BeaconPosterPalette = "chrome";
|
||||
|
||||
@@ -204,7 +204,8 @@ namespace OpenRA.Mods.RA.Traits
|
||||
beacon = new Beacon(
|
||||
self.Owner,
|
||||
target - new WVec(0, 0, altitude),
|
||||
Info.BeaconPalettePrefix,
|
||||
Info.BeaconPaletteIsPlayerPalette,
|
||||
Info.BeaconPalette,
|
||||
Info.BeaconImage,
|
||||
Info.BeaconPoster,
|
||||
Info.BeaconPosterPalette,
|
||||
|
||||
Reference in New Issue
Block a user