Add beacon/radar ping placements for nukes/ion cannons/chronospheres/iron curtains.

This commit is contained in:
ScottNZ
2014-02-22 00:00:15 +13:00
parent 0a9a959ecf
commit 338fb38bd3
5 changed files with 38 additions and 4 deletions

View File

@@ -30,6 +30,11 @@ namespace OpenRA.Mods.RA
public readonly bool DisplayTimer = false; public readonly bool DisplayTimer = false;
public readonly bool DisplayBeacon = false;
public readonly int BeaconDuration = 10 * 25;
public readonly string BeaconPalettePrefix = "player";
public readonly bool DisplayRadarPing = false;
public readonly string OrderName; public readonly string OrderName;
public abstract object Create(ActorInitializer init); public abstract object Create(ActorInitializer init);

View File

@@ -10,7 +10,9 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Mods.RA.Effects;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA
@@ -23,13 +25,16 @@ namespace OpenRA.Mods.RA
public class SupportPowerManager : ITick, IResolveOrder public class SupportPowerManager : ITick, IResolveOrder
{ {
public readonly Actor self; public readonly Actor self;
public Dictionary<string, SupportPowerInstance> Powers = new Dictionary<string, SupportPowerInstance>(); public readonly Dictionary<string, SupportPowerInstance> Powers = new Dictionary<string, SupportPowerInstance>();
public readonly DeveloperMode DevMode;
public readonly Lazy<RadarPings> RadarPings;
public readonly DeveloperMode devMode;
public SupportPowerManager(ActorInitializer init) public SupportPowerManager(ActorInitializer init)
{ {
self = init.self; self = init.self;
devMode = init.self.Trait<DeveloperMode>(); DevMode = init.self.Trait<DeveloperMode>();
RadarPings = Lazy.New(() => init.world.WorldActor.TraitOrDefault<RadarPings>());
init.world.ActorAdded += ActorAdded; init.world.ActorAdded += ActorAdded;
init.world.ActorRemoved += ActorRemoved; init.world.ActorRemoved += ActorRemoved;
@@ -148,7 +153,7 @@ namespace OpenRA.Mods.RA
if (Active) if (Active)
{ {
var power = Instances.First(); var power = Instances.First();
if (Manager.devMode.FastCharge && RemainingTime > 25) if (Manager.DevMode.FastCharge && RemainingTime > 25)
RemainingTime = 25; RemainingTime = 25;
if (RemainingTime > 0) --RemainingTime; if (RemainingTime > 0) --RemainingTime;
@@ -187,6 +192,20 @@ namespace OpenRA.Mods.RA
RemainingTime = TotalTime; RemainingTime = TotalTime;
notifiedCharging = notifiedReady = false; notifiedCharging = notifiedReady = false;
if (power.Info.DisplayBeacon)
power.self.World.Add(new Beacon(
order.Player,
order.TargetLocation.CenterPosition,
power.Info.BeaconDuration,
power.Info.BeaconPalettePrefix));
if (power.Info.DisplayRadarPing && Manager.RadarPings != null)
Manager.RadarPings.Value.Add(
() => order.Player.IsAlliedWith(power.self.World.RenderPlayer),
order.TargetLocation.CenterPosition,
order.Player.Color.RGB,
power.Info.BeaconDuration);
if (Info.OneShot) if (Info.OneShot)
Disabled = true; Disabled = true;
} }

View File

@@ -445,6 +445,8 @@ EYE:
LaunchSound: ion1.aud LaunchSound: ion1.aud
SelectTargetSound: select1.aud SelectTargetSound: select1.aud
InsufficientPowerSound: nopower1.aud InsufficientPowerSound: nopower1.aud
DisplayBeacon: True
DisplayRadarPing: True
SupportPowerChargeBar: SupportPowerChargeBar:
TMPL: TMPL:
@@ -483,6 +485,8 @@ TMPL:
LaunchSound: nuklnch1.aud LaunchSound: nuklnch1.aud
IncomingSound: nuke1.aud IncomingSound: nuke1.aud
MissileWeapon: atomic MissileWeapon: atomic
DisplayBeacon: True
DisplayRadarPing: True
SupportPowerChargeBar: SupportPowerChargeBar:
GUN: GUN:

View File

@@ -96,6 +96,8 @@ PALACEH:
IncomingSound: IncomingSound:
MissileWeapon: atomic MissileWeapon: atomic
SpawnOffset: -512,1c171,0 SpawnOffset: -512,1c171,0
DisplayBeacon: True
DisplayRadarPing: True
CanPowerDown: CanPowerDown:
RequiresPower: RequiresPower:
SupportPowerChargeBar: SupportPowerChargeBar:

View File

@@ -37,6 +37,8 @@ MSLO:
MissileWeapon: atomic MissileWeapon: atomic
SpawnOffset: 0,427,0 SpawnOffset: 0,427,0
DisplayTimer: True DisplayTimer: True
DisplayBeacon: True
DisplayRadarPing: True
CanPowerDown: CanPowerDown:
RequiresPower: RequiresPower:
SupportPowerChargeBar: SupportPowerChargeBar:
@@ -224,6 +226,7 @@ IRON:
InsufficientPowerSound: nopowr1.aud InsufficientPowerSound: nopowr1.aud
BeginChargeSound: ironchg1.aud BeginChargeSound: ironchg1.aud
EndChargeSound: ironrdy1.aud EndChargeSound: ironrdy1.aud
DisplayRadarPing: True
SupportPowerChargeBar: SupportPowerChargeBar:
PDOX: PDOX:
@@ -264,6 +267,7 @@ PDOX:
EndChargeSound: chrordy1.aud EndChargeSound: chrordy1.aud
Duration: 20 Duration: 20
KillCargo: yes KillCargo: yes
DisplayRadarPing: True
SupportPowerChargeBar: SupportPowerChargeBar:
-AcceptsSupplies: -AcceptsSupplies: