Merge PlaceSimpleBeacon and AnimatedBeacon into PlaceBeacon and Beacon
This commit is contained in:
@@ -23,13 +23,9 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
|
|
||||||
readonly Player owner;
|
readonly Player owner;
|
||||||
readonly WPos position;
|
readonly WPos position;
|
||||||
readonly string beaconPalette;
|
|
||||||
readonly bool isPlayerPalette;
|
readonly bool isPlayerPalette;
|
||||||
readonly string posterPalette;
|
readonly string beaconPalette, posterPalette;
|
||||||
readonly Animation arrow;
|
readonly Animation arrow, beacon, circles, clock, poster;
|
||||||
readonly Animation circles;
|
|
||||||
readonly Animation poster;
|
|
||||||
readonly Animation clock;
|
|
||||||
readonly int duration;
|
readonly int duration;
|
||||||
|
|
||||||
int delay;
|
int delay;
|
||||||
@@ -39,7 +35,7 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
|
|
||||||
// Player-placed beacons are removed after a delay
|
// Player-placed beacons are removed after a delay
|
||||||
public Beacon(Player owner, WPos position, int duration, string beaconPalette, bool isPlayerPalette,
|
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.owner = owner;
|
||||||
this.position = position;
|
this.position = position;
|
||||||
@@ -48,6 +44,12 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
this.duration = duration;
|
this.duration = duration;
|
||||||
this.delay = delay;
|
this.delay = delay;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(beaconSequence))
|
||||||
|
{
|
||||||
|
beacon = new Animation(owner.World, beaconCollection);
|
||||||
|
beacon.PlayRepeating(beaconSequence);
|
||||||
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(arrowSprite))
|
if (!string.IsNullOrEmpty(arrowSprite))
|
||||||
{
|
{
|
||||||
arrow = new Animation(owner.World, beaconCollection);
|
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
|
// 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,
|
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, int delay = 0, int duration = -1)
|
string beaconSequence, string arrowSequence, string circleSequence, string clockSequence, Func<float> clockFraction, int delay = 0, int duration = -1)
|
||||||
: this(owner, position, duration, palette, isPlayerPalette, posterCollection, arrowSequence, circleSequence, delay)
|
: this(owner, position, duration, palette, isPlayerPalette, posterCollection, beaconSequence, arrowSequence, circleSequence, delay)
|
||||||
{
|
{
|
||||||
this.posterPalette = posterPalette;
|
this.posterPalette = posterPalette;
|
||||||
|
|
||||||
@@ -97,6 +99,9 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
if (arrow != null)
|
if (arrow != null)
|
||||||
arrow.Tick();
|
arrow.Tick();
|
||||||
|
|
||||||
|
if (beacon != null)
|
||||||
|
beacon.Tick();
|
||||||
|
|
||||||
if (circles != null)
|
if (circles != null)
|
||||||
circles.Tick();
|
circles.Tick();
|
||||||
|
|
||||||
@@ -119,6 +124,10 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
|
|
||||||
var palette = r.Palette(isPlayerPalette ? beaconPalette + owner.InternalName : beaconPalette);
|
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)
|
if (circles != null)
|
||||||
foreach (var a in circles.Render(position, palette))
|
foreach (var a in circles.Render(position, palette))
|
||||||
yield return a;
|
yield return a;
|
||||||
|
|||||||
@@ -30,7 +30,9 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
public Beacon New(Player owner, WPos position, int duration = 30 * 25, bool showRadarPings = true)
|
public Beacon New(Player owner, WPos position, int duration = 30 * 25, bool showRadarPings = true)
|
||||||
{
|
{
|
||||||
var beacon = owner.PlayerActor.Info.TraitInfo<PlaceBeaconInfo>();
|
var beacon = owner.PlayerActor.Info.TraitInfo<PlaceBeaconInfo>();
|
||||||
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));
|
owner.PlayerActor.World.AddFrameEndTask(w => w.Add(playerBeacon));
|
||||||
|
|
||||||
if (showRadarPings && radarPings != null)
|
if (showRadarPings && radarPings != null)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[PaletteReference("IsPlayerPalette")] public readonly string Palette = "player";
|
[PaletteReference("IsPlayerPalette")] public readonly string Palette = "player";
|
||||||
|
|
||||||
public readonly string BeaconImage = "beacon";
|
public readonly string BeaconImage = "beacon";
|
||||||
|
[SequenceReference("BeaconImage")] public readonly string BeaconSequence = null;
|
||||||
[SequenceReference("BeaconImage")] public readonly string ArrowSequence = "arrow";
|
[SequenceReference("BeaconImage")] public readonly string ArrowSequence = "arrow";
|
||||||
[SequenceReference("BeaconImage")] public readonly string CircleSequence = "circles";
|
[SequenceReference("BeaconImage")] public readonly string CircleSequence = "circles";
|
||||||
|
|
||||||
@@ -58,8 +59,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (playerBeacon != null)
|
if (playerBeacon != null)
|
||||||
self.World.Remove(playerBeacon);
|
self.World.Remove(playerBeacon);
|
||||||
|
|
||||||
playerBeacon = new Beacon(self.Owner, order.Target.CenterPosition, info.Duration,
|
playerBeacon = new Beacon(self.Owner, order.Target.CenterPosition, info.Duration, info.Palette, info.IsPlayerPalette,
|
||||||
info.Palette, info.IsPlayerPalette, info.BeaconImage, info.ArrowSequence, info.CircleSequence);
|
info.BeaconImage, info.BeaconSequence, info.ArrowSequence, info.CircleSequence);
|
||||||
|
|
||||||
self.World.Add(playerBeacon);
|
self.World.Add(playerBeacon);
|
||||||
|
|
||||||
|
|||||||
@@ -166,6 +166,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
Info.BeaconImage,
|
Info.BeaconImage,
|
||||||
Info.BeaconPoster,
|
Info.BeaconPoster,
|
||||||
Info.BeaconPosterPalette,
|
Info.BeaconPosterPalette,
|
||||||
|
Info.BeaconSequence,
|
||||||
Info.ArrowSequence,
|
Info.ArrowSequence,
|
||||||
Info.CircleSequence,
|
Info.CircleSequence,
|
||||||
Info.ClockSequence,
|
Info.ClockSequence,
|
||||||
|
|||||||
@@ -140,6 +140,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
Info.BeaconImage,
|
Info.BeaconImage,
|
||||||
Info.BeaconPoster,
|
Info.BeaconPoster,
|
||||||
Info.BeaconPosterPalette,
|
Info.BeaconPosterPalette,
|
||||||
|
Info.BeaconSequence,
|
||||||
Info.ArrowSequence,
|
Info.ArrowSequence,
|
||||||
Info.CircleSequence,
|
Info.CircleSequence,
|
||||||
Info.ClockSequence,
|
Info.ClockSequence,
|
||||||
|
|||||||
@@ -211,6 +211,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
Info.BeaconImage,
|
Info.BeaconImage,
|
||||||
Info.BeaconPoster,
|
Info.BeaconPoster,
|
||||||
Info.BeaconPosterPalette,
|
Info.BeaconPosterPalette,
|
||||||
|
Info.BeaconSequence,
|
||||||
Info.ArrowSequence,
|
Info.ArrowSequence,
|
||||||
Info.CircleSequence,
|
Info.CircleSequence,
|
||||||
Info.ClockSequence,
|
Info.ClockSequence,
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[SequenceReference("BeaconImage")] public readonly string BeaconPoster = null;
|
[SequenceReference("BeaconImage")] public readonly string BeaconPoster = null;
|
||||||
[PaletteReference] public readonly string BeaconPosterPalette = "chrome";
|
[PaletteReference] public readonly string BeaconPosterPalette = "chrome";
|
||||||
[SequenceReference("BeaconImage")] public readonly string ClockSequence = null;
|
[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 ArrowSequence = null;
|
||||||
[SequenceReference("BeaconImage")] public readonly string CircleSequence = null;
|
[SequenceReference("BeaconImage")] public readonly string CircleSequence = null;
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,12 @@ Player:
|
|||||||
AllyNotification: OurAllyIsUnderAttack
|
AllyNotification: OurAllyIsUnderAttack
|
||||||
HarvesterAttackNotifier:
|
HarvesterAttackNotifier:
|
||||||
PlayerStatistics:
|
PlayerStatistics:
|
||||||
PlaceSimpleBeacon:
|
PlaceBeacon:
|
||||||
|
Palette: effect
|
||||||
|
IsPlayerPalette: false
|
||||||
|
BeaconSequence: idle
|
||||||
|
ArrowSequence:
|
||||||
|
CircleSequence:
|
||||||
ProvidesTechPrerequisite@low:
|
ProvidesTechPrerequisite@low:
|
||||||
Name: Low
|
Name: Low
|
||||||
Prerequisites: techlevel.low
|
Prerequisites: techlevel.low
|
||||||
|
|||||||
Reference in New Issue
Block a user