lots of heli fixes

This commit is contained in:
Chris Forbes
2009-12-31 11:17:28 +13:00
parent d52c7fba0b
commit 0edadeb7af
5 changed files with 43 additions and 20 deletions

View File

@@ -31,8 +31,12 @@ namespace OpenRa.Game.Traits.Activities
}
var dist = Dest - self.CenterLocation;
if (float2.WithinEpsilon(float2.Zero, dist, 10))
if (float2.WithinEpsilon(float2.Zero, dist, 2))
{
self.CenterLocation = Dest;
self.Location = ((1 / 24f) * self.CenterLocation).ToInt2();
return NextActivity;
}
var desiredFacing = Util.GetFacing(dist, unit.Facing);
Util.TickFacing(ref unit.Facing, desiredFacing, self.Info.ROT);

View File

@@ -16,18 +16,12 @@ namespace OpenRa.Game.Traits.Activities
float2 w1, w2, w3; /* tangent points to turn circles */
float2 landPoint;
static bool IsReserved(Actor a)
{
var res = a.traits.GetOrDefault<Reservable>();
return res != null && res.IsReserved;
}
Actor ChooseAirfield(Actor self)
{
var airfield = Game.world.Actors
.Where(a => a.Info == Rules.UnitInfo["AFLD"] /* todo: generalize this */
&& a.Owner == self.Owner
&& !IsReserved(a))
&& !Reservable.IsReserved(a))
.FirstOrDefault();
if (airfield == null)