From 81753047ebc4fe95f6397490ac5388b964e58df9 Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Wed, 8 Jun 2022 05:58:53 -0700 Subject: [PATCH] drawCracks and createRubble (#6989) --- core/src/mindustry/entities/comp/BuildingComp.java | 4 ++-- core/src/mindustry/world/Block.java | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index 67bb98165b..77b5da267b 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -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); } } diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index 827782cd85..cee89e4d1c 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -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 */