Created FlashPaletteEffectWarhead and removed the hardcoded flashing from NukeLaunch

Not actually hardcoded, but there was a hard dependency in NukeLaunch on FlashPaletteEffect and explicit flashing checks.
This commit is contained in:
Pavel Penev
2020-07-09 02:58:58 +03:00
committed by abcdefg30
parent 2e7bd4de4b
commit 8c394a4cb5
9 changed files with 105 additions and 12 deletions

View File

@@ -27,7 +27,6 @@ namespace OpenRA.Mods.Common.Effects
readonly string weaponPalette;
readonly string upSequence;
readonly string downSequence;
readonly string flashType;
readonly WPos ascendSource;
readonly WPos ascendTarget;
@@ -51,7 +50,7 @@ namespace OpenRA.Mods.Common.Effects
public NukeLaunch(Player firedBy, string name, WeaponInfo weapon, string weaponPalette, string upSequence, string downSequence,
WPos launchPos, WPos targetPos, WDist detonationAltitude, bool removeOnDetonation, WDist velocity, int launchDelay, int impactDelay,
bool skipAscent, string flashType,
bool skipAscent,
string trailImage, string[] trailSequences, string trailPalette, bool trailUsePlayerPalette, int trailDelay, int trailInterval)
{
this.firedBy = firedBy;
@@ -62,7 +61,6 @@ namespace OpenRA.Mods.Common.Effects
this.launchDelay = launchDelay;
this.impactDelay = impactDelay;
turn = skipAscent ? 0 : impactDelay / 2;
this.flashType = flashType;
this.trailImage = trailImage;
this.trailSequences = trailSequences;
this.trailPalette = trailPalette;
@@ -151,10 +149,6 @@ namespace OpenRA.Mods.Common.Effects
weapon.Impact(target, warheadArgs);
foreach (var flash in world.WorldActor.TraitsImplementing<FlashPaletteEffect>())
if (flash.Info.Type == flashType)
flash.Enable(-1);
detonated = true;
}