Remove Order.TargetLocation from support powers.
This commit is contained in:
@@ -28,13 +28,13 @@ namespace OpenRA.Mods.Cnc.Effects
|
||||
int weaponDelay;
|
||||
bool impacted = false;
|
||||
|
||||
public IonCannon(Player firedBy, WeaponInfo weapon, World world, WPos launchPos, CPos location, string effect, string sequence, string palette, int delay)
|
||||
public IonCannon(Player firedBy, WeaponInfo weapon, World world, WPos launchPos, Target target, string effect, string sequence, string palette, int delay)
|
||||
{
|
||||
this.target = target;
|
||||
this.firedBy = firedBy;
|
||||
this.weapon = weapon;
|
||||
this.palette = palette;
|
||||
weaponDelay = delay;
|
||||
target = Target.FromCell(world, location);
|
||||
anim = new Animation(world, effect);
|
||||
anim.PlayThen(sequence, () => Finish(world));
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.CnC.Scripting
|
||||
[Desc("Activate the actor's IonCannonPower.")]
|
||||
public void ActivateIonCannon(CPos target)
|
||||
{
|
||||
icp.Activate(Self, target);
|
||||
icp.Activate(Self, Target.FromCell(Self.World, target));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,8 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
public override void Activate(Actor self, Order order, SupportPowerManager manager)
|
||||
{
|
||||
base.Activate(self, order, manager);
|
||||
attack.AttackTarget(Target.FromCell(self.World, order.TargetLocation), false, false, true);
|
||||
|
||||
attack.AttackTarget(order.Target, false, false, true);
|
||||
}
|
||||
|
||||
protected override void Created(Actor self)
|
||||
|
||||
@@ -50,7 +50,8 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
|
||||
class ChronoshiftPower : SupportPower
|
||||
{
|
||||
public ChronoshiftPower(Actor self, ChronoshiftPowerInfo info) : base(self, info) { }
|
||||
public ChronoshiftPower(Actor self, ChronoshiftPowerInfo info)
|
||||
: base(self, info) { }
|
||||
|
||||
public override void SelectTarget(Actor self, string order, SupportPowerManager manager)
|
||||
{
|
||||
@@ -62,6 +63,8 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
{
|
||||
base.Activate(self, order, manager);
|
||||
|
||||
var info = (ChronoshiftPowerInfo)Info;
|
||||
var targetDelta = self.World.Map.CellContaining(order.Target.CenterPosition) - order.ExtraLocation;
|
||||
foreach (var target in UnitsInRange(order.ExtraLocation))
|
||||
{
|
||||
var cs = target.TraitsImplementing<Chronoshiftable>()
|
||||
@@ -70,11 +73,10 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
if (cs == null)
|
||||
continue;
|
||||
|
||||
var targetCell = target.Location + (order.TargetLocation - order.ExtraLocation);
|
||||
var cpi = Info as ChronoshiftPowerInfo;
|
||||
var targetCell = target.Location + targetDelta;
|
||||
|
||||
if (self.Owner.Shroud.IsExplored(targetCell) && cs.CanChronoshiftTo(target, targetCell))
|
||||
cs.Teleport(target, targetCell, cpi.Duration, cpi.KillCargo, self);
|
||||
cs.Teleport(target, targetCell, info.Duration, info.KillCargo, self);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,16 +74,16 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
{
|
||||
base.Activate(self, order, manager);
|
||||
|
||||
Activate(self, order.TargetLocation);
|
||||
Activate(self, order.Target);
|
||||
}
|
||||
|
||||
public void Activate(Actor self, CPos targetLocation)
|
||||
public void Activate(Actor self, Target target)
|
||||
{
|
||||
self.World.AddFrameEndTask(w =>
|
||||
{
|
||||
PlayLaunchSounds();
|
||||
Game.Sound.Play(SoundType.World, info.OnFireSound, self.World.Map.CenterOfCell(targetLocation));
|
||||
w.Add(new IonCannon(self.Owner, info.WeaponInfo, w, self.CenterPosition, targetLocation,
|
||||
Game.Sound.Play(SoundType.World, info.OnFireSound, target.CenterPosition);
|
||||
w.Add(new IonCannon(self.Owner, info.WeaponInfo, w, self.CenterPosition, target,
|
||||
info.Effect, info.EffectSequence, info.EffectPalette, info.WeaponDelay));
|
||||
|
||||
if (info.CameraActor == null)
|
||||
@@ -91,7 +91,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
|
||||
var camera = w.CreateActor(info.CameraActor, new TypeDictionary
|
||||
{
|
||||
new LocationInit(targetLocation),
|
||||
new LocationInit(self.World.Map.CellContaining(target.CenterPosition)),
|
||||
new OwnerInit(self.Owner),
|
||||
});
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
base.Activate(self, order, manager);
|
||||
|
||||
SendAirstrike(self, self.World.Map.CenterOfCell(order.TargetLocation));
|
||||
SendAirstrike(self, order.Target.CenterPosition);
|
||||
}
|
||||
|
||||
public void SendAirstrike(Actor self, WPos target, bool randomize = true, int attackFacing = 0)
|
||||
|
||||
@@ -71,9 +71,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (wsb != null && wsb.DefaultAnimation.HasSequence(info.Sequence))
|
||||
wsb.PlayCustomAnimation(self, info.Sequence);
|
||||
|
||||
Game.Sound.Play(SoundType.World, info.OnFireSound, self.World.Map.CenterOfCell(order.TargetLocation));
|
||||
Game.Sound.Play(SoundType.World, info.OnFireSound, order.Target.CenterPosition);
|
||||
|
||||
foreach (var a in UnitsInRange(order.TargetLocation))
|
||||
foreach (var a in UnitsInRange(self.World.Map.CellContaining(order.Target.CenterPosition)))
|
||||
{
|
||||
var external = a.TraitsImplementing<ExternalCondition>()
|
||||
.FirstOrDefault(t => t.Info.Condition == info.Condition && t.CanGrantCondition(a, self));
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
base.Activate(self, order, manager);
|
||||
PlayLaunchSounds();
|
||||
|
||||
Activate(self, self.World.Map.CenterOfCell(order.TargetLocation));
|
||||
Activate(self, order.Target.CenterPosition);
|
||||
}
|
||||
|
||||
public void Activate(Actor self, WPos targetPosition)
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
base.Activate(self, order, manager);
|
||||
|
||||
SendParatroopers(self, self.World.Map.CenterOfCell(order.TargetLocation));
|
||||
SendParatroopers(self, order.Target.CenterPosition);
|
||||
}
|
||||
|
||||
public Actor[] SendParatroopers(Actor self, WPos target, bool randomize = true, int dropFacing = 0)
|
||||
|
||||
@@ -48,17 +48,15 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
self.World.AddFrameEndTask(w =>
|
||||
{
|
||||
var location = self.World.Map.CenterOfCell(order.TargetLocation);
|
||||
|
||||
PlayLaunchSounds();
|
||||
Game.Sound.Play(SoundType.World, info.DeploySound, location);
|
||||
Game.Sound.Play(SoundType.World, info.DeploySound, order.Target.CenterPosition);
|
||||
|
||||
if (!string.IsNullOrEmpty(info.EffectSequence) && !string.IsNullOrEmpty(info.EffectPalette))
|
||||
w.Add(new SpriteEffect(location, w, info.EffectImage, info.EffectSequence, info.EffectPalette));
|
||||
w.Add(new SpriteEffect(order.Target.CenterPosition, w, info.EffectImage, info.EffectSequence, info.EffectPalette));
|
||||
|
||||
var actor = w.CreateActor(info.Actor, new TypeDictionary
|
||||
{
|
||||
new LocationInit(order.TargetLocation),
|
||||
new LocationInit(self.World.Map.CellContaining(order.Target.CenterPosition)),
|
||||
new OwnerInit(self.Owner),
|
||||
});
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
ping = manager.RadarPings.Value.Add(
|
||||
() => order.Player.IsAlliedWith(self.World.RenderPlayer),
|
||||
self.World.Map.CenterOfCell(order.TargetLocation),
|
||||
order.Target.CenterPosition,
|
||||
order.Player.Color.RGB,
|
||||
Info.RadarPingDuration);
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (a.Self.OccupiesSpace == null)
|
||||
return 0;
|
||||
|
||||
return (a.Self.CenterPosition - a.Self.World.Map.CenterOfCell(order.TargetLocation)).HorizontalLengthSquared;
|
||||
return (a.Self.CenterPosition - order.Target.CenterPosition).HorizontalLengthSquared;
|
||||
});
|
||||
|
||||
if (power == null)
|
||||
|
||||
Reference in New Issue
Block a user