diff --git a/OpenRA.Mods.Cnc/AirstrikePower.cs b/OpenRA.Mods.Cnc/AirstrikePower.cs new file mode 100644 index 0000000000..a1a16ee036 --- /dev/null +++ b/OpenRA.Mods.Cnc/AirstrikePower.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using OpenRA.Traits; + +namespace OpenRA.Mods.Cnc +{ + class AirstrikePowerInfo : SupportPowerInfo + { + public override object Create(Actor self) { return new AirstrikePower(self, this); } + } + + class AirstrikePower : SupportPower, IResolveOrder + { + public AirstrikePower(Actor self, AirstrikePowerInfo info) : base(self, info) { } + + class SelectTarget : IOrderGenerator + { + public IEnumerable Order(World world, int2 xy, MouseInput mi) + { + if (mi.Button == MouseButton.Right) + Game.controller.CancelInputMode(); + return OrderInner(world, xy, mi); + } + + IEnumerable OrderInner(World world, int2 xy, MouseInput mi) + { + if (mi.Button == MouseButton.Left) + yield return new Order("Airstrike", world.LocalPlayer.PlayerActor, xy); + } + + public void Tick(World world) { } + public void Render(World world) { } + + public string GetCursor(World world, int2 xy, MouseInput mi) { return "ability"; } + } + + public void ResolveOrder(Actor self, Order order) + { + if (order.OrderString == "Airstrike") + { + // todo: spawn a10, have it dump napalm all over the target + + Game.controller.CancelInputMode(); + FinishActivate(); + } + } + } +} diff --git a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj index ee510261e8..d8cc715923 100644 --- a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj +++ b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj @@ -45,6 +45,7 @@ + diff --git a/mods/cnc/system.yaml b/mods/cnc/system.yaml index 06c7e3bab5..5cfd1f1dbc 100644 --- a/mods/cnc/system.yaml +++ b/mods/cnc/system.yaml @@ -26,6 +26,13 @@ Player: EndChargeSound: ionredy1.aud LaunchSound: ion1.aud SelectTargetSound: select1.aud + AirstrikePower: + Image: a10icnh + ChargeTime: 8 + Description: Delivers a load of napalm on your target. + Prerequisites: hq + TechLevel: 8 + EndChargeSound: airredy1.aud World: GlobalDefaults: