Reset breaking progress when changing blocks

This commit is contained in:
2026-10-07 17:32:14 -03:00
parent 4f8fef6ca2
commit ff53d30a7e
+5
View File
@@ -36,6 +36,11 @@ export class MultiPlayerGameMode {
const block_info = EverythingRegistry.get_by_id<BlockRegistry>("blocks", hit.block)!;
const tool = this.#held_item()?.tool;
// looking at another block starts it over
const pos = this.destroy_pos;
if (!pos || pos.x !== hit.x || pos.y !== hit.y || pos.z !== hit.z) {
this.destroy_progress = 0;
}
this.destroy_pos = { x: hit.x, y: hit.y, z: hit.z };
this.destroy_time = block_info.toughness ?? 9999;
this.destroy_progress += TICK_DELTA * (tool && tool.type === block_info.tool_to_break ? tool.speed : 1);