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

View File

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

View File

@@ -1,6 +1,7 @@
package mindustry.entities.abilities;
import arc.*;
import arc.audio.*;
import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.math.*;
@@ -19,6 +20,7 @@ public class EnergyFieldAbility extends Ability{
public float damage = 1, reload = 100, range = 60;
public Effect healEffect = Fx.heal, hitEffect = Fx.hitLaserBlast, damageEffect = Fx.chainLightning;
public StatusEffect status = StatusEffects.electrified;
public Sound shootSound = Sounds.spark;
public float statusDuration = 60f * 6f;
public float x, y;
public boolean hitBuildings = true;
@@ -139,6 +141,10 @@ public class EnergyFieldAbility extends Ability{
}
}
if(anyNearby){
shootSound.at(unit);
}
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));
if(shootSound != Sounds.none && !headless){
if(mount.sound == null) mount.sound = new SoundLoop(shootSound, 1f);
mount.sound.update(x, y, true);
mount.sound.update(bulletX, bulletY, true);
}
}
}else{
@@ -323,6 +323,9 @@ public class Weapon implements Cloneable{
Time.run(sequenceNum * shotDelay + firstShotDelay, () -> {
if(!unit.isAdded()) return;
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++;
});