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

@@ -183,8 +183,11 @@ public class AssetsProcess extends BaseProcessor{
} }
if(classname.equals("Sounds")){ 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), "none", Modifier.STATIC, Modifier.PUBLIC).initializer("new " + rtype + "()")
type.addField(FieldSpec.builder(ClassName.bestGuess(rtype), "unset", Modifier.STATIC, Modifier.PUBLIC).initializer("new " + rtype + "()").build()); .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()); type.addMethod(loadBegin.build());

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.

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.

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

@@ -13,13 +13,17 @@ public class SoundPriority{
public static void init(){ public static void init(){
max(7, laserbig, beam, laserbeam); max(7, laserbig, beam, laserbeam);
//priority 2: long weapon loops //priority 2: long weapon loops and big explosions
set( set(
2f, 2f,
laserbig, laserbig,
beam, beam,
laserbeam, laserbeam,
beamPlasma beamPlasma,
reactorExplosion,
reactorExplosion2,
coreExplode,
blockExplodeElectricBig, blockExplodeExplosive
); );
//priority 1.5: big weapon sounds, not loops //priority 1.5: big weapon sounds, not loops

View File

@@ -4402,7 +4402,7 @@ public class Blocks{
); );
coolantMultiplier = 15f; coolantMultiplier = 15f;
shootSound = Sounds.shootAlt; shootSound = Sounds.shootBreach;
targetUnderBlocks = false; targetUnderBlocks = false;
shake = 1f; shake = 1f;
@@ -4489,7 +4489,7 @@ public class Blocks{
consumeAmmoOnce = true; consumeAmmoOnce = true;
targetUnderBlocks = false; targetUnderBlocks = false;
shootSound = Sounds.shootAltLong; shootSound = Sounds.shootDiffuse;
drawer = new DrawTurret("reinforced-"){{ drawer = new DrawTurret("reinforced-"){{
parts.add(new RegionPart("-front"){{ parts.add(new RegionPart("-front"){{
@@ -4917,7 +4917,7 @@ public class Blocks{
rotateSpeed = 5f; rotateSpeed = 5f;
shootCone = 30f; shootCone = 30f;
consumeAmmoOnce = true; consumeAmmoOnce = true;
shootSound = Sounds.shootBig; shootSound = Sounds.shootDisperse;
drawer = new DrawTurret("reinforced-"){{ drawer = new DrawTurret("reinforced-"){{
parts.add(new RegionPart("-side"){{ parts.add(new RegionPart("-side"){{
@@ -5005,10 +5005,9 @@ public class Blocks{
waveStroke = 4f; waveStroke = 4f;
waveRad = 40f; waveRad = 40f;
}}; }};
despawnSound = Sounds.dullExplosion;
//TODO shoot sound despawnSound = Sounds.afflictExplosion;
shootSound = Sounds.cannon; shootSound = Sounds.shootAfflict;
fragBullet = intervalBullet = new BasicBulletType(3f, 35){{ fragBullet = intervalBullet = new BasicBulletType(3f, 35){{
width = 9f; width = 9f;

View File

@@ -1485,7 +1485,7 @@ public class UnitTypes{
frontColor = Color.white; frontColor = Color.white;
mixColorTo = Color.white; mixColorTo = Color.white;
hitSound = Sounds.plasmaboom; hitSound = Sounds.plasmaBomb;
shootCone = 180f; shootCone = 180f;
ejectEffect = Fx.none; ejectEffect = Fx.none;
@@ -3104,7 +3104,7 @@ public class UnitTypes{
researchCostMultiplier = 0f; researchCostMultiplier = 0f;
weapons.add(new Weapon("merui-weapon"){{ weapons.add(new Weapon("merui-weapon"){{
shootSound = Sounds.missile; shootSound = Sounds.shootMerui;
mirror = false; mirror = false;
showStatSprite = false; showStatSprite = false;
x = 0f; x = 0f;
@@ -3744,7 +3744,7 @@ public class UnitTypes{
} }
weapons.add(new Weapon("elude-weapon"){{ weapons.add(new Weapon("elude-weapon"){{
shootSound = Sounds.blaster; shootSound = Sounds.shootElude;
y = -2f; y = -2f;
x = 4f; x = 4f;
top = true; top = true;
@@ -3792,7 +3792,7 @@ public class UnitTypes{
); );
weapons.add(new Weapon("avert-weapon"){{ weapons.add(new Weapon("avert-weapon"){{
shootSound = Sounds.blaster; shootSound = Sounds.shootAvert;
reload = 35f; reload = 35f;
x = 0f; x = 0f;
y = 6.5f; y = 6.5f;
@@ -3881,7 +3881,7 @@ public class UnitTypes{
}}); }});
smokeEffect = Fx.shootSmokeTitan; smokeEffect = Fx.shootSmokeTitan;
hitColor = Pal.sapBullet; hitColor = Pal.sapBullet;
despawnSound = Sounds.spark; despawnSound = Sounds.artilleryShockExplosion;
sprite = "large-orb"; sprite = "large-orb";
trailEffect = Fx.missileTrail; 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. */ /** Called when the block is destroyed. The tile is still intact at this stage. */
public void onDestroyed(){ public void onDestroyed(){
float explosiveness = block.baseExplosiveness; float explosiveness = block.baseExplosiveness;
float flammability = 0f; float flammability = 0f;
float power = 0f; float power = 0f;
@@ -1476,7 +1475,6 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
} }
if(block.hasLiquids && state.rules.damageExplosions){ if(block.hasLiquids && state.rules.damageExplosions){
liquids.each(this::splashLiquid); liquids.each(this::splashLiquid);
} }
@@ -1486,6 +1484,26 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
if(block.createRubble && !floor().solid && !floor().isLiquid){ if(block.createRubble && !floor().solid && !floor().isLiquid){
Effect.rubble(x, y, block.size); 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(){ public String getDisplayName(){
@@ -2178,7 +2196,6 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
public void killed(){ public void killed(){
dead = true; dead = true;
Events.fire(new BlockDestroyEvent(tile)); Events.fire(new BlockDestroyEvent(tile));
if(!headless) playDestroySound();
onDestroyed(); onDestroyed();
if(tile != emptyTile){ if(tile != emptyTile){
tile.remove(); tile.remove();
@@ -2187,10 +2204,6 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
afterDestroyed(); afterDestroyed();
} }
public void playDestroySound(){
block.destroySound.at(tile, Mathf.random(block.destroyPitchMin, block.destroyPitchMax), block.destroySoundVolume);
}
public void checkAllowUpdate(){ public void checkAllowUpdate(){
if(!allowUpdate()){ if(!allowUpdate()){
enabled = false; enabled = false;

View File

@@ -96,7 +96,7 @@ public class GlobalVars{
//sounds //sounds
if(Core.assets != null){ if(Core.assets != null){
for(Sound sound : Core.assets.getAll(Sound.class, new Seq<>(Sound.class))){ 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(); String name = sound.file.nameWithoutExtension();
soundNames.add(name); soundNames.add(name);
put("@sfx-" + name, Sounds.getSoundId(sound)); put("@sfx-" + name, Sounds.getSoundId(sound));

View File

@@ -2004,7 +2004,7 @@ public class LExecutor{
@Override @Override
public void run(LExecutor exec){ public void run(LExecutor exec){
Sound sound = Sounds.getSound(id.numi()); Sound sound = Sounds.getSound(id.numi());
if(sound == null || sound == Sounds.swish) sound = Sounds.none; //no. if(sound == null) sound = Sounds.none;
if(positional){ if(positional){
sound.at(World.unconv(x.numf()), World.unconv(y.numf()), pitch.numf(), Math.min(volume.numf(), 2f), limit.bool()); 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. */ /** Should the sound made when this block is deconstructed change in pitch. */
public boolean breakPitchChange = true; public boolean breakPitchChange = true;
/** Sound made when this block is built. */ /** Sound made when this block is built. */
public Sound placeSound = Sounds.place; public Sound placeSound = Sounds.unset;
/** Sound made when this block is deconstructed. */ /** Sound made when this block is deconstructed. */
public Sound breakSound = Sounds.breaks; public Sound breakSound = Sounds.breaks;
/** Sounds made when this block is destroyed.*/ /** Sounds made when this block is destroyed.*/
public Sound destroySound = Sounds.boom; public Sound destroySound = Sounds.unset;
/** Volume of destruction sound. */ /** Volume of destruction sound. */
public float destroySoundVolume = 1f; public float destroySoundVolume = 1f;
/** Range of destroy sound. */ /** Range of destroy sound. */
@@ -1260,6 +1260,20 @@ public class Block extends UnlockableContent implements Senseable{
public void init(){ public void init(){
super.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 //disable standard shadow
if(customShadow){ if(customShadow){
hasShadow = false; hasShadow = false;

View File

@@ -41,6 +41,7 @@ public class Wall extends Block{
//it's a wall of course it's supported everywhere //it's a wall of course it's supported everywhere
envEnabled = Env.any; envEnabled = Env.any;
destroySound = Sounds.blockExplodeWall;
} }
@Override @Override

View File

@@ -38,7 +38,7 @@ public class ImpactReactor extends PowerGenerator{
explosionDamage = 1900 * 4; explosionDamage = 1900 * 4;
explosionMinWarmup = 0.3f; explosionMinWarmup = 0.3f;
explodeEffect = Fx.impactReactorExplosion; explodeEffect = Fx.impactReactorExplosion;
explodeSound = Sounds.explosionbig; explodeSound = Sounds.reactorExplosion2;
} }
@Override @Override

View File

@@ -41,7 +41,7 @@ public class VariableReactor extends PowerGenerator{
explosionRadius = 16; explosionRadius = 16;
explosionDamage = 1500; explosionDamage = 1500;
explodeEffect = new MultiEffect(Fx.bigShockwave, new WrapEffect(Fx.titanSmoke, Color.valueOf("e3ae6f"))); explodeEffect = new MultiEffect(Fx.bigShockwave, new WrapEffect(Fx.titanSmoke, Color.valueOf("e3ae6f")));
explodeSound = Sounds.explosionbig; explodeSound = Sounds.reactorExplosion2;
explosionPuddles = 70; explosionPuddles = 70;
explosionPuddleRange = tilesize * 6f; explosionPuddleRange = tilesize * 6f;