More Helicopter polish
This commit is contained in:
@@ -28,15 +28,15 @@ using OpenRA.Mods.RA.Activities;
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
class HelicopterInfo : AircraftInfo
|
||||
{
|
||||
{
|
||||
public readonly float InstabilityMagnitude = 2.0f;
|
||||
public readonly int InstabilityTicks = 5;
|
||||
public readonly int InstabilityTicks = 5;
|
||||
public readonly int IdealSeparation = 40;
|
||||
public readonly bool LandWhenIdle = true;
|
||||
|
||||
public override object Create( ActorInitializer init ) { return new Helicopter( init ); }
|
||||
}
|
||||
|
||||
|
||||
class Helicopter : Aircraft, IIssueOrder, IResolveOrder
|
||||
{
|
||||
public IDisposable reservation;
|
||||
@@ -112,21 +112,21 @@ namespace OpenRA.Mods.RA
|
||||
var rawSpeed = .2f * Util.GetEffectiveSpeed(self, UnitMovementType.Fly);
|
||||
var otherHelis = self.World.FindUnitsInCircle(self.CenterLocation, Info.IdealSeparation)
|
||||
.Where(a => a.traits.Contains<Helicopter>());
|
||||
|
||||
|
||||
var f = otherHelis
|
||||
.Select(h => self.traits.Get<Helicopter>().GetRepulseForce(self, h))
|
||||
.Aggregate(float2.Zero, (a, b) => a + b);
|
||||
|
||||
self.CenterLocation += rawSpeed * f;
|
||||
|
||||
|
||||
if (--offsetTicks <= 0)
|
||||
{
|
||||
self.CenterLocation += Info.InstabilityMagnitude * self.World.SharedRandom.Gauss2D(5);
|
||||
unit.Altitude += (int)(Info.InstabilityMagnitude * self.World.SharedRandom.Gauss1D(5));
|
||||
offsetTicks = Info.InstabilityTicks;
|
||||
}
|
||||
|
||||
Location = ((1 / 24f) * self.CenterLocation).ToInt2();
|
||||
|
||||
Location = ((1 / 24f) * self.CenterLocation).ToInt2();
|
||||
}
|
||||
|
||||
const float Epsilon = .5f;
|
||||
@@ -142,6 +142,6 @@ namespace OpenRA.Mods.RA
|
||||
if (d.LengthSquared < Epsilon)
|
||||
return float2.FromAngle((float)self.World.SharedRandom.NextDouble() * 3.14f);
|
||||
return (5 / d.LengthSquared) * d;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ using OpenRA.Mods.RA.Activities;
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
public class ProducesHelicoptersInfo : ProductionInfo
|
||||
{
|
||||
{
|
||||
public override object Create(ActorInitializer init) { return new ProducesHelicopters(); }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user