More sound effects + core destruction sound

This commit is contained in:
Anuken
2025-12-06 23:14:08 -05:00
parent 65c63c292e
commit e255912156
19 changed files with 130 additions and 8 deletions
+2
View File
@@ -314,6 +314,8 @@ public class Block extends UnlockableContent implements Senseable{
public Sound breakSound = Sounds.breaks;
/** Sounds made when this block is destroyed.*/
public Sound destroySound = Sounds.boom;
/** Volume of destruction sound. */
public float destroySoundVolume = 1f;
/** Range of destroy sound. */
public float destroyPitchMin = 1f, destroyPitchMax = 1f;
/** How reflective this block is. */
@@ -354,7 +354,7 @@ public class Accelerator extends Block{
float spacing = 12f;
for(int i = 0; i < 13; i++){
int fi = i;
Time.run(i * 1.1f, () -> {
Time.run(i * 2f, () -> {
float radius = block.size/2f + 1 + spacing * fi;
int rays = Mathf.ceil(radius * Mathf.PI * 2f / 6f);
for(int r = 0; r < rays; r++){
@@ -369,8 +369,6 @@ public class Accelerator extends Block{
}
});
}
});
}
@@ -1,5 +1,6 @@
package mindustry.world.blocks.defense;
import arc.audio.*;
import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.math.*;
@@ -28,6 +29,10 @@ public class MendProjector extends Block{
public float phaseBoost = 12f;
public float phaseRangeBoost = 50f;
public float useTime = 400f;
public Sound mendSound = Sounds.healAbility;
public float mendSoundVolume = 0.5f;
private boolean any = false;
public MendProjector(String name){
super(name);
@@ -69,7 +74,7 @@ public class MendProjector extends Block{
@Override
public void drawPlace(int x, int y, int rotation, boolean valid){
super.drawPlace(x, y, rotation, valid);
Drawf.dashCircle(x * tilesize + offset, y * tilesize + offset, range, baseColor);
indexer.eachBlock(player.team(), x * tilesize + offset, y * tilesize + offset, range, other -> true, other -> Drawf.selected(other, Tmp.c1.set(baseColor).a(Mathf.absin(4f, 1f))));
@@ -101,11 +106,18 @@ public class MendProjector extends Block{
float realRange = range + phaseHeat * phaseRangeBoost;
charge = 0f;
any = false;
indexer.eachBlock(this, realRange, b -> b.damaged() && !b.isHealSuppressed(), other -> {
other.heal(other.maxHealth() * (healPercent + phaseHeat * phaseBoost) / 100f * efficiency);
other.recentlyHealed();
Fx.healBlockFull.at(other.x, other.y, other.block.size, baseColor, other.block);
any = true;
});
if(any){
mendSound.at(this, 1f + Mathf.range(0.1f), mendSoundVolume);
}
}
}
@@ -82,6 +82,8 @@ public class CoreBlock extends StorageBlock{
//support everything
replaceable = false;
destroySound = Sounds.coreExplode;
destroySoundVolume = 1.6f;
}
@Remote(called = Loc.server)
@@ -621,6 +623,9 @@ public class CoreBlock extends StorageBlock{
super.onDestroyed();
}
Effect.shockwaveDust(x, y, 40f + block.size * tilesize, 0.5f);
Fx.coreExplosion.at(x, y, team.color);
//add a spawn to the map for future reference - waves should be disabled, so it shouldn't matter
if(state.isCampaign() && team == state.rules.waveTeam && team.cores().size <= 1 && spawner.getSpawns().size == 0 && state.rules.sector.planet.enemyCoreSpawnReplace){
//do not recache
@@ -634,6 +639,16 @@ public class CoreBlock extends StorageBlock{
Events.fire(new CoreChangeEvent(this));
}
@Override
public void playDestroySound(){
if(team.data().cores.size <= 1 && player != null && player.team() == team && state.rules.canGameOver){
//play at full volume when doing a game over
block.destroySound.play(block.destroySoundVolume, Mathf.random(block.destroyPitchMin, block.destroyPitchMax), 0f);
}else{
super.playDestroySound();
}
}
@Override
public void afterDestroyed(){
super.afterDestroyed();
@@ -63,6 +63,8 @@ public class RepairTurret extends Block{
group = BlockGroup.projectors;
envEnabled |= Env.space;
ambientSound = Sounds.healBeam;
ambientSoundVolume = 1f;
}
@Override
@@ -176,6 +178,11 @@ public class RepairTurret extends Block{
Drawf.dashCircle(x, y, repairRadius, Pal.accent);
}
@Override
public boolean shouldAmbientSound(){
return target != null && efficiency > 0f;
}
@Override
public void updateTile(){
float multiplier = 1f;