New sound for rock/plant breaking

This commit is contained in:
Anuken
2021-07-14 17:22:21 -04:00
parent ac25e17286
commit dd5389c738
7 changed files with 11 additions and 5 deletions

View File

@@ -368,6 +368,7 @@ public class Blocks implements ContentList{
sporeCluster = new Prop("spore-cluster"){{
variants = 3;
breakSound = Sounds.plantBreak;
}};
boulder = new Prop("boulder"){{

View File

@@ -1442,7 +1442,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
@Override
public void killed(){
Events.fire(new BlockDestroyEvent(tile));
block.breakSound.at(tile);
block.destroySound.at(tile);
onDestroyed();
tile.remove();
remove();

View File

@@ -190,8 +190,10 @@ public class Block extends UnlockableContent{
public int outlinedIcon = -1;
/** Whether this block has a shadow under it. */
public boolean hasShadow = true;
/** Sounds made when this block breaks.*/
public Sound breakSound = Sounds.boom;
/** Sounds made when this block is destroyed.*/
public Sound destroySound = Sounds.boom;
/** Sound made when this block is deconstructed. */
public Sound breakSound = Sounds.breaks;
/** How reflective this block is. */
public float albedo = 0f;
/** Environmental passive light color. */

View File

@@ -47,7 +47,7 @@ public class ConstructBlock extends Block{
/** Returns a ConstructBlock by size. */
public static ConstructBlock get(int size){
if(size > maxBlockSize) throw new IllegalArgumentException("No. Don't place ConstructBlock of size greater than " + maxBlockSize);
if(size > maxBlockSize) throw new IllegalArgumentException("No. Don't place ConstructBlocks of size greater than " + maxBlockSize);
return consBlocks[size - 1];
}
@@ -57,7 +57,7 @@ public class ConstructBlock extends Block{
block.breakEffect.at(tile.drawx(), tile.drawy(), block.size, block.mapColor);
Events.fire(new BlockBuildEndEvent(tile, builder, team, true, null));
tile.remove();
if(shouldPlay()) Sounds.breaks.at(tile, calcPitch(false));
if(shouldPlay()) block.breakSound.at(tile, calcPitch(false));
}
@Remote(called = Loc.server)

View File

@@ -4,15 +4,18 @@ import arc.*;
import arc.graphics.g2d.*;
import arc.math.*;
import mindustry.content.*;
import mindustry.gen.*;
import mindustry.world.*;
public class Prop extends Block{
public Prop(String name){
super(name);
breakable = true;
alwaysReplace = true;
instantDeconstruct = true;
breakEffect = Fx.breakProp;
breakSound = Sounds.rockBreak;
}
@Override