Added straightforward hover behavior for all units. Give a unit a nonzero Altitude: in its Mobile: block and the WithShadow: trait to make it hover.
This commit is contained in:
@@ -30,6 +30,7 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
public readonly int Speed = 1;
|
public readonly int Speed = 1;
|
||||||
public readonly bool OnRails = false;
|
public readonly bool OnRails = false;
|
||||||
public readonly bool SharesCell = false;
|
public readonly bool SharesCell = false;
|
||||||
|
public readonly int Altitude;
|
||||||
|
|
||||||
public virtual object Create(ActorInitializer init) { return new Mobile(init, this); }
|
public virtual object Create(ActorInitializer init) { return new Mobile(init, this); }
|
||||||
|
|
||||||
@@ -110,7 +111,7 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
int2 __fromCell, __toCell;
|
int2 __fromCell, __toCell;
|
||||||
public SubCell fromSubCell, toSubCell;
|
public SubCell fromSubCell, toSubCell;
|
||||||
|
|
||||||
int __altitude;
|
//int __altitude;
|
||||||
|
|
||||||
[Sync]
|
[Sync]
|
||||||
public int Facing
|
public int Facing
|
||||||
@@ -120,11 +121,7 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Sync]
|
[Sync]
|
||||||
public int Altitude
|
public int Altitude { get; set; }
|
||||||
{
|
|
||||||
get { return __altitude; }
|
|
||||||
set { __altitude = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int ROT { get { return Info.ROT; } }
|
public int ROT { get { return Info.ROT; } }
|
||||||
public int InitialFacing { get { return Info.InitialFacing; } }
|
public int InitialFacing { get { return Info.InitialFacing; } }
|
||||||
|
|||||||
@@ -95,6 +95,14 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
public override Activity Tick( Actor self )
|
public override Activity Tick( Actor self )
|
||||||
{
|
{
|
||||||
var mobile = self.Trait<Mobile>();
|
var mobile = self.Trait<Mobile>();
|
||||||
|
var info = self.Info.Traits.Get<MobileInfo>();
|
||||||
|
|
||||||
|
if (mobile.Altitude != info.Altitude)
|
||||||
|
{
|
||||||
|
if (mobile.Altitude < info.Altitude)
|
||||||
|
++mobile.Altitude;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
if (destination == mobile.toCell)
|
if (destination == mobile.toCell)
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
using OpenRA.Mods.RA.Air;
|
using OpenRA.Mods.RA.Air;
|
||||||
|
using OpenRA.Mods.RA.Move;
|
||||||
|
|
||||||
namespace OpenRA.Mods.RA.Render
|
namespace OpenRA.Mods.RA.Render
|
||||||
{
|
{
|
||||||
@@ -25,7 +26,7 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
var move = self.Trait<IMove>();
|
var move = self.Trait<IMove>();
|
||||||
|
|
||||||
/* rude hack */
|
/* rude hack */
|
||||||
var visualOffset = (move is Helicopter && move.Altitude > 0)
|
var visualOffset = ((move is Helicopter || move is Mobile) && move.Altitude > 0)
|
||||||
? Math.Abs((self.ActorID + Game.LocalTick) / 5 % 4 - 1) - 1 : 0;
|
? Math.Abs((self.ActorID + Game.LocalTick) / 5 % 4 - 1) - 1 : 0;
|
||||||
|
|
||||||
var shadowSprites = r.Select(a => a.WithPalette("shadow"));
|
var shadowSprites = r.Select(a => a.WithPalette("shadow"));
|
||||||
|
|||||||
Reference in New Issue
Block a user