diff --git a/OpenRA.Mods.Common/Effects/Beacon.cs b/OpenRA.Mods.Common/Effects/Beacon.cs index be26598900..2438500768 100644 --- a/OpenRA.Mods.Common/Effects/Beacon.cs +++ b/OpenRA.Mods.Common/Effects/Beacon.cs @@ -23,13 +23,9 @@ namespace OpenRA.Mods.Common.Effects readonly Player owner; readonly WPos position; - readonly string beaconPalette; readonly bool isPlayerPalette; - readonly string posterPalette; - readonly Animation arrow; - readonly Animation circles; - readonly Animation poster; - readonly Animation clock; + readonly string beaconPalette, posterPalette; + readonly Animation arrow, beacon, circles, clock, poster; readonly int duration; int delay; @@ -39,7 +35,7 @@ namespace OpenRA.Mods.Common.Effects // Player-placed beacons are removed after a delay public Beacon(Player owner, WPos position, int duration, string beaconPalette, bool isPlayerPalette, - string beaconCollection, string arrowSprite, string circleSprite, int delay = 0) + string beaconCollection, string beaconSequence, string arrowSprite, string circleSprite, int delay = 0) { this.owner = owner; this.position = position; @@ -48,6 +44,12 @@ namespace OpenRA.Mods.Common.Effects this.duration = duration; this.delay = delay; + if (!string.IsNullOrEmpty(beaconSequence)) + { + beacon = new Animation(owner.World, beaconCollection); + beacon.PlayRepeating(beaconSequence); + } + if (!string.IsNullOrEmpty(arrowSprite)) { arrow = new Animation(owner.World, beaconCollection); @@ -63,8 +65,8 @@ namespace OpenRA.Mods.Common.Effects // By default, support power beacons are expected to clean themselves up public Beacon(Player owner, WPos position, bool isPlayerPalette, string palette, string posterCollection, string posterType, string posterPalette, - string arrowSequence, string circleSequence, string clockSequence, Func clockFraction, int delay = 0, int duration = -1) - : this(owner, position, duration, palette, isPlayerPalette, posterCollection, arrowSequence, circleSequence, delay) + string beaconSequence, string arrowSequence, string circleSequence, string clockSequence, Func clockFraction, int delay = 0, int duration = -1) + : this(owner, position, duration, palette, isPlayerPalette, posterCollection, beaconSequence, arrowSequence, circleSequence, delay) { this.posterPalette = posterPalette; @@ -97,6 +99,9 @@ namespace OpenRA.Mods.Common.Effects if (arrow != null) arrow.Tick(); + if (beacon != null) + beacon.Tick(); + if (circles != null) circles.Tick(); @@ -119,6 +124,10 @@ namespace OpenRA.Mods.Common.Effects var palette = r.Palette(isPlayerPalette ? beaconPalette + owner.InternalName : beaconPalette); + if (beacon != null) + foreach (var a in beacon.Render(position, palette)) + yield return a; + if (circles != null) 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 ceff0b22a9..7afcdfba1d 100644 --- a/OpenRA.Mods.Common/Scripting/Global/BeaconGlobal.cs +++ b/OpenRA.Mods.Common/Scripting/Global/BeaconGlobal.cs @@ -30,7 +30,9 @@ namespace OpenRA.Mods.Common.Scripting public Beacon New(Player owner, WPos position, int duration = 30 * 25, bool showRadarPings = true) { var beacon = owner.PlayerActor.Info.TraitInfo(); - var playerBeacon = new Beacon(owner, position, duration, beacon.Palette, beacon.IsPlayerPalette, beacon.BeaconImage, beacon.ArrowSequence, beacon.CircleSequence); + var playerBeacon = new Beacon(owner, position, duration, beacon.Palette, beacon.IsPlayerPalette, + beacon.BeaconImage, beacon.BeaconSequence, beacon.ArrowSequence, beacon.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 1da9b369b2..402ccd6e1c 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlaceBeacon.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlaceBeacon.cs @@ -28,6 +28,7 @@ namespace OpenRA.Mods.Common.Traits [PaletteReference("IsPlayerPalette")] public readonly string Palette = "player"; public readonly string BeaconImage = "beacon"; + [SequenceReference("BeaconImage")] public readonly string BeaconSequence = null; [SequenceReference("BeaconImage")] public readonly string ArrowSequence = "arrow"; [SequenceReference("BeaconImage")] public readonly string CircleSequence = "circles"; @@ -58,8 +59,8 @@ namespace OpenRA.Mods.Common.Traits if (playerBeacon != null) self.World.Remove(playerBeacon); - playerBeacon = new Beacon(self.Owner, order.Target.CenterPosition, info.Duration, - info.Palette, info.IsPlayerPalette, info.BeaconImage, info.ArrowSequence, info.CircleSequence); + playerBeacon = new Beacon(self.Owner, order.Target.CenterPosition, info.Duration, info.Palette, info.IsPlayerPalette, + info.BeaconImage, info.BeaconSequence, info.ArrowSequence, info.CircleSequence); self.World.Add(playerBeacon); diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs index b14e09947f..64e3703c6f 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs @@ -166,6 +166,7 @@ namespace OpenRA.Mods.Common.Traits Info.BeaconImage, Info.BeaconPoster, Info.BeaconPosterPalette, + Info.BeaconSequence, Info.ArrowSequence, Info.CircleSequence, Info.ClockSequence, diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs index ab4604982e..2a7e1211ef 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs @@ -140,6 +140,7 @@ namespace OpenRA.Mods.Common.Traits Info.BeaconImage, Info.BeaconPoster, Info.BeaconPosterPalette, + Info.BeaconSequence, Info.ArrowSequence, Info.CircleSequence, Info.ClockSequence, diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/ParatroopersPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/ParatroopersPower.cs index ff95650d7c..dbdf3d012a 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/ParatroopersPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/ParatroopersPower.cs @@ -211,6 +211,7 @@ namespace OpenRA.Mods.Common.Traits Info.BeaconImage, Info.BeaconPoster, Info.BeaconPosterPalette, + Info.BeaconSequence, Info.ArrowSequence, Info.CircleSequence, Info.ClockSequence, diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs index 9d100f7a22..212fe64237 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs @@ -77,6 +77,7 @@ namespace OpenRA.Mods.Common.Traits [SequenceReference("BeaconImage")] public readonly string BeaconPoster = null; [PaletteReference] public readonly string BeaconPosterPalette = "chrome"; [SequenceReference("BeaconImage")] public readonly string ClockSequence = null; + [SequenceReference("BeaconImage")] public readonly string BeaconSequence = null; [SequenceReference("BeaconImage")] public readonly string ArrowSequence = null; [SequenceReference("BeaconImage")] public readonly string CircleSequence = null; diff --git a/mods/ts/rules/player.yaml b/mods/ts/rules/player.yaml index 7851972559..6cf755fa07 100644 --- a/mods/ts/rules/player.yaml +++ b/mods/ts/rules/player.yaml @@ -95,7 +95,12 @@ Player: AllyNotification: OurAllyIsUnderAttack HarvesterAttackNotifier: PlayerStatistics: - PlaceSimpleBeacon: + PlaceBeacon: + Palette: effect + IsPlayerPalette: false + BeaconSequence: idle + ArrowSequence: + CircleSequence: ProvidesTechPrerequisite@low: Name: Low Prerequisites: techlevel.low