From 05cc75a78add487380f0446001f595dae802d03f Mon Sep 17 00:00:00 2001 From: Xaver-DaRed Date: Tue, 10 Feb 2026 19:14:59 +0100 Subject: [PATCH] Digging: Relax position distance check and make it more precise --- .../globals/hobbies/chocobo_digging/logic.lua | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/scripts/globals/hobbies/chocobo_digging/logic.lua b/scripts/globals/hobbies/chocobo_digging/logic.lua index c6f2cb5575a..5d6e6754056 100644 --- a/scripts/globals/hobbies/chocobo_digging/logic.lua +++ b/scripts/globals/hobbies/chocobo_digging/logic.lua @@ -305,17 +305,11 @@ xi.chocoboDig.start = function(player) local text = zones[zoneId].text local todayDigCount = xi.chocoboDig.fetchFatigue(player) local currentX = player:getXPos() + local currentY = player:getYPos() local currentZ = player:getZPos() - local currentXSign = 0 - local currentZSign = 0 - - if currentX < 0 then - currentXSign = 2 - end - - if currentZ < 0 then - currentZSign = 2 - end + local currentXSign = currentX < 0 and 2 or 0 + local currentYSign = currentY < 0 and 2 or 0 + local currentZSign = currentZ < 0 and 2 or 0 ----------------------------------- -- Early returns and exceptions @@ -351,12 +345,10 @@ xi.chocoboDig.start = function(player) -- Handle auto-fail from position. local lastX = player:getLocalVar('[DIG]LastXPos') * (1 - player:getLocalVar('[DIG]LastXPosSign')) + local lastY = player:getLocalVar('[DIG]LastYPos') * (1 - player:getLocalVar('[DIG]LastYPosSign')) local lastZ = player:getLocalVar('[DIG]LastZPos') * (1 - player:getLocalVar('[DIG]LastZPosSign')) - if - currentX >= lastX - 5 and currentX <= lastX + 5 and -- Check current X axis to see if you are too close to your last X. - currentZ >= lastZ - 5 and currentZ <= lastZ + 5 -- Check current Z axis to see if you are too close to your last Z. - then + if player:checkDistance(lastX, lastY, lastZ) < 5 then player:messageText(player, text.FIND_NOTHING) player:setLocalVar('[DIG]LastDigTime', GetSystemTime()) @@ -369,8 +361,10 @@ xi.chocoboDig.start = function(player) -- Set player variables, no matter the result. player:setLocalVar('[DIG]LastXPos', math.abs(currentX)) + player:setLocalVar('[DIG]LastYPos', math.abs(currentY)) player:setLocalVar('[DIG]LastZPos', math.abs(currentZ)) player:setLocalVar('[DIG]LastXPosSign', currentXSign) + player:setLocalVar('[DIG]LastYPosSign', currentYSign) player:setLocalVar('[DIG]LastZPosSign', currentZSign) player:setLocalVar('[DIG]LastDigTime', GetSystemTime())