Convert WithRotor to world coords.
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using OpenRA.FileFormats;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
@@ -15,8 +16,10 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
{
|
{
|
||||||
public class WithRotorInfo : ITraitInfo, Requires<RenderSimpleInfo>
|
public class WithRotorInfo : ITraitInfo, Requires<RenderSimpleInfo>
|
||||||
{
|
{
|
||||||
|
[Desc("Position relative to body")]
|
||||||
|
public readonly WVec Offset = WVec.Zero;
|
||||||
|
|
||||||
public readonly string Id = "rotor";
|
public readonly string Id = "rotor";
|
||||||
public readonly int[] Offset = { 0, 0 };
|
|
||||||
public object Create(ActorInitializer init) { return new WithRotor(init.self, this); }
|
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)
|
public WithRotor(Actor self, WithRotorInfo info)
|
||||||
{
|
{
|
||||||
var rs = self.Trait<RenderSimple>();
|
var rs = self.Trait<RenderSimple>();
|
||||||
var facing = self.Trait<IFacing>();
|
|
||||||
|
|
||||||
rotorAnim = new Animation(rs.GetImage(self));
|
rotorAnim = new Animation(rs.GetImage(self));
|
||||||
rotorAnim.PlayRepeating("rotor");
|
rotorAnim.PlayRepeating("rotor");
|
||||||
var turret = new Turret(info.Offset);
|
|
||||||
rs.anims.Add(info.Id, new AnimationWithOffset(
|
rs.anims.Add(info.Id, new AnimationWithOffset(
|
||||||
rotorAnim,
|
rotorAnim,
|
||||||
wr => turret.PxPosition(self, facing).ToFloat2(),
|
wr => wr.ScreenPxOffset(rs.LocalToWorld(info.Offset.Rotate(rs.QuantizeOrientation(self, self.Orientation)))),
|
||||||
null ) { ZOffset = 1 } );
|
null ) { ZOffset = 1 } );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ TRAN:
|
|||||||
Range: 8
|
Range: 8
|
||||||
RenderUnit:
|
RenderUnit:
|
||||||
WithRotor@PRIMARY:
|
WithRotor@PRIMARY:
|
||||||
Offset: 0,14,0,-4
|
Offset: -597,0,171
|
||||||
WithRotor@SECONDARY:
|
WithRotor@SECONDARY:
|
||||||
Id: rotor_2
|
Id: rotor_2
|
||||||
Offset: 0,-14,0,-2
|
Offset: 597,0,85
|
||||||
WithShadow:
|
WithShadow:
|
||||||
Cargo:
|
Cargo:
|
||||||
Types: Infantry
|
Types: Infantry
|
||||||
@@ -84,7 +84,7 @@ HELI:
|
|||||||
Period: 200
|
Period: 200
|
||||||
RenderUnit:
|
RenderUnit:
|
||||||
WithRotor:
|
WithRotor:
|
||||||
Offset: 0,0,0,-2
|
Offset: 0,0,85
|
||||||
WithMuzzleFlash:
|
WithMuzzleFlash:
|
||||||
WithShadow:
|
WithShadow:
|
||||||
FallsToEarth:
|
FallsToEarth:
|
||||||
|
|||||||
@@ -187,10 +187,10 @@ TRAN:
|
|||||||
LandableTerrainTypes: Clear,Rough,Road,Ore,Beach
|
LandableTerrainTypes: Clear,Rough,Road,Ore,Beach
|
||||||
RenderUnit:
|
RenderUnit:
|
||||||
WithRotor@PRIMARY:
|
WithRotor@PRIMARY:
|
||||||
Offset: 0,14,0,-8
|
Offset: -597,0,341
|
||||||
WithRotor@SECONDARY:
|
WithRotor@SECONDARY:
|
||||||
Id: rotor_2
|
Id: rotor_2
|
||||||
Offset: 0,-14,0,-5
|
Offset: 597,0,213
|
||||||
WithShadow:
|
WithShadow:
|
||||||
Cargo:
|
Cargo:
|
||||||
Types: Infantry
|
Types: Infantry
|
||||||
@@ -232,7 +232,7 @@ HELI:
|
|||||||
Speed: 16
|
Speed: 16
|
||||||
RenderUnit:
|
RenderUnit:
|
||||||
WithRotor:
|
WithRotor:
|
||||||
Offset: 0,0,0,-2
|
Offset: 0,0,85
|
||||||
WithShadow:
|
WithShadow:
|
||||||
LimitedAmmo:
|
LimitedAmmo:
|
||||||
Ammo: 6
|
Ammo: 6
|
||||||
|
|||||||
@@ -209,10 +209,10 @@ TRAN:
|
|||||||
LandableTerrainTypes: Clear,Rough,Road,Ore,Beach
|
LandableTerrainTypes: Clear,Rough,Road,Ore,Beach
|
||||||
RenderUnit:
|
RenderUnit:
|
||||||
WithRotor@PRIMARY:
|
WithRotor@PRIMARY:
|
||||||
Offset: 0,14,0,-8
|
Offset: -597,0,341
|
||||||
WithRotor@SECONDARY:
|
WithRotor@SECONDARY:
|
||||||
Id: rotor_2
|
Id: rotor_2
|
||||||
Offset: 0,-14,0,-5
|
Offset: 597,0,213
|
||||||
WithShadow:
|
WithShadow:
|
||||||
Cargo:
|
Cargo:
|
||||||
Types: Infantry
|
Types: Infantry
|
||||||
@@ -272,7 +272,7 @@ HELI:
|
|||||||
Speed: 16
|
Speed: 16
|
||||||
RenderUnit:
|
RenderUnit:
|
||||||
WithRotor:
|
WithRotor:
|
||||||
Offset: 0,0,0,-2
|
Offset: 0,0,85
|
||||||
WithShadow:
|
WithShadow:
|
||||||
LimitedAmmo:
|
LimitedAmmo:
|
||||||
Ammo: 8
|
Ammo: 8
|
||||||
|
|||||||
Reference in New Issue
Block a user