From aed59c48632b550d9bc14637d42a72fd20df25ee Mon Sep 17 00:00:00 2001 From: Justus Wolff Date: Sun, 15 Feb 2026 19:56:58 +0100 Subject: [PATCH] add rendering to hopefully make debugging easier --- src/main.lua | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/main.lua b/src/main.lua index 4057625..6c5958a 100644 --- a/src/main.lua +++ b/src/main.lua @@ -306,12 +306,12 @@ local function center(direction, wanted) end local function moveto(x,y,cx,cz,direction) while x ~= cx or y ~= cz do - if x > cx then -- x + if cx < x then -- x center(direction) cx = cx + 1 move("forward") end - if x < cx then + if cx > x then center(direction) cx = cx - 1 move("back") @@ -345,6 +345,26 @@ local function printdes(buf, dimensions) while true do local target = getnearestunplaced(buf, pbuf, cx,cy,cz,nil, dimensions["x"],dimensions["z"], false) if not target then break end + + reset() -- render current work + for x=1,dimensions["x"],1 do + for z=1,dimensions["z"],1 do + local currentbuf = pbuf[posasstring(x, cy, z)] + term.setCursorPos(x, z) + if currentbuf then -- wall + term.blit(" ", colors.toBlit(colors.white), colors.toBlit(colors.white)) + elseif currentbuf == false or currentbuf == nil then -- nothing + term.blit("\127", colors.toBlit(colors.gray), colors.toBlit(colors.black)) + end + end + end + term.setCursorPos(cx,cz) + term.blit(" ", colors.toBlit(colors.red), colors.toBlit(colors.red)) + term.setCursorPos(target[1],target[2]) + term.blit(" ", colors.toBlit(colors.lime), colors.toBlit(colors.lime)) + + read("") + cx,cz,direction = moveto(target[1],target[2],cx,cz,direction) place("down") pbuf[posasstring(cx,cy,cz)] = true