Compare commits

..

60 Commits

Author SHA1 Message Date
Justus Wolff
2f7e2194b3 remove experimental warning 2026-02-23 01:16:11 +01:00
Justus Wolff
7886710d15 add correction manuevuers for move 2026-02-23 01:15:07 +01:00
Justus Wolff
93d20c3e9e change the failcheck again. 2026-02-23 01:03:49 +01:00
Justus Wolff
bc2cdbf347 change the failcheck to use even. 2026-02-23 01:01:29 +01:00
Justus Wolff
ee428d09bc check if even, yes? ok, add 1 no? dont add 1. 2026-02-23 01:00:43 +01:00
Justus Wolff
285ef315ab add check so that an unevenstack only gets added if it actually has something. 2026-02-23 00:52:26 +01:00
Justus Wolff
b795880174 also remove wanted from center call in VP_prinstack 2026-02-23 00:48:19 +01:00
Justus Wolff
1e6f259bab and fix that again 2026-02-23 00:46:06 +01:00
Justus Wolff
d17ab84e67 aaand fix an y offset bug 2026-02-23 00:44:51 +01:00
Justus Wolff
c20b6b7eba change a few things 2026-02-23 00:42:54 +01:00
Justus Wolff
0c6185f67e remove check at the end of VP_splitstack and add some stuff to move 2026-02-23 00:37:55 +01:00
Justus Wolff
a284cc6c87 qol 2026-02-22 21:19:40 +01:00
Justus Wolff
1e2bf6183b forgot to reset ind 2026-02-22 21:11:53 +01:00
Justus Wolff
f8467d5703 I knew I forgot something... 2026-02-22 21:00:34 +01:00
Justus Wolff
b75e547483 remade splitstack. 2026-02-22 20:57:59 +01:00
Justus Wolff
0c71102650 fix start position of master turtle. 2026-02-22 20:47:47 +01:00
Justus Wolff
c76c674a58 so first we fix an height issue aswell as an naming issue in a packet 2026-02-22 20:41:06 +01:00
Justus Wolff
ba3d077bac and fix an indexing issue again... 2026-02-22 20:38:25 +01:00
Justus Wolff
0107287084 and fix master turtle not properly getting its own stack. 2026-02-22 20:37:07 +01:00
Justus Wolff
bc4193cadb forgot to send height as master turtle. 2026-02-22 20:35:26 +01:00
Justus Wolff
f14fb1cc2f also ask user to add <x> many blocks to master turtle 2026-02-22 20:33:43 +01:00
Justus Wolff
5434ceb46c also fix going right for no reason (why did I add that?) 2026-02-22 20:31:47 +01:00
Justus Wolff
0a9ef1709e fix stack printing 2026-02-22 20:30:47 +01:00
Justus Wolff
8b05cf5e67 print id when waiting for stack and dimension 2026-02-22 20:27:36 +01:00
Justus Wolff
663bf2ffb9 fix dimension accessing 2026-02-22 20:24:31 +01:00
Justus Wolff
f804467e82 hopefully fixed 2026-02-22 20:23:39 +01:00
Justus Wolff
6f6e61b092 D E B U G 2026-02-22 20:21:25 +01:00
Justus Wolff
f06e2e9b3a more debugging 2026-02-22 20:20:38 +01:00
Justus Wolff
2123699e23 add debugging code 2026-02-22 20:19:54 +01:00
Justus Wolff
c66fedaf2f attempt to fix createstack and reintroduce optimizestack. 2026-02-22 20:16:58 +01:00
Justus Wolff
0df5a87891 remove optimizestack call 2026-02-22 20:09:58 +01:00
justuswolff
bdf3f34e6b failcheck 2026-02-19 20:12:03 +01:00
justuswolff
608083d928 expand failcheck a little 2026-02-19 20:07:54 +01:00
justuswolff
ce75d4a034 failcheck 2026-02-19 20:06:18 +01:00
justuswolff
4f82df6dbb fix an bug where we couldnt index an stack properly 2026-02-19 20:03:27 +01:00
justuswolff
37233f7b42 add rednet open to action 3 and 4 2026-02-19 20:00:05 +01:00
justuswolff
322ec34491 add update function 2026-02-19 19:57:53 +01:00
justuswolff
5e299edd9c VPrint full first code 2026-02-19 19:56:23 +01:00
justuswolff
35bd00feb9 fix it again... 2026-02-18 20:22:06 +01:00
justuswolff
3f74327f77 change return to home again under VP_printstack or rather, fix it. 2026-02-18 20:18:40 +01:00
justuswolff
90a54914be change a bit of positioning under VP_printstack 2026-02-18 20:15:57 +01:00
justuswolff
de029e6886 attempt to fix y offset at VP_printstack 2026-02-18 20:12:23 +01:00
justuswolff
29e23e9f40 provide cx,cz and direction to VP_printstack 2026-02-18 20:09:20 +01:00
justuswolff
5417ff638f remove fuel checking in VPrint entirely 2026-02-18 20:07:06 +01:00
justuswolff
cd8a403d6e made VPrint a mode and experimental 2026-02-18 20:02:40 +01:00
justuswolff
529b10e8dd add optimization for stacks 2026-02-18 18:52:49 +01:00
justuswolff
a6d267765d refactor code to provide newest needed argument to getnearestunplaced. 2026-02-17 22:26:11 +01:00
justuswolff
ab9d5c7b83 make getnearestunplaced also take direction into account. 2026-02-17 22:25:20 +01:00
justuswolff
94f825c346 fix fill hopefully A G A I N 2026-02-17 22:07:54 +01:00
justuswolff
517256b255 fix bufistype hopefully... 2026-02-17 22:04:52 +01:00
justuswolff
1232262718 fix a bit more stuff 2026-02-17 22:02:55 +01:00
justuswolff
b1b6ca4be6 immediatly fill in neighbors such that we get less lag 2026-02-17 22:01:43 +01:00
justuswolff
3c8896abbb also fixed that same progress feature 2026-02-17 21:58:58 +01:00
justuswolff
a7953e499c add small progress thing in fill 2026-02-17 21:58:22 +01:00
justuswolff
a80ddd3126 make write to buf under fill use cx and cz 2026-02-17 21:54:58 +01:00
justuswolff
df02298213 fix fill function 2026-02-17 21:53:15 +01:00
justuswolff
5a2a494c29 remove dummy fill call in newdesign. 2026-02-17 21:52:04 +01:00
justuswolff
9d60c43a7c add an way to "fill" things 2026-02-17 21:51:11 +01:00
justuswolff
57e0872455 render no ceilings on next floor 2026-02-17 15:00:56 +01:00
justuswolff
54a7cd2bb8 fix raw url in main.lua 2026-02-17 14:17:52 +01:00

View File

@@ -1,4 +1,4 @@
-- https://git.l--n.de/justuswolff/cc_housebuild/raw/branch/main/src/main.lua
local url = "http://justus.l--n.de:3000/JUFS/cc_housebuild/raw/branch/main/src/main.lua"
if not _G["turtle"] then
error("This program only runs on turtles!")
@@ -74,6 +74,45 @@ local function load(name)
content = textutils.unserialiseJSON(content)
return content["buf"],content["dimensions"]
end
local function bufistype(buf, x,y,z, targettype)
if buf[posasstring(x,y,z)] == targettype then
return true
else
return targettype == 0 and buf[posasstring(x,y,z)] == nil
end
end
local function fill_getneighbors(x,y,z, sx,sz, seltype,buf)
local out = {}
if x ~= sx and bufistype(buf, x+1,y,z, seltype) then table.insert(out, {x+1,z}) end
if x ~= 1 and bufistype(buf, x-1,y,z, seltype) then table.insert(out, {x-1,z}) end
if z ~= sz and bufistype(buf, x,y,z+1, seltype) then table.insert(out, {x,z+1}) end
if z ~= 1 and bufistype(buf, x,y,z-1, seltype) then table.insert(out, {x,z-1}) end
return out
end
local function fill(ntype, x,y,z, buf, sx,sz)
local inittype = buf[posasstring(x,y,z)]
if inittype == ntype then return end -- no work needs to be done
local neighbors = fill_getneighbors(x,y,z, sx,sz, inittype,buf)
buf[posasstring(x,y,z)] = ntype
local processed = 0
local totalneighbors = #neighbors
term.setcol(colors.white, colors.black)
while #neighbors > 0 do
term.setCursorPos(1,1)
term.write(tostring(processed).."/"..tostring(totalneighbors))
local cn = table.remove(neighbors, 1)
local cx,cz = cn[1],cn[2]
local newneigh = fill_getneighbors(cx,y,cz, sx,sz, inittype,buf)
for _,v in pairs(newneigh) do
table.insert(neighbors, v)
buf[posasstring(v[1],y,v[2])] = ntype
totalneighbors = totalneighbors + 1
end
buf[posasstring(cx,y,cz)] = ntype
processed = processed + 1
end
end
local function newdesign()
local buf = {}
local dimensions = {
@@ -102,6 +141,7 @@ local function newdesign()
term.blit("W", colors.toBlit(colors.black), colors.toBlit(colors.white))
end
end
local shift = false
while true do
-- render buf
@@ -116,7 +156,11 @@ local function newdesign()
renderblock(currentbuf-1)
--term.blit("C", colors.toBlit(colors.black), colors.toBlit(colors.red))
elseif currentbuf == 0 or currentbuf == nil then -- nothing
term.blit("\127", colors.toBlit(colors.gray), colors.toBlit(colors.black))
if buf[posasstring(x-camx, currentfloor-1, z-camy)] == 2 then
term.blit("\127", colors.toBlit(colors.red), colors.toBlit(colors.black))
else
term.blit("\127", colors.toBlit(colors.gray), colors.toBlit(colors.black))
end
end
end
end
@@ -138,12 +182,21 @@ local function newdesign()
event[4] = event[4]-camy
if event[3] <= dimensions["x"] and event[4] <= dimensions["z"] then
if event[2] == 1 then -- left button, set
if shift then
fill(1, event[3],currentfloor,event[4], buf,dimensions["x"],dimensions["z"])
end
buf[posasstring(event[3], currentfloor, event[4])] = 1
end
if event[2] == 3 then -- middle button, set special block
if shift then
fill(currentblock, event[3],currentfloor,event[4], buf,dimensions["x"],dimensions["z"])
end
buf[posasstring(event[3], currentfloor, event[4])] = currentblock
end
if event[2] == 2 then -- right button, erase
if shift then
fill(0, event[3],currentfloor,event[4], buf,dimensions["x"],dimensions["z"])
end
buf[posasstring(event[3], currentfloor, event[4])] = 0
end
end
@@ -158,6 +211,9 @@ local function newdesign()
currentblock = blocks[blockindex]
end
if event[1] == "key" then
if keys.getName(event[2]) == "leftShift" then
shift = true
end
if keys.getName(event[2]) == "leftCtrl" then -- menu
local action = selopt({
"Save",
@@ -236,9 +292,12 @@ local function newdesign()
camx = camx - 1
end
end
if event[1] == "key_up" then
if keys.getName(event[2]) == "leftShift" then shift = false end
end
end
end
local function move(direction)
local function move(direction, continousattempt)
if direction == "left" then
turtle.turnLeft()
return
@@ -247,29 +306,42 @@ local function move(direction)
turtle.turnRight()
return
end
local correction = 0
while true do
if turtle.getFuelLevel() == 0 then
reset()
print("Out of fuel! Please insert fuel into current slot.")
print("Out of fuel! Trying to refuel.")
while true do
local suc = turtle.refuel(64)
if suc then
print("Refuelled. Press enter to continue.")
read("")
break
end
local current = turtle.getSelectedSlot()
if current == 16 then
turtle.select(1)
else
turtle.select(current+1)
end
os.sleep(1)
end
end
local suc,reason = turtle[direction]()
if not suc then
if not suc and not continousattempt then
printError(reason)
print("Resolve the error and press enter to continue.")
read("")
else
elseif not suc and continousattempt then
reset()
printError("Failure moving "..direction.." Continous attempt true.")
move("forward", true)
correction = correction + 1
elseif suc then
break
end
end
for _=1,correction,1 do
move("back", true)
end
end
local function place(direction)
local func = turtle.place
@@ -302,25 +374,48 @@ local function placebuf(buf, x, y, z)
place("down")
end
end
local function getnearestunplaced(buf, pbuf, cx,cy,cz,clayer, sx,sz)
local function directiondist(direction, wanted)
if direction == 0 then return 1 end
if direction == 1 and wanted == -1 then return 2 end
if direction == -1 and wanted == 1 then return 2 end
if direction ~= wanted then return 1 end -- failsafes
if direction == wanted then return 0 end
end
local function needstobeplaced(placecode, clayer)
if clayer == 0 or clayer == 2 then
return placecode == 1
end
if clayer == 1 then
return placecode == 1 or placecode == 4
end
if clayer == 3 then
return placecode == 1 or placecode == 4 or placecode == 3
end
end
local function getnearestunplaced(buf, pbuf, cx,cy,cz,clayer, sx,sz, direction)
local distance = math.huge
local selected = nil
for x=1,sx,1 do
for y=1,sz,1 do
local extracost = 0
if x ~= cx and direction ~= 0 then
extracost = extracost + 1
end
if y > cz and direction ~= 1 then
extracost = extracost + directiondist(direction, 1)
end
if y < cz and direction ~= -1 then
extracost = extracost + directiondist(direction, -1)
end
local needplace = buf[posasstring(x,cy,y)]
if pbuf[posasstring(x,cy,y)] then needplace = 0 end -- already placed
if clayer == 0 or clayer == 2 then
needplace = needplace == 1
end
if clayer == 1 then
needplace = needplace == 1 or needplace == 4
end
if clayer == 3 then
needplace = needplace == 1 or needplace == 4 or needplace == 3
end
needplace = needstobeplaced(needplace, clayer)
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)
cd = cd + extracost
if cd < distance then
distance = cd
selected = {x,y}
@@ -420,7 +515,7 @@ local function printdes(buf, dimensions)
for clayer=1,3,1 do -- build walls
local pbuf = {}
while true do
local target = getnearestunplaced(buf, pbuf, cx,cy,cz,clayer, dimensions["x"],dimensions["z"])
local target = getnearestunplaced(buf, pbuf, cx,cy,cz,clayer, dimensions["x"],dimensions["z"], direction)
if not target then break end
render(buf, pbuf, cx,cy,cz, target[1],target[2], dimensions["x"],dimensions["z"], setlists[clayer])
@@ -446,7 +541,7 @@ local function printdes(buf, dimensions)
end
end
while true do
local target = getnearestunplaced(cbuf, pbuf, cx,0,cz,0, dimensions["x"],dimensions["z"])
local target = getnearestunplaced(cbuf, pbuf, cx,0,cz,0, dimensions["x"],dimensions["z"], direction)
if not target then break end
render(cbuf, pbuf, cx,0,cz, target[1],target[2], dimensions["x"],dimensions["z"], {1})
@@ -466,11 +561,266 @@ local function printdes(buf, dimensions)
center(direction)
end
-- vertical stack printing
local function VP_movetoy(y, target)
while y > target do
move("down", true)
y = y - 1
end
while y < target do
move("up", true)
y = y + 1
end
return target
end
local function VP_moveto(x,z, cx,cz,direction)
local y = 0
--[[
y lanes for directions:
1: +x
2: -x
3: +z
4: -z
]]--
while x ~= cx do
if cx < x then -- x
center(direction)
direction = 0
y = VP_movetoy(y, 1)
cx = cx + 1
move("forward", true)
end
if cx > x then
center(direction)
direction = 0
y = VP_movetoy(y, 2)
cx = cx - 1
move("back", true)
end
end
while z ~= cz do
if z > cz then -- z
if center(direction, 1) then move("right") end
y = VP_movetoy(y, 3)
cz = cz + 1
move("forward", true)
direction = 1
end
if z < cz then
if center(direction, -1) then move("left") end
y = VP_movetoy(y, 4)
cz = cz - 1
move("forward", true)
direction = -1
end
end
VP_movetoy(y, 0)
return cx,cz,direction
end
local function VP_optimizestack(target)
-- go from bottom to top and erase false entries until we encounter a true one.
while #target > 0 do
if target[1] then break else
table.remove(target, 1)
end
end
return target
end
local function VP_createstack(buf, dimensions)
local fout = {
["height"] = dimensions["y"]*(4)+1,
["dimensions"] = dimensions,
}
local out = {}
for x=1,dimensions["x"],1 do
for z=1,dimensions["z"],1 do
local tempbuf = {}
for y=1,dimensions["y"],1 do -- for each y dimension
local placecode = buf[posasstring(x,y,z)]
for layer=1,3,1 do -- layers
table.insert(tempbuf, needstobeplaced(placecode, layer))
end
-- ceiling
table.insert(tempbuf, buf[posasstring(x,y,z)] ~= 2)
end
VP_optimizestack(tempbuf)
if #tempbuf > 0 then
out[posasstring(x,z)] = tempbuf
end
end
end
fout["stacks"] = out
return fout
end
local function VP_lengthofdict(target)
local out = 0
for _,v in pairs(target) do out = out + 1 end
return out
end
local function VP_splitstack(_stack, x)
local stack = _stack["stacks"]
local height = _stack["height"]
local stacks = {}
local spliteverx = math.floor(VP_lengthofdict(stack)/x)
local ind = 0
local buf = {}
for i,v in pairs(stack) do
if ind == spliteverx then
ind = 0
table.insert(stacks, buf)
buf = {}
end
buf[i] = v
ind = ind + 1
end
if VP_lengthofdict(buf) > 0 then table.insert(stacks, buf) end
local out = {
height=height,
stacks={}
}
for _,v in pairs(stacks) do
table.insert(out["stacks"],v)
end
return out
end
--[[local function VP_inspectsplitted(stacks, dimensions) -- I will probably never finish this.
local currentselected = 1
while true do
reset() -- render
local _,y = term.getSize()
term.setCursorPos(1,y)
term.setcol(colors.yellow, colors.black)
term.write("Currentlayer: ")
term.write(tostring(currentselected))
local event = table.pack(os.pullEvent())
if event[1] == "key" then
end
end
end]]
local function VP_printstack(buf, dimensions, cx,cy,cz,direction)
reset()
move("up")
for _=1,buf["height"]-cy,1 do
move("up")
end
local ox,oz = cx,cz
cx,cz,direction = VP_moveto(cx+1,cz, cx,cz,direction)
for x=1,dimensions["x"],1 do
for z=1,dimensions["z"],1 do
local tempbuf = buf["stacks"][posasstring(x,z)]
if tempbuf then
cx,cz,direction = VP_moveto(x,z, cx,cz,direction)
for _=1,#tempbuf+1,1 do
move("down", true)
end
for _,v in pairs(tempbuf) do
if v then
place("down")
end
move("up", true)
end
move("up", true)
end
end
end
VP_moveto(ox,oz, cx,cz,direction)
for _=1,buf["height"]+1,1 do
move("down")
end
center(direction)
return cx,cz,direction
end
local function VP_calccost(stacks, height,sx,sz) -- calculate needed blocks
local cost = 0
for cx=1,sx,1 do
for cz=1,sz,1 do
local tempbuf = stacks[posasstring(cx,cz)]
if tempbuf then
for ind=1,height,1 do
if tempbuf[ind] then cost = cost + 1 end
end
end
end
end
return cost
end
local function VP_selectpos(design,dimensions,msg, cx,cz)
cx,cz = cx or 0, cz or 0
local camx,camz = cx,cz
while true do
render(design,{}, camx,1,camz, camx,camz, dimensions["x"],dimensions["z"], {1,4})
term.setCursorPos(1,1)
term.write(msg)
local _,y = term.getSize()
term.setCursorPos(1,y)
term.write("x: ")
term.write(tostring(camx))
term.write(" z: ")
term.write(tostring(camz))
local _,key = os.pullEvent("key")
key = keys.getName(key)
if key == "w" then
camz = camz - 1
end
if key == "s" then
camz = camz + 1
end
if key == "a" then
camx = camx - 1
end
if key == "d" then
camx = camx + 1
end
if key == "enter" then
break
end
end
return camx,camz
end
local function expwarn()
reset()
term.write("This mode is experimental! Be cautious!")
incline()
term.write("Enter to continue.")
read("")
end
local function randomstr(length)
local possible = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
local out = ""
for _=1,length,1 do
local ind = math.random(#possible)
out = out .. string.sub(possible, ind, ind)
end
return out
end
while true do
integritycheck()
local action = selopt({
"New Design",
"Print Design"
"Print Design",
"VPrint Design",
"Join VPrint",
"Update",
}, "Select Action")
if action == 1 then
@@ -505,5 +855,150 @@ while true do
end
end
end
if action == 3 then
--expwarn()
peripheral.find("modem", rednet.open)
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)
local stacks = VP_createstack(buf, dimensions)
local height = stacks["height"]
print("Stacks created.")
local code = randomstr(5)
print("Pair code: '"..code.."'")
write("Enter amount of partaking turtles: ")
local expam = tonumber(read())
write("Press enter to send pair request.")
read("")
rednet.broadcast({
code=code,
}, "HB_vprint_pair")
print("Sent. awaiting pair accepts.")
local accepted = {}
while #accepted < expam do
local id,msg = rednet.receive("HB_vprint_pairespond")
if msg["code"] == code then
table.insert(accepted, id)
reset()
term.write(tostring(#accepted).."/"..tostring(expam))
end
end
reset()
print("Paired. Splitting stacks and sending out...")
local even = (VP_lengthofdict(stacks["stacks"])%(#accepted+1)) == 0
if even then even = #accepted+1 else even = #accepted end
stacks = VP_splitstack(stacks, even)
if #stacks["stacks"] ~= #accepted and (#stacks["stacks"] ~= #accepted+1) then
printError("Internal error with VP_splitstack. It returned "..#stacks["stacks"].." stacks.")
return
end
for i,v in pairs(accepted) do
reset()
print("ID "..tostring(v).." needs "..VP_calccost(stacks["stacks"][i], stacks["height"],dimensions["x"],dimensions["z"]).." blocks.")
print("Please ensure that turtle has that many blocks and press enter to continue.")
read("")
rednet.send(v, {
stack=stacks["stacks"][i],
dimensions=dimensions,
height=height
}, "HB_vprint_pairacknowledge")
end
print("This turtle needs "..tostring(VP_calccost(stacks["stacks"][expam+1], stacks["height"],dimensions["x"],dimensions["z"])).." blocks.")
print("Please ensure that turtle has that many blocks and press enter to continue.")
read("")
local x,y = 0,0
for _,v in pairs(accepted) do
x,y = VP_selectpos(buf,dimensions,"Select position of turtle "..tostring(v), x,y)
rednet.send(v, {
cx=x,
cz=y,
}, "HB_vprint_pairpossend")
end
reset()
write("Ready to begin, press enter to continue")
read("")
print("Sending begin signal.")
for _,v in pairs(accepted) do
rednet.send(v, {}, "HB_vprint_begin")
end
local ownstack = {
stacks=stacks["stacks"][expam+1],
dimensions=dimensions,
height=height
}
VP_printstack(ownstack,dimensions, 0,0,1,0)
end
end
if action == 4 then
--expwarn()
peripheral.find("modem", rednet.open)
reset()
term.write("Enter the code: ")
local code = read()
local masterid = 0
local buf = {}
local dimensions = {}
local height = 0
local cx,cz = 0,0
while true do -- await pairing request and respond
local id,request = rednet.receive("HB_vprint_pair")
if request["code"] == code then
masterid = id
print("Detected master: "..tostring(masterid))
print("Responding...")
rednet.send(masterid, {
code=code,
}, "HB_vprint_pairespond")
print("Waiting for response... ID: "..tostring(os.getComputerID()))
local id,msg = -1,{}
repeat
id,msg = rednet.receive("HB_vprint_pairacknowledge")
until id == masterid
buf = msg["stack"]
dimensions = msg["dimensions"]
height = msg["height"]
break
end
end
print("Received stacks and dimensions. ID: "..tostring(os.getComputerID()))
local id,msg = -1,"" -- wait until we get our current position
repeat
id,msg = rednet.receive("HB_vprint_pairpossend")
until id == masterid
cx,cz = msg["cx"],msg["cz"]
repeat -- wait until we can begin
id = rednet.receive("HB_vprint_begin")
until id == masterid
local ownstack = {
stacks=buf,
dimensions=dimensions,
height=height
}
VP_printstack(ownstack,dimensions, cx,0,cz,0)
end
if action == 5 then
shell.run("rm", "main.lua")
shell.run("wget", url)
return
end
end