diff --git a/OpenRA.Mods.Common/Effects/Beacon.cs b/OpenRA.Mods.Common/Effects/Beacon.cs index 03049e3a52..9d1bfdbc05 100644 --- a/OpenRA.Mods.Common/Effects/Beacon.cs +++ b/OpenRA.Mods.Common/Effects/Beacon.cs @@ -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 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 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; diff --git a/OpenRA.Mods.Common/Scripting/Global/BeaconGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/BeaconGlobal.cs index 30b998c14e..a276f8ffb0 100644 --- a/OpenRA.Mods.Common/Scripting/Global/BeaconGlobal.cs +++ b/OpenRA.Mods.Common/Scripting/Global/BeaconGlobal.cs @@ -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) diff --git a/OpenRA.Mods.Common/Traits/Player/PlaceBeacon.cs b/OpenRA.Mods.Common/Traits/Player/PlaceBeacon.cs index 8448c85e9a..40f465a4a8 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlaceBeacon.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlaceBeacon.cs @@ -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)) diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs index 8af698d990..318576029b 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs @@ -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, diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs index 0c004ead3d..b35e775a33 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs @@ -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, diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs index f5289d485f..4e94b17afb 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs @@ -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"; diff --git a/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs b/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs index 48a6221f29..6a1f856e8e 100644 --- a/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs +++ b/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs @@ -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,