improve appearance of smoketrails
This commit is contained in:
committed by
Matthew Bowra-Dean
parent
8ca1da8828
commit
cf26e4aa8a
@@ -13,18 +13,44 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
class SmokeTrailWhenDamagedInfo : TraitInfo<SmokeTrailWhenDamaged> { }
|
class SmokeTrailWhenDamagedInfo : ITraitInfo
|
||||||
|
{
|
||||||
|
public readonly int[] Offset = { 0, 0 };
|
||||||
|
public readonly int Interval = 1;
|
||||||
|
|
||||||
|
public object Create(ActorInitializer init) { return new SmokeTrailWhenDamaged(init.self, this); }
|
||||||
|
}
|
||||||
|
|
||||||
class SmokeTrailWhenDamaged : ITick
|
class SmokeTrailWhenDamaged : ITick
|
||||||
{
|
{
|
||||||
|
Turret smokeTurret;
|
||||||
|
int2 position;
|
||||||
|
int interval;
|
||||||
|
int ticks;
|
||||||
|
|
||||||
|
public SmokeTrailWhenDamaged(Actor self, SmokeTrailWhenDamagedInfo info)
|
||||||
|
{
|
||||||
|
smokeTurret = new Turret(info.Offset);
|
||||||
|
interval = info.Interval;
|
||||||
|
}
|
||||||
|
|
||||||
public void Tick(Actor self)
|
public void Tick(Actor self)
|
||||||
{
|
{
|
||||||
if (self.GetDamageState() >= DamageState.Heavy)
|
if (--ticks <= 0)
|
||||||
self.World.AddFrameEndTask(
|
{
|
||||||
w => { if (!self.Destroyed) w.Add(
|
if (self.Trait<IMove>().Altitude > 0)
|
||||||
new Smoke(w, self.CenterLocation.ToInt2()
|
{
|
||||||
- new int2(0, self.Trait<IMove>().Altitude),
|
var facing = self.Trait<IFacing>();
|
||||||
"smokey")); });
|
var altitude = new float2(0, self.Trait<IMove>().Altitude);
|
||||||
|
position = (self.CenterLocation - Combat.GetTurretPosition(self, facing, smokeTurret) - altitude).ToInt2();
|
||||||
|
|
||||||
|
if (self.GetDamageState() >= DamageState.Heavy)
|
||||||
|
self.World.AddFrameEndTask(
|
||||||
|
w => w.Add(new Smoke(w, position, "smokey")));
|
||||||
|
}
|
||||||
|
|
||||||
|
ticks = interval;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,12 @@ BADR:
|
|||||||
Spins: no
|
Spins: no
|
||||||
Moves: yes
|
Moves: yes
|
||||||
Explosion: UnitExplode
|
Explosion: UnitExplode
|
||||||
SmokeTrailWhenDamaged:
|
SmokeTrailWhenDamaged@0:
|
||||||
|
Offset: 11, -11
|
||||||
|
Interval: 2
|
||||||
|
SmokeTrailWhenDamaged@1:
|
||||||
|
Offset: -11, -11
|
||||||
|
Interval: 2
|
||||||
|
|
||||||
BADR.bomber:
|
BADR.bomber:
|
||||||
CarpetBomb:
|
CarpetBomb:
|
||||||
@@ -61,7 +66,12 @@ BADR.bomber:
|
|||||||
Spins: no
|
Spins: no
|
||||||
Moves: yes
|
Moves: yes
|
||||||
Explosion: UnitExplode
|
Explosion: UnitExplode
|
||||||
SmokeTrailWhenDamaged:
|
SmokeTrailWhenDamaged@0:
|
||||||
|
Offset: 11, -11
|
||||||
|
Interval: 2
|
||||||
|
SmokeTrailWhenDamaged@1:
|
||||||
|
Offset: -11, -11
|
||||||
|
Interval: 2
|
||||||
|
|
||||||
V2RL:
|
V2RL:
|
||||||
Inherits: ^Vehicle
|
Inherits: ^Vehicle
|
||||||
@@ -738,6 +748,8 @@ MIG:
|
|||||||
Moves: yes
|
Moves: yes
|
||||||
Explosion: UnitExplode
|
Explosion: UnitExplode
|
||||||
SmokeTrailWhenDamaged:
|
SmokeTrailWhenDamaged:
|
||||||
|
Offset: 0,-20,0,-4
|
||||||
|
Interval: 2
|
||||||
|
|
||||||
YAK:
|
YAK:
|
||||||
Inherits: ^Plane
|
Inherits: ^Plane
|
||||||
@@ -785,6 +797,9 @@ YAK:
|
|||||||
Moves: yes
|
Moves: yes
|
||||||
Explosion: UnitExplode
|
Explosion: UnitExplode
|
||||||
SmokeTrailWhenDamaged:
|
SmokeTrailWhenDamaged:
|
||||||
|
Offset: 0, -20
|
||||||
|
Interval: 2
|
||||||
|
|
||||||
|
|
||||||
TRAN:
|
TRAN:
|
||||||
Inherits: ^Plane
|
Inherits: ^Plane
|
||||||
@@ -863,6 +878,7 @@ HELI:
|
|||||||
FallsToEarth:
|
FallsToEarth:
|
||||||
Explosion: UnitExplode
|
Explosion: UnitExplode
|
||||||
SmokeTrailWhenDamaged:
|
SmokeTrailWhenDamaged:
|
||||||
|
Offset: 0,-10
|
||||||
|
|
||||||
HIND:
|
HIND:
|
||||||
Inherits: ^Plane
|
Inherits: ^Plane
|
||||||
@@ -908,6 +924,7 @@ HIND:
|
|||||||
FallsToEarth:
|
FallsToEarth:
|
||||||
Explosion: UnitExplode
|
Explosion: UnitExplode
|
||||||
SmokeTrailWhenDamaged:
|
SmokeTrailWhenDamaged:
|
||||||
|
Offset: 0,-10
|
||||||
|
|
||||||
U2:
|
U2:
|
||||||
Inherits: ^Plane
|
Inherits: ^Plane
|
||||||
@@ -933,6 +950,8 @@ U2:
|
|||||||
Moves: yes
|
Moves: yes
|
||||||
Explosion: UnitExplode
|
Explosion: UnitExplode
|
||||||
SmokeTrailWhenDamaged:
|
SmokeTrailWhenDamaged:
|
||||||
|
Offset: 0,-25
|
||||||
|
Interval: 2
|
||||||
|
|
||||||
1TNK.Husk:
|
1TNK.Husk:
|
||||||
Inherits: ^Husk
|
Inherits: ^Husk
|
||||||
|
|||||||
Reference in New Issue
Block a user