mmm
This commit is contained in:
parent
5422d52065
commit
4f2631b349
24 changed files with 414 additions and 5665 deletions
|
@ -1,84 +1,39 @@
|
|||
_G.position = vector.new(-1,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).." "
|
||||
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
|
||||
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
|
||||
term.redirect(forward)
|
||||
W = window.create(term.current(),1,1,term.getSize())
|
||||
W.setBackgroundColor(colors.white)
|
||||
W.setTextColor(colors.black)
|
||||
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
|
||||
rednet.receive()
|
||||
end
|
||||
,
|
||||
function()
|
||||
while true do
|
||||
W.redraw()
|
||||
sleep(0.1)
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue