Revert "TS: EMP Cannon should only be able to fire via the support power. Fix…"
This reverts commit cd5eb89ebc.
This commit is contained in:
committed by
Gustas
parent
014163d7d3
commit
04d45e1f54
@@ -34,22 +34,13 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
[Desc("Range circle border width.")]
|
[Desc("Range circle border width.")]
|
||||||
public readonly float CircleBorderWidth = 3;
|
public readonly float CircleBorderWidth = 3;
|
||||||
|
|
||||||
[Desc("Condition set to the unit that will execute the attack while the support power is in targeting mode.")]
|
|
||||||
[GrantedConditionReference]
|
|
||||||
public readonly string SupportPowerTargetingCondition = "support-targeting";
|
|
||||||
|
|
||||||
[Desc("Condition set to the unit is executing the attack while the support power attack is in progress.")]
|
|
||||||
[GrantedConditionReference]
|
|
||||||
public readonly string SupportPowerAttackingCondition = "support-attacking";
|
|
||||||
|
|
||||||
public override object Create(ActorInitializer init) { return new AttackOrderPower(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new AttackOrderPower(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class AttackOrderPower : SupportPower, INotifyCreated, INotifyBurstComplete, INotifyBecomingIdle
|
sealed class AttackOrderPower : SupportPower, INotifyCreated, INotifyBurstComplete
|
||||||
{
|
{
|
||||||
readonly AttackOrderPowerInfo info;
|
readonly AttackOrderPowerInfo info;
|
||||||
AttackBase attack;
|
AttackBase attack;
|
||||||
int attackingToken = 0;
|
|
||||||
|
|
||||||
public AttackOrderPower(Actor self, AttackOrderPowerInfo info)
|
public AttackOrderPower(Actor self, AttackOrderPowerInfo info)
|
||||||
: base(self, info)
|
: base(self, info)
|
||||||
@@ -67,7 +58,6 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
base.Activate(self, order, manager);
|
base.Activate(self, order, manager);
|
||||||
PlayLaunchSounds();
|
PlayLaunchSounds();
|
||||||
|
|
||||||
attackingToken = self.GrantCondition(info.SupportPowerAttackingCondition);
|
|
||||||
attack.AttackTarget(order.Target, AttackSource.Default, false, false, true);
|
attack.AttackTarget(order.Target, AttackSource.Default, false, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,11 +72,6 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
{
|
{
|
||||||
self.World.IssueOrder(new Order("Stop", self, false));
|
self.World.IssueOrder(new Order("Stop", self, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
void INotifyBecomingIdle.OnBecomingIdle(Actor self)
|
|
||||||
{
|
|
||||||
self.RevokeCondition(attackingToken);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SelectAttackPowerTarget : OrderGenerator
|
public class SelectAttackPowerTarget : OrderGenerator
|
||||||
@@ -98,21 +83,14 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
readonly string cursorBlocked;
|
readonly string cursorBlocked;
|
||||||
readonly MouseButton expectedButton;
|
readonly MouseButton expectedButton;
|
||||||
readonly AttackBase attack;
|
readonly AttackBase attack;
|
||||||
readonly Actor self;
|
|
||||||
readonly int targetingToken = 0;
|
|
||||||
bool isFiring;
|
|
||||||
|
|
||||||
public SelectAttackPowerTarget(Actor self, string order, SupportPowerManager manager, string cursor, MouseButton button, AttackBase attack)
|
public SelectAttackPowerTarget(Actor self, string order, SupportPowerManager manager, string cursor, MouseButton button, AttackBase attack)
|
||||||
{
|
{
|
||||||
this.self = self;
|
|
||||||
|
|
||||||
// Clear selection if using Left-Click Orders
|
// Clear selection if using Left-Click Orders
|
||||||
if (Game.Settings.Game.UseClassicMouseStyle)
|
if (Game.Settings.Game.UseClassicMouseStyle)
|
||||||
manager.Self.World.Selection.Clear();
|
manager.Self.World.Selection.Clear();
|
||||||
|
|
||||||
instance = manager.GetPowersForActor(self).FirstOrDefault();
|
instance = manager.GetPowersForActor(self).FirstOrDefault();
|
||||||
targetingToken = self.GrantCondition((instance.Info as AttackOrderPowerInfo).SupportPowerTargetingCondition);
|
|
||||||
|
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
this.order = order;
|
this.order = order;
|
||||||
this.cursor = cursor;
|
this.cursor = cursor;
|
||||||
@@ -131,21 +109,12 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
|
|
||||||
protected override IEnumerable<Order> OrderInner(World world, CPos cell, int2 worldPixel, MouseInput mi)
|
protected override IEnumerable<Order> OrderInner(World world, CPos cell, int2 worldPixel, MouseInput mi)
|
||||||
{
|
{
|
||||||
// CancelInputMode will call Deactivate before we could validate the target, so we need to delay clearing the targeting flag
|
|
||||||
isFiring = true;
|
|
||||||
world.CancelInputMode();
|
world.CancelInputMode();
|
||||||
if (mi.Button == expectedButton && IsValidTarget(world, cell))
|
if (mi.Button == expectedButton && IsValidTarget(world, cell))
|
||||||
{
|
|
||||||
self.RevokeCondition(targetingToken);
|
|
||||||
yield return new Order(order, manager.Self, Target.FromCell(world, cell), false)
|
yield return new Order(order, manager.Self, Target.FromCell(world, cell), false)
|
||||||
{
|
{
|
||||||
SuppressVisualFeedback = true
|
SuppressVisualFeedback = true
|
||||||
};
|
};
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
self.RevokeCondition(targetingToken);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Tick(World world)
|
protected override void Tick(World world)
|
||||||
@@ -155,14 +124,6 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
world.CancelInputMode();
|
world.CancelInputMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Deactivate()
|
|
||||||
{
|
|
||||||
if (!isFiring)
|
|
||||||
{
|
|
||||||
self.RevokeCondition(targetingToken);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override IEnumerable<IRenderable> Render(WorldRenderer wr, World world) { yield break; }
|
protected override IEnumerable<IRenderable> Render(WorldRenderer wr, World world) { yield break; }
|
||||||
protected override IEnumerable<IRenderable> RenderAboveShroud(WorldRenderer wr, World world) { yield break; }
|
protected override IEnumerable<IRenderable> RenderAboveShroud(WorldRenderer wr, World world) { yield break; }
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
IEnumerable<IRenderable> IOrderGenerator.RenderAboveShroud(WorldRenderer wr, World world) { return RenderAboveShroud(wr, world); }
|
IEnumerable<IRenderable> IOrderGenerator.RenderAboveShroud(WorldRenderer wr, World world) { return RenderAboveShroud(wr, world); }
|
||||||
IEnumerable<IRenderable> IOrderGenerator.RenderAnnotations(WorldRenderer wr, World world) { return RenderAnnotations(wr, world); }
|
IEnumerable<IRenderable> IOrderGenerator.RenderAnnotations(WorldRenderer wr, World world) { return RenderAnnotations(wr, world); }
|
||||||
string IOrderGenerator.GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi) { return GetCursor(world, cell, worldPixel, mi); }
|
string IOrderGenerator.GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi) { return GetCursor(world, cell, worldPixel, mi); }
|
||||||
void IOrderGenerator.Deactivate() { Deactivate(); }
|
void IOrderGenerator.Deactivate() { }
|
||||||
bool IOrderGenerator.HandleKeyPress(KeyInput e) { return false; }
|
bool IOrderGenerator.HandleKeyPress(KeyInput e) { return false; }
|
||||||
void IOrderGenerator.SelectionChanged(World world, IEnumerable<Actor> selected) { SelectionChanged(world, selected); }
|
void IOrderGenerator.SelectionChanged(World world, IEnumerable<Actor> selected) { SelectionChanged(world, selected); }
|
||||||
|
|
||||||
@@ -42,6 +42,5 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
protected abstract string GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi);
|
protected abstract string GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi);
|
||||||
protected abstract IEnumerable<Order> OrderInner(World world, CPos cell, int2 worldPixel, MouseInput mi);
|
protected abstract IEnumerable<Order> OrderInner(World world, CPos cell, int2 worldPixel, MouseInput mi);
|
||||||
protected virtual void SelectionChanged(World world, IEnumerable<Actor> selected) { }
|
protected virtual void SelectionChanged(World world, IEnumerable<Actor> selected) { }
|
||||||
protected virtual void Deactivate() { }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ NAPULS:
|
|||||||
InitialFacing: 896
|
InitialFacing: 896
|
||||||
RealignDelay: -1
|
RealignDelay: -1
|
||||||
AttackTurreted:
|
AttackTurreted:
|
||||||
RequiresCondition: !build-incomplete && !empdisable && !disabled && ( support-targeting || support-attacking )
|
RequiresCondition: !build-incomplete && !empdisable && !disabled
|
||||||
Armament:
|
Armament:
|
||||||
Weapon: EMPulseCannon
|
Weapon: EMPulseCannon
|
||||||
LocalOffset: 212,0,1768
|
LocalOffset: 212,0,1768
|
||||||
|
|||||||
Reference in New Issue
Block a user