Add WAngle-compatible airstrike/paratrooper APIs.

This commit is contained in:
Paul Chote
2020-06-10 21:05:12 +01:00
committed by reaperrr
parent a98e460257
commit 27602a4a97
4 changed files with 68 additions and 30 deletions

View File

@@ -27,19 +27,27 @@ namespace OpenRA.Mods.Common.Scripting
ap = self.TraitsImplementing<AirstrikePower>().First();
}
[Desc("Activate the actor's Airstrike Power.")]
public void SendAirstrike(WPos target, bool randomize = true, int facing = 0)
[Desc("Activate the actor's Airstrike Power. Returns the aircraft that will attack.")]
public Actor[] TargetAirstrike(WPos target, WAngle? facing = null)
{
ap.SendAirstrike(Self, target, randomize, facing);
return ap.SendAirstrike(Self, target, facing);
}
[Desc("Activate the actor's Airstrike Power.")]
[Desc("Activate the actor's Airstrike Power. DEPRECATED! Will be removed.")]
public void SendAirstrike(WPos target, bool randomize = true, int facing = 0)
{
Game.Debug("SendAirstrike is deprecated. Use TargetAirstrike instead.");
ap.SendAirstrike(Self, target, randomize ? (WAngle?)null : WAngle.FromFacing(facing));
}
[Desc("Activate the actor's Airstrike Power. DEPRECATED! Will be removed.")]
public void SendAirstrikeFrom(CPos from, CPos to)
{
Game.Debug("SendAirstrikeFrom is deprecated. Use TargetAirstrike instead.");
var i = Self.World.Map.CenterOfCell(from);
var j = Self.World.Map.CenterOfCell(to);
ap.SendAirstrike(Self, j, false, (i - j).Yaw.Facing);
ap.SendAirstrike(Self, j, (i - j).Yaw);
}
}
}

View File

@@ -28,10 +28,18 @@ namespace OpenRA.Mods.Common.Scripting
}
[Desc("Activate the actor's Paratroopers Power. Returns the aircraft that will drop the reinforcements.")]
public Actor[] ActivateParatroopers(WPos target, int facing = -1)
public Actor[] TargetParatroopers(WPos target, WAngle? facing = null)
{
var actors = pp.SendParatroopers(Self, target, facing);
return actors.First;
}
[Desc("Activate the actor's Paratroopers Power. Returns the aircraft that will drop the reinforcements. DEPRECATED! Will be removed.")]
public Actor[] ActivateParatroopers(WPos target, int facing = -1)
{
Game.Debug("SendParatroopersFrom is deprecated. Use TargetParatroopers instead.");
var actors = pp.SendParatroopers(Self, target, facing == -1 ? (WAngle?)null : WAngle.FromFacing(facing));
return actors.First;
}
}
}