moved paradrop crap into mod dll
This commit is contained in:
@@ -1,11 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenRa.Traits.Activities
|
||||
{
|
||||
class Fly : IActivity
|
||||
public class Fly : IActivity
|
||||
{
|
||||
readonly float2 Pos;
|
||||
bool isCanceled;
|
||||
|
||||
@@ -5,7 +5,7 @@ using System.Text;
|
||||
|
||||
namespace OpenRa.Traits.Activities
|
||||
{
|
||||
class FlyAttack : IActivity
|
||||
public class FlyAttack : IActivity
|
||||
{
|
||||
public IActivity NextActivity { get; set; }
|
||||
Actor Target;
|
||||
@@ -30,7 +30,7 @@ namespace OpenRa.Traits.Activities
|
||||
public void Cancel(Actor self) { Target = null; NextActivity = null; }
|
||||
}
|
||||
|
||||
class FlyCircle : IActivity
|
||||
public class FlyCircle : IActivity
|
||||
{
|
||||
public IActivity NextActivity { get; set; }
|
||||
int2 Target;
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace OpenRa.Traits.Activities
|
||||
{
|
||||
class RemoveSelf : IActivity
|
||||
public class RemoveSelf : IActivity
|
||||
{
|
||||
bool isCanceled;
|
||||
public IActivity NextActivity { get; set; }
|
||||
|
||||
@@ -3,7 +3,7 @@ using OpenRa.Traits.Activities;
|
||||
|
||||
namespace OpenRa.Traits
|
||||
{
|
||||
class CargoInfo : ITraitInfo
|
||||
public class CargoInfo : ITraitInfo
|
||||
{
|
||||
public readonly int Passengers = 0;
|
||||
public readonly UnitMovementType[] PassengerTypes = { };
|
||||
@@ -12,7 +12,7 @@ namespace OpenRa.Traits
|
||||
public object Create(Actor self) { return new Cargo(self); }
|
||||
}
|
||||
|
||||
class Cargo : IPips, IIssueOrder, IResolveOrder
|
||||
public class Cargo : IPips, IIssueOrder, IResolveOrder
|
||||
{
|
||||
List<Actor> cargo = new List<Actor>();
|
||||
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRa.GameRules;
|
||||
|
||||
namespace OpenRa.Traits
|
||||
{
|
||||
class MobileInfo : ITraitInfo
|
||||
public class MobileInfo : ITraitInfo
|
||||
{
|
||||
public readonly UnitMovementType MovementType = UnitMovementType.Wheel;
|
||||
|
||||
public object Create(Actor self) { return new Mobile(self); }
|
||||
}
|
||||
|
||||
class Mobile : IIssueOrder, IResolveOrder, IOccupySpace, IMovement
|
||||
public class Mobile : IIssueOrder, IResolveOrder, IOccupySpace, IMovement
|
||||
{
|
||||
readonly Actor self;
|
||||
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using OpenRa.Traits.Activities;
|
||||
using OpenRa.Effects;
|
||||
|
||||
namespace OpenRa.Traits
|
||||
{
|
||||
class ParaDropInfo : ITraitInfo
|
||||
{
|
||||
public readonly int LZRange = 4;
|
||||
public object Create(Actor self) { return new ParaDrop(); }
|
||||
}
|
||||
|
||||
class ParaDrop : ITick
|
||||
{
|
||||
readonly List<int2> droppedAt = new List<int2>();
|
||||
int2 lz;
|
||||
|
||||
public void SetLZ( int2 lz )
|
||||
{
|
||||
this.lz = lz;
|
||||
droppedAt.Clear();
|
||||
}
|
||||
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
var r = self.Info.Traits.Get<ParaDropInfo>().LZRange;
|
||||
|
||||
if ((self.Location - lz).LengthSquared <= r * r && !droppedAt.Contains(self.Location))
|
||||
{
|
||||
// todo: check is this is a good drop cell.
|
||||
|
||||
// unload a dude here
|
||||
droppedAt.Add(self.Location);
|
||||
|
||||
var cargo = self.traits.Get<Cargo>();
|
||||
if (cargo.IsEmpty(self))
|
||||
FinishedDropping(self);
|
||||
else
|
||||
{
|
||||
var a = cargo.Unload(self);
|
||||
var rs = a.traits.Get<RenderSimple>();
|
||||
|
||||
self.World.AddFrameEndTask(w => w.Add(
|
||||
new Parachute(self.Owner, rs.anim.Name,
|
||||
self.CenterLocation,
|
||||
self.traits.Get<Unit>().Altitude, a)));
|
||||
|
||||
Sound.Play("chute1.aud");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FinishedDropping(Actor self)
|
||||
{
|
||||
// this kindof sucks, actually.
|
||||
self.CancelActivity();
|
||||
self.QueueActivity(new Fly(Util.CenterOfCell(self.World.ChooseRandomEdgeCell())));
|
||||
self.QueueActivity(new RemoveSelf());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using OpenRa.Traits.Activities;
|
||||
|
||||
namespace OpenRa.Traits
|
||||
{
|
||||
class ParatroopersPowerInfo : SupportPowerInfo
|
||||
{
|
||||
public string[] DropItems = { };
|
||||
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();
|
||||
|
||||
DoParadrop(Owner, order.TargetLocation,
|
||||
self.Info.Traits.Get<ParatroopersPowerInfo>().DropItems);
|
||||
|
||||
FinishActivate();
|
||||
}
|
||||
}
|
||||
|
||||
static void DoParadrop(Player owner, int2 p, string[] items)
|
||||
{
|
||||
var startPos = owner.World.ChooseRandomEdgeCell();
|
||||
owner.World.AddFrameEndTask(w =>
|
||||
{
|
||||
var a = w.CreateActor("BADR", startPos, owner);
|
||||
|
||||
a.CancelActivity();
|
||||
a.QueueActivity(new FlyCircle(p));
|
||||
a.traits.Get<ParaDrop>().SetLZ(p);
|
||||
|
||||
var cargo = a.traits.Get<Cargo>();
|
||||
foreach (var i in items)
|
||||
cargo.Load(a, new Actor(owner.World, i.ToLowerInvariant(),
|
||||
new int2(0,0), a.Owner));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenRa.GameRules;
|
||||
using OpenRa.Graphics;
|
||||
using OpenRa.Traits.Activities;
|
||||
|
||||
namespace OpenRa.Traits
|
||||
{
|
||||
static class Util
|
||||
public static class Util
|
||||
{
|
||||
public static void TickFacing( ref int facing, int desiredFacing, int rot )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user