diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index 37add5f7f5..6c28f04fb6 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -126,7 +126,7 @@ public class Block extends UnlockableContent{ public BlockGroup group = BlockGroup.none; /** List of block flags. Used for AI indexing. */ public EnumSet flags = EnumSet.of(); - /** Targeting priority of this block, as seen by enemies.*/ + /** Targeting priority of this block, as seen by enemies .*/ public TargetPriority priority = TargetPriority.base; /** How much this block affects the unit cap by. * The block flags must contain unitModifier in order for this to work. */ @@ -139,9 +139,9 @@ public class Block extends UnlockableContent{ public boolean consumesTap; /** Whether to draw the glow of the liquid for this block, if it has one. */ public boolean drawLiquidLight = true; - /** Whether to periodically sync this block across the network.*/ + /** Whether to periodically sync this block across the network. */ public boolean sync; - /** Whether this block uses conveyor-type placement mode.*/ + /** Whether this block uses conveyor-type placement mode. */ public boolean conveyorPlacement; /** * The color of this block when displayed on the minimap or map preview. @@ -173,12 +173,12 @@ public class Block extends UnlockableContent{ /** Radius of the light emitted by this block. */ public float lightRadius = 60f; - /** The sound that this block makes while active. One sound loop. Do not overuse.*/ + /** The sound that this block makes while active. One sound loop. Do not overuse. */ public Sound loopSound = Sounds.none; /** Active sound base volume. */ public float loopSoundVolume = 0.5f; - /** The sound that this block makes while idle. Uses one sound loop for all blocks.*/ + /** The sound that this block makes while idle. Uses one sound loop for all blocks. */ public Sound ambientSound = Sounds.none; /** Idle sound base volume. */ public float ambientSoundVolume = 0.05f; @@ -193,6 +193,8 @@ public class Block extends UnlockableContent{ public BuildVisibility buildVisibility = BuildVisibility.hidden; /** Multiplier for speed of building this block. */ public float buildCostMultiplier = 1f; + /** Build completion at which deconstruction finishes. */ + public float deconstructThreshold = 0f; /** Multiplier for cost of research in tech tree. */ public float researchCostMultiplier = 1; /** Whether this block has instant transfer.*/ diff --git a/core/src/mindustry/world/blocks/ConstructBlock.java b/core/src/mindustry/world/blocks/ConstructBlock.java index c99f36f36b..17210fefe3 100644 --- a/core/src/mindustry/world/blocks/ConstructBlock.java +++ b/core/src/mindustry/world/blocks/ConstructBlock.java @@ -289,7 +289,7 @@ public class ConstructBlock extends Block{ progress = Mathf.clamp(progress - amount); - if(progress <= 0 || state.rules.infiniteResources){ + if(progress <= (previous == null ? 0 : previous.deconstructThreshold) || state.rules.infiniteResources){ if(lastBuilder == null) lastBuilder = builder; Call.deconstructFinish(tile, this.cblock == null ? previous : this.cblock, lastBuilder); } diff --git a/core/src/mindustry/world/blocks/environment/Boulder.java b/core/src/mindustry/world/blocks/environment/Boulder.java index 28893d22d4..3d2cd2efa1 100644 --- a/core/src/mindustry/world/blocks/environment/Boulder.java +++ b/core/src/mindustry/world/blocks/environment/Boulder.java @@ -12,6 +12,8 @@ public class Boulder extends Block{ super(name); breakable = true; alwaysReplace = true; + + deconstructThreshold = 0.35f; } @Override