add ability to emit a muzzleflash from multiple weapons; make ftnk somewhat nicer
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -20,27 +21,36 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
class WithMuzzleFlash : INotifyAttack
|
||||
{
|
||||
Animation muzzleFlash;
|
||||
List<Animation> muzzleFlashes = new List<Animation>();
|
||||
bool isShowing;
|
||||
|
||||
public WithMuzzleFlash(Actor self)
|
||||
{
|
||||
var attackInfo = self.Info.Traits.Get<AttackBaseInfo>();
|
||||
var attack = self.Trait<AttackBase>();
|
||||
var render = self.Trait<RenderSimple>();
|
||||
var facing = self.Trait<IFacing>();
|
||||
|
||||
muzzleFlash = new Animation(render.GetImage(self), () => self.Trait<IFacing>().Facing);
|
||||
muzzleFlash.Play("muzzle");
|
||||
foreach (var t in attack.Turrets)
|
||||
{
|
||||
var turret = t;
|
||||
var muzzleFlash = new Animation(render.GetImage(self), () => self.Trait<IFacing>().Facing);
|
||||
muzzleFlash.Play("muzzle");
|
||||
|
||||
render.anims.Add("muzzle", new RenderSimple.AnimationWithOffset(
|
||||
muzzleFlash,
|
||||
() => attackInfo.PrimaryOffset.AbsOffset(),
|
||||
() => !isShowing));
|
||||
render.anims.Add("muzzle{0}".F(muzzleFlashes.Count), new RenderSimple.AnimationWithOffset(
|
||||
muzzleFlash,
|
||||
() => Combat.GetTurretPosition(self, facing, turret),
|
||||
() => !isShowing));
|
||||
|
||||
muzzleFlashes.Add(muzzleFlash);
|
||||
}
|
||||
}
|
||||
|
||||
public void Attacking(Actor self)
|
||||
{
|
||||
isShowing = true;
|
||||
muzzleFlash.PlayThen("muzzle", () => isShowing = false);
|
||||
foreach( var mf in muzzleFlashes )
|
||||
mf.PlayThen("muzzle", () => isShowing = false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,8 @@
|
||||
</unit>
|
||||
<!-- Flame Tank -->
|
||||
<unit name="ftnk">
|
||||
<sequence name="idle" start="0" facings="32" />
|
||||
<sequence name="idle" start="0" length="1" facings="32" />
|
||||
<sequence name="muzzle" start="0" length="13" facings="8" src="flame" />
|
||||
</unit>
|
||||
<!-- Mobile HQ -->
|
||||
<unit name="mhq">
|
||||
@@ -78,8 +79,9 @@
|
||||
<unit name="msam">
|
||||
<sequence name="idle" start="0" facings="32" />
|
||||
<sequence name="turret" start="32" facings="32" />
|
||||
<sequence name="aim" start="64" facings="32" /> <!-- hack -->
|
||||
<sequence name="turret-3" start="64" facings="32" />
|
||||
<sequence name="aim" start="64" facings="32" />
|
||||
<!-- hack -->
|
||||
<sequence name="turret-3" start="64" facings="32" />
|
||||
</unit>
|
||||
<!-- SSM Launcher -->
|
||||
<unit name="mlrs">
|
||||
|
||||
@@ -136,10 +136,12 @@ FTNK:
|
||||
Range: 4
|
||||
AttackBase:
|
||||
PrimaryWeapon: BigFlamer
|
||||
PrimaryOffset: 0,0,0,-2
|
||||
MuzzleFlash: yes
|
||||
PrimaryOffset: 2,-8,0,-2
|
||||
SecondaryWeapon: BigFlamer
|
||||
SecondaryOffset: -2,-8,0,-2
|
||||
RenderUnit:
|
||||
AutoTarget:
|
||||
WithMuzzleFlash:
|
||||
|
||||
BGGY:
|
||||
Inherits: ^Vehicle
|
||||
|
||||
@@ -170,10 +170,10 @@ Flamethrower:
|
||||
|
||||
BigFlamer:
|
||||
ROF: 50
|
||||
Range: 2
|
||||
Range: 3.5
|
||||
Report: FLAMER2
|
||||
Projectile: Bullet
|
||||
Speed: 100
|
||||
Speed: 20
|
||||
Warhead:
|
||||
Spread: 8
|
||||
Verses: 90%,100%,60%,25%,50%
|
||||
@@ -181,7 +181,7 @@ BigFlamer:
|
||||
Explosion: 3
|
||||
ImpactSound: flamer2
|
||||
SmudgeType: Scorch
|
||||
Damage: 50
|
||||
Damage: 40
|
||||
|
||||
Chemspray:
|
||||
ROF: 70
|
||||
|
||||
Reference in New Issue
Block a user