A lot more sounds

This commit is contained in:
Anuken
2025-11-14 11:04:52 -05:00
parent 67495e628b
commit d33d355aa2
14 changed files with 38 additions and 16 deletions

View File

@@ -3,7 +3,6 @@ package mindustry.audio;
import arc.*;
import arc.audio.*;
import arc.struct.*;
import mindustry.gen.*;
import static mindustry.gen.Sounds.*;
@@ -12,17 +11,24 @@ public class SoundPriority{
static int lastGroup = 1;
public static void init(){
max(7, laserbig, beam, laserbeam);
//priority 2: long weapon loops
set(
2f,
laserbig,
beam
beam,
laserbeam
);
//priority 1.5: big weapon sounds, not loops
set(1.5f,
set(
1.5f,
railgun,
largeCannon
largeCannon,
lasercharge,
lasercharge2,
lasercharge3
);
//priority 1: ambient noises
@@ -37,7 +43,13 @@ public class SoundPriority{
respawning
);
sameGroup(Sounds.missile, Sounds.missileShort);
//very loud
laser.setMaxConcurrent(5);
sameGroup(hit1, hit2, hit3);
max(4, hit1, hit2, hit3);
sameGroup(missile, missileShort, missilePlasmaShort);
for(var sound : Core.assets.getAll(Sound.class, new Seq<>())){
sound.setMinConcurrentInterrupt(Math.min(0.25f, sound.getLength() * 0.5f));
@@ -47,6 +59,10 @@ public class SoundPriority{
mechStep.setMaxConcurrent(3);
}
static void max(int max, Sound... sounds){
for(var s : sounds) s.setMaxConcurrent(max);
}
static void sameGroup(Sound... sounds){
int id = lastGroup ++;
for(var s : sounds) s.setConcurrentGroup(id);

View File

@@ -633,13 +633,13 @@ public class UnitTypes{
reload = 24f;
shootCone = 180f;
ejectEffect = Fx.none;
shootSound = Sounds.explosion;
shootSound = Sounds.crawlerExplosion;
shootSoundVolume = 0.4f;
x = shootY = 0f;
mirror = false;
bullet = new BulletType(){{
collidesTiles = false;
collides = false;
hitSound = Sounds.explosion;
rangeOverride = 25f;
hitEffect = Fx.pulverize;
@@ -1311,7 +1311,7 @@ public class UnitTypes{
reload = 30f;
ejectEffect = Fx.none;
recoil = 2f;
shootSound = Sounds.missileShort;
shootSound = Sounds.missilePlasmaShort;
velocityRnd = 0.5f;
inaccuracy = 15f;
alternate = true;
@@ -1897,8 +1897,9 @@ public class UnitTypes{
rotate = true;
reload = 90f;
x = y = shootX = shootY = 0f;
shootSound = Sounds.mineDeploy;
shootSound = Sounds.missilePlasmaShort;
rotateSpeed = 180f;
shootSoundVolume = 0.9f;
shoot.shots = 3;
shoot.shotDelay = 7f;
@@ -1917,7 +1918,7 @@ public class UnitTypes{
frontColor = Color.white;
mixColorTo = Color.white;
hitSound = Sounds.plasmaboom;
hitSound = Sounds.explosionPlasmaSmall;
underwater = true;
ejectEffect = Fx.none;
@@ -2068,7 +2069,7 @@ public class UnitTypes{
rotate = true;
inaccuracy = 1f;
velocityRnd = 0.1f;
shootSound = Sounds.missile;
shootSound = Sounds.missilePlasma;
ejectEffect = Fx.none;
bullet = new FlakBulletType(2.5f, 25){{
@@ -2084,6 +2085,7 @@ public class UnitTypes{
lightRadius = 60f;
lightOpacity = 0.7f;
lightColor = Pal.heal;
despawnSound = Sounds.explosion;
splashDamageRadius = 30f;
splashDamage = 25f;
@@ -2302,8 +2304,7 @@ public class UnitTypes{
shootY = 7f;
recoil = 4f;
cooldownTime = reload - 10f;
//TODO better sound
shootSound = Sounds.laser;
shootSound = Sounds.shootNavanax;
bullet = new EmpBulletType(){{
float rad = 100f;
@@ -2337,7 +2338,7 @@ public class UnitTypes{
hitShake = 4f;
trailRotation = true;
status = StatusEffects.electrified;
hitSound = Sounds.plasmaboom;
hitSound = Sounds.empBlast;
trailEffect = new Effect(16f, e -> {
color(Pal.heal);

View File

@@ -25,8 +25,11 @@ public class BasicBulletType extends BulletType{
public BasicBulletType(float speed, float damage, String bulletSprite){
super(speed, damage);
this.sprite = bulletSprite;
hitSoundPitchRange = 0.2f;
hitSoundVolume = 0.4f;
}
public BasicBulletType(float speed, float damage){
this(speed, damage, "bullet");
}

View File

@@ -128,6 +128,8 @@ public class Weapon implements Cloneable{
public float layerOffset = 0f;
/** sound used for shooting */
public Sound shootSound = Sounds.pew;
/** volume of the shoot sound */
public float shootSoundVolume = 1f;
/** sound used for weapons that have a delay */
public Sound chargeSound = Sounds.none;
/** sound played when there is nothing to shoot */
@@ -498,7 +500,7 @@ public class Weapon implements Cloneable{
handleBullet(unit, mount, mount.bullet);
if(!continuous){
shootSound.at(bulletX, bulletY, Mathf.random(soundPitchMin, soundPitchMax));
shootSound.at(bulletX, bulletY, Mathf.random(soundPitchMin, soundPitchMax), shootSoundVolume);
}
ejectEffect.at(mountX, mountY, angle * Mathf.sign(this.x));