Separate IBodyOrientation from render traits.
This commit is contained in:
@@ -57,6 +57,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
var self = init.self;
|
||||
// Work around a bogus crash
|
||||
anim.PlayRepeating( NormalizeSequence(self, "idle") );
|
||||
self.Trait<IBodyOrientation>().QuantizedFacings = anim.CurrentSequence.Facings;
|
||||
|
||||
// Can't call Complete() directly from ctor because other traits haven't been inited yet
|
||||
if (self.Info.Traits.Get<RenderBuildingInfo>().HasMakeAnimation && !init.Contains<SkipMakeAnimsInit>())
|
||||
|
||||
@@ -61,6 +61,8 @@ namespace OpenRA.Mods.RA.Render
|
||||
anim.PlayFetchIndex(NormalizeInfantrySequence(self, "stand"), () => 0);
|
||||
State = AnimationState.Waiting;
|
||||
mobile = self.Trait<Mobile>();
|
||||
|
||||
self.Trait<IBodyOrientation>().QuantizedFacings = anim.CurrentSequence.Facings;
|
||||
}
|
||||
|
||||
public void Attacking(Actor self, Target target)
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
public class Turreted : ITick, ISync, IResolveOrder
|
||||
{
|
||||
[Sync] public int QuantizedFacings = -1;
|
||||
[Sync] public int QuantizedFacings = 0;
|
||||
[Sync] public int turretFacing = 0;
|
||||
public int? desiredFacing;
|
||||
TurretedInfo info;
|
||||
@@ -96,7 +96,7 @@ namespace OpenRA.Mods.RA
|
||||
// Hack: turretFacing is relative to the world, so subtract the body yaw
|
||||
var local = WRot.FromYaw(WAngle.FromFacing(turretFacing) - self.Orientation.Yaw);
|
||||
|
||||
if (QuantizedFacings == -1)
|
||||
if (QuantizedFacings == 0)
|
||||
return local;
|
||||
|
||||
// Quantize orientation to match a rendered sprite
|
||||
|
||||
Reference in New Issue
Block a user