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