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