Skip to content

fixed/improved openhole #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 26 additions & 38 deletions LucasTerra.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1983,54 +1983,42 @@ end
-- @param holes The holes ID's. (optional)
-- @returns boolean

function openhole(x,y,z,holes)
function openhole(x,y,z, holes)
x,y,z = x or $wptx, y or $wpty, z or $wptz
holes = holes or {{593,594}, {606, 607}, {608, 609}, {867, 868}}
local shovelid = false
for i,j in ipairs(shovels) do
if itemcount(j) > 0 then
shovelid = j
break
end
end
if not shovelid then
for i,j in ipairs(shovels) do
if clientitemhotkey(j) ~= 'not found' then
shovelid = j
break
end
end
holes = holes or {{593, 594}, {606, 607}, {608, 609}, {867, 868}}

local shovelId = gettool('shovel')
if shovelId == 0 then
printerror('Couldn\'t find shovel in your backpacks.')

return false
elseif ((not $fasthotkeys and clientitemhotkey(shovelId, 'crosshair') == 'not found') and itemcount(shovelId) == 0) then
printerror('Couldn\'t find shovel on your hotkeys.')

return false
end
local k = ''
if not shovelid then return false end

reachlocation(x,y,z)
if x and y and z and math.abs($posx-x) <= 7 and math.abs($posy-y) <= 5 and $posz == z and ($posx ~= x or $posy ~= y) then
if x and y and z and math.abs($posx - x) <= 7 and math.abs($posy - y) <= 5 and $posz == z and ($posx ~= x or $posy ~= y) then
local v = 1
while v <= #holes and not isitemontile(holes[v][1],x,y,z) do
v = v+1

while v <= #holes and not isitemontile(holes[v][1], x,y,z) do
v = v + 1
end

if v <= #holes then
local id = topitem(x,y,z).id
while id ~= holes[v][2] do
if id == holes[v][1] then
if iscreatureontile(x,y,z) then
local dir, dirx, diry = wheretomoveitem(x,y,z,99)
moveitems(99,ground(x+dirx,y+diry,z),ground(x,y,z),100) wait(1400,1600)
elseif clientitemhotkey(shovelid,'crosshair') == 'not found' and itemcount(shovelid) == 0 then
printerror(shoveltype.. ' not found.')
return false
end
useitemon(shovelid,id,ground(x,y,z),k) wait(900,1100)
elseif not itemproperty(id,ITEM_NOTMOVEABLE) then
moveitems(id,ground($posx,$posy,$posz),ground(x,y,z),100) waitping(1,1.3)
else
return false
end
id = topitem(x,y,z).id
local id = topuseitem(x,y,z).id

while id == holes[v][1] do
useitemon(shovelId, id, ground(x,y,z)) waitping(1, 2)

id = topuseitem(x,y,z).id
end

return true
end
end

return false
end

Expand Down