Fixed continuous weapon sounds / Improved naval support audio

This commit is contained in:
Anuken
2021-07-14 18:46:51 -04:00
parent dd5389c738
commit a559c3581e
4 changed files with 14 additions and 1 deletions

Binary file not shown.

View File

@@ -1780,6 +1780,7 @@ public class UnitTypes implements ContentList{
shots = 3; shots = 3;
shotDelay = 7f; shotDelay = 7f;
x = y = shootX = shootY = 0f; x = y = shootX = shootY = 0f;
shootSound = Sounds.mineDeploy;
bullet = new BasicBulletType(){{ bullet = new BasicBulletType(){{
sprite = "mine-bullet"; sprite = "mine-bullet";
@@ -2150,6 +2151,8 @@ public class UnitTypes implements ContentList{
shootY = 7f; shootY = 7f;
recoil = 4f; recoil = 4f;
cooldownTime = reload - 10f; cooldownTime = reload - 10f;
//TODO better sound
shootSound = Sounds.laser;
bullet = new EmpBulletType(){{ bullet = new EmpBulletType(){{
float rad = 100f; float rad = 100f;
@@ -2182,6 +2185,7 @@ public class UnitTypes implements ContentList{
hitShake = 4f; hitShake = 4f;
trailRotation = true; trailRotation = true;
status = StatusEffects.electrified; status = StatusEffects.electrified;
hitSound = Sounds.plasmaboom;
trailEffect = new Effect(16f, e -> { trailEffect = new Effect(16f, e -> {
color(Pal.heal); color(Pal.heal);

View File

@@ -1,6 +1,7 @@
package mindustry.entities.abilities; package mindustry.entities.abilities;
import arc.*; import arc.*;
import arc.audio.*;
import arc.graphics.*; import arc.graphics.*;
import arc.graphics.g2d.*; import arc.graphics.g2d.*;
import arc.math.*; import arc.math.*;
@@ -19,6 +20,7 @@ public class EnergyFieldAbility extends Ability{
public float damage = 1, reload = 100, range = 60; public float damage = 1, reload = 100, range = 60;
public Effect healEffect = Fx.heal, hitEffect = Fx.hitLaserBlast, damageEffect = Fx.chainLightning; public Effect healEffect = Fx.heal, hitEffect = Fx.hitLaserBlast, damageEffect = Fx.chainLightning;
public StatusEffect status = StatusEffects.electrified; public StatusEffect status = StatusEffects.electrified;
public Sound shootSound = Sounds.spark;
public float statusDuration = 60f * 6f; public float statusDuration = 60f * 6f;
public float x, y; public float x, y;
public boolean hitBuildings = true; public boolean hitBuildings = true;
@@ -139,6 +141,10 @@ public class EnergyFieldAbility extends Ability{
} }
} }
if(anyNearby){
shootSound.at(unit);
}
timer = 0f; timer = 0f;
} }
} }

View File

@@ -249,7 +249,7 @@ public class Weapon implements Cloneable{
unit.vel.add(Tmp.v1.trns(unit.rotation + 180f, mount.bullet.type.recoil)); unit.vel.add(Tmp.v1.trns(unit.rotation + 180f, mount.bullet.type.recoil));
if(shootSound != Sounds.none && !headless){ if(shootSound != Sounds.none && !headless){
if(mount.sound == null) mount.sound = new SoundLoop(shootSound, 1f); if(mount.sound == null) mount.sound = new SoundLoop(shootSound, 1f);
mount.sound.update(x, y, true); mount.sound.update(bulletX, bulletY, true);
} }
} }
}else{ }else{
@@ -323,6 +323,9 @@ public class Weapon implements Cloneable{
Time.run(sequenceNum * shotDelay + firstShotDelay, () -> { Time.run(sequenceNum * shotDelay + firstShotDelay, () -> {
if(!unit.isAdded()) return; if(!unit.isAdded()) return;
mount.bullet = bullet(unit, shootX + unit.x - baseX, shootY + unit.y - baseY, f + Mathf.range(inaccuracy), lifeScl); mount.bullet = bullet(unit, shootX + unit.x - baseX, shootY + unit.y - baseY, f + Mathf.range(inaccuracy), lifeScl);
if(!continuous){
shootSound.at(shootX, shootY, Mathf.random(soundPitchMin, soundPitchMax));
}
}); });
sequenceNum++; sequenceNum++;
}); });