mmm
This commit is contained in:
parent
5422d52065
commit
4f2631b349
24 changed files with 414 additions and 5665 deletions
|
@ -1,7 +1,7 @@
|
|||
local filename = "tobuild"
|
||||
rednet.open("left")
|
||||
while true do
|
||||
id, message, protocol = rednet.receive()
|
||||
id, messages, protocol = rednet.receive()
|
||||
if protocol == "getnexttobuild" then
|
||||
file = fs.open(filename,"r")
|
||||
line = file.readLine()
|
||||
|
@ -13,15 +13,15 @@ while true do
|
|||
print(line)
|
||||
rednet.send(id,line,"nexttobuild")
|
||||
elseif protocol == "failedtobuild" then
|
||||
print(message.."failed")
|
||||
print(messages.."failed")
|
||||
file = fs.open(filename,"r")
|
||||
restof = file.readAll()
|
||||
file.close()
|
||||
file = fs.open(filename,"w")
|
||||
file.writeLine(message)
|
||||
file.writeLine(messages)
|
||||
file.write(restof)
|
||||
file.close()
|
||||
end
|
||||
--file = fs.open(filename,"r")
|
||||
--print(file.readAll())
|
||||
end
|
||||
--print(file.readAll())
|
||||
end
|
||||
|
|
1584
computer/1/tobuild
1584
computer/1/tobuild
File diff suppressed because it is too large
Load diff
|
@ -1,15 +1,15 @@
|
|||
return {
|
||||
{
|
||||
name = "water",
|
||||
amount = 32900,
|
||||
amount = 32700,
|
||||
},
|
||||
{
|
||||
name = "blood",
|
||||
amount = 150,
|
||||
amount = 50,
|
||||
},
|
||||
{
|
||||
name = "still_milk",
|
||||
amount = 2000,
|
||||
amount = 1000,
|
||||
},
|
||||
{
|
||||
name = "lava",
|
||||
|
@ -25,7 +25,7 @@ return {
|
|||
},
|
||||
{
|
||||
name = "molten_rose_gold",
|
||||
amount = 0.44444444444446,
|
||||
amount = 0,
|
||||
},
|
||||
{
|
||||
amount = 0,
|
||||
|
|
|
@ -120,7 +120,6 @@ function connectTankOrAssign(fluid)
|
|||
_G.fluidTanks[index] = {
|
||||
name = fluid,
|
||||
amount = 0,
|
||||
connected = false
|
||||
}
|
||||
print("assigned tank", index, "to", fluid)
|
||||
break
|
||||
|
|
|
@ -3,18 +3,19 @@ require("pathfinding")
|
|||
require("fluids")
|
||||
sfx = require("sfx")
|
||||
|
||||
press_pos = vector.new(1,0,0)
|
||||
deployer_pos = vector.new(2,0,0)
|
||||
furnace_pos = vector.new(4,2,0)
|
||||
saw_pos = vector.new(3,1,0)
|
||||
saw_out_pos = vector.new(2,0,0)
|
||||
mill_pos = vector.new(4,0,0)
|
||||
mixer_pos = vector.new(-1,0,0)
|
||||
compactor_pos = vector.new(-2,0,0)
|
||||
spout_pos = vector.new(-3,0,0)
|
||||
melter_pos = vector.new(-4,1,-3)
|
||||
casting_table_pos = vector.new(-3,0,-3)
|
||||
washer_pos = vector.new(3,0,-4)
|
||||
press_pos = vector.new(1, 0, 0)
|
||||
deployer_pos = vector.new(2, 0, 0)
|
||||
furnace_pos = vector.new(4, 2, 0)
|
||||
saw_pos = vector.new(3, 1, 0)
|
||||
saw_out_pos = vector.new(2, 0, 0)
|
||||
mill_pos = vector.new(4, 0, 0)
|
||||
mixer_pos = vector.new(-1, 0, 0)
|
||||
compactor_pos = vector.new(-2, 0, 0)
|
||||
spout_pos = vector.new(-3, 0, 0)
|
||||
melter_pos = vector.new(-4, 1, -3)
|
||||
casting_pos = vector.new(-2, 1, -4)
|
||||
washer_pos = vector.new(3, 0, -4)
|
||||
growth_chamber_pos = vector.new(-3, 2, 0)
|
||||
|
||||
function spout(extra_items)
|
||||
local fluid = extra_items[1]
|
||||
|
@ -40,25 +41,27 @@ function spout(extra_items)
|
|||
end
|
||||
pumpToTanks(false)
|
||||
end
|
||||
|
||||
function saw(_)
|
||||
goTo(saw_pos, "south")
|
||||
turtle.drop()
|
||||
goTo(saw_out_pos, "south")
|
||||
takeDepot()
|
||||
end
|
||||
|
||||
function mill(extra_items)
|
||||
goTo(mill_pos,"south")
|
||||
goTo(mill_pos, "south")
|
||||
item_count = 0
|
||||
if turtle.getItemCount() ~= 0 then
|
||||
item_count = 1
|
||||
end
|
||||
insertForward(1, 1)
|
||||
for _,item in pairs(extra_items) do
|
||||
for _, item in pairs(extra_items) do
|
||||
item_count = item_count + item.count
|
||||
selectItem(item.name)
|
||||
insertForward(1, item.count)
|
||||
end
|
||||
print(item_count,"items")
|
||||
print(item_count, "items")
|
||||
while pFront("getItemDetail", 1) do
|
||||
sleep(0.1)
|
||||
end
|
||||
|
@ -66,6 +69,7 @@ function mill(extra_items)
|
|||
takeForward(i)
|
||||
end
|
||||
end
|
||||
|
||||
function deploy(extra_items)
|
||||
-- extra_items should only be one item
|
||||
goTo(deployer_pos, "south")
|
||||
|
@ -80,6 +84,7 @@ function deploy(extra_items)
|
|||
goDown()
|
||||
takeDepot()
|
||||
end
|
||||
|
||||
function deploy_tool(extra_items)
|
||||
-- extra_items should only be one item
|
||||
goTo(deployer_pos, "south")
|
||||
|
@ -98,6 +103,7 @@ function deploy_tool(extra_items)
|
|||
pFront("pushItem", "top")
|
||||
turtle.suckUp()
|
||||
end
|
||||
|
||||
function furnace(extra_items)
|
||||
goTo(furnace_pos, "south")
|
||||
item_count = 0
|
||||
|
@ -106,7 +112,7 @@ function furnace(extra_items)
|
|||
end
|
||||
turtle.dropUp(1)
|
||||
pFront("pullItems", "top", 1, 64, 1)
|
||||
for _,item in pairs(extra_items) do
|
||||
for _, item in pairs(extra_items) do
|
||||
item_count = item_count + item.count
|
||||
selectItem(item.name)
|
||||
turtle.dropUp(item.count)
|
||||
|
@ -118,19 +124,22 @@ function furnace(extra_items)
|
|||
pFront("pushItems", "top", 3)
|
||||
turtle.suckUp()
|
||||
end
|
||||
|
||||
function press(_)
|
||||
goTo(press_pos, "south")
|
||||
insertDepot(1)
|
||||
sleep(1)
|
||||
takeDepot()
|
||||
end
|
||||
|
||||
function compact(extra_items, product, yield)
|
||||
silly_temp = mixer_pos
|
||||
mixer_pos = compactor_pos
|
||||
mix(extra_items, product, yield)
|
||||
mixer_pos = silly_temp
|
||||
end
|
||||
function make_water(_,_,yield)
|
||||
|
||||
function make_water(_, _, yield)
|
||||
selectFluidDevice("water_source")
|
||||
connectTank("water")
|
||||
pumpToTanks(true)
|
||||
|
@ -139,6 +148,7 @@ function make_water(_,_,yield)
|
|||
pumpToTanks(false)
|
||||
fluidInvAdd("water", yield)
|
||||
end
|
||||
|
||||
function alloy(parts, product)
|
||||
for _, item in pairs(parts) do
|
||||
if not isFluid[item.name] then
|
||||
|
@ -174,6 +184,7 @@ function alloy(parts, product)
|
|||
fluidInvAdd(fluid.name, -created_amount)
|
||||
end
|
||||
end
|
||||
|
||||
function melt(_, product, yield)
|
||||
goTo(melter_pos, "north")
|
||||
goUp()
|
||||
|
@ -188,6 +199,7 @@ function melt(_, product, yield)
|
|||
pumpToTanks(false)
|
||||
fluidInvAdd(product, yield)
|
||||
end
|
||||
|
||||
function mix(extra_items, product, yield)
|
||||
-- prepare fluids
|
||||
local fluids = {}
|
||||
|
@ -221,7 +233,7 @@ function mix(extra_items, product, yield)
|
|||
sleep(1)
|
||||
contents = pFront("list")
|
||||
inputs_remaining = false
|
||||
for i = 1,9 do
|
||||
for i = 1, 9 do
|
||||
if contents[i] then
|
||||
inputs_remaining = true
|
||||
break
|
||||
|
@ -231,7 +243,7 @@ function mix(extra_items, product, yield)
|
|||
if product == "still_milk" then
|
||||
repeat
|
||||
is_done = false
|
||||
for _,t in pairs(pFront("tanks")) do
|
||||
for _, t in pairs(pFront("tanks")) do
|
||||
if stripModname(t.name) == "still_milk" then
|
||||
is_done = t.amount >= yield
|
||||
break
|
||||
|
@ -245,7 +257,7 @@ function mix(extra_items, product, yield)
|
|||
end
|
||||
-- empty fluids
|
||||
tanks = pFront("tanks")
|
||||
for _,tank in pairs(tanks) do
|
||||
for _, tank in pairs(tanks) do
|
||||
if tank.amount > 0 then
|
||||
connectTankOrAssign(stripModname(tank.name))
|
||||
pumpToTanks(true)
|
||||
|
@ -255,6 +267,7 @@ function mix(extra_items, product, yield)
|
|||
end
|
||||
fluidInvAdd(product, yield)
|
||||
end
|
||||
|
||||
function craft(extra_items)
|
||||
local slot = 0
|
||||
for _, item in pairs(extra_items) do
|
||||
|
@ -277,7 +290,7 @@ function wash(_, product)
|
|||
insertDepot(1)
|
||||
repeat
|
||||
is_done = false
|
||||
for _,item in pairs(pFront("items")) do
|
||||
for _, item in pairs(pFront("items")) do
|
||||
if stripModname(item.name) == product then
|
||||
is_done = true
|
||||
end
|
||||
|
@ -286,6 +299,57 @@ function wash(_, product)
|
|||
takeDepot()
|
||||
end
|
||||
|
||||
function growth_chamber()
|
||||
goTo(growth_chamber_pos, "west")
|
||||
pTop("pushItem", "front")
|
||||
turtle.suck()
|
||||
end
|
||||
|
||||
function cast_ingot(source, product, yield)
|
||||
fluid = source[1]
|
||||
if not isFluid[fluid.name] then
|
||||
error(fluid .. " is not a fluid")
|
||||
end
|
||||
connectTank(fluid)
|
||||
selectFluidDevice("melter")
|
||||
pumpToDevices(true)
|
||||
goTo(melter_pos, "north")
|
||||
repeat
|
||||
melter_tank = pFront("tanks")[1]
|
||||
local storage_emptied = melter_tank.amount >= getFluidAmount(fluid.name)
|
||||
local melter_full = melter_tank.amount >= melter_tank.capacity
|
||||
done_filling = storage_emptied or melter_full
|
||||
until done_filling
|
||||
pumpToDevices(false)
|
||||
local fluid_in_melter = melter_tank.amount
|
||||
local ingot_count = math.floor(fluid_in_melter / 111)
|
||||
local leftover = fluid_in_melter - ingot_count * 111.11
|
||||
print("expecting", ingot_count, "ingots")
|
||||
goTo(casting_pos, "west")
|
||||
for i = 1, ingot_count do
|
||||
redstone.setOutput("front", true)
|
||||
sleep(0.1)
|
||||
redstone.setOutput("front", false)
|
||||
goDown()
|
||||
repeat
|
||||
sleep(0.1)
|
||||
until pFront("getItemDetail", 2)
|
||||
takeForward(2)
|
||||
goUp()
|
||||
end
|
||||
|
||||
if leftover > 1 then
|
||||
pumpToTanks(true)
|
||||
sleep(5)
|
||||
pumpToTanks(false)
|
||||
end
|
||||
fluidInvAdd(fluid.name, -(ingot_count * 111))
|
||||
end
|
||||
|
||||
function rolling_mill()
|
||||
print("unimplemented :3")
|
||||
end
|
||||
|
||||
return {
|
||||
mill = mill,
|
||||
deploy = deploy,
|
||||
|
@ -301,4 +365,7 @@ return {
|
|||
spout = spout,
|
||||
make_water = make_water,
|
||||
wash = wash,
|
||||
}
|
||||
cast_ingot = cast_ingot,
|
||||
rolling_mill = rolling_mill,
|
||||
growth_chamber = growth_chamber,
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ function read_recipe(file)
|
|||
yield = 1
|
||||
while 1 do
|
||||
line = file.readLine()
|
||||
if not line then return nil end
|
||||
if string.sub(line, 1, 5) == "base " then
|
||||
base = string.sub(line, 6)
|
||||
elseif string.sub(line, 1, 13) == "intermediate " then
|
||||
|
|
|
@ -112,6 +112,10 @@ yield 3
|
|||
steps:
|
||||
craft andesite_alloy bronze_sheet
|
||||
|
||||
large_cogwheel
|
||||
steps:
|
||||
craft cogwheel bronze_sheet cogwheel
|
||||
|
||||
flint_knife
|
||||
steps:
|
||||
craft flint nil nil stick
|
||||
|
@ -231,6 +235,10 @@ molten_rose_gold
|
|||
steps:
|
||||
alloy molten_copper molten_gold
|
||||
|
||||
rose_gold_ingot
|
||||
steps:
|
||||
cast_ingot molten_rose_gold
|
||||
|
||||
molten_copper
|
||||
yield 111
|
||||
base copper_ingot
|
||||
|
@ -366,3 +374,66 @@ salmon
|
|||
yield 0.25
|
||||
steps:
|
||||
compact wet_sponge
|
||||
|
||||
milk_jar
|
||||
steps:
|
||||
craft glass birch_planks glass glass milk_bucket glass glass glass glass
|
||||
|
||||
milk_bucket
|
||||
base bucket
|
||||
steps:
|
||||
spout still_milk:1000
|
||||
|
||||
bucket
|
||||
steps:
|
||||
craft iron_ingot nil iron_ingot nil iron_ingot
|
||||
|
||||
molten_bronze
|
||||
yield 888
|
||||
steps:
|
||||
mix copper_nugget:36 tin_nugget:36
|
||||
|
||||
bronze_ingot
|
||||
steps:
|
||||
cast_ingot molten_bronze
|
||||
|
||||
copper_nugget
|
||||
yield 9
|
||||
steps:
|
||||
craft copper_ingot
|
||||
|
||||
tin_nugget
|
||||
yield 9
|
||||
steps:
|
||||
craft tin_ingot
|
||||
|
||||
iron_wire
|
||||
yield 2
|
||||
steps:
|
||||
rolling_mill iron_sheet
|
||||
|
||||
redstone_chip
|
||||
base electron_tube
|
||||
intermediate incomplete_redstone_chip
|
||||
repeat 12
|
||||
steps:
|
||||
spout molten_copper:41
|
||||
deploy iron_wire
|
||||
press
|
||||
|
||||
smart_chute
|
||||
steps:
|
||||
craft filter golden_sheet nil comparator observer nil chute chute
|
||||
|
||||
chute
|
||||
yield 4
|
||||
steps:
|
||||
craft iron_sheet nil nil iron_ingot nil nil iron_sheet
|
||||
|
||||
stone_growth_chamber
|
||||
steps:
|
||||
craft copper_casing copper_casing copper_casing copper_sheet water_bucket copper_sheet copper_casing copper_casing copper_casing
|
||||
|
||||
cobblestone
|
||||
steps:
|
||||
growth_chamber
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
term.clear()
|
||||
term.setCursorPos(1,1)
|
||||
|
||||
|
||||
parallel.waitForAny(
|
||||
function()
|
||||
shell.run("shell")
|
||||
|
|
|
@ -10,7 +10,7 @@ keep_stocked = {
|
|||
flint = 10
|
||||
}
|
||||
|
||||
-- resetAllFluidDevices()
|
||||
resetAllFluidDevices()
|
||||
goHome()
|
||||
|
||||
print("known recipes:\n")
|
||||
|
|
4
computer/20/.settings
Normal file
4
computer/20/.settings
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
[ "motd.enable" ] = false,
|
||||
[ "motd.path" ] = "/rom/motd.txt:/motd.txt:/rom/cccbridge_motd.txt",
|
||||
}
|
|
@ -1,18 +1,48 @@
|
|||
screen = peripheral.wrap("bottom")
|
||||
screen = peripheral.wrap("create_source_1")
|
||||
|
||||
message = {
|
||||
"Menu coming soon!",
|
||||
"Don't miss our opening day 50% off!",
|
||||
"The best vegan* fast food available"
|
||||
robot = peripheral.wrap("animatronic_1")
|
||||
|
||||
messages = {
|
||||
"Menu coming soon!",
|
||||
"Don't miss our opening day 50% off!",
|
||||
"The best vegan* fast food available"
|
||||
}
|
||||
i= 1
|
||||
rotations = {360-40, 360-20, 0, 360+20, 360+40}
|
||||
|
||||
n=1
|
||||
function update_rot()
|
||||
n = n%5 + 1
|
||||
target_rot = 180 + rotations[n]
|
||||
if target_rot > 180 then
|
||||
target_rot = target_rot - 360
|
||||
end
|
||||
robot.setBodyRot(0, target_rot, 0)
|
||||
robot.setFace("sad")
|
||||
robot.push()
|
||||
-- sleep(1.5)
|
||||
-- for i = 1, 5 do
|
||||
|
||||
-- end
|
||||
end
|
||||
|
||||
message_time = 5
|
||||
message_index = 1
|
||||
pose_time = 0
|
||||
dt = 0.1
|
||||
while true do
|
||||
screen.clear()
|
||||
screen.setCursorPos(1,1)
|
||||
screen.write(message[i])
|
||||
i = i+1
|
||||
if i > #message then
|
||||
i = 1
|
||||
end
|
||||
sleep(4)
|
||||
sleep(dt)
|
||||
pose_time = pose_time + dt
|
||||
if pose_time > 0.4 then
|
||||
pose_time = 0
|
||||
--
|
||||
end
|
||||
message_time = message_time + dt
|
||||
if message_time > 4 then
|
||||
message_time = 0
|
||||
screen.clear()
|
||||
screen.setCursorPos(1, 1)
|
||||
screen.write(messages[message_index])
|
||||
message_index = (message_index % #messages) + 1
|
||||
end
|
||||
update_rot()
|
||||
end
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
file = fs.open("tobuild","w")
|
||||
while true do
|
||||
id,message = rednet.receive()
|
||||
if id == 3 then
|
||||
if message=="done" then
|
||||
file.close()
|
||||
return
|
||||
else
|
||||
print(message)
|
||||
file.writeLine(message)
|
||||
end
|
||||
end
|
||||
end
|
||||
file = fs.open(arg[1],"w")
|
||||
repeat
|
||||
id,mess = rednet.receive()
|
||||
file.writeLine(mess)
|
||||
until not mess
|
||||
file.close()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
while true do
|
||||
print("rednerd")
|
||||
message = {os.pullEvent("rednet_message")}
|
||||
print(message[3])
|
||||
messages = {os.pullEvent("rednet_message")}
|
||||
print(messages[3])
|
||||
coroutine.yield()
|
||||
end
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
||||
|
|
3841
computer/4/tobuild
3841
computer/4/tobuild
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,5 @@
|
|||
|
||||
while message~="i can halt now" do
|
||||
while messages~="i can halt now" do
|
||||
rednet.send(id,"halt")
|
||||
id,message = rednet.receve()
|
||||
id,messages = rednet.receve()
|
||||
end
|
||||
|
|
40
computer/5/scoundril
Normal file
40
computer/5/scoundril
Normal file
|
@ -0,0 +1,40 @@
|
|||
W = window.create(term.native(),5,10,39,13)
|
||||
--W.setBackgroundColor(colors.lightGray)
|
||||
--W.setTextColor(colors.black)
|
||||
W.clear()
|
||||
|
||||
function scoundrilmirror()
|
||||
while true do
|
||||
--local x,y = W.getCursorPos()
|
||||
--paintutils.drawBox(4,9,46,23,colors.gray)
|
||||
--W.setBackgroundColor(colors.brown)
|
||||
--W.setTextColor(colors.pink)
|
||||
id,mess = rednet.receive()
|
||||
if id == 4 then
|
||||
W[mess[1]](unpack(mess[2]))
|
||||
end
|
||||
--W.setCursorPos(x,y)
|
||||
--paintutils.drawBox(4,9,46,23,colors.gray)
|
||||
end
|
||||
end
|
||||
function eventmirror()
|
||||
while true do
|
||||
event = {os.pullEventRaw()}
|
||||
if event[1] == "rednet_message" then
|
||||
|
||||
elseif event[1] == "modem_message" then
|
||||
|
||||
else
|
||||
rednet.send(
|
||||
4,
|
||||
event,
|
||||
"pocketevent"
|
||||
)
|
||||
--print(event)
|
||||
end
|
||||
end
|
||||
end
|
||||
parallel.waitForAll(
|
||||
scoundrilmirror,
|
||||
eventmirror
|
||||
)
|
|
@ -7,7 +7,7 @@ local function splitprefixes(str,prefixes)
|
|||
end
|
||||
end
|
||||
end
|
||||
while true do
|
||||
while false do
|
||||
thing = read( nil, nil,
|
||||
function(str)
|
||||
copy = require("rednetcopy")
|
||||
|
@ -24,15 +24,15 @@ while true do
|
|||
if #choices > 0 then
|
||||
return choices
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
name,sub,id = splitprefixes(str,turts)
|
||||
--print(name,sub,id)
|
||||
--print(sub)
|
||||
if not id then return end
|
||||
rednet.send(id,sub,"complete")
|
||||
_,message = rednet.receive("completed",0.2)
|
||||
return message
|
||||
_,messages = rednet.receive("completed",0.2)
|
||||
return messages
|
||||
end
|
||||
)
|
||||
turts = copy.lookup("tomfoolery")
|
||||
|
|
34
computer/5/test2.lua
Normal file
34
computer/5/test2.lua
Normal file
|
@ -0,0 +1,34 @@
|
|||
tab = "self"
|
||||
|
||||
while true do
|
||||
copy = require("rednetcopy")
|
||||
turts = copy.lookup("tomfoolery")
|
||||
table.insert(turts,{-1,"self"})
|
||||
table.sort(
|
||||
turts,
|
||||
function(a,b)
|
||||
return a[1] < b[1]
|
||||
end
|
||||
)
|
||||
turtlenames = {}
|
||||
x,y = term.getCursorPos()
|
||||
term.setCursorPos(1,1)
|
||||
for i,v in pairs(turts) do
|
||||
if tab ~= v[2] then
|
||||
term.setBackgroundColor((math.mod(i,2) == 0) and colors.lightGray or colors.cyan)
|
||||
term.setTextColor(colors.black)
|
||||
else
|
||||
term.setBackgroundColor(colors.gray)
|
||||
term.setTextColor(colors.white)
|
||||
end
|
||||
table.insert(turtlenames,v[2])
|
||||
write(" "..v[2].." ")
|
||||
end
|
||||
term.setBackgroundColor(colors.brown)
|
||||
write(" ")
|
||||
term.setBackgroundColor(colors.black)
|
||||
term.setTextColor(colors.white)
|
||||
term.setCursorPos(x,y)
|
||||
|
||||
|
||||
end
|
30
computer/5/thief
Normal file
30
computer/5/thief
Normal file
|
@ -0,0 +1,30 @@
|
|||
W = window.create(term.native(),3,3,39,13)
|
||||
function thiefmirror()
|
||||
while true do
|
||||
id,mess = rednet.receive()
|
||||
if id == 3 then
|
||||
W[mess[1]](unpack(mess[2]))
|
||||
end
|
||||
end
|
||||
end
|
||||
function eventmirror()
|
||||
while true do
|
||||
event = {os.pullEventRaw()}
|
||||
if event[1] == "rednet_message" then
|
||||
|
||||
elseif event[1] == "modem_message" then
|
||||
|
||||
else
|
||||
rednet.send(
|
||||
3,
|
||||
event,
|
||||
"pocketevent"
|
||||
)
|
||||
--print(event)
|
||||
end
|
||||
end
|
||||
end
|
||||
parallel.waitForAll(
|
||||
thiefmirror,
|
||||
eventmirror
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue