diff --git a/lib/plugins/digging.js b/lib/plugins/digging.js index 5ee3f10ed..8537c28be 100644 --- a/lib/plugins/digging.js +++ b/lib/plugins/digging.js @@ -17,11 +17,9 @@ function inject (bot) { bot.lastHeldItemName = '' if (bot.heldItem) { bot.lastHeldItemName = bot.heldItem.name } bot.on('heldItemChanged', () => { - // if (bot.heldItem) {console.log("this why " + bot.heldItem.name);} - // if (!bot.heldItem) {console.log("this why " + bot.heldItem);} let nameToCompare = '' if (bot.heldItem) { nameToCompare = bot.heldItem.name } - if (bot.lastHeldItemName != nameToCompare) { + if (bot.lastHeldItemName !== nameToCompare) { bot.lastHeldItemName = nameToCompare bot.digPercentage = 0 } @@ -111,18 +109,10 @@ function inject (bot) { location: block.position, face: diggingFace // default face is 1 (top) }) - const waitTime = bot.digTime(block) - // waitInterval = setTimeout(finishDigging, waitTime) if (waitInterval) { clearInterval(waitInterval) } - // bot.digPercentage = (50 / bot.digTime(block)); - // bot.referenceTime = window.performance.now(); - waitInterval = setInterval(() => { //! !!! + waitInterval = setInterval(() => { bot.digPercentage += (50 / bot.digTime(block)) - // bot.digPercentage += (Math.abs(bot.referenceTime - window.performance.now()) / bot.digTime(block)); - // console.log(Math.abs(bot.referenceTime - window.performance.now()) + ", " + bot.digPercentage); - // bot.referenceTime = window.performance.now(); if (bot.digPercentage >= 1.0) { - // console.log("broke it"); finishDigging() } }, 50) @@ -156,7 +146,6 @@ function inject (bot) { } const eventName = `blockUpdate:${block.position}` - // console.log(bot.digPercentage + "% " + eventName); bot.on(eventName, onBlockUpdate) bot.stopDigging = () => {