Merge pull request #11991 from abcdefg30/ion

Fix the IonCannonPower not playing all launch sounds
This commit is contained in:
Oliver Brakmann
2016-09-30 17:02:27 +02:00
committed by GitHub
3 changed files with 12 additions and 4 deletions

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Cnc.Effects
int weaponDelay;
bool impacted = false;
public IonCannon(Player firedBy, WeaponInfo weapon, World world, CPos location, string effect, string sequence, string palette, int delay)
public IonCannon(Player firedBy, WeaponInfo weapon, World world, WPos launchPos, CPos location, string effect, string sequence, string palette, int delay)
{
this.firedBy = firedBy;
this.weapon = weapon;
@@ -38,6 +38,9 @@ namespace OpenRA.Mods.Cnc.Effects
target = Target.FromCell(world, location);
anim = new Animation(world, effect);
anim.PlayThen(sequence, () => Finish(world));
if (weapon.Report != null && weapon.Report.Any())
Game.Sound.Play(weapon.Report.Random(firedBy.World.SharedRandom), launchPos);
}
public void Tick(World world)

View File

@@ -43,6 +43,9 @@ namespace OpenRA.Mods.Cnc.Traits
[Desc("Apply the weapon impact this many ticks into the effect")]
public readonly int WeaponDelay = 7;
[Desc("Sound to instantly play at the targeted area.")]
public readonly string OnFireSound = null;
public override object Create(ActorInitializer init) { return new IonCannonPower(init.Self, this); }
public void RulesetLoaded(Ruleset rules, ActorInfo ai) { WeaponInfo = rules.Weapons[Weapon.ToLowerInvariant()]; }
}
@@ -63,8 +66,10 @@ namespace OpenRA.Mods.Cnc.Traits
self.World.AddFrameEndTask(w =>
{
Game.Sound.Play(Info.LaunchSound, self.World.Map.CenterOfCell(order.TargetLocation));
w.Add(new IonCannon(self.Owner, info.WeaponInfo, w, order.TargetLocation, info.Effect, info.EffectSequence, info.EffectPalette, info.WeaponDelay));
PlayLaunchSounds();
Game.Sound.Play(info.OnFireSound, self.World.Map.CenterOfCell(order.TargetLocation));
w.Add(new IonCannon(self.Owner, info.WeaponInfo, w, self.CenterPosition, order.TargetLocation,
info.Effect, info.EffectSequence, info.EffectPalette, info.WeaponDelay));
if (info.CameraActor == null)
return;

View File

@@ -575,9 +575,9 @@ EYE:
LongDesc: Initiate an Ion Cannon strike.\nApplies instant damage to a small area.
BeginChargeSpeechNotification: IonCannonCharging
EndChargeSpeechNotification: IonCannonReady
LaunchSound: ion1.aud
SelectTargetSpeechNotification: SelectTarget
InsufficientPowerSpeechNotification: InsufficientPower
OnFireSound: ion1.aud
DisplayRadarPing: True
CameraActor: camera.small
SupportPowerChargeBar: