Convert support powers from actor disabled to pausable-conditional.
This commit is contained in:
@@ -88,7 +88,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
var pos = world.Map.CenterOfCell(cell);
|
||||
var range = attack.GetMaximumRange().LengthSquared;
|
||||
|
||||
return instance.Instances.Where(i => !i.Self.IsDisabled()).MinByOrDefault(a => (a.Self.CenterPosition - pos).HorizontalLengthSquared).Self;
|
||||
return instance.Instances.Where(i => !i.IsTraitPaused).MinByOrDefault(a => (a.Self.CenterPosition - pos).HorizontalLengthSquared).Self;
|
||||
}
|
||||
|
||||
bool IsValidTarget(World world, CPos cell)
|
||||
@@ -96,7 +96,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
var pos = world.Map.CenterOfCell(cell);
|
||||
var range = attack.GetMaximumRange().LengthSquared;
|
||||
|
||||
return world.Map.Contains(cell) && instance.Instances.Any(a => !a.Self.IsDisabled() && (a.Self.CenterPosition - pos).HorizontalLengthSquared < range);
|
||||
return world.Map.Contains(cell) && instance.Instances.Any(a => !a.IsTraitPaused && (a.Self.CenterPosition - pos).HorizontalLengthSquared < range);
|
||||
}
|
||||
|
||||
IEnumerable<Order> IOrderGenerator.Order(World world, CPos cell, int2 worldPixel, MouseInput mi)
|
||||
@@ -122,7 +122,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
|
||||
IEnumerable<IRenderable> IOrderGenerator.RenderAboveShroud(WorldRenderer wr, World world)
|
||||
{
|
||||
foreach (var a in instance.Instances.Where(i => !i.Self.IsDisabled()))
|
||||
foreach (var a in instance.Instances.Where(i => !i.IsTraitPaused))
|
||||
{
|
||||
yield return new RangeCircleRenderable(
|
||||
a.Self.CenterPosition,
|
||||
|
||||
@@ -101,18 +101,18 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
}
|
||||
|
||||
bool NoActiveRadar { get { return !self.World.ActorsHavingTrait<ProvidesRadar>(r => !r.IsTraitDisabled).Any(a => a.Owner == self.Owner); } }
|
||||
bool wasDisabled;
|
||||
bool wasPaused;
|
||||
|
||||
void ITick.Tick(Actor self)
|
||||
{
|
||||
if (!wasDisabled && (self.IsDisabled() || (info.RequiresActiveRadar && NoActiveRadar)))
|
||||
if (!wasPaused && (IsTraitPaused || (info.RequiresActiveRadar && NoActiveRadar)))
|
||||
{
|
||||
wasDisabled = true;
|
||||
wasPaused = true;
|
||||
RemoveGps(self);
|
||||
}
|
||||
else if (wasDisabled && !self.IsDisabled() && !(info.RequiresActiveRadar && NoActiveRadar))
|
||||
else if (wasPaused && !IsTraitPaused && !(info.RequiresActiveRadar && NoActiveRadar))
|
||||
{
|
||||
wasDisabled = false;
|
||||
wasPaused = false;
|
||||
owner.GpsAdd(self);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
public abstract class SupportPowerInfo : ConditionalTraitInfo
|
||||
public abstract class SupportPowerInfo : PausableConditionalTraitInfo
|
||||
{
|
||||
[Desc("Measured in seconds.")]
|
||||
public readonly int ChargeTime = 0;
|
||||
@@ -76,7 +76,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public SupportPowerInfo() { OrderName = GetType().Name + "Order"; }
|
||||
}
|
||||
|
||||
public class SupportPower : ConditionalTrait<SupportPowerInfo>
|
||||
public class SupportPower : PausableConditionalTrait<SupportPowerInfo>
|
||||
{
|
||||
public readonly Actor Self;
|
||||
readonly SupportPowerInfo info;
|
||||
|
||||
@@ -179,11 +179,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
prereqsAvailable = available;
|
||||
}
|
||||
|
||||
static bool InstanceDisabled(SupportPower sp)
|
||||
{
|
||||
return sp.Self.IsDisabled();
|
||||
}
|
||||
|
||||
bool notifiedCharging;
|
||||
bool notifiedReady;
|
||||
public void Tick()
|
||||
@@ -192,7 +187,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!instancesEnabled)
|
||||
RemainingTime = TotalTime;
|
||||
|
||||
Active = !Disabled && Instances.Any(i => !i.Self.IsDisabled());
|
||||
Active = !Disabled && Instances.Any(i => !i.IsTraitPaused);
|
||||
if (!Active)
|
||||
return;
|
||||
|
||||
@@ -224,7 +219,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!Ready)
|
||||
return;
|
||||
|
||||
var power = Instances.FirstOrDefault();
|
||||
var power = Instances.FirstOrDefault(i => !i.IsTraitPaused);
|
||||
if (power == null)
|
||||
return;
|
||||
|
||||
@@ -236,7 +231,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!Ready)
|
||||
return;
|
||||
|
||||
var power = Instances.Where(i => !InstanceDisabled(i))
|
||||
var power = Instances.Where(i => !i.IsTraitPaused)
|
||||
.MinByOrDefault(a =>
|
||||
{
|
||||
if (a.Self.OccupiesSpace == null)
|
||||
|
||||
@@ -477,6 +477,7 @@ HQ:
|
||||
DetectCloaked:
|
||||
Range: 5c0
|
||||
AirstrikePower:
|
||||
PauseOnCondition: disabled
|
||||
Prerequisites: ~techlevel.superweapons
|
||||
Icon: airstrike
|
||||
ChargeTime: 240
|
||||
@@ -573,6 +574,7 @@ EYE:
|
||||
DetectCloaked:
|
||||
Range: 5c0
|
||||
IonCannonPower:
|
||||
PauseOnCondition: disabled
|
||||
Prerequisites: ~techlevel.superweapons
|
||||
Icon: ioncannon
|
||||
Cursor: ioncannon
|
||||
@@ -625,6 +627,7 @@ TMPL:
|
||||
DetectCloaked:
|
||||
Range: 5c0
|
||||
NukePower:
|
||||
PauseOnCondition: disabled
|
||||
Prerequisites: ~techlevel.superweapons
|
||||
Icon: abomb
|
||||
Cursor: nuke
|
||||
|
||||
@@ -950,6 +950,7 @@ palace:
|
||||
NukePower:
|
||||
Cursor: nuke
|
||||
Icon: deathhand
|
||||
PauseOnCondition: disabled
|
||||
Prerequisites: ~techlevel.superweapons, ~palace.nuke
|
||||
ChargeTime: 300
|
||||
Description: Death Hand
|
||||
@@ -969,6 +970,7 @@ palace:
|
||||
Description: Recruit Fremen
|
||||
LongDesc: Elite infantry unit armed with assault rifles and rockets\n Strong vs Infantry, Vehicles\n Weak vs Artillery\n Special Ability: Invisibility
|
||||
Icon: fremen
|
||||
PauseOnCondition: disabled
|
||||
Prerequisites: ~techlevel.superweapons, ~palace.fremen
|
||||
Actors: fremen, fremen
|
||||
Type: Palace
|
||||
@@ -980,6 +982,7 @@ palace:
|
||||
Description: Recruit Saboteur
|
||||
LongDesc: Sneaky infantry, armed with explosives\n Strong vs Buildings\n Weak vs Everything\n Special Ability: destroy buildings
|
||||
Icon: saboteur
|
||||
PauseOnCondition: disabled
|
||||
Prerequisites: ~techlevel.superweapons, ~palace.saboteur
|
||||
Actors: saboteur
|
||||
Type: Palace
|
||||
|
||||
@@ -21,6 +21,7 @@ MSLO:
|
||||
RevealsShroud:
|
||||
Range: 5c0
|
||||
NukePower:
|
||||
PauseOnCondition: disabled
|
||||
Cursor: nuke
|
||||
Icon: abomb
|
||||
ChargeTime: 540
|
||||
@@ -318,6 +319,7 @@ IRON:
|
||||
Bib:
|
||||
HasMinibib: Yes
|
||||
GrantExternalConditionPower@IRONCURTAIN:
|
||||
PauseOnCondition: disabled
|
||||
Icon: invuln
|
||||
ChargeTime: 120
|
||||
Description: Invulnerability
|
||||
@@ -375,6 +377,7 @@ PDOX:
|
||||
Prerequisite: pdox.germany
|
||||
ChronoshiftPower@chronoshift:
|
||||
OrderName: Chronoshift
|
||||
PauseOnCondition: disabled
|
||||
Prerequisites: !pdox.germany
|
||||
Icon: chrono
|
||||
ChargeTime: 120
|
||||
@@ -389,6 +392,7 @@ PDOX:
|
||||
DisplayRadarPing: True
|
||||
ChronoshiftPower@advancedchronoshift:
|
||||
OrderName: AdvancedChronoshift
|
||||
PauseOnCondition: disabled
|
||||
Prerequisites: pdox.germany
|
||||
Icon: chrono
|
||||
ChargeTime: 120
|
||||
@@ -811,6 +815,7 @@ ATEK:
|
||||
Range: 6c0
|
||||
Bib:
|
||||
GpsPower:
|
||||
PauseOnCondition: disabled
|
||||
Icon: gps
|
||||
OneShot: yes
|
||||
ChargeTime: 480
|
||||
|
||||
@@ -417,6 +417,7 @@ GAPLUG:
|
||||
MaxHeightDelta: 3
|
||||
IonCannonPower:
|
||||
Cursor: ioncannon
|
||||
PauseOnCondition: disabled || empdisable
|
||||
RequiresCondition: plug.ioncannona || plug.ioncannonb
|
||||
Icon: ioncannon
|
||||
Effect: explosion
|
||||
@@ -431,6 +432,7 @@ GAPLUG:
|
||||
DisplayRadarPing: True
|
||||
CameraActor: camera
|
||||
ProduceActorPower:
|
||||
PauseOnCondition: disabled || empdisable
|
||||
RequiresCondition: plug.hunterseekera || plug.hunterseekerb
|
||||
Description: Hunter Seeker
|
||||
LongDesc: Releases a drone that will acquire and destroy an enemy target.
|
||||
|
||||
@@ -364,6 +364,7 @@ NATMPL:
|
||||
RequiresCondition: !disabled
|
||||
Sequence: idle-lights
|
||||
ProduceActorPower:
|
||||
PauseOnCondition: empdisable
|
||||
Description: Hunter Seeker
|
||||
LongDesc: Releases a drone that will acquire and destroy an enemy target.
|
||||
Prerequisites: ~techlevel.superweapons
|
||||
|
||||
@@ -353,6 +353,7 @@ NAMISL:
|
||||
ProvidesPrerequisite@buildingname:
|
||||
SupportPowerChargeBar:
|
||||
NukePower:
|
||||
PauseOnCondition: disabled
|
||||
Cursor: nuke
|
||||
Icon: clustermissile
|
||||
ChargeTime: 540
|
||||
|
||||
@@ -45,6 +45,7 @@ NAPULS:
|
||||
ProvidesPrerequisite@gdi:
|
||||
ResetOnOwnerChange: true
|
||||
AttackOrderPower:
|
||||
PauseOnCondition: empdisable || disabled
|
||||
Cursor: emp
|
||||
Icon: emp
|
||||
ChargeTime: 135
|
||||
|
||||
Reference in New Issue
Block a user