Change the way NukePower>SkipAscent works

This commit is contained in:
Mustafa Alperen Seki
2018-03-31 11:24:57 +03:00
committed by abcdefg30
parent 5b7d43f1e0
commit dc71a71a09
2 changed files with 5 additions and 8 deletions

View File

@@ -47,10 +47,10 @@ namespace OpenRA.Mods.Common.Effects
this.weaponPalette = weaponPalette; this.weaponPalette = weaponPalette;
this.downSequence = downSequence; this.downSequence = downSequence;
this.delay = delay; this.delay = delay;
turn = delay / 2; turn = skipAscent ? 0 : delay / 2;
this.flashType = flashType; this.flashType = flashType;
var offset = new WVec(WDist.Zero, WDist.Zero, velocity * turn); var offset = new WVec(WDist.Zero, WDist.Zero, velocity * (delay - turn));
ascendSource = launchPos; ascendSource = launchPos;
ascendTarget = launchPos + offset; ascendTarget = launchPos + offset;
descendSource = targetPos + offset; descendSource = targetPos + offset;
@@ -59,12 +59,9 @@ namespace OpenRA.Mods.Common.Effects
anim = new Animation(firedBy.World, name); anim = new Animation(firedBy.World, name);
anim.PlayRepeating(upSequence); anim.PlayRepeating(upSequence);
pos = launchPos; pos = skipAscent ? descendSource : ascendSource;
if (weapon.Report != null && weapon.Report.Any()) if (weapon.Report != null && weapon.Report.Any())
Game.Sound.Play(SoundType.World, weapon.Report.Random(firedBy.World.SharedRandom), pos); Game.Sound.Play(SoundType.World, weapon.Report.Random(firedBy.World.SharedRandom), pos);
if (skipAscent)
ticks = turn;
} }
public void Tick(World world) public void Tick(World world)
@@ -80,7 +77,7 @@ namespace OpenRA.Mods.Common.Effects
if (ticks == turn) if (ticks == turn)
anim.PlayRepeating(downSequence); anim.PlayRepeating(downSequence);
if (ticks <= turn) if (ticks < turn)
pos = WPos.LerpQuadratic(ascendSource, ascendTarget, WAngle.Zero, ticks, turn); pos = WPos.LerpQuadratic(ascendSource, ascendTarget, WAngle.Zero, ticks, turn);
else else
pos = WPos.LerpQuadratic(descendSource, descendTarget, WAngle.Zero, ticks - turn, delay - turn); pos = WPos.LerpQuadratic(descendSource, descendTarget, WAngle.Zero, ticks - turn, delay - turn);

View File

@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Visual ascent velocity in WDist / tick.")] [Desc("Visual ascent velocity in WDist / tick.")]
public readonly WDist FlightVelocity = new WDist(512); public readonly WDist FlightVelocity = new WDist(512);
[Desc("Descend immediately on the target, with half the FlightDelay.")] [Desc("Descend immediately on the target.")]
public readonly bool SkipAscent = false; public readonly bool SkipAscent = false;
[Desc("Amount of time before detonation to remove the beacon.")] [Desc("Amount of time before detonation to remove the beacon.")]