Paratroopers, Spyplane.

This commit is contained in:
Paul Chote
2010-12-05 17:44:34 +13:00
parent 9e16eb513f
commit 172e1eb295
4 changed files with 56 additions and 87 deletions

View File

@@ -13,10 +13,10 @@ using OpenRA.Orders;
using OpenRA.Traits;
using OpenRA.FileFormats;
using OpenRA.Mods.RA.Air;
/*
namespace OpenRA.Mods.RA
{
class ParatroopersPowerInfo : SupportPowerInfo
public class ParatroopersPowerInfo : SupportPowerInfo
{
[ActorReference]
public string[] DropItems = { };
@@ -28,58 +28,40 @@ namespace OpenRA.Mods.RA
public override object Create(ActorInitializer init) { return new ParatroopersPower(init.self, this); }
}
class ParatroopersPower : SupportPower, IResolveOrder
public class ParatroopersPower : SupportPower
{
public ParatroopersPower(Actor self, ParatroopersPowerInfo info) : base(self, info) { }
protected override void OnActivate()
public override void Activate(Actor self, Order order)
{
Self.World.OrderGenerator =
new GenericSelectTarget( Owner.PlayerActor, "ParatroopersActivate", "ability" );
}
var items = (Info as ParatroopersPowerInfo).DropItems;
var startPos = self.World.ChooseRandomEdgeCell();
public void ResolveOrder(Actor self, Order order)
{
if (!IsReady) return;
if (order.OrderString == "ParatroopersActivate")
{
DoParadrop(Owner, order.TargetLocation,
self.Info.Traits.Get<ParatroopersPowerInfo>().DropItems);
FinishActivate();
}
}
void DoParadrop(Player owner, int2 p, string[] items)
{
var startPos = owner.World.ChooseRandomEdgeCell();
owner.World.AddFrameEndTask(w =>
self.World.AddFrameEndTask(w =>
{
var info = (Info as ParatroopersPowerInfo);
var flare = info.FlareType != null ? w.CreateActor(info.FlareType, new TypeDictionary
{
new LocationInit( p ),
new OwnerInit( owner ),
new LocationInit( order.TargetLocation ),
new OwnerInit( self.Owner ),
}) : null;
var a = w.CreateActor(info.UnitType, new TypeDictionary
{
new LocationInit( startPos ),
new OwnerInit( owner ),
new FacingInit( Util.GetFacing(p - startPos, 0) ),
new OwnerInit( self.Owner ),
new FacingInit( Util.GetFacing(order.TargetLocation - startPos, 0) ),
new AltitudeInit( Rules.Info[info.UnitType].Traits.Get<PlaneInfo>().CruiseAltitude ),
});
a.CancelActivity();
a.QueueActivity(new FlyCircle(p));
a.Trait<ParaDrop>().SetLZ(p, flare);
a.QueueActivity(new FlyCircle(order.TargetLocation));
a.Trait<ParaDrop>().SetLZ(order.TargetLocation, flare);
var cargo = a.Trait<Cargo>();
foreach (var i in items)
cargo.Load(a, owner.World.CreateActor(false, i.ToLowerInvariant(), new TypeDictionary { new OwnerInit( a.Owner ) }));
cargo.Load(a, self.World.CreateActor(false, i.ToLowerInvariant(), new TypeDictionary { new OwnerInit( a.Owner ) }));
});
}
}
}
*/

View File

@@ -14,61 +14,46 @@ using OpenRA.Traits;
using OpenRA.Traits.Activities;
using OpenRA.FileFormats;
using OpenRA.Mods.RA.Air;
/*
namespace OpenRA.Mods.RA
{
class SpyPlanePowerInfo : SupportPowerInfo
{
public readonly float RevealTime = .1f; // minutes
public readonly int RevealTime = 6; // seconds
public override object Create(ActorInitializer init) { return new SpyPlanePower(init.self,this); }
}
class SpyPlanePower : SupportPower, IResolveOrder
class SpyPlanePower : SupportPower
{
public SpyPlanePower(Actor self, SpyPlanePowerInfo info) : base(self, info) { }
protected override void OnFinishCharging() { Sound.PlayToPlayer(Owner, "spypln1.aud"); }
protected override void OnActivate()
public override void Activate(Actor self, Order order)
{
Self.World.OrderGenerator = new GenericSelectTarget(Owner.PlayerActor, "SpyPlane", "ability");
Sound.Play("slcttgt1.aud");
}
var enterCell = self.World.ChooseRandomEdgeCell();
public void ResolveOrder(Actor self, Order order)
{
if (!IsReady) return;
if (order.OrderString == "SpyPlane")
var plane = self.World.CreateActor("u2", new TypeDictionary
{
FinishActivate();
new LocationInit( enterCell ),
new OwnerInit( self.Owner ),
new FacingInit( Util.GetFacing(order.TargetLocation - enterCell, 0) ),
new AltitudeInit( Rules.Info["u2"].Traits.Get<PlaneInfo>().CruiseAltitude ),
});
var enterCell = self.World.ChooseRandomEdgeCell();
var plane = self.World.CreateActor("u2", new TypeDictionary
plane.CancelActivity();
plane.QueueActivity(Fly.ToCell(order.TargetLocation));
plane.QueueActivity(new CallFunc(() => plane.World.AddFrameEndTask( w =>
{
new LocationInit( enterCell ),
new OwnerInit( self.Owner ),
new FacingInit( Util.GetFacing(order.TargetLocation - enterCell, 0) ),
new AltitudeInit( Rules.Info["u2"].Traits.Get<PlaneInfo>().CruiseAltitude ),
});
var camera = w.CreateActor("camera", new TypeDictionary
{
new LocationInit( order.TargetLocation ),
new OwnerInit( self.Owner ),
});
plane.CancelActivity();
plane.QueueActivity(Fly.ToCell(order.TargetLocation));
plane.QueueActivity(new CallFunc(() => plane.World.AddFrameEndTask( w =>
{
var camera = w.CreateActor("camera", new TypeDictionary
{
new LocationInit( order.TargetLocation ),
new OwnerInit( Owner ),
});
camera.QueueActivity(new Wait((int)(25 * 60 * (Info as SpyPlanePowerInfo).RevealTime)));
camera.QueueActivity(new RemoveSelf());
})));
plane.QueueActivity(new FlyOffMap { Interruptible = false });
plane.QueueActivity(new RemoveSelf());
}
camera.QueueActivity(new Wait(25 * (Info as SpyPlanePowerInfo).RevealTime));
camera.QueueActivity(new RemoveSelf());
})));
plane.QueueActivity(new FlyOffMap { Interruptible = false });
plane.QueueActivity(new RemoveSelf());
}
}
}
*/

View File

@@ -723,7 +723,23 @@ AFLD:
BelowUnits:
Reservable:
IronCurtainable:
SpyPlanePower:
Image: smigicon
# ChargeTime: 180
ChargeTime: 10
Description: Spy Plane
LongDesc: Reveals an area of the map.
SelectTargetSound: slcttgt1.aud
EndChargeSound: spypln1.aud
ParatroopersPower:
Image: pinficon
# ChargeTime: 360
ChargeTime: 10
Description: Paratroopers
LongDesc: A Badger drops a squad of Riflemen \nanywhere on the map
Prerequisites: AFLD
DropItems: E1,E1,E1,E3,E3
SelectTargetSound: slcttgt1.aud
POWR:
Inherits: ^Building
Buildable:

View File

@@ -41,20 +41,6 @@ Player:
# LongDesc: Makes a group of units invulnerable\nfor 10 seconds.
# Prerequisites: IRON
# Duration: 10
# SpyPlanePower:
# Image: smigicon
# ChargeTime: 3
# Description: Spy Plane
# LongDesc: Reveals an area of the map.
# Prerequisites: AFLD
# ParatroopersPower:
# Image: pinficon
# ChargeTime: 6
# Description: Paratroopers
# LongDesc: A Badger drops a squad of Riflemen \nanywhere on the map
# Prerequisites: AFLD
# DropItems: E1,E1,E1,E3,E3
# SelectTargetSound: slcttgt1.aud
# SonarPulsePower:
# Image: sonricon
# ChargeTime: 10