diff --git a/OpenRA.Mods.RA/Render/WithRotor.cs b/OpenRA.Mods.RA/Render/WithRotor.cs index 89e5f513c6..7a5c6a0bb0 100755 --- a/OpenRA.Mods.RA/Render/WithRotor.cs +++ b/OpenRA.Mods.RA/Render/WithRotor.cs @@ -8,6 +8,7 @@ */ #endregion +using OpenRA.FileFormats; using OpenRA.Graphics; using OpenRA.Traits; @@ -15,8 +16,10 @@ namespace OpenRA.Mods.RA.Render { public class WithRotorInfo : ITraitInfo, Requires { + [Desc("Position relative to body")] + public readonly WVec Offset = WVec.Zero; + public readonly string Id = "rotor"; - public readonly int[] Offset = { 0, 0 }; public object Create(ActorInitializer init) { return new WithRotor(init.self, this); } } @@ -26,14 +29,12 @@ namespace OpenRA.Mods.RA.Render public WithRotor(Actor self, WithRotorInfo info) { var rs = self.Trait(); - var facing = self.Trait(); rotorAnim = new Animation(rs.GetImage(self)); rotorAnim.PlayRepeating("rotor"); - var turret = new Turret(info.Offset); rs.anims.Add(info.Id, new AnimationWithOffset( rotorAnim, - wr => turret.PxPosition(self, facing).ToFloat2(), + wr => wr.ScreenPxOffset(rs.LocalToWorld(info.Offset.Rotate(rs.QuantizeOrientation(self, self.Orientation)))), null ) { ZOffset = 1 } ); } diff --git a/mods/cnc/rules/aircraft.yaml b/mods/cnc/rules/aircraft.yaml index 3b2465ee29..7e8b777621 100644 --- a/mods/cnc/rules/aircraft.yaml +++ b/mods/cnc/rules/aircraft.yaml @@ -28,10 +28,10 @@ TRAN: Range: 8 RenderUnit: WithRotor@PRIMARY: - Offset: 0,14,0,-4 + Offset: -597,0,171 WithRotor@SECONDARY: Id: rotor_2 - Offset: 0,-14,0,-2 + Offset: 597,0,85 WithShadow: Cargo: Types: Infantry @@ -84,7 +84,7 @@ HELI: Period: 200 RenderUnit: WithRotor: - Offset: 0,0,0,-2 + Offset: 0,0,85 WithMuzzleFlash: WithShadow: FallsToEarth: diff --git a/mods/ra-classic/rules/aircraft.yaml b/mods/ra-classic/rules/aircraft.yaml index 8c96099d29..ad2745911e 100644 --- a/mods/ra-classic/rules/aircraft.yaml +++ b/mods/ra-classic/rules/aircraft.yaml @@ -187,10 +187,10 @@ TRAN: LandableTerrainTypes: Clear,Rough,Road,Ore,Beach RenderUnit: WithRotor@PRIMARY: - Offset: 0,14,0,-8 + Offset: -597,0,341 WithRotor@SECONDARY: Id: rotor_2 - Offset: 0,-14,0,-5 + Offset: 597,0,213 WithShadow: Cargo: Types: Infantry @@ -232,7 +232,7 @@ HELI: Speed: 16 RenderUnit: WithRotor: - Offset: 0,0,0,-2 + Offset: 0,0,85 WithShadow: LimitedAmmo: Ammo: 6 diff --git a/mods/ra/rules/aircraft.yaml b/mods/ra/rules/aircraft.yaml index d823b06bcb..dc5d006743 100644 --- a/mods/ra/rules/aircraft.yaml +++ b/mods/ra/rules/aircraft.yaml @@ -209,10 +209,10 @@ TRAN: LandableTerrainTypes: Clear,Rough,Road,Ore,Beach RenderUnit: WithRotor@PRIMARY: - Offset: 0,14,0,-8 + Offset: -597,0,341 WithRotor@SECONDARY: Id: rotor_2 - Offset: 0,-14,0,-5 + Offset: 597,0,213 WithShadow: Cargo: Types: Infantry @@ -272,7 +272,7 @@ HELI: Speed: 16 RenderUnit: WithRotor: - Offset: 0,0,0,-2 + Offset: 0,0,85 WithShadow: LimitedAmmo: Ammo: 8