Merge pull request #9716 from teees/hover-fix
Disable hovering for landed aircraft
This commit is contained in:
@@ -18,20 +18,21 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Changes the visual Z position periodically.")]
|
[Desc("Changes the visual Z position periodically.")]
|
||||||
public class HoversInfo : ITraitInfo, Requires<IMoveInfo>
|
public class HoversInfo : UpgradableTraitInfo, Requires<IMoveInfo>
|
||||||
{
|
{
|
||||||
[Desc("Amount of Z axis changes in world units.")]
|
[Desc("Amount of Z axis changes in world units.")]
|
||||||
public readonly int OffsetModifier = -43;
|
public readonly int OffsetModifier = -43;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new Hovers(this, init.Self); }
|
public override object Create(ActorInitializer init) { return new Hovers(this, init.Self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Hovers : IRenderModifier
|
public class Hovers : UpgradableTrait<HoversInfo>, IRenderModifier
|
||||||
{
|
{
|
||||||
readonly HoversInfo info;
|
readonly HoversInfo info;
|
||||||
readonly bool aircraft;
|
readonly bool aircraft;
|
||||||
|
|
||||||
public Hovers(HoversInfo info, Actor self)
|
public Hovers(HoversInfo info, Actor self)
|
||||||
|
: base(info)
|
||||||
{
|
{
|
||||||
this.info = info;
|
this.info = info;
|
||||||
aircraft = self.Info.HasTraitInfo<AircraftInfo>();
|
aircraft = self.Info.HasTraitInfo<AircraftInfo>();
|
||||||
@@ -39,7 +40,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public IEnumerable<IRenderable> ModifyRender(Actor self, WorldRenderer wr, IEnumerable<IRenderable> r)
|
public IEnumerable<IRenderable> ModifyRender(Actor self, WorldRenderer wr, IEnumerable<IRenderable> r)
|
||||||
{
|
{
|
||||||
if (self.World.Paused)
|
if (self.World.Paused || IsTraitDisabled)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
var visualOffset = !aircraft || self.CenterPosition.Z > 0 ? (int)Math.Abs((self.ActorID + Game.LocalTick) / 5 % 4 - 1) - 1 : 0;
|
var visualOffset = !aircraft || self.CenterPosition.Z > 0 ? (int)Math.Abs((self.ActorID + Game.LocalTick) / 5 % 4 - 1) - 1 : 0;
|
||||||
|
|||||||
@@ -97,7 +97,9 @@ ORCA:
|
|||||||
PipTypeEmpty: AmmoEmpty
|
PipTypeEmpty: AmmoEmpty
|
||||||
AutoTarget:
|
AutoTarget:
|
||||||
RenderSprites:
|
RenderSprites:
|
||||||
Hovers:
|
Hovers@AIRBORNE:
|
||||||
|
UpgradeTypes: airborne
|
||||||
|
UpgradeMinEnabledLevel: 1
|
||||||
|
|
||||||
ORCAB:
|
ORCAB:
|
||||||
Inherits: ^Plane
|
Inherits: ^Plane
|
||||||
@@ -139,7 +141,9 @@ ORCAB:
|
|||||||
PipTypeEmpty: AmmoEmpty
|
PipTypeEmpty: AmmoEmpty
|
||||||
AutoTarget:
|
AutoTarget:
|
||||||
RenderSprites:
|
RenderSprites:
|
||||||
Hovers:
|
Hovers@AIRBORNE:
|
||||||
|
UpgradeTypes: airborne
|
||||||
|
UpgradeMinEnabledLevel: 1
|
||||||
|
|
||||||
ORCATRAN:
|
ORCATRAN:
|
||||||
Inherits: ^Helicopter
|
Inherits: ^Helicopter
|
||||||
@@ -172,7 +176,9 @@ ORCATRAN:
|
|||||||
MaxWeight: 5
|
MaxWeight: 5
|
||||||
PipCount: 5
|
PipCount: 5
|
||||||
UnloadVoice: Move
|
UnloadVoice: Move
|
||||||
Hovers:
|
Hovers@AIRBORNE:
|
||||||
|
UpgradeTypes: airborne
|
||||||
|
UpgradeMinEnabledLevel: 1
|
||||||
|
|
||||||
TRNSPORT:
|
TRNSPORT:
|
||||||
Inherits: ^Helicopter
|
Inherits: ^Helicopter
|
||||||
@@ -202,7 +208,9 @@ TRNSPORT:
|
|||||||
Range: 2c0
|
Range: 2c0
|
||||||
Type: CenterPosition
|
Type: CenterPosition
|
||||||
RenderSprites:
|
RenderSprites:
|
||||||
Hovers:
|
Hovers@AIRBORNE:
|
||||||
|
UpgradeTypes: airborne
|
||||||
|
UpgradeMinEnabledLevel: 1
|
||||||
Selectable:
|
Selectable:
|
||||||
Bounds: 44,32,0,-8
|
Bounds: 44,32,0,-8
|
||||||
|
|
||||||
@@ -285,7 +293,9 @@ APACHE:
|
|||||||
WithSpriteRotorOverlay:
|
WithSpriteRotorOverlay:
|
||||||
Offset: 85,0,384
|
Offset: 85,0,384
|
||||||
RenderSprites:
|
RenderSprites:
|
||||||
Hovers:
|
Hovers@AIRBORNE:
|
||||||
|
UpgradeTypes: airborne
|
||||||
|
UpgradeMinEnabledLevel: 1
|
||||||
|
|
||||||
HUNTER:
|
HUNTER:
|
||||||
Inherits@1: ^GainsExperience
|
Inherits@1: ^GainsExperience
|
||||||
|
|||||||
Reference in New Issue
Block a user