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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

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

View File

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

View File

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

View File

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