use a getter for Aircraft.Location
This commit is contained in:
@@ -60,7 +60,6 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
var speed = .2f * aircraft.MovementSpeedForCell(self, self.Location);
|
var speed = .2f * aircraft.MovementSpeedForCell(self, self.Location);
|
||||||
var angle = aircraft.Facing / 128f * Math.PI;
|
var angle = aircraft.Facing / 128f * Math.PI;
|
||||||
aircraft.center += speed * -float2.FromAngle((float)angle);
|
aircraft.center += speed * -float2.FromAngle((float)angle);
|
||||||
aircraft.Location = Util.CellContaining(self.CenterLocation);
|
|
||||||
aircraft.Altitude += Math.Sign(desiredAltitude - aircraft.Altitude);
|
aircraft.Altitude += Math.Sign(desiredAltitude - aircraft.Altitude);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
if (float2.WithinEpsilon(float2.Zero, dist, 2))
|
if (float2.WithinEpsilon(float2.Zero, dist, 2))
|
||||||
{
|
{
|
||||||
aircraft.center = Dest;
|
aircraft.center = Dest;
|
||||||
aircraft.Location = Util.CellContaining(self.CenterLocation);
|
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +48,6 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
|
|
||||||
var rawSpeed = .2f * aircraft.MovementSpeedForCell(self, self.Location);
|
var rawSpeed = .2f * aircraft.MovementSpeedForCell(self, self.Location);
|
||||||
aircraft.center += (rawSpeed / dist.Length) * dist;
|
aircraft.center += (rawSpeed / dist.Length) * dist;
|
||||||
aircraft.Location = Util.CellContaining(self.CenterLocation);
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
var angle = aircraft.Facing / 128f * Math.PI;
|
var angle = aircraft.Facing / 128f * Math.PI;
|
||||||
|
|
||||||
aircraft.center += speed * -float2.FromAngle((float)angle);
|
aircraft.center += speed * -float2.FromAngle((float)angle);
|
||||||
aircraft.Location = Util.CellContaining(self.CenterLocation);
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
protected readonly Actor self;
|
protected readonly Actor self;
|
||||||
[Sync]
|
[Sync]
|
||||||
public int2 Location;
|
public int2 Location { get { return Util.CellContaining( center.ToInt2() ); } }
|
||||||
[Sync]
|
[Sync]
|
||||||
public int Facing { get; set; }
|
public int Facing { get; set; }
|
||||||
[Sync]
|
[Sync]
|
||||||
@@ -46,10 +46,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
this.self = init.self;
|
this.self = init.self;
|
||||||
if( init.Contains<LocationInit>() )
|
if( init.Contains<LocationInit>() )
|
||||||
{
|
this.center = Util.CenterOfCell( init.Get<LocationInit, int2>() );
|
||||||
this.Location = init.Get<LocationInit, int2>();
|
|
||||||
this.center = Util.CenterOfCell( Location );
|
|
||||||
}
|
|
||||||
|
|
||||||
this.Facing = init.Contains<FacingInit>() ? init.Get<FacingInit,int>() : info.InitialFacing;
|
this.Facing = init.Contains<FacingInit>() ? init.Get<FacingInit,int>() : info.InitialFacing;
|
||||||
this.Altitude = init.Contains<AltitudeInit>() ? init.Get<AltitudeInit,int>() : 0;
|
this.Altitude = init.Contains<AltitudeInit>() ? init.Get<AltitudeInit,int>() : 0;
|
||||||
@@ -67,13 +64,11 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
public void SetPosition(Actor self, int2 cell)
|
public void SetPosition(Actor self, int2 cell)
|
||||||
{
|
{
|
||||||
Location = cell;
|
SetPxPosition( self, Util.CenterOfCell( cell ) );
|
||||||
center = Util.CenterOfCell(cell);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetPxPosition( Actor self, int2 px )
|
public void SetPxPosition( Actor self, int2 px )
|
||||||
{
|
{
|
||||||
Location = Util.CellContaining( px );
|
|
||||||
center = px;
|
center = px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -147,8 +147,6 @@ namespace OpenRA.Mods.RA
|
|||||||
aircraft.Altitude += (int)(Info.InstabilityMagnitude * self.World.SharedRandom.Gauss1D(5));
|
aircraft.Altitude += (int)(Info.InstabilityMagnitude * self.World.SharedRandom.Gauss1D(5));
|
||||||
offsetTicks = Info.InstabilityTicks;
|
offsetTicks = Info.InstabilityTicks;
|
||||||
}
|
}
|
||||||
|
|
||||||
Location = Util.CellContaining(self.CenterLocation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const float Epsilon = .5f;
|
const float Epsilon = .5f;
|
||||||
|
|||||||
Reference in New Issue
Block a user