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
+26
View File
@@ -262,6 +262,32 @@ public class Effect{
decal(region, x, y, Mathf.random(4) * 90, 3600, Pal.rubble);
}
public static void shockwaveDust(float x, float y, float rad){
shockwaveDust(x, y, rad, 1f);
}
public static void shockwaveDust(float x, float y, float rad, float density){
float spacing = 12f;
int waves = Math.max(1, Mathf.ceil(rad / spacing));
for(int i = 0; i < waves; i++){
int fi = i;
Time.run(i * 3.5f, () -> {
float radius = 1 + spacing * fi;
int rays = Mathf.ceil(radius * Mathf.PI * 2f / 6f * density);
for(int r = 0; r < rays; r++){
if(Mathf.chance(0.7f - fi * 0.02f)){
float angle = r * 360f / (float)rays;
float ox = Angles.trnsx(angle, radius), oy = Angles.trnsy(angle, radius);
Tile t = world.tileWorld(x + ox, y + oy);
if(t != null){
Fx.podLandDust.at(t.worldx(), t.worldy(), angle + Mathf.range(30f), Tmp.c1.set(t.floor().mapColor).mul(1.7f + Mathf.range(0.15f)));
}
}
}
});
}
}
public static class EffectContainer implements Scaled{
public float x, y, time, lifetime, rotation;
public Color color;
@@ -1,6 +1,8 @@
package mindustry.entities.abilities;
import arc.*;
import arc.audio.*;
import arc.math.*;
import arc.scene.ui.layout.*;
import arc.util.*;
import mindustry.content.*;
@@ -13,6 +15,8 @@ public class RepairFieldAbility extends Ability{
public float amount = 1, reload = 100, range = 60, healPercent = 0f;
public Effect healEffect = Fx.heal;
public Effect activeEffect = Fx.healWaveDynamic;
public Sound sound = Sounds.healAbility;
public float soundVolume = 0.5f;
public boolean parentizeEffects = false;
/** Multiplies healing to units of the same type by this amount. */
public float sameTypeHealMult = 1f;
@@ -69,6 +73,7 @@ public class RepairFieldAbility extends Ability{
if(wasHealed){
activeEffect.at(unit, range);
sound.at(unit, 1f + Mathf.range(0.1f), soundVolume);
}
timer = 0f;
@@ -161,6 +161,10 @@ public class BulletType extends Content implements Cloneable{
public float healPercent = 0f;
/** flat amount of block health healed */
public float healAmount = 0f;
/** sound played when a block is healed */
public Sound healSound = Sounds.blockHeal;
/** volume of heal sound */
public float healSoundVolume = 0.9f;
/** Fraction of bullet damage that heals that shooter. */
public float lifesteal = 0f;
/** Whether to make fire on impact */
@@ -442,6 +446,7 @@ public class BulletType extends Content implements Cloneable{
if(heals() && build.team == b.team && !(build.block instanceof ConstructBlock)){
healEffect.at(build.x, build.y, 0f, healColor, build.block);
build.heal(healPercent / 100f * build.maxHealth + healAmount);
healSound.at(build, 1f + Mathf.range(0.1f), healSoundVolume);
hit(b);
}else if(build.team != b.team && direct){
@@ -2178,7 +2178,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
public void killed(){
dead = true;
Events.fire(new BlockDestroyEvent(tile));
block.destroySound.at(tile, Mathf.random(block.destroyPitchMin, block.destroyPitchMax));
if(!headless) playDestroySound();
onDestroyed();
if(tile != emptyTile){
tile.remove();
@@ -2187,6 +2187,10 @@ 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;