From e69cb5845c3317fe49eaa43e5ac8ed2f38c70cee Mon Sep 17 00:00:00 2001 From: minjaesong Date: Wed, 9 Feb 2022 17:42:25 +0900 Subject: [PATCH] fixed a bug where barehand digging 'box' would not align as intended --- .../modulebasegame/gameitems/PickaxeGeneric.kt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/net/torvald/terrarum/modulebasegame/gameitems/PickaxeGeneric.kt b/src/net/torvald/terrarum/modulebasegame/gameitems/PickaxeGeneric.kt index bb54f72a3..47031c883 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameitems/PickaxeGeneric.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameitems/PickaxeGeneric.kt @@ -33,19 +33,18 @@ object PickaxeCore { ) = mouseInInteractableRangeTools(actor, item) { // un-round the mx val ww = INGAME.world.width + val hpww = ww * TILE_SIZE / 2 val apos = actor.centrePosPoint - val mx = if (apos.x < 0.0 && mx >= ww / 2) mx - ww - else if (apos.x > 0.0 && mx < ww / 2) mx + ww + val mx = if (apos.x - mx * TILE_SIZE< -hpww) mx - ww + else if (apos.x - mx * TILE_SIZE >= hpww) mx + ww else mx - val wmx = mx * TILE_SIZED - val wmy = my * TILE_SIZED var xoff = -(mw / 2) // implicit flooring var yoff = -(mh / 2) // implicit flooring // if mw or mh is even number, make it closer toward the actor - if (mw % 2 == 0 && apos.x > wmx) xoff += 1 - if (mh % 2 == 0 && apos.y > wmy) yoff += 1 - + if (mw % 2 == 0 && apos.x > mx * TILE_SIZE) xoff += 1 + if (mh % 2 == 0 && apos.y > my * TILE_SIZE) yoff += 1 + var usageStatus = false for (oy in 0 until mh) for (ox in 0 until mw) {