From 76124b7c7926581a1feb7269b96239adc1362991 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 14 Feb 2016 11:31:55 +0100 Subject: [PATCH 1/6] Unhardcode beacon sprites for documentation and lint testing. --- OpenRA.Mods.Common/Effects/Beacon.cs | 8 ++++---- OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs | 2 ++ OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs | 2 ++ OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs | 6 ++++-- OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs | 2 ++ 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/OpenRA.Mods.Common/Effects/Beacon.cs b/OpenRA.Mods.Common/Effects/Beacon.cs index 76b4e9d11b..623d9068f0 100644 --- a/OpenRA.Mods.Common/Effects/Beacon.cs +++ b/OpenRA.Mods.Common/Effects/Beacon.cs @@ -51,20 +51,20 @@ namespace OpenRA.Mods.Common.Effects } // Support power beacons are expected to clean themselves up - public Beacon(Player owner, WPos position, string palettePrefix, string posterType, string posterPalette, Func clockFraction) + public Beacon(Player owner, WPos position, string palettePrefix, string posterCollection, string posterType, string posterPalette, string clockSequence, Func clockFraction) : this(owner, position, -1, palettePrefix) { this.posterPalette = posterPalette; if (posterType != null) { - poster = new Animation(owner.World, "beacon"); + poster = new Animation(owner.World, posterCollection); poster.Play(posterType); if (clockFraction != null) { - clock = new Animation(owner.World, "beacon"); - clock.PlayFetchIndex("clock", () => Exts.Clamp((int)(clockFraction() * (clock.CurrentSequence.Length - 1)), 0, clock.CurrentSequence.Length - 1)); + clock = new Animation(owner.World, posterCollection); + clock.PlayFetchIndex(clockSequence, () => Exts.Clamp((int)(clockFraction() * (clock.CurrentSequence.Length - 1)), 0, clock.CurrentSequence.Length - 1)); } } } diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs index 117450b12a..c4a2a848e0 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs @@ -170,8 +170,10 @@ namespace OpenRA.Mods.Common.Traits self.Owner, target - new WVec(0, 0, altitude), Info.BeaconPalettePrefix, + Info.BeaconImage, Info.BeaconPoster, Info.BeaconPosterPalette, + Info.ClockSequence, () => 1 - ((distanceTestActor.CenterPosition - target).HorizontalLength - info.BeaconDistanceOffset.Length) * 1f / distance); w.Add(beacon); diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs index d39584be2e..8c929a60e7 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs @@ -135,8 +135,10 @@ namespace OpenRA.Mods.Common.Traits order.Player, targetPosition, Info.BeaconPalettePrefix, + Info.BeaconImage, Info.BeaconPoster, Info.BeaconPosterPalette, + Info.ClockSequence, () => missile.FractionComplete); Action removeBeacon = () => self.World.AddFrameEndTask(w => diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs index 9d4a18b15e..2d7f8a9126 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs @@ -45,9 +45,11 @@ namespace OpenRA.Mods.Common.Traits [Desc("Beacons are only supported on the Airstrike and Nuke powers")] public readonly bool DisplayBeacon = false; - public readonly string BeaconPalettePrefix = "player"; - public readonly string BeaconPoster = null; + [PaletteReference(true)] public readonly string BeaconPalettePrefix = "player"; + public readonly string BeaconImage = "beacon"; + [SequenceReference("BeaconImage")] public readonly string BeaconPoster = null; [PaletteReference] public readonly string BeaconPosterPalette = "chrome"; + [SequenceReference("BeaconImage")] public readonly string ClockSequence = "clock"; public readonly bool DisplayRadarPing = false; diff --git a/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs b/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs index 5d7de97992..01f7b53cb2 100644 --- a/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs +++ b/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs @@ -205,8 +205,10 @@ namespace OpenRA.Mods.RA.Traits self.Owner, target - new WVec(0, 0, altitude), Info.BeaconPalettePrefix, + Info.BeaconImage, Info.BeaconPoster, Info.BeaconPosterPalette, + Info.ClockSequence, () => 1 - ((distanceTestActor.CenterPosition - target).HorizontalLength - info.BeaconDistanceOffset.Length) * 1f / distance); w.Add(beacon); From 9f4cdb98436a823d3d0707cb793f9d3e1236236f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 24 Apr 2016 23:42:57 +0200 Subject: [PATCH 2/6] Unhardcode player beacons for documentation and lint testing. --- OpenRA.Mods.Common/Effects/Beacon.cs | 14 +++++++------- .../Scripting/Global/BeaconGlobal.cs | 5 +++-- OpenRA.Mods.Common/Traits/Player/PlaceBeacon.cs | 8 +++++++- .../Traits/SupportPowers/AirstrikePower.cs | 2 ++ .../Traits/SupportPowers/NukePower.cs | 2 ++ .../Traits/SupportPowers/SupportPower.cs | 3 +++ .../Traits/SupportPowers/ParatroopersPower.cs | 2 ++ 7 files changed, 26 insertions(+), 10 deletions(-) diff --git a/OpenRA.Mods.Common/Effects/Beacon.cs b/OpenRA.Mods.Common/Effects/Beacon.cs index 623d9068f0..03049e3a52 100644 --- a/OpenRA.Mods.Common/Effects/Beacon.cs +++ b/OpenRA.Mods.Common/Effects/Beacon.cs @@ -34,25 +34,25 @@ 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) + public Beacon(Player owner, WPos position, int duration, string palettePrefix, string beaconCollection, string arrowSprite, string circleSprite) { this.owner = owner; this.position = position; this.palettePrefix = palettePrefix; - arrow = new Animation(owner.World, "beacon"); - circles = new Animation(owner.World, "beacon"); + arrow = new Animation(owner.World, beaconCollection); + circles = new Animation(owner.World, beaconCollection); - arrow.Play("arrow"); - circles.Play("circles"); + arrow.Play(arrowSprite); + circles.Play(circleSprite); if (duration > 0) owner.World.Add(new DelayedAction(duration, () => owner.World.Remove(this))); } // Support power beacons are expected to clean themselves up - public Beacon(Player owner, WPos position, string palettePrefix, string posterCollection, string posterType, string posterPalette, string clockSequence, Func clockFraction) - : this(owner, position, -1, palettePrefix) + 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) { this.posterPalette = posterPalette; diff --git a/OpenRA.Mods.Common/Scripting/Global/BeaconGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/BeaconGlobal.cs index 14cb7fe87b..30b998c14e 100644 --- a/OpenRA.Mods.Common/Scripting/Global/BeaconGlobal.cs +++ b/OpenRA.Mods.Common/Scripting/Global/BeaconGlobal.cs @@ -27,9 +27,10 @@ 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") + 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") { - var playerBeacon = new Beacon(owner, position, duration, palettePrefix); + var playerBeacon = new Beacon(owner, position, duration, palettePrefix, 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 cafec3fad9..8448c85e9a 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlaceBeacon.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlaceBeacon.cs @@ -19,8 +19,14 @@ namespace OpenRA.Mods.Common.Traits public readonly int Duration = 30 * 25; public readonly string NotificationType = "Sounds"; public readonly string Notification = "Beacon"; + + [PaletteReference(true)] public readonly string PalettePrefix = "player"; + public readonly string BeaconImage = "beacon"; + [SequenceReference("BeaconImage")] public readonly string ArrowSequence = "arrow"; + [SequenceReference("BeaconImage")] public readonly string CircleSequence = "circles"; + public object Create(ActorInitializer init) { return new PlaceBeacon(init.Self, this); } } @@ -50,7 +56,7 @@ namespace OpenRA.Mods.Common.Traits if (playerBeacon != null) self.World.Remove(playerBeacon); - playerBeacon = new Beacon(self.Owner, pos, info.Duration, info.PalettePrefix); + playerBeacon = new Beacon(self.Owner, pos, info.Duration, info.PalettePrefix, 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 c4a2a848e0..8af698d990 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs @@ -173,6 +173,8 @@ namespace OpenRA.Mods.Common.Traits Info.BeaconImage, Info.BeaconPoster, Info.BeaconPosterPalette, + Info.ArrowSequence, + Info.CircleSequence, Info.ClockSequence, () => 1 - ((distanceTestActor.CenterPosition - target).HorizontalLength - info.BeaconDistanceOffset.Length) * 1f / distance); diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs index 8c929a60e7..0c004ead3d 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs @@ -138,6 +138,8 @@ namespace OpenRA.Mods.Common.Traits Info.BeaconImage, Info.BeaconPoster, Info.BeaconPosterPalette, + Info.ArrowSequence, + Info.CircleSequence, Info.ClockSequence, () => missile.FractionComplete); diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs index 2d7f8a9126..f5289d485f 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs @@ -51,6 +51,9 @@ namespace OpenRA.Mods.Common.Traits [PaletteReference] public readonly string BeaconPosterPalette = "chrome"; [SequenceReference("BeaconImage")] public readonly string ClockSequence = "clock"; + [SequenceReference("BeaconImage")] public readonly string ArrowSequence = "arrow"; + [SequenceReference("BeaconImage")] public readonly string CircleSequence = "circles"; + public readonly bool DisplayRadarPing = false; [Desc("Measured in ticks.")] diff --git a/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs b/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs index 01f7b53cb2..48a6221f29 100644 --- a/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs +++ b/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs @@ -208,6 +208,8 @@ namespace OpenRA.Mods.RA.Traits Info.BeaconImage, Info.BeaconPoster, Info.BeaconPosterPalette, + Info.ArrowSequence, + Info.CircleSequence, Info.ClockSequence, () => 1 - ((distanceTestActor.CenterPosition - target).HorizontalLength - info.BeaconDistanceOffset.Length) * 1f / distance); From 59fbfbc851a24eb99622ba21e37c0482be057bbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 24 Apr 2016 23:44:15 +0200 Subject: [PATCH 3/6] Don't enforce beacons to be player palettes. --- OpenRA.Mods.Common/Effects/Beacon.cs | 15 +++++++++------ .../Scripting/Global/BeaconGlobal.cs | 4 ++-- OpenRA.Mods.Common/Traits/Player/PlaceBeacon.cs | 7 ++++--- .../Traits/SupportPowers/AirstrikePower.cs | 3 ++- .../Traits/SupportPowers/NukePower.cs | 3 ++- .../Traits/SupportPowers/SupportPower.cs | 5 ++++- .../Traits/SupportPowers/ParatroopersPower.cs | 3 ++- 7 files changed, 25 insertions(+), 15 deletions(-) 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, From a8dd67a2318c03f1f1ba0dab4b8f0a801c82df73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 14 Feb 2016 12:09:38 +0100 Subject: [PATCH 4/6] ParatroopersPower also supports beacons. --- OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs index 4e94b17afb..b5ccbc16b7 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs @@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Traits [Desc("Palette used for the icon.")] [PaletteReference] public readonly string IconPalette = "chrome"; - [Desc("Beacons are only supported on the Airstrike and Nuke powers")] + [Desc("Beacons are only supported on the Airstrike, Paratroopers, and Nuke powers")] public readonly bool DisplayBeacon = false; public readonly bool BeaconPaletteIsPlayerPalette = true; From 4e9a48d253cf3854a7fd07aa3f524159290e9f48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 13 Mar 2016 11:04:09 +0100 Subject: [PATCH 5/6] Summarize the rendering parts to generate a beacon. --- OpenRA.Mods.Common/Traits/Player/PlaceBeacon.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenRA.Mods.Common/Traits/Player/PlaceBeacon.cs b/OpenRA.Mods.Common/Traits/Player/PlaceBeacon.cs index 40f465a4a8..cba8a9bc95 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlaceBeacon.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlaceBeacon.cs @@ -14,6 +14,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { + [Desc("A beacon that is constructed from a circle sprite that is animated once and a moving arrow sprite.")] public class PlaceBeaconInfo : ITraitInfo { public readonly int Duration = 30 * 25; From 6a9b8e81f466a7abb620a0159316aaf2eadbab7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 24 Apr 2016 23:37:56 +0200 Subject: [PATCH 6/6] Don't expose palettes and sprites to Lua. --- OpenRA.Mods.Common/Scripting/Global/BeaconGlobal.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Scripting/Global/BeaconGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/BeaconGlobal.cs index a276f8ffb0..95f44a4a1c 100644 --- a/OpenRA.Mods.Common/Scripting/Global/BeaconGlobal.cs +++ b/OpenRA.Mods.Common/Scripting/Global/BeaconGlobal.cs @@ -27,10 +27,10 @@ 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 palette = "player", bool isPlayerPalette = true, string beaconCollection = "beacon", string arrowSequence = "arrow", string circleSequence = "circle") + public Beacon New(Player owner, WPos position, int duration = 30 * 25, bool showRadarPings = true) { - var playerBeacon = new Beacon(owner, position, duration, palette, isPlayerPalette, beaconCollection, arrowSequence, circleSequence); + var beacon = owner.PlayerActor.Info.TraitInfo(); + var playerBeacon = new Beacon(owner, position, duration, beacon.Palette, beacon.IsPlayerPalette, beacon.BeaconImage, beacon.ArrowSequence, beacon.CircleSequence); owner.PlayerActor.World.AddFrameEndTask(w => w.Add(playerBeacon)); if (showRadarPings && radarPings != null)