Add Orientation getter to IFacing.
This commit is contained in:
@@ -69,9 +69,7 @@ namespace OpenRA
|
||||
{
|
||||
get
|
||||
{
|
||||
// TODO: Support non-zero pitch/roll in IFacing (IOrientation?)
|
||||
var facingValue = facing != null ? facing.Facing : WAngle.Zero;
|
||||
return new WRot(WAngle.Zero, WAngle.Zero, facingValue);
|
||||
return facing != null ? facing.Orientation : WRot.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -319,6 +319,7 @@ namespace OpenRA.Traits
|
||||
{
|
||||
WAngle TurnSpeed { get; }
|
||||
WAngle Facing { get; set; }
|
||||
WRot Orientation { get; }
|
||||
}
|
||||
|
||||
public interface IFacingInfo : ITraitInfoInterface { int GetInitialFacing(); }
|
||||
|
||||
@@ -64,8 +64,16 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
IEnumerable<int> speedModifiers;
|
||||
INotifyVisualPositionChanged[] notifyVisualPositionChanged;
|
||||
|
||||
WRot orientation;
|
||||
|
||||
[Sync]
|
||||
public WAngle Facing { get; set; }
|
||||
public WAngle Facing
|
||||
{
|
||||
get { return orientation.Yaw; }
|
||||
set { orientation = orientation.WithYaw(value); }
|
||||
}
|
||||
|
||||
public WRot Orientation { get { return orientation; } }
|
||||
|
||||
[Sync]
|
||||
public WPos CenterPosition { get; private set; }
|
||||
|
||||
@@ -208,8 +208,16 @@ namespace OpenRA.Mods.Common.Traits
|
||||
INotifyVisualPositionChanged[] notifyVisualPositionChanged;
|
||||
IOverrideAircraftLanding overrideAircraftLanding;
|
||||
|
||||
WRot orientation;
|
||||
|
||||
[Sync]
|
||||
public WAngle Facing { get; set; }
|
||||
public WAngle Facing
|
||||
{
|
||||
get { return orientation.Yaw; }
|
||||
set { orientation = orientation.WithYaw(value); }
|
||||
}
|
||||
|
||||
public WRot Orientation { get { return orientation; } }
|
||||
|
||||
[Sync]
|
||||
public WPos CenterPosition { get; private set; }
|
||||
|
||||
@@ -68,8 +68,16 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Sync]
|
||||
public WPos CenterPosition { get; private set; }
|
||||
|
||||
WRot orientation;
|
||||
|
||||
[Sync]
|
||||
public WAngle Facing { get; set; }
|
||||
public WAngle Facing
|
||||
{
|
||||
get { return orientation.Yaw; }
|
||||
set { orientation = orientation.WithYaw(value); }
|
||||
}
|
||||
|
||||
public WRot Orientation { get { return orientation; } }
|
||||
|
||||
public WAngle TurnSpeed { get { return WAngle.Zero; } }
|
||||
|
||||
|
||||
@@ -195,10 +195,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
#endregion
|
||||
|
||||
WAngle oldFacing, facing;
|
||||
WAngle oldFacing;
|
||||
WRot orientation;
|
||||
WPos oldPos;
|
||||
CPos fromCell, toCell;
|
||||
public SubCell FromSubCell, ToSubCell;
|
||||
|
||||
INotifyCustomLayerChanged[] notifyCustomLayerChanged;
|
||||
INotifyVisualPositionChanged[] notifyVisualPositionChanged;
|
||||
INotifyMoving[] notifyMoving;
|
||||
@@ -216,13 +218,16 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
#region IFacing
|
||||
|
||||
[Sync]
|
||||
public WAngle Facing
|
||||
{
|
||||
get { return facing; }
|
||||
set { facing = value; }
|
||||
get { return orientation.Yaw; }
|
||||
set { orientation = orientation.WithYaw(value); }
|
||||
}
|
||||
|
||||
public WRot Orientation { get { return orientation; } }
|
||||
|
||||
public WAngle TurnSpeed { get { return new WAngle(4 * Info.TurnSpeed); } }
|
||||
#endregion
|
||||
|
||||
@@ -858,12 +863,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
void IActorPreviewInitModifier.ModifyActorPreviewInit(Actor self, TypeDictionary inits)
|
||||
{
|
||||
if (!inits.Contains<DynamicFacingInit>() && !inits.Contains<FacingInit>())
|
||||
inits.Add(new DynamicFacingInit(() => facing.Facing));
|
||||
inits.Add(new DynamicFacingInit(() => Facing.Facing));
|
||||
}
|
||||
|
||||
void IDeathActorInitModifier.ModifyDeathActorInit(Actor self, TypeDictionary init)
|
||||
{
|
||||
init.Add(new FacingInit(facing.Facing));
|
||||
init.Add(new FacingInit(Facing.Facing));
|
||||
|
||||
// Allows the husk to drag to its final position
|
||||
if (CanEnterCell(self.Location, self, BlockedByActor.Stationary))
|
||||
|
||||
Reference in New Issue
Block a user