start on paratroopers; fix bugs in chrono/invuln

This commit is contained in:
Chris Forbes
2010-01-28 17:50:30 +13:00
parent 5bd6c32aff
commit 02ab0f5444
5 changed files with 63 additions and 7 deletions

View File

@@ -224,6 +224,7 @@
<Compile Include="Traits\LightPaletteRotator.cs" />
<Compile Include="Traits\LimitedAmmo.cs" />
<Compile Include="Traits\NukePower.cs" />
<Compile Include="Traits\ParatroopersPower.cs" />
<Compile Include="Traits\Passenger.cs" />
<Compile Include="Traits\PlaceBuilding.cs" />
<Compile Include="Traits\SonarPulsePower.cs" />

View File

@@ -66,8 +66,7 @@ namespace OpenRa.Traits
if (chronosphere != null)
chronosphere.traits.Get<RenderBuilding>().PlayCustomAnim(chronosphere, "active");
}
Game.controller.CancelInputMode();
FinishActivate();
}
}

View File

@@ -28,6 +28,9 @@ namespace OpenRa.Traits
{
if (order.OrderString == "IronCurtain")
{
if (self.Owner == self.World.LocalPlayer)
Game.controller.CancelInputMode();
var curtain = self.World.Actors.Where(a => a.Owner != null
&& a.traits.Contains<IronCurtain>()).FirstOrDefault();
if (curtain != null)
@@ -37,7 +40,7 @@ namespace OpenRa.Traits
order.TargetActor.traits.Get<IronCurtainable>().Activate(order.TargetActor,
(int)((Info as IronCurtainPowerInfo).Duration * 25 * 60));
Game.controller.CancelInputMode();
FinishActivate();
}
}

View File

@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OpenRa.Traits
{
class ParatroopersPowerInfo : SupportPowerInfo
{
/* todo... */
public override object Create(Actor self) { return new ParatroopersPower(self,this); }
}
class ParatroopersPower : SupportPower, IResolveOrder
{
public ParatroopersPower(Actor self, ParatroopersPowerInfo info) : base(self, info) { }
protected override void OnActivate()
{
Game.controller.orderGenerator = new SelectTarget();
Sound.Play("slcttgt1.aud");
}
class SelectTarget : IOrderGenerator
{
public IEnumerable<Order> Order(World world, int2 xy, MouseInput mi)
{
if (mi.Button == MouseButton.Left)
yield return new Order("ParatroopersActivate", world.LocalPlayer.PlayerActor, xy);
}
public void Tick(World world) {}
public void Render(World world) {}
public Cursor GetCursor(World world, int2 xy, MouseInput mi)
{
return Cursor.Ability;
}
}
public void ResolveOrder(Actor self, Order order)
{
if (order.OrderString == "ParatroopersActivate")
{
if (self.Owner == self.World.LocalPlayer)
Game.controller.CancelInputMode();
/* todo:... */
FinishActivate();
}
}
}
}

View File

@@ -165,9 +165,7 @@ TRAN
HELI
HIND
U2
; TODO:
; U2 (spyplane)
; BADR (paratrooper/paradrop plane)
BADR
[MIG]
Description=Mig Attack Plane
@@ -209,7 +207,8 @@ InitialFacing=20
LongDesc=Helicopter Gunship with Chainguns.\n Strong vs Infantry, Light Vehicles.\n Weak vs Tanks
[U2]
Traits=Unit, Plane, RenderUnit, WithShadow, IronCurtainable
[BADR]
Traits=Unit, Plane, RenderUnit, WithShadow, IronCurtainable