From 6983d873e5533297b10972184f129574c53f12e1 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Tue, 28 Jun 2022 00:30:48 +0100 Subject: hole --- hole.lua | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/hole.lua b/hole.lua index bbdf646..c8b55fa 100644 --- a/hole.lua +++ b/hole.lua @@ -12,7 +12,9 @@ while true do local scanned = scanner.scan() local targets = {} for _,s in ipairs(scanned) do - if s.name ~= "minecraft:air" and s.y < 0 and s.y > -5 then + if s.name ~= "minecraft:air" and s.y < 0 and s.y > -5 + and s.z <= 7 and s.z >= -8 + and s.x <= 7 and s.x >= -8 then local should_add = true for i,t in ipairs(targets) do @@ -29,13 +31,9 @@ while true do end end for _,v in ipairs(targets) do - if v.z <= 7 and v.z >= -8 - and v.x <= 7 and v.x >= -8 - then - local yaw,pitch = yaw_pitch(v.x,v.y,v.z) - print(v.x,v.y,v.z,yaw,pitch,v.name) - laser.fire(yaw,pitch,4) - end + local yaw,pitch = yaw_pitch(v.x,v.y,v.z) + print(v.x,v.y,v.z,yaw,pitch,v.name) + laser.fire(yaw,pitch,4) end if #targets == 0 then for i = 1,3 do -- cgit v1.2.3