mmm
This commit is contained in:
parent
5422d52065
commit
4f2631b349
24 changed files with 414 additions and 5665 deletions
|
@ -1,9 +1,9 @@
|
|||
file = fs.open("tobuild","r")
|
||||
file = fs.open(arg[1],"r")
|
||||
line = file.readLine()
|
||||
while line do
|
||||
rednet.send(4,line)
|
||||
line = file.readLine()
|
||||
end
|
||||
write("line".."\n")
|
||||
rednet.send(4,"done")
|
||||
rednet.send(4,nil)
|
||||
file.close()
|
||||
|
|
|
@ -2,8 +2,8 @@ im = require("inventorymanager")
|
|||
local height = 0
|
||||
function mineLayer()
|
||||
rednet.broadcast("i can halt now")
|
||||
id, message = rednet.receive(nil, 5)
|
||||
if message == "halt" then
|
||||
id, messages = rednet.receive(nil, 5)
|
||||
if messages == "halt" then
|
||||
print("was ordered to stop")
|
||||
return false
|
||||
end
|
||||
|
@ -17,15 +17,15 @@ function mineLayer()
|
|||
slots = slots +1
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if slots < 8 then
|
||||
print("not confident i can pick it all up :(")
|
||||
return false
|
||||
end
|
||||
status = "dropping down"
|
||||
print(status)
|
||||
while turtle.down() do
|
||||
height = height+1
|
||||
while turtle.down() do
|
||||
height = height+1
|
||||
end
|
||||
turtle.digDown()
|
||||
turtle.down()
|
||||
|
@ -33,7 +33,7 @@ function mineLayer()
|
|||
status = "mining layer:"..height
|
||||
print(status)
|
||||
for i = 1,16 do
|
||||
|
||||
|
||||
for j = 1,15 do
|
||||
hit, below = turtle.inspectDown()
|
||||
if below.name == "minecraft:water" then
|
||||
|
@ -66,7 +66,7 @@ function mineLayer()
|
|||
end
|
||||
function gohome()
|
||||
status = "resurfacing"
|
||||
print(status)
|
||||
print(status)
|
||||
for i = 1,height do
|
||||
turtle.up()
|
||||
end
|
||||
|
@ -74,6 +74,6 @@ function gohome()
|
|||
end
|
||||
turtle.forward()
|
||||
while mineLayer() do
|
||||
|
||||
|
||||
end
|
||||
gohome()
|
||||
|
|
|
@ -1,85 +1,37 @@
|
|||
_G.position = vector.new(-2,186,126)
|
||||
_G.facing = vector.new(-1,0,0)
|
||||
rednet.open("left")
|
||||
--old_print = _G.print
|
||||
--[[new_print = function(...)
|
||||
x = ""
|
||||
for i,v in ipairs(arg) do
|
||||
x = x..tostring(v).." "
|
||||
end
|
||||
old_print(x)
|
||||
rednet.broadcast(x)
|
||||
end]]
|
||||
--_G.print = new_print
|
||||
--rednet.host("tomfoolery",os.computerLabel())
|
||||
--while true do
|
||||
function append(tbl,value)
|
||||
table.insert(tbl,value)
|
||||
return tbl
|
||||
end
|
||||
rednet.host("tomfoolery",os.getComputerLabel())
|
||||
queue = {}
|
||||
history = {}
|
||||
if true then
|
||||
parallel.waitForAll(
|
||||
function()
|
||||
while true do
|
||||
--print("reading")
|
||||
while running do
|
||||
coroutine.yield()
|
||||
end
|
||||
write(
|
||||
shell.dir().."> "
|
||||
)
|
||||
table.insert(
|
||||
queue,
|
||||
append(
|
||||
history,
|
||||
not running and read(
|
||||
nil,
|
||||
history,
|
||||
shell.complete
|
||||
)
|
||||
)[#history]
|
||||
)
|
||||
sleep(0.05)--coroutine.yield()
|
||||
end
|
||||
end,
|
||||
function()
|
||||
while true do
|
||||
--print("attempting to run shell on :"..(queue[1] or ""))
|
||||
running = true
|
||||
shell.run(
|
||||
table.remove(
|
||||
queue,
|
||||
1
|
||||
)
|
||||
)
|
||||
running = false
|
||||
--term.clear()
|
||||
for i,v in pairs(queue) do
|
||||
--print(v)
|
||||
end
|
||||
sleep(0.05)
|
||||
end
|
||||
end,
|
||||
function()
|
||||
while true do
|
||||
--print("recieving")
|
||||
id,mess,kind = rednet.receive()
|
||||
if kind == "complete" then
|
||||
rednet.send(id,shell.complete(mess),"completed")
|
||||
elseif kind == "run" then
|
||||
print("recieved")
|
||||
print(id, mess, kind)
|
||||
table.insert(queue,mess)
|
||||
sleep(0.05)
|
||||
else
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
rednet.receive()
|
||||
rednet.host("tomfoolery",os.computerLabel())
|
||||
|
||||
forward = {}
|
||||
--print(term.native())
|
||||
for i,v in pairs(term.native()) do
|
||||
print(i,v)
|
||||
forward[i] = function(...)
|
||||
rednet.send(5,{i,{...}})
|
||||
return v(...)
|
||||
end
|
||||
end
|
||||
term.redirect(forward)
|
||||
W = window.create(term.current(),1,1,term.getSize())
|
||||
term.redirect(W)
|
||||
parallel.waitForAll(
|
||||
function()
|
||||
shell.run("shell")
|
||||
end,
|
||||
function()
|
||||
while true do
|
||||
id, message, protocol = rednet.receive(
|
||||
"pocketevent"
|
||||
)
|
||||
os.queueEvent(unpack(message))
|
||||
end
|
||||
end
|
||||
,
|
||||
function()
|
||||
while true do
|
||||
W.redraw()
|
||||
sleep(0.5)
|
||||
end
|
||||
end
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue