2026-02-14 22:07:35 +01:00
|
|
|
-- https://git.l--n.de/justuswolff/cc_housebuild/raw/branch/main/src/main.lua
|
|
|
|
|
|
|
|
|
|
if not _G["turtle"] then
|
|
|
|
|
error("This program only runs on turtles!")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local turtle = _G["turtle"]
|
|
|
|
|
|
2026-02-14 22:24:37 +01:00
|
|
|
print("House building system")
|
|
|
|
|
print("JUFS Technologies (c) 2026 (Justus Wolff)")
|
|
|
|
|
|
2026-02-14 22:07:35 +01:00
|
|
|
print("fuel: "..tostring(turtle.getFuelLevel()).."/"..tostring(turtle.getFuelLimit()))
|
2026-02-15 12:31:55 +01:00
|
|
|
os.sleep(0.1)
|
2026-02-14 22:07:35 +01:00
|
|
|
|
2026-02-14 22:27:16 +01:00
|
|
|
function term.setcol(fc, bc)
|
|
|
|
|
term.setTextColor(fc)
|
|
|
|
|
term.setBackgroundColor(bc)
|
|
|
|
|
end
|
2026-02-14 22:24:37 +01:00
|
|
|
local function reset()
|
2026-02-14 22:28:25 +01:00
|
|
|
term.setcol(colors.white, colors.black)
|
2026-02-14 22:24:37 +01:00
|
|
|
term.clear()
|
|
|
|
|
term.setCursorPos(1,1)
|
|
|
|
|
end
|
|
|
|
|
local function incline()
|
2026-02-14 22:25:53 +01:00
|
|
|
local _,y = term.getCursorPos()
|
|
|
|
|
term.setCursorPos(1,y+1)
|
2026-02-14 22:24:37 +01:00
|
|
|
end
|
|
|
|
|
local function selopt(options, title)
|
|
|
|
|
local selected = 1
|
|
|
|
|
|
|
|
|
|
while true do
|
2026-02-14 22:26:20 +01:00
|
|
|
reset()
|
|
|
|
|
term.setcol(colors.black, colors.white)
|
|
|
|
|
term.write(title)
|
2026-02-14 22:24:37 +01:00
|
|
|
for i,v in pairs(options) do
|
|
|
|
|
incline()
|
|
|
|
|
if i == selected then
|
|
|
|
|
term.setcol(colors.black, colors.blue)
|
|
|
|
|
else
|
|
|
|
|
term.setcol(colors.white, colors.black)
|
|
|
|
|
end
|
|
|
|
|
term.write(v)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local event,key = os.pullEvent("key")
|
|
|
|
|
if keys.getName(key) == "w" and selected ~= 1 then
|
|
|
|
|
selected = selected - 1
|
|
|
|
|
end
|
|
|
|
|
if keys.getName(key) == "s" and selected ~= #options then
|
|
|
|
|
selected = selected + 1
|
|
|
|
|
end
|
|
|
|
|
if keys.getName(key) == "enter" then
|
|
|
|
|
return selected
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2026-02-15 10:58:55 +01:00
|
|
|
local function integritycheck()
|
|
|
|
|
if not fs.exists("designs") then
|
|
|
|
|
fs.makeDir("designs")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
local function posasstring(...)
|
|
|
|
|
local positions = {...}
|
|
|
|
|
local out = ""
|
|
|
|
|
for _,v in pairs(positions) do
|
|
|
|
|
out = out .. tostring(v) .. ":"
|
|
|
|
|
end
|
|
|
|
|
return out
|
|
|
|
|
end
|
2026-02-15 12:31:55 +01:00
|
|
|
local function load(name)
|
|
|
|
|
local file = fs.open("designs/"..name, "r")
|
|
|
|
|
local content = file.readAll()
|
|
|
|
|
file.close()
|
|
|
|
|
content = textutils.unserialiseJSON(content)
|
|
|
|
|
return content["buf"],content["dimensions"]
|
|
|
|
|
end
|
2026-02-15 10:58:55 +01:00
|
|
|
local function newdesign()
|
|
|
|
|
local buf = {}
|
|
|
|
|
local dimensions = {
|
|
|
|
|
x = 8,
|
|
|
|
|
z = 8,
|
|
|
|
|
y = 1
|
|
|
|
|
}
|
|
|
|
|
local currentfloor = 1
|
2026-02-15 11:29:23 +01:00
|
|
|
local camx,camy = 0,0
|
|
|
|
|
|
2026-02-15 10:58:55 +01:00
|
|
|
|
|
|
|
|
while true do
|
|
|
|
|
-- render buf
|
|
|
|
|
reset()
|
2026-02-15 11:29:23 +01:00
|
|
|
for x=1+camx,dimensions["x"]+camx,1 do
|
|
|
|
|
for z=1+camy,dimensions["z"]+camy,1 do
|
2026-02-15 11:39:21 +01:00
|
|
|
local currentbuf = buf[posasstring(x-camx, currentfloor, z-camy)]
|
2026-02-15 11:37:00 +01:00
|
|
|
term.setCursorPos(x, z)
|
2026-02-15 18:27:45 +01:00
|
|
|
if currentbuf == 1 then -- wall
|
2026-02-15 10:58:55 +01:00
|
|
|
term.blit(" ", colors.toBlit(colors.white), colors.toBlit(colors.white))
|
2026-02-15 18:27:45 +01:00
|
|
|
elseif currentbuf == 2 then -- no ceiling
|
|
|
|
|
term.blit(" ", colors.toBlit(colors.red), colors.toBlit(colors.red))
|
2026-02-15 18:29:12 +01:00
|
|
|
elseif currentbuf == 0 or currentbuf == nil then -- nothing
|
2026-02-15 11:04:20 +01:00
|
|
|
term.blit("\127", colors.toBlit(colors.gray), colors.toBlit(colors.black))
|
2026-02-15 10:58:55 +01:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2026-02-15 11:16:07 +01:00
|
|
|
term.setcol(colors.yellow, colors.black)
|
|
|
|
|
local _,y = term.getSize()
|
2026-02-15 11:40:57 +01:00
|
|
|
term.setCursorPos(1,y-1)
|
2026-02-15 11:40:26 +01:00
|
|
|
term.write("Press Ctrl for menu. ")
|
2026-02-15 11:40:57 +01:00
|
|
|
term.setCursorPos(1,y)
|
2026-02-15 11:40:26 +01:00
|
|
|
term.write("x: "..tostring(camx))
|
|
|
|
|
term.write(" z: "..tostring(camy))
|
|
|
|
|
term.write(" floor: "..tostring(currentfloor))
|
2026-02-14 22:24:37 +01:00
|
|
|
|
2026-02-15 10:58:55 +01:00
|
|
|
-- user input
|
|
|
|
|
local event = table.pack(os.pullEvent())
|
2026-02-15 11:16:07 +01:00
|
|
|
if event[1] == "mouse_click" or event[1] == "mouse_drag" then
|
2026-02-15 11:29:23 +01:00
|
|
|
event[3] = event[3]+camx
|
|
|
|
|
event[4] = event[4]+camy
|
2026-02-15 11:16:07 +01:00
|
|
|
if event[3] <= dimensions["x"] and event[4] <= dimensions["z"] then
|
|
|
|
|
if event[2] == 1 then -- left button, set
|
2026-02-15 18:27:45 +01:00
|
|
|
buf[posasstring(event[3], currentfloor, event[4])] = 1
|
|
|
|
|
end
|
|
|
|
|
if event[2] == 3 then -- middle button, set no ceiling
|
|
|
|
|
buf[posasstring(event[3], currentfloor, event[4])] = 2
|
2026-02-15 11:16:07 +01:00
|
|
|
end
|
|
|
|
|
if event[2] == 2 then -- right button, erase
|
2026-02-15 18:27:45 +01:00
|
|
|
buf[posasstring(event[3], currentfloor, event[4])] = 0
|
2026-02-15 11:16:07 +01:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2026-02-15 11:29:23 +01:00
|
|
|
if event[1] == "key" then
|
|
|
|
|
if keys.getName(event[2]) == "leftCtrl" then -- menu
|
|
|
|
|
local action = selopt({
|
|
|
|
|
"Save",
|
|
|
|
|
"Load",
|
|
|
|
|
"Exit",
|
|
|
|
|
"Change X size",
|
|
|
|
|
"Change floor amount",
|
|
|
|
|
"Change Z size"
|
|
|
|
|
}, "menu")
|
|
|
|
|
if action == 3 then return end -- exit
|
|
|
|
|
if action == 1 then -- save
|
|
|
|
|
reset()
|
|
|
|
|
for _,v in pairs(fs.list("designs")) do
|
|
|
|
|
term.write(v)
|
|
|
|
|
incline()
|
|
|
|
|
end
|
|
|
|
|
write("Enter name: ")
|
|
|
|
|
local name = read()
|
|
|
|
|
local file = fs.open("designs/"..name, "w")
|
|
|
|
|
file.write(textutils.serialiseJSON({
|
|
|
|
|
["dimensions"] = dimensions,
|
|
|
|
|
["buf"] = buf
|
|
|
|
|
}))
|
|
|
|
|
file.close()
|
2026-02-15 11:18:03 +01:00
|
|
|
end
|
2026-02-15 11:29:23 +01:00
|
|
|
if action == 2 then -- load
|
|
|
|
|
reset()
|
|
|
|
|
for _,v in pairs(fs.list("designs")) do
|
|
|
|
|
term.write(v)
|
|
|
|
|
incline()
|
|
|
|
|
end
|
|
|
|
|
write("Enter name: ")
|
|
|
|
|
local name = read()
|
|
|
|
|
if not fs.exists("designs/"..name) or name == "" then
|
|
|
|
|
printError("Design not found!")
|
|
|
|
|
else
|
2026-02-15 12:31:55 +01:00
|
|
|
buf,dimensions = load(name)
|
2026-02-15 11:44:07 +01:00
|
|
|
camx,camy,currentfloor = 0,0,1
|
2026-02-15 11:29:23 +01:00
|
|
|
end
|
2026-02-15 11:18:03 +01:00
|
|
|
end
|
2026-02-15 11:29:23 +01:00
|
|
|
if action == 4 then -- change X size
|
|
|
|
|
reset()
|
|
|
|
|
write("Enter new X size: ")
|
|
|
|
|
local xsize = tonumber(read())
|
|
|
|
|
dimensions["x"] = xsize
|
2026-02-15 11:16:07 +01:00
|
|
|
end
|
2026-02-15 11:29:23 +01:00
|
|
|
if action == 5 then -- change floor amount
|
|
|
|
|
reset()
|
|
|
|
|
write("Enter new floor amount: ")
|
|
|
|
|
local ysize = tonumber(read())
|
|
|
|
|
dimensions["y"] = ysize
|
|
|
|
|
end
|
|
|
|
|
if action == 6 then -- change Z size
|
|
|
|
|
reset()
|
|
|
|
|
write("Enter new Z size: ")
|
|
|
|
|
local zsize = tonumber(read())
|
|
|
|
|
dimensions["z"] = zsize
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if keys.getName(event[2]) == "q" and currentfloor < dimensions["y"] then -- go up
|
|
|
|
|
currentfloor = currentfloor + 1
|
|
|
|
|
end
|
|
|
|
|
if keys.getName(event[2]) == "e" and currentfloor > 1 then -- go down
|
|
|
|
|
currentfloor = currentfloor - 1
|
|
|
|
|
end
|
2026-02-15 11:34:16 +01:00
|
|
|
if keys.getName(event[2]) == "w" and camy < dimensions["z"] then -- pan up
|
2026-02-15 11:29:23 +01:00
|
|
|
camy = camy + 1
|
2026-02-15 11:21:01 +01:00
|
|
|
end
|
2026-02-15 11:41:52 +01:00
|
|
|
if keys.getName(event[2]) == "s" and camy > -dimensions["z"] then -- pan down
|
2026-02-15 11:31:05 +01:00
|
|
|
camy = camy - 1
|
2026-02-15 11:21:01 +01:00
|
|
|
end
|
2026-02-15 11:37:00 +01:00
|
|
|
if keys.getName(event[2]) == "a" and camx < dimensions["x"] then -- pan left
|
2026-02-15 11:29:23 +01:00
|
|
|
camx = camx + 1
|
2026-02-15 11:21:01 +01:00
|
|
|
end
|
2026-02-15 11:41:52 +01:00
|
|
|
if keys.getName(event[2]) == "d" and camx > -dimensions["z"] then -- pan right
|
2026-02-15 11:31:05 +01:00
|
|
|
camx = camx - 1
|
|
|
|
|
end
|
2026-02-15 10:58:55 +01:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2026-02-15 12:31:55 +01:00
|
|
|
local function move(direction)
|
|
|
|
|
if direction == "left" then
|
|
|
|
|
turtle.turnLeft()
|
2026-02-15 12:34:15 +01:00
|
|
|
return
|
2026-02-15 12:31:55 +01:00
|
|
|
end
|
|
|
|
|
if direction == "right" then
|
|
|
|
|
turtle.turnRight()
|
2026-02-15 12:34:15 +01:00
|
|
|
return
|
2026-02-15 12:31:55 +01:00
|
|
|
end
|
|
|
|
|
while true do
|
|
|
|
|
if turtle.getFuelLevel() == 0 then
|
|
|
|
|
reset()
|
|
|
|
|
print("Out of fuel! Please insert fuel into current slot.")
|
|
|
|
|
while true do
|
|
|
|
|
local suc = turtle.refuel(64)
|
|
|
|
|
if suc then
|
|
|
|
|
print("Refuelled. Press enter to continue.")
|
|
|
|
|
read("")
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
os.sleep(1)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
local suc,reason = turtle[direction]()
|
|
|
|
|
if not suc then
|
|
|
|
|
printError(reason)
|
|
|
|
|
print("Resolve the error and press enter to continue.")
|
|
|
|
|
read("")
|
|
|
|
|
else
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
local function place(direction)
|
|
|
|
|
local func = turtle.place
|
2026-02-15 19:38:34 +01:00
|
|
|
local cfunc = turtle.compare
|
2026-02-15 12:31:55 +01:00
|
|
|
if direction == "down" then
|
|
|
|
|
func = turtle.placeDown
|
2026-02-15 19:38:34 +01:00
|
|
|
cfunc = turtle.compareDown
|
2026-02-15 12:31:55 +01:00
|
|
|
end
|
|
|
|
|
if direction == "up" then
|
|
|
|
|
func = turtle.placeUp
|
2026-02-15 19:38:34 +01:00
|
|
|
cfunc = turtle.compareUp
|
2026-02-15 12:31:55 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
while true do
|
|
|
|
|
local suc = func()
|
|
|
|
|
if not suc then -- next slot
|
2026-02-15 19:38:34 +01:00
|
|
|
if cfunc() and turtle.getItemDetail(turtle.getSelectedSlot())["name"] ~= "minecraft:air" then return end
|
2026-02-15 12:31:55 +01:00
|
|
|
local current = turtle.getSelectedSlot()
|
|
|
|
|
if current == 16 then
|
|
|
|
|
turtle.select(1)
|
|
|
|
|
else
|
|
|
|
|
turtle.select(current+1)
|
|
|
|
|
end
|
2026-02-15 12:33:17 +01:00
|
|
|
else break end
|
2026-02-15 12:31:55 +01:00
|
|
|
os.sleep(0) -- yield
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
local function placebuf(buf, x, y, z)
|
2026-02-15 18:27:45 +01:00
|
|
|
if buf[posasstring(x,y,z)] == 1 then
|
2026-02-15 12:31:55 +01:00
|
|
|
place("down")
|
|
|
|
|
end
|
|
|
|
|
end
|
2026-02-15 19:32:16 +01:00
|
|
|
local function getnearestunplaced(buf, pbuf, cx,cy,cz,co, sx,sz, setceiling)
|
|
|
|
|
local distance = math.huge
|
|
|
|
|
local selected = nil
|
|
|
|
|
|
|
|
|
|
for x=1,sx,1 do
|
|
|
|
|
for y=1,sz,1 do
|
|
|
|
|
local needplace = buf[posasstring(x,cy,y)]
|
|
|
|
|
if pbuf[posasstring(x,cy,y)] then needplace = 0 end -- already placed
|
|
|
|
|
needplace = setceiling and (needplace == 2 or needplace == 1) or needplace == 1
|
|
|
|
|
if needplace then -- needs to be placed, calculate distance
|
|
|
|
|
local cd = math.abs(y-cz)+math.abs(x-cx) -- raw distance (amount of blocks between)
|
|
|
|
|
if cd < distance then
|
|
|
|
|
distance = cd
|
|
|
|
|
selected = {x,y}
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return selected
|
|
|
|
|
end
|
2026-02-15 19:43:14 +01:00
|
|
|
local function center(direction, wanted)
|
2026-02-15 19:32:16 +01:00
|
|
|
if direction == 1 and wanted ~= 1 then
|
|
|
|
|
move("left")
|
|
|
|
|
end
|
|
|
|
|
if direction == -1 and wanted ~= -1 then
|
|
|
|
|
move("right")
|
|
|
|
|
end
|
2026-02-15 19:43:14 +01:00
|
|
|
end
|
|
|
|
|
local function moveto(x,y,cx,cz,direction)
|
2026-02-15 19:32:16 +01:00
|
|
|
while x ~= cx or y ~= cz do
|
|
|
|
|
if x > cx then -- x
|
2026-02-15 19:43:14 +01:00
|
|
|
center(direction)
|
2026-02-15 19:32:16 +01:00
|
|
|
cx = cx + 1
|
|
|
|
|
move("forward")
|
|
|
|
|
end
|
|
|
|
|
if x < cx then
|
2026-02-15 19:43:14 +01:00
|
|
|
center(direction)
|
2026-02-15 19:32:16 +01:00
|
|
|
cx = cx - 1
|
|
|
|
|
move("back")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if y > cz then -- z
|
2026-02-15 19:43:14 +01:00
|
|
|
center(direction, 1)
|
2026-02-15 19:32:16 +01:00
|
|
|
cz = cz + 1
|
|
|
|
|
move("right")
|
|
|
|
|
move("forward")
|
|
|
|
|
direction = 1
|
|
|
|
|
end
|
|
|
|
|
if y < cz then
|
2026-02-15 19:43:14 +01:00
|
|
|
center(direction, -1)
|
2026-02-15 19:32:16 +01:00
|
|
|
cz = cz - 1
|
|
|
|
|
move("left")
|
|
|
|
|
move("forward")
|
|
|
|
|
direction = -1
|
|
|
|
|
end
|
|
|
|
|
end
|
2026-02-15 19:43:14 +01:00
|
|
|
return cx,cz,direction
|
2026-02-15 19:32:16 +01:00
|
|
|
end
|
2026-02-15 12:31:55 +01:00
|
|
|
local function printdes(buf, dimensions)
|
|
|
|
|
move("up")
|
|
|
|
|
move("forward")
|
|
|
|
|
|
2026-02-15 19:32:16 +01:00
|
|
|
local cx = 1
|
|
|
|
|
local cz = 1
|
2026-02-15 19:43:14 +01:00
|
|
|
local direction = 0
|
2026-02-15 12:31:55 +01:00
|
|
|
for cy=1,dimensions["y"],1 do
|
2026-02-15 18:27:45 +01:00
|
|
|
for _=1,3,1 do -- build walls
|
2026-02-15 19:32:16 +01:00
|
|
|
local pbuf = {}
|
|
|
|
|
while true do
|
|
|
|
|
local target = getnearestunplaced(buf, pbuf, cx,cy,cz,nil, dimensions["x"],dimensions["z"], false)
|
|
|
|
|
if not target then break end
|
2026-02-15 19:44:25 +01:00
|
|
|
cx,cz,direction = moveto(target[1],target[2],cx,cz,direction)
|
2026-02-15 19:32:16 +01:00
|
|
|
place("down")
|
|
|
|
|
pbuf[posasstring(cx,cy,cz)] = true
|
|
|
|
|
end
|
|
|
|
|
move("up")
|
|
|
|
|
--[[for cz=1,dimensions["z"],1 do
|
2026-02-15 12:40:44 +01:00
|
|
|
for cx=1,dimensions["x"],1 do
|
|
|
|
|
placebuf(buf, cx, cy, cz)
|
|
|
|
|
move("forward")
|
|
|
|
|
end
|
|
|
|
|
-- return to standard pos but +1 to z
|
|
|
|
|
--move("back")
|
|
|
|
|
move("right")
|
|
|
|
|
move("forward")
|
|
|
|
|
move("right")
|
|
|
|
|
for _=1,dimensions["x"],1 do
|
|
|
|
|
move("forward")
|
|
|
|
|
end
|
|
|
|
|
move("right")
|
|
|
|
|
move("right")
|
|
|
|
|
end
|
|
|
|
|
-- return to standard pos but +1 to y
|
|
|
|
|
move("left")
|
|
|
|
|
for _=1,dimensions["z"],1 do
|
|
|
|
|
move("forward")
|
|
|
|
|
end
|
|
|
|
|
move("right")
|
2026-02-15 19:32:16 +01:00
|
|
|
move("up")]]--
|
2026-02-15 12:40:44 +01:00
|
|
|
end
|
|
|
|
|
-- build ceiling/floor
|
2026-02-15 19:32:16 +01:00
|
|
|
for _cz=1,dimensions["z"],1 do
|
|
|
|
|
for _cx=1,dimensions["x"],1 do
|
2026-02-15 19:44:25 +01:00
|
|
|
cx,cz,direction = moveto(_cx,_cz,cx,cz,direction)
|
2026-02-15 19:32:16 +01:00
|
|
|
if buf[posasstring(_cx,cy,_cz)] ~= 2 then
|
2026-02-15 18:27:45 +01:00
|
|
|
place("down")
|
|
|
|
|
end
|
2026-02-15 12:31:55 +01:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- return to standard pos but +1 to y
|
2026-02-15 19:44:25 +01:00
|
|
|
cx,cz,direction = moveto(1,1,cx,cz,direction)
|
2026-02-15 12:31:55 +01:00
|
|
|
move("up")
|
|
|
|
|
end
|
2026-02-15 19:43:14 +01:00
|
|
|
center(direction)
|
2026-02-15 12:31:55 +01:00
|
|
|
end
|
2026-02-15 10:58:55 +01:00
|
|
|
|
|
|
|
|
while true do
|
|
|
|
|
integritycheck()
|
|
|
|
|
local action = selopt({
|
|
|
|
|
"New Design",
|
|
|
|
|
"Print Design"
|
|
|
|
|
}, "Select Action")
|
|
|
|
|
|
|
|
|
|
if action == 1 then
|
|
|
|
|
newdesign()
|
|
|
|
|
end
|
2026-02-15 12:31:55 +01:00
|
|
|
if action == 2 then
|
|
|
|
|
reset()
|
|
|
|
|
for _,v in pairs(fs.list("designs")) do
|
|
|
|
|
term.write(v)
|
|
|
|
|
incline()
|
|
|
|
|
end
|
|
|
|
|
write("Enter name: ")
|
|
|
|
|
local name = read()
|
|
|
|
|
if not fs.exists("designs/"..name) or name == "" then
|
|
|
|
|
printError("Design not found!")
|
|
|
|
|
else
|
|
|
|
|
local buf,dimensions = load(name)
|
|
|
|
|
write("Calculating fuel cost...")
|
|
|
|
|
local cost = dimensions["x"]*dimensions["z"]*(dimensions["y"]*4-1)
|
|
|
|
|
print(tostring(turtle.getFuelLevel()).."/"..tostring(cost))
|
|
|
|
|
if turtle.getFuelLevel() < cost then
|
|
|
|
|
write("WARNING: Not enough fuel! Continue anyway? y/n: ")
|
|
|
|
|
while true do
|
|
|
|
|
local ans = read("")
|
|
|
|
|
if ans == "y" then
|
|
|
|
|
printdes(buf, dimensions)
|
|
|
|
|
break
|
|
|
|
|
elseif ans == "n" then break end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
printdes(buf, dimensions)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2026-02-15 10:58:55 +01:00
|
|
|
end
|
2026-02-14 22:24:37 +01:00
|
|
|
|