diff --git a/annotations/src/main/java/mindustry/annotations/impl/AssetsProcess.java b/annotations/src/main/java/mindustry/annotations/impl/AssetsProcess.java index acad282be2..57d2f9cf45 100644 --- a/annotations/src/main/java/mindustry/annotations/impl/AssetsProcess.java +++ b/annotations/src/main/java/mindustry/annotations/impl/AssetsProcess.java @@ -183,8 +183,11 @@ public class AssetsProcess extends BaseProcessor{ } if(classname.equals("Sounds")){ - type.addField(FieldSpec.builder(ClassName.bestGuess(rtype), "none", Modifier.STATIC, Modifier.PUBLIC).initializer("new " + rtype + "()").build()); - type.addField(FieldSpec.builder(ClassName.bestGuess(rtype), "unset", Modifier.STATIC, Modifier.PUBLIC).initializer("new " + rtype + "()").build()); + type.addField(FieldSpec.builder(ClassName.bestGuess(rtype), "none", Modifier.STATIC, Modifier.PUBLIC).initializer("new " + rtype + "()") + .addJavadoc("Does not play anything.").build()); + + type.addField(FieldSpec.builder(ClassName.bestGuess(rtype), "unset", Modifier.STATIC, Modifier.PUBLIC).initializer("new " + rtype + "()") + .addJavadoc("Used a placeholder value for unset default values. This is usually reassigned in init() of the relevant block or unit. Does not play anything.").build()); } type.addMethod(loadBegin.build()); diff --git a/core/assets/sounds/afflictExplosion.ogg b/core/assets/sounds/afflictExplosion.ogg new file mode 100644 index 0000000000..3e2af45f8c Binary files /dev/null and b/core/assets/sounds/afflictExplosion.ogg differ diff --git a/core/assets/sounds/blaster.ogg b/core/assets/sounds/blaster.ogg deleted file mode 100644 index eaade08fd1..0000000000 Binary files a/core/assets/sounds/blaster.ogg and /dev/null differ diff --git a/core/assets/sounds/blockExplode1.ogg b/core/assets/sounds/blockExplode1.ogg new file mode 100644 index 0000000000..76b84efca2 Binary files /dev/null and b/core/assets/sounds/blockExplode1.ogg differ diff --git a/core/assets/sounds/blockExplode2.ogg b/core/assets/sounds/blockExplode2.ogg new file mode 100644 index 0000000000..1485acfbe7 Binary files /dev/null and b/core/assets/sounds/blockExplode2.ogg differ diff --git a/core/assets/sounds/blockExplode3.ogg b/core/assets/sounds/blockExplode3.ogg new file mode 100644 index 0000000000..554f6a4756 Binary files /dev/null and b/core/assets/sounds/blockExplode3.ogg differ diff --git a/core/assets/sounds/blockExplodeElectric.ogg b/core/assets/sounds/blockExplodeElectric.ogg new file mode 100644 index 0000000000..51ddc8f109 Binary files /dev/null and b/core/assets/sounds/blockExplodeElectric.ogg differ diff --git a/core/assets/sounds/blockExplodeElectricBig.ogg b/core/assets/sounds/blockExplodeElectricBig.ogg new file mode 100644 index 0000000000..af2008d9ad Binary files /dev/null and b/core/assets/sounds/blockExplodeElectricBig.ogg differ diff --git a/core/assets/sounds/blockExplodeExplosive.ogg b/core/assets/sounds/blockExplodeExplosive.ogg new file mode 100644 index 0000000000..62e6b2fd44 Binary files /dev/null and b/core/assets/sounds/blockExplodeExplosive.ogg differ diff --git a/core/assets/sounds/blockExplodeFlammable.ogg b/core/assets/sounds/blockExplodeFlammable.ogg new file mode 100644 index 0000000000..7c7c2185bf Binary files /dev/null and b/core/assets/sounds/blockExplodeFlammable.ogg differ diff --git a/core/assets/sounds/blockExplodeWall.ogg b/core/assets/sounds/blockExplodeWall.ogg new file mode 100644 index 0000000000..9b6564e81c Binary files /dev/null and b/core/assets/sounds/blockExplodeWall.ogg differ diff --git a/core/assets/sounds/boom.ogg b/core/assets/sounds/boom.ogg deleted file mode 100644 index 19f41d80b2..0000000000 Binary files a/core/assets/sounds/boom.ogg and /dev/null differ diff --git a/core/assets/sounds/cannon.ogg b/core/assets/sounds/cannon.ogg deleted file mode 100644 index c8ee4264ff..0000000000 Binary files a/core/assets/sounds/cannon.ogg and /dev/null differ diff --git a/core/assets/sounds/combustion.ogg b/core/assets/sounds/combustion.ogg index 6aab153a47..adc7177783 100644 Binary files a/core/assets/sounds/combustion.ogg and b/core/assets/sounds/combustion.ogg differ diff --git a/core/assets/sounds/explosionbig.ogg b/core/assets/sounds/explosionbig.ogg deleted file mode 100644 index 30cb7933f0..0000000000 Binary files a/core/assets/sounds/explosionbig.ogg and /dev/null differ diff --git a/core/assets/sounds/place.ogg b/core/assets/sounds/place.ogg deleted file mode 100644 index 29bcec7a9b..0000000000 Binary files a/core/assets/sounds/place.ogg and /dev/null differ diff --git a/core/assets/sounds/place1.ogg b/core/assets/sounds/place1.ogg new file mode 100644 index 0000000000..234da35916 Binary files /dev/null and b/core/assets/sounds/place1.ogg differ diff --git a/core/assets/sounds/place2.ogg b/core/assets/sounds/place2.ogg new file mode 100644 index 0000000000..1df9d38d27 Binary files /dev/null and b/core/assets/sounds/place2.ogg differ diff --git a/core/assets/sounds/place3.ogg b/core/assets/sounds/place3.ogg new file mode 100644 index 0000000000..b945911fe5 Binary files /dev/null and b/core/assets/sounds/place3.ogg differ diff --git a/core/assets/sounds/plasmaboom.ogg b/core/assets/sounds/plasmaBomb.ogg similarity index 100% rename from core/assets/sounds/plasmaboom.ogg rename to core/assets/sounds/plasmaBomb.ogg diff --git a/core/assets/sounds/reactorExplosion2.ogg b/core/assets/sounds/reactorExplosion2.ogg new file mode 100644 index 0000000000..539b4a0e95 Binary files /dev/null and b/core/assets/sounds/reactorExplosion2.ogg differ diff --git a/core/assets/sounds/respawn.ogg b/core/assets/sounds/respawn.ogg deleted file mode 100644 index b194989ebf..0000000000 Binary files a/core/assets/sounds/respawn.ogg and /dev/null differ diff --git a/core/assets/sounds/shootAfflict.ogg b/core/assets/sounds/shootAfflict.ogg new file mode 100644 index 0000000000..684d5e467f Binary files /dev/null and b/core/assets/sounds/shootAfflict.ogg differ diff --git a/core/assets/sounds/shootAvert.ogg b/core/assets/sounds/shootAvert.ogg new file mode 100644 index 0000000000..7397ba3ed6 Binary files /dev/null and b/core/assets/sounds/shootAvert.ogg differ diff --git a/core/assets/sounds/shootBig.ogg b/core/assets/sounds/shootBig.ogg deleted file mode 100644 index 9bc3bf055d..0000000000 Binary files a/core/assets/sounds/shootBig.ogg and /dev/null differ diff --git a/core/assets/sounds/shootAlt.ogg b/core/assets/sounds/shootBreach.ogg similarity index 100% rename from core/assets/sounds/shootAlt.ogg rename to core/assets/sounds/shootBreach.ogg diff --git a/core/assets/sounds/shootAltLong.ogg b/core/assets/sounds/shootDiffuse.ogg similarity index 100% rename from core/assets/sounds/shootAltLong.ogg rename to core/assets/sounds/shootDiffuse.ogg diff --git a/core/assets/sounds/shootDisperse.ogg b/core/assets/sounds/shootDisperse.ogg new file mode 100644 index 0000000000..414791a1f7 Binary files /dev/null and b/core/assets/sounds/shootDisperse.ogg differ diff --git a/core/assets/sounds/shootElude.ogg b/core/assets/sounds/shootElude.ogg new file mode 100644 index 0000000000..d35e1a987c Binary files /dev/null and b/core/assets/sounds/shootElude.ogg differ diff --git a/core/assets/sounds/shootMerui.ogg b/core/assets/sounds/shootMerui.ogg new file mode 100644 index 0000000000..1c933546d2 Binary files /dev/null and b/core/assets/sounds/shootMerui.ogg differ diff --git a/core/assets/sounds/swish.ogg b/core/assets/sounds/swish.ogg deleted file mode 100644 index 4b6e5eec53..0000000000 Binary files a/core/assets/sounds/swish.ogg and /dev/null differ diff --git a/core/assets/sounds/unitCreate.ogg b/core/assets/sounds/unitCreate.ogg index ba12fc4bff..2abc5a3f67 100644 Binary files a/core/assets/sounds/unitCreate.ogg and b/core/assets/sounds/unitCreate.ogg differ diff --git a/core/src/mindustry/audio/SoundPriority.java b/core/src/mindustry/audio/SoundPriority.java index f9c21b2df7..459eb0aaca 100644 --- a/core/src/mindustry/audio/SoundPriority.java +++ b/core/src/mindustry/audio/SoundPriority.java @@ -13,13 +13,17 @@ public class SoundPriority{ public static void init(){ max(7, laserbig, beam, laserbeam); - //priority 2: long weapon loops + //priority 2: long weapon loops and big explosions set( 2f, laserbig, beam, laserbeam, - beamPlasma + beamPlasma, + reactorExplosion, + reactorExplosion2, + coreExplode, + blockExplodeElectricBig, blockExplodeExplosive ); //priority 1.5: big weapon sounds, not loops diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index a133f59029..8a1d8e91a4 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -4402,7 +4402,7 @@ public class Blocks{ ); coolantMultiplier = 15f; - shootSound = Sounds.shootAlt; + shootSound = Sounds.shootBreach; targetUnderBlocks = false; shake = 1f; @@ -4489,7 +4489,7 @@ public class Blocks{ consumeAmmoOnce = true; targetUnderBlocks = false; - shootSound = Sounds.shootAltLong; + shootSound = Sounds.shootDiffuse; drawer = new DrawTurret("reinforced-"){{ parts.add(new RegionPart("-front"){{ @@ -4917,7 +4917,7 @@ public class Blocks{ rotateSpeed = 5f; shootCone = 30f; consumeAmmoOnce = true; - shootSound = Sounds.shootBig; + shootSound = Sounds.shootDisperse; drawer = new DrawTurret("reinforced-"){{ parts.add(new RegionPart("-side"){{ @@ -5005,10 +5005,9 @@ public class Blocks{ waveStroke = 4f; waveRad = 40f; }}; - despawnSound = Sounds.dullExplosion; - //TODO shoot sound - shootSound = Sounds.cannon; + despawnSound = Sounds.afflictExplosion; + shootSound = Sounds.shootAfflict; fragBullet = intervalBullet = new BasicBulletType(3f, 35){{ width = 9f; diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index 46d029ea7a..573e66ed8b 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -1485,7 +1485,7 @@ public class UnitTypes{ frontColor = Color.white; mixColorTo = Color.white; - hitSound = Sounds.plasmaboom; + hitSound = Sounds.plasmaBomb; shootCone = 180f; ejectEffect = Fx.none; @@ -3104,7 +3104,7 @@ public class UnitTypes{ researchCostMultiplier = 0f; weapons.add(new Weapon("merui-weapon"){{ - shootSound = Sounds.missile; + shootSound = Sounds.shootMerui; mirror = false; showStatSprite = false; x = 0f; @@ -3744,7 +3744,7 @@ public class UnitTypes{ } weapons.add(new Weapon("elude-weapon"){{ - shootSound = Sounds.blaster; + shootSound = Sounds.shootElude; y = -2f; x = 4f; top = true; @@ -3792,7 +3792,7 @@ public class UnitTypes{ ); weapons.add(new Weapon("avert-weapon"){{ - shootSound = Sounds.blaster; + shootSound = Sounds.shootAvert; reload = 35f; x = 0f; y = 6.5f; @@ -3881,7 +3881,7 @@ public class UnitTypes{ }}); smokeEffect = Fx.shootSmokeTitan; hitColor = Pal.sapBullet; - despawnSound = Sounds.spark; + despawnSound = Sounds.artilleryShockExplosion; sprite = "large-orb"; trailEffect = Fx.missileTrail; diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index cdc819a09d..794b720c82 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -1452,7 +1452,6 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, /** Called when the block is destroyed. The tile is still intact at this stage. */ public void onDestroyed(){ - float explosiveness = block.baseExplosiveness; float flammability = 0f; float power = 0f; @@ -1476,7 +1475,6 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, } if(block.hasLiquids && state.rules.damageExplosions){ - liquids.each(this::splashLiquid); } @@ -1486,6 +1484,26 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, if(block.createRubble && !floor().solid && !floor().isLiquid){ Effect.rubble(x, y, block.size); } + + if(!headless){ + playDestroySound(); + + if(explosiveness > 40f){ + Sounds.blockExplodeExplosive.at(tile, Mathf.random(block.destroyPitchMin, block.destroyPitchMax), block.destroySoundVolume); + }else if(flammability > 5f){ + Sounds.blockExplodeFlammable.at(tile, Mathf.random(block.destroyPitchMin, block.destroyPitchMax), block.destroySoundVolume); + } + + if(power > 30000f){ + Sounds.blockExplodeElectricBig.at(tile, Mathf.random(block.destroyPitchMin, block.destroyPitchMax), block.destroySoundVolume); + }else if(power > 2000f){ + Sounds.blockExplodeElectric.at(tile, Mathf.random(block.destroyPitchMin, block.destroyPitchMax), block.destroySoundVolume); + } + } + } + + public void playDestroySound(){ + block.destroySound.at(tile, Mathf.random(block.destroyPitchMin, block.destroyPitchMax), block.destroySoundVolume); } public String getDisplayName(){ @@ -2178,7 +2196,6 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, public void killed(){ dead = true; Events.fire(new BlockDestroyEvent(tile)); - if(!headless) playDestroySound(); onDestroyed(); if(tile != emptyTile){ tile.remove(); @@ -2187,10 +2204,6 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, afterDestroyed(); } - public void playDestroySound(){ - block.destroySound.at(tile, Mathf.random(block.destroyPitchMin, block.destroyPitchMax), block.destroySoundVolume); - } - public void checkAllowUpdate(){ if(!allowUpdate()){ enabled = false; diff --git a/core/src/mindustry/logic/GlobalVars.java b/core/src/mindustry/logic/GlobalVars.java index ab39bad8be..1921400be9 100644 --- a/core/src/mindustry/logic/GlobalVars.java +++ b/core/src/mindustry/logic/GlobalVars.java @@ -96,7 +96,7 @@ public class GlobalVars{ //sounds if(Core.assets != null){ for(Sound sound : Core.assets.getAll(Sound.class, new Seq<>(Sound.class))){ - if(sound != Sounds.none && sound != Sounds.swish && sound.file != null){ + if(sound != Sounds.none && sound.file != null){ String name = sound.file.nameWithoutExtension(); soundNames.add(name); put("@sfx-" + name, Sounds.getSoundId(sound)); diff --git a/core/src/mindustry/logic/LExecutor.java b/core/src/mindustry/logic/LExecutor.java index 5d4a6f15df..f036bad977 100644 --- a/core/src/mindustry/logic/LExecutor.java +++ b/core/src/mindustry/logic/LExecutor.java @@ -2004,7 +2004,7 @@ public class LExecutor{ @Override public void run(LExecutor exec){ Sound sound = Sounds.getSound(id.numi()); - if(sound == null || sound == Sounds.swish) sound = Sounds.none; //no. + if(sound == null) sound = Sounds.none; if(positional){ sound.at(World.unconv(x.numf()), World.unconv(y.numf()), pitch.numf(), Math.min(volume.numf(), 2f), limit.bool()); diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index d8d32c0cc6..8ffc83ed14 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -309,11 +309,11 @@ public class Block extends UnlockableContent implements Senseable{ /** Should the sound made when this block is deconstructed change in pitch. */ public boolean breakPitchChange = true; /** Sound made when this block is built. */ - public Sound placeSound = Sounds.place; + public Sound placeSound = Sounds.unset; /** Sound made when this block is deconstructed. */ public Sound breakSound = Sounds.breaks; /** Sounds made when this block is destroyed.*/ - public Sound destroySound = Sounds.boom; + public Sound destroySound = Sounds.unset; /** Volume of destruction sound. */ public float destroySoundVolume = 1f; /** Range of destroy sound. */ @@ -1260,6 +1260,20 @@ public class Block extends UnlockableContent implements Senseable{ public void init(){ super.init(); + if(destroySound == Sounds.unset){ + destroySound = + size >= 3 ? Sounds.blockExplode3 : + size >= 2 ? Sounds.blockExplode2 : + Sounds.blockExplode1; + } + + if(placeSound == Sounds.unset){ + placeSound = + size >= 3 ? Sounds.place3 : + size >= 2 ? Sounds.place2 : + Sounds.place1; + } + //disable standard shadow if(customShadow){ hasShadow = false; diff --git a/core/src/mindustry/world/blocks/defense/Wall.java b/core/src/mindustry/world/blocks/defense/Wall.java index 03b919f795..7e3a3ae9a1 100644 --- a/core/src/mindustry/world/blocks/defense/Wall.java +++ b/core/src/mindustry/world/blocks/defense/Wall.java @@ -41,6 +41,7 @@ public class Wall extends Block{ //it's a wall of course it's supported everywhere envEnabled = Env.any; + destroySound = Sounds.blockExplodeWall; } @Override diff --git a/core/src/mindustry/world/blocks/power/ImpactReactor.java b/core/src/mindustry/world/blocks/power/ImpactReactor.java index 136cf66b46..03795fe837 100644 --- a/core/src/mindustry/world/blocks/power/ImpactReactor.java +++ b/core/src/mindustry/world/blocks/power/ImpactReactor.java @@ -38,7 +38,7 @@ public class ImpactReactor extends PowerGenerator{ explosionDamage = 1900 * 4; explosionMinWarmup = 0.3f; explodeEffect = Fx.impactReactorExplosion; - explodeSound = Sounds.explosionbig; + explodeSound = Sounds.reactorExplosion2; } @Override diff --git a/core/src/mindustry/world/blocks/power/VariableReactor.java b/core/src/mindustry/world/blocks/power/VariableReactor.java index 2f8d81dd0f..ad5d27d913 100644 --- a/core/src/mindustry/world/blocks/power/VariableReactor.java +++ b/core/src/mindustry/world/blocks/power/VariableReactor.java @@ -41,7 +41,7 @@ public class VariableReactor extends PowerGenerator{ explosionRadius = 16; explosionDamage = 1500; explodeEffect = new MultiEffect(Fx.bigShockwave, new WrapEffect(Fx.titanSmoke, Color.valueOf("e3ae6f"))); - explodeSound = Sounds.explosionbig; + explodeSound = Sounds.reactorExplosion2; explosionPuddles = 70; explosionPuddleRange = tilesize * 6f;