Convert Aircraft.Facing to WAngle.
This commit is contained in:
@@ -209,13 +209,21 @@ namespace OpenRA.Mods.Common.Traits
|
||||
IOverrideAircraftLanding overrideAircraftLanding;
|
||||
|
||||
[Sync]
|
||||
public int Facing { get; set; }
|
||||
public WAngle Facing;
|
||||
|
||||
int IFacing.Facing
|
||||
{
|
||||
get { return Facing.Facing; }
|
||||
set { Facing = WAngle.FromFacing(value); }
|
||||
}
|
||||
|
||||
[Sync]
|
||||
public WPos CenterPosition { get; private set; }
|
||||
|
||||
public CPos TopLeft { get { return self.World.Map.CellContaining(CenterPosition); } }
|
||||
public int TurnSpeed { get { return !IsTraitDisabled && !IsTraitPaused ? Info.TurnSpeed : 0; } }
|
||||
public int TurnSpeed { get { return !IsTraitDisabled && !IsTraitPaused ? 4 * Info.TurnSpeed : 0; } }
|
||||
public int IdleTurnSpeed { get { return Info.IdleTurnSpeed != -1 ? 4 * Info.IdleTurnSpeed : -1; } }
|
||||
|
||||
public Actor ReservedActor { get; private set; }
|
||||
public bool MayYieldReservation { get; private set; }
|
||||
public bool ForceLanding { get; private set; }
|
||||
@@ -240,7 +248,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
MovementType movementTypes;
|
||||
WPos cachedPosition;
|
||||
int cachedFacing;
|
||||
WAngle cachedFacing;
|
||||
|
||||
public Aircraft(ActorInitializer init, AircraftInfo info)
|
||||
: base(info)
|
||||
@@ -255,7 +263,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (centerPositionInit != null)
|
||||
SetPosition(self, centerPositionInit.Value);
|
||||
|
||||
Facing = init.GetValue<FacingInit, int>(info, Info.InitialFacing);
|
||||
Facing = WAngle.FromFacing(init.GetValue<FacingInit, int>(info, Info.InitialFacing));
|
||||
creationActivityDelay = init.GetValue<CreationActivityDelayInit, int>(info, 0);
|
||||
}
|
||||
|
||||
@@ -393,7 +401,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
// HACK: Prevent updating visibility twice per tick. We really shouldn't be
|
||||
// moving twice in a tick in the first place.
|
||||
notify = false;
|
||||
SetPosition(self, CenterPosition + FlyStep(speed, repulsionForce.Yaw.Facing));
|
||||
SetPosition(self, CenterPosition + FlyStep(speed, repulsionForce.Yaw));
|
||||
notify = true;
|
||||
}
|
||||
|
||||
@@ -558,14 +566,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return new[] { Pair.New(TopLeft, SubCell.FullCell) };
|
||||
}
|
||||
|
||||
public WVec FlyStep(int facing)
|
||||
public WVec FlyStep(WAngle facing)
|
||||
{
|
||||
return FlyStep(MovementSpeed, facing);
|
||||
}
|
||||
|
||||
public WVec FlyStep(int speed, int facing)
|
||||
public WVec FlyStep(int speed, WAngle facing)
|
||||
{
|
||||
var dir = new WVec(0, -1024, 0).Rotate(WRot.FromFacing(facing));
|
||||
var dir = new WVec(0, -1024, 0).Rotate(WRot.FromYaw(facing));
|
||||
return speed * dir / 1024;
|
||||
}
|
||||
|
||||
@@ -663,7 +671,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public void ModifyDeathActorInit(Actor self, TypeDictionary init)
|
||||
{
|
||||
init.Add(new FacingInit(Facing));
|
||||
init.Add(new FacingInit(Facing.Facing));
|
||||
}
|
||||
|
||||
void INotifyBecomingIdle.OnBecomingIdle(Actor self)
|
||||
@@ -1176,7 +1184,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
void IActorPreviewInitModifier.ModifyActorPreviewInit(Actor self, TypeDictionary inits)
|
||||
{
|
||||
if (!inits.Contains<DynamicFacingInit>() && !inits.Contains<FacingInit>())
|
||||
inits.Add(new DynamicFacingInit(() => Facing));
|
||||
inits.Add(new DynamicFacingInit(() => Facing.Facing));
|
||||
}
|
||||
|
||||
Activity ICreationActivity.GetCreationActivity()
|
||||
|
||||
Reference in New Issue
Block a user