#67 fixed: spinners work again
This commit is contained in:
@@ -50,6 +50,7 @@ namespace OpenRa.Game.GameRules
|
||||
public readonly int[] PrimaryOffset = { 0, 0 };
|
||||
public readonly int[] SecondaryOffset = null;
|
||||
public readonly int Recoil = 0;
|
||||
public readonly int[] ScreenSpaceTurretOffset = { 0, 0 };
|
||||
|
||||
public UnitInfo(string name) { Name = name; }
|
||||
|
||||
|
||||
@@ -16,7 +16,11 @@ namespace OpenRa.Game.Traits
|
||||
: base(self)
|
||||
{
|
||||
turretAnim = new Animation(self.unitInfo.Name);
|
||||
turretAnim.PlayFetchIndex("turret", () => self.traits.Get<Turreted>().turretFacing / 8);
|
||||
if (self.traits.Contains<Turreted>())
|
||||
turretAnim.PlayFetchIndex("turret",
|
||||
() => self.traits.Get<Turreted>().turretFacing / 8);
|
||||
else
|
||||
turretAnim.PlayRepeating("turret"); /* not really a turret; it's a spinner */
|
||||
}
|
||||
|
||||
public override IEnumerable<Pair<Sprite, float2>> Render(Actor self)
|
||||
|
||||
@@ -87,7 +87,9 @@ namespace OpenRa.Game.Traits
|
||||
var bodyFacing = self.traits.Get<Mobile>().facing;
|
||||
var quantizedFacing = bodyFacing - bodyFacing % ru.anim.CurrentSequence.Length;
|
||||
|
||||
return (RotateVectorByFacing(new float2(offset[0], offset[1]), quantizedFacing, .7f) + GetRecoil(self, recoil));
|
||||
return (RotateVectorByFacing(new float2(offset[0], offset[1]), quantizedFacing, .7f) + GetRecoil(self, recoil))
|
||||
+ new float2(self.unitInfo.ScreenSpaceTurretOffset[0],
|
||||
self.unitInfo.ScreenSpaceTurretOffset[1]);
|
||||
}
|
||||
|
||||
public static Pair<Sprite, float2> Centered(Sprite s, float2 location)
|
||||
|
||||
Reference in New Issue
Block a user