drawCracks and createRubble (#6989)

This commit is contained in:
MEEPofFaith
2022-06-08 05:58:53 -07:00
committed by GitHub
parent 91643d94c4
commit 81753047eb
2 changed files with 6 additions and 2 deletions

View File

@@ -1108,7 +1108,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
}
public void drawCracks(){
if(!damaged() || block.size > BlockRenderer.maxCrackSize) return;
if(!block.drawCracks || !damaged() || block.size > BlockRenderer.maxCrackSize) return;
int id = pos();
TextureRegion region = renderer.blocks.cracks[block.size - 1][Mathf.clamp((int)((1f - healthf()) * BlockRenderer.crackRegions), 0, BlockRenderer.crackRegions-1)];
Draw.colorl(0.2f, 0.1f + (1f - healthf())* 0.6f);
@@ -1322,7 +1322,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
Damage.dynamicExplosion(x, y, flammability, explosiveness * 3.5f, power, tilesize * block.size / 2f, state.rules.damageExplosions, block.destroyEffect);
if(!floor().solid && !floor().isLiquid){
if(block.createRubble && !floor().solid && !floor().isLiquid){
Effect.rubble(x, y, block.size);
}
}

View File

@@ -166,6 +166,10 @@ public class Block extends UnlockableContent implements Senseable{
public float baseExplosiveness = 0f;
/** bullet that this block spawns when destroyed */
public @Nullable BulletType destroyBullet = null;
/** whether cracks are drawn when this block is damaged */
public boolean drawCracks = true;
/** whether rubble is created when this block is destroyed */
public boolean createRubble = true;
/** whether this block can be placed on edges of liquids. */
public boolean floating = false;
/** multiblock size */