More sound effects

This commit is contained in:
Anuken
2025-12-09 00:22:48 -05:00
parent 2fb59eb099
commit f53abd0b3d
42 changed files with 62 additions and 28 deletions

View File

@@ -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

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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));

View File

@@ -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());

View File

@@ -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;

View File

@@ -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

View File

@@ -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

View File

@@ -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;