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"
|
local filename = "tobuild"
|
||||||
rednet.open("left")
|
rednet.open("left")
|
||||||
while true do
|
while true do
|
||||||
id, message, protocol = rednet.receive()
|
id, messages, protocol = rednet.receive()
|
||||||
if protocol == "getnexttobuild" then
|
if protocol == "getnexttobuild" then
|
||||||
file = fs.open(filename,"r")
|
file = fs.open(filename,"r")
|
||||||
line = file.readLine()
|
line = file.readLine()
|
||||||
|
@ -13,15 +13,15 @@ while true do
|
||||||
print(line)
|
print(line)
|
||||||
rednet.send(id,line,"nexttobuild")
|
rednet.send(id,line,"nexttobuild")
|
||||||
elseif protocol == "failedtobuild" then
|
elseif protocol == "failedtobuild" then
|
||||||
print(message.."failed")
|
print(messages.."failed")
|
||||||
file = fs.open(filename,"r")
|
file = fs.open(filename,"r")
|
||||||
restof = file.readAll()
|
restof = file.readAll()
|
||||||
file.close()
|
file.close()
|
||||||
file = fs.open(filename,"w")
|
file = fs.open(filename,"w")
|
||||||
file.writeLine(message)
|
file.writeLine(messages)
|
||||||
file.write(restof)
|
file.write(restof)
|
||||||
file.close()
|
file.close()
|
||||||
end
|
end
|
||||||
--file = fs.open(filename,"r")
|
--file = fs.open(filename,"r")
|
||||||
--print(file.readAll())
|
--print(file.readAll())
|
||||||
end
|
end
|
||||||
|
|
1584
computer/1/tobuild
1584
computer/1/tobuild
File diff suppressed because it is too large
Load diff
|
@ -1,15 +1,15 @@
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
name = "water",
|
name = "water",
|
||||||
amount = 32900,
|
amount = 32700,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "blood",
|
name = "blood",
|
||||||
amount = 150,
|
amount = 50,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "still_milk",
|
name = "still_milk",
|
||||||
amount = 2000,
|
amount = 1000,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "lava",
|
name = "lava",
|
||||||
|
@ -25,7 +25,7 @@ return {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "molten_rose_gold",
|
name = "molten_rose_gold",
|
||||||
amount = 0.44444444444446,
|
amount = 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
amount = 0,
|
amount = 0,
|
||||||
|
|
|
@ -120,7 +120,6 @@ function connectTankOrAssign(fluid)
|
||||||
_G.fluidTanks[index] = {
|
_G.fluidTanks[index] = {
|
||||||
name = fluid,
|
name = fluid,
|
||||||
amount = 0,
|
amount = 0,
|
||||||
connected = false
|
|
||||||
}
|
}
|
||||||
print("assigned tank", index, "to", fluid)
|
print("assigned tank", index, "to", fluid)
|
||||||
break
|
break
|
||||||
|
|
|
@ -3,18 +3,19 @@ require("pathfinding")
|
||||||
require("fluids")
|
require("fluids")
|
||||||
sfx = require("sfx")
|
sfx = require("sfx")
|
||||||
|
|
||||||
press_pos = vector.new(1,0,0)
|
press_pos = vector.new(1, 0, 0)
|
||||||
deployer_pos = vector.new(2,0,0)
|
deployer_pos = vector.new(2, 0, 0)
|
||||||
furnace_pos = vector.new(4,2,0)
|
furnace_pos = vector.new(4, 2, 0)
|
||||||
saw_pos = vector.new(3,1,0)
|
saw_pos = vector.new(3, 1, 0)
|
||||||
saw_out_pos = vector.new(2,0,0)
|
saw_out_pos = vector.new(2, 0, 0)
|
||||||
mill_pos = vector.new(4,0,0)
|
mill_pos = vector.new(4, 0, 0)
|
||||||
mixer_pos = vector.new(-1,0,0)
|
mixer_pos = vector.new(-1, 0, 0)
|
||||||
compactor_pos = vector.new(-2,0,0)
|
compactor_pos = vector.new(-2, 0, 0)
|
||||||
spout_pos = vector.new(-3,0,0)
|
spout_pos = vector.new(-3, 0, 0)
|
||||||
melter_pos = vector.new(-4,1,-3)
|
melter_pos = vector.new(-4, 1, -3)
|
||||||
casting_table_pos = vector.new(-3,0,-3)
|
casting_pos = vector.new(-2, 1, -4)
|
||||||
washer_pos = vector.new(3,0,-4)
|
washer_pos = vector.new(3, 0, -4)
|
||||||
|
growth_chamber_pos = vector.new(-3, 2, 0)
|
||||||
|
|
||||||
function spout(extra_items)
|
function spout(extra_items)
|
||||||
local fluid = extra_items[1]
|
local fluid = extra_items[1]
|
||||||
|
@ -40,25 +41,27 @@ function spout(extra_items)
|
||||||
end
|
end
|
||||||
pumpToTanks(false)
|
pumpToTanks(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
function saw(_)
|
function saw(_)
|
||||||
goTo(saw_pos, "south")
|
goTo(saw_pos, "south")
|
||||||
turtle.drop()
|
turtle.drop()
|
||||||
goTo(saw_out_pos, "south")
|
goTo(saw_out_pos, "south")
|
||||||
takeDepot()
|
takeDepot()
|
||||||
end
|
end
|
||||||
|
|
||||||
function mill(extra_items)
|
function mill(extra_items)
|
||||||
goTo(mill_pos,"south")
|
goTo(mill_pos, "south")
|
||||||
item_count = 0
|
item_count = 0
|
||||||
if turtle.getItemCount() ~= 0 then
|
if turtle.getItemCount() ~= 0 then
|
||||||
item_count = 1
|
item_count = 1
|
||||||
end
|
end
|
||||||
insertForward(1, 1)
|
insertForward(1, 1)
|
||||||
for _,item in pairs(extra_items) do
|
for _, item in pairs(extra_items) do
|
||||||
item_count = item_count + item.count
|
item_count = item_count + item.count
|
||||||
selectItem(item.name)
|
selectItem(item.name)
|
||||||
insertForward(1, item.count)
|
insertForward(1, item.count)
|
||||||
end
|
end
|
||||||
print(item_count,"items")
|
print(item_count, "items")
|
||||||
while pFront("getItemDetail", 1) do
|
while pFront("getItemDetail", 1) do
|
||||||
sleep(0.1)
|
sleep(0.1)
|
||||||
end
|
end
|
||||||
|
@ -66,6 +69,7 @@ function mill(extra_items)
|
||||||
takeForward(i)
|
takeForward(i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function deploy(extra_items)
|
function deploy(extra_items)
|
||||||
-- extra_items should only be one item
|
-- extra_items should only be one item
|
||||||
goTo(deployer_pos, "south")
|
goTo(deployer_pos, "south")
|
||||||
|
@ -80,6 +84,7 @@ function deploy(extra_items)
|
||||||
goDown()
|
goDown()
|
||||||
takeDepot()
|
takeDepot()
|
||||||
end
|
end
|
||||||
|
|
||||||
function deploy_tool(extra_items)
|
function deploy_tool(extra_items)
|
||||||
-- extra_items should only be one item
|
-- extra_items should only be one item
|
||||||
goTo(deployer_pos, "south")
|
goTo(deployer_pos, "south")
|
||||||
|
@ -98,6 +103,7 @@ function deploy_tool(extra_items)
|
||||||
pFront("pushItem", "top")
|
pFront("pushItem", "top")
|
||||||
turtle.suckUp()
|
turtle.suckUp()
|
||||||
end
|
end
|
||||||
|
|
||||||
function furnace(extra_items)
|
function furnace(extra_items)
|
||||||
goTo(furnace_pos, "south")
|
goTo(furnace_pos, "south")
|
||||||
item_count = 0
|
item_count = 0
|
||||||
|
@ -106,7 +112,7 @@ function furnace(extra_items)
|
||||||
end
|
end
|
||||||
turtle.dropUp(1)
|
turtle.dropUp(1)
|
||||||
pFront("pullItems", "top", 1, 64, 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
|
item_count = item_count + item.count
|
||||||
selectItem(item.name)
|
selectItem(item.name)
|
||||||
turtle.dropUp(item.count)
|
turtle.dropUp(item.count)
|
||||||
|
@ -118,19 +124,22 @@ function furnace(extra_items)
|
||||||
pFront("pushItems", "top", 3)
|
pFront("pushItems", "top", 3)
|
||||||
turtle.suckUp()
|
turtle.suckUp()
|
||||||
end
|
end
|
||||||
|
|
||||||
function press(_)
|
function press(_)
|
||||||
goTo(press_pos, "south")
|
goTo(press_pos, "south")
|
||||||
insertDepot(1)
|
insertDepot(1)
|
||||||
sleep(1)
|
sleep(1)
|
||||||
takeDepot()
|
takeDepot()
|
||||||
end
|
end
|
||||||
|
|
||||||
function compact(extra_items, product, yield)
|
function compact(extra_items, product, yield)
|
||||||
silly_temp = mixer_pos
|
silly_temp = mixer_pos
|
||||||
mixer_pos = compactor_pos
|
mixer_pos = compactor_pos
|
||||||
mix(extra_items, product, yield)
|
mix(extra_items, product, yield)
|
||||||
mixer_pos = silly_temp
|
mixer_pos = silly_temp
|
||||||
end
|
end
|
||||||
function make_water(_,_,yield)
|
|
||||||
|
function make_water(_, _, yield)
|
||||||
selectFluidDevice("water_source")
|
selectFluidDevice("water_source")
|
||||||
connectTank("water")
|
connectTank("water")
|
||||||
pumpToTanks(true)
|
pumpToTanks(true)
|
||||||
|
@ -139,6 +148,7 @@ function make_water(_,_,yield)
|
||||||
pumpToTanks(false)
|
pumpToTanks(false)
|
||||||
fluidInvAdd("water", yield)
|
fluidInvAdd("water", yield)
|
||||||
end
|
end
|
||||||
|
|
||||||
function alloy(parts, product)
|
function alloy(parts, product)
|
||||||
for _, item in pairs(parts) do
|
for _, item in pairs(parts) do
|
||||||
if not isFluid[item.name] then
|
if not isFluid[item.name] then
|
||||||
|
@ -174,6 +184,7 @@ function alloy(parts, product)
|
||||||
fluidInvAdd(fluid.name, -created_amount)
|
fluidInvAdd(fluid.name, -created_amount)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function melt(_, product, yield)
|
function melt(_, product, yield)
|
||||||
goTo(melter_pos, "north")
|
goTo(melter_pos, "north")
|
||||||
goUp()
|
goUp()
|
||||||
|
@ -188,6 +199,7 @@ function melt(_, product, yield)
|
||||||
pumpToTanks(false)
|
pumpToTanks(false)
|
||||||
fluidInvAdd(product, yield)
|
fluidInvAdd(product, yield)
|
||||||
end
|
end
|
||||||
|
|
||||||
function mix(extra_items, product, yield)
|
function mix(extra_items, product, yield)
|
||||||
-- prepare fluids
|
-- prepare fluids
|
||||||
local fluids = {}
|
local fluids = {}
|
||||||
|
@ -221,7 +233,7 @@ function mix(extra_items, product, yield)
|
||||||
sleep(1)
|
sleep(1)
|
||||||
contents = pFront("list")
|
contents = pFront("list")
|
||||||
inputs_remaining = false
|
inputs_remaining = false
|
||||||
for i = 1,9 do
|
for i = 1, 9 do
|
||||||
if contents[i] then
|
if contents[i] then
|
||||||
inputs_remaining = true
|
inputs_remaining = true
|
||||||
break
|
break
|
||||||
|
@ -231,7 +243,7 @@ function mix(extra_items, product, yield)
|
||||||
if product == "still_milk" then
|
if product == "still_milk" then
|
||||||
repeat
|
repeat
|
||||||
is_done = false
|
is_done = false
|
||||||
for _,t in pairs(pFront("tanks")) do
|
for _, t in pairs(pFront("tanks")) do
|
||||||
if stripModname(t.name) == "still_milk" then
|
if stripModname(t.name) == "still_milk" then
|
||||||
is_done = t.amount >= yield
|
is_done = t.amount >= yield
|
||||||
break
|
break
|
||||||
|
@ -245,7 +257,7 @@ function mix(extra_items, product, yield)
|
||||||
end
|
end
|
||||||
-- empty fluids
|
-- empty fluids
|
||||||
tanks = pFront("tanks")
|
tanks = pFront("tanks")
|
||||||
for _,tank in pairs(tanks) do
|
for _, tank in pairs(tanks) do
|
||||||
if tank.amount > 0 then
|
if tank.amount > 0 then
|
||||||
connectTankOrAssign(stripModname(tank.name))
|
connectTankOrAssign(stripModname(tank.name))
|
||||||
pumpToTanks(true)
|
pumpToTanks(true)
|
||||||
|
@ -255,6 +267,7 @@ function mix(extra_items, product, yield)
|
||||||
end
|
end
|
||||||
fluidInvAdd(product, yield)
|
fluidInvAdd(product, yield)
|
||||||
end
|
end
|
||||||
|
|
||||||
function craft(extra_items)
|
function craft(extra_items)
|
||||||
local slot = 0
|
local slot = 0
|
||||||
for _, item in pairs(extra_items) do
|
for _, item in pairs(extra_items) do
|
||||||
|
@ -277,7 +290,7 @@ function wash(_, product)
|
||||||
insertDepot(1)
|
insertDepot(1)
|
||||||
repeat
|
repeat
|
||||||
is_done = false
|
is_done = false
|
||||||
for _,item in pairs(pFront("items")) do
|
for _, item in pairs(pFront("items")) do
|
||||||
if stripModname(item.name) == product then
|
if stripModname(item.name) == product then
|
||||||
is_done = true
|
is_done = true
|
||||||
end
|
end
|
||||||
|
@ -286,6 +299,57 @@ function wash(_, product)
|
||||||
takeDepot()
|
takeDepot()
|
||||||
end
|
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 {
|
return {
|
||||||
mill = mill,
|
mill = mill,
|
||||||
deploy = deploy,
|
deploy = deploy,
|
||||||
|
@ -301,4 +365,7 @@ return {
|
||||||
spout = spout,
|
spout = spout,
|
||||||
make_water = make_water,
|
make_water = make_water,
|
||||||
wash = wash,
|
wash = wash,
|
||||||
}
|
cast_ingot = cast_ingot,
|
||||||
|
rolling_mill = rolling_mill,
|
||||||
|
growth_chamber = growth_chamber,
|
||||||
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ function read_recipe(file)
|
||||||
yield = 1
|
yield = 1
|
||||||
while 1 do
|
while 1 do
|
||||||
line = file.readLine()
|
line = file.readLine()
|
||||||
|
if not line then return nil end
|
||||||
if string.sub(line, 1, 5) == "base " then
|
if string.sub(line, 1, 5) == "base " then
|
||||||
base = string.sub(line, 6)
|
base = string.sub(line, 6)
|
||||||
elseif string.sub(line, 1, 13) == "intermediate " then
|
elseif string.sub(line, 1, 13) == "intermediate " then
|
||||||
|
|
|
@ -112,6 +112,10 @@ yield 3
|
||||||
steps:
|
steps:
|
||||||
craft andesite_alloy bronze_sheet
|
craft andesite_alloy bronze_sheet
|
||||||
|
|
||||||
|
large_cogwheel
|
||||||
|
steps:
|
||||||
|
craft cogwheel bronze_sheet cogwheel
|
||||||
|
|
||||||
flint_knife
|
flint_knife
|
||||||
steps:
|
steps:
|
||||||
craft flint nil nil stick
|
craft flint nil nil stick
|
||||||
|
@ -231,6 +235,10 @@ molten_rose_gold
|
||||||
steps:
|
steps:
|
||||||
alloy molten_copper molten_gold
|
alloy molten_copper molten_gold
|
||||||
|
|
||||||
|
rose_gold_ingot
|
||||||
|
steps:
|
||||||
|
cast_ingot molten_rose_gold
|
||||||
|
|
||||||
molten_copper
|
molten_copper
|
||||||
yield 111
|
yield 111
|
||||||
base copper_ingot
|
base copper_ingot
|
||||||
|
@ -366,3 +374,66 @@ salmon
|
||||||
yield 0.25
|
yield 0.25
|
||||||
steps:
|
steps:
|
||||||
compact wet_sponge
|
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.clear()
|
||||||
term.setCursorPos(1,1)
|
term.setCursorPos(1,1)
|
||||||
|
|
||||||
|
|
||||||
parallel.waitForAny(
|
parallel.waitForAny(
|
||||||
function()
|
function()
|
||||||
shell.run("shell")
|
shell.run("shell")
|
||||||
|
|
|
@ -10,7 +10,7 @@ keep_stocked = {
|
||||||
flint = 10
|
flint = 10
|
||||||
}
|
}
|
||||||
|
|
||||||
-- resetAllFluidDevices()
|
resetAllFluidDevices()
|
||||||
goHome()
|
goHome()
|
||||||
|
|
||||||
print("known recipes:\n")
|
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 = {
|
robot = peripheral.wrap("animatronic_1")
|
||||||
"Menu coming soon!",
|
|
||||||
"Don't miss our opening day 50% off!",
|
messages = {
|
||||||
"The best vegan* fast food available"
|
"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
|
while true do
|
||||||
screen.clear()
|
sleep(dt)
|
||||||
screen.setCursorPos(1,1)
|
pose_time = pose_time + dt
|
||||||
screen.write(message[i])
|
if pose_time > 0.4 then
|
||||||
i = i+1
|
pose_time = 0
|
||||||
if i > #message then
|
--
|
||||||
i = 1
|
end
|
||||||
end
|
message_time = message_time + dt
|
||||||
sleep(4)
|
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
|
end
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
file = fs.open("tobuild","r")
|
file = fs.open(arg[1],"r")
|
||||||
line = file.readLine()
|
line = file.readLine()
|
||||||
while line do
|
while line do
|
||||||
rednet.send(4,line)
|
rednet.send(4,line)
|
||||||
line = file.readLine()
|
line = file.readLine()
|
||||||
end
|
end
|
||||||
write("line".."\n")
|
write("line".."\n")
|
||||||
rednet.send(4,"done")
|
rednet.send(4,nil)
|
||||||
file.close()
|
file.close()
|
||||||
|
|
|
@ -2,8 +2,8 @@ im = require("inventorymanager")
|
||||||
local height = 0
|
local height = 0
|
||||||
function mineLayer()
|
function mineLayer()
|
||||||
rednet.broadcast("i can halt now")
|
rednet.broadcast("i can halt now")
|
||||||
id, message = rednet.receive(nil, 5)
|
id, messages = rednet.receive(nil, 5)
|
||||||
if message == "halt" then
|
if messages == "halt" then
|
||||||
print("was ordered to stop")
|
print("was ordered to stop")
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
@ -17,15 +17,15 @@ function mineLayer()
|
||||||
slots = slots +1
|
slots = slots +1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if slots < 8 then
|
if slots < 8 then
|
||||||
print("not confident i can pick it all up :(")
|
print("not confident i can pick it all up :(")
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
status = "dropping down"
|
status = "dropping down"
|
||||||
print(status)
|
print(status)
|
||||||
while turtle.down() do
|
while turtle.down() do
|
||||||
height = height+1
|
height = height+1
|
||||||
end
|
end
|
||||||
turtle.digDown()
|
turtle.digDown()
|
||||||
turtle.down()
|
turtle.down()
|
||||||
|
@ -33,7 +33,7 @@ function mineLayer()
|
||||||
status = "mining layer:"..height
|
status = "mining layer:"..height
|
||||||
print(status)
|
print(status)
|
||||||
for i = 1,16 do
|
for i = 1,16 do
|
||||||
|
|
||||||
for j = 1,15 do
|
for j = 1,15 do
|
||||||
hit, below = turtle.inspectDown()
|
hit, below = turtle.inspectDown()
|
||||||
if below.name == "minecraft:water" then
|
if below.name == "minecraft:water" then
|
||||||
|
@ -66,7 +66,7 @@ function mineLayer()
|
||||||
end
|
end
|
||||||
function gohome()
|
function gohome()
|
||||||
status = "resurfacing"
|
status = "resurfacing"
|
||||||
print(status)
|
print(status)
|
||||||
for i = 1,height do
|
for i = 1,height do
|
||||||
turtle.up()
|
turtle.up()
|
||||||
end
|
end
|
||||||
|
@ -74,6 +74,6 @@ function gohome()
|
||||||
end
|
end
|
||||||
turtle.forward()
|
turtle.forward()
|
||||||
while mineLayer() do
|
while mineLayer() do
|
||||||
|
|
||||||
end
|
end
|
||||||
gohome()
|
gohome()
|
||||||
|
|
|
@ -1,85 +1,37 @@
|
||||||
_G.position = vector.new(-2,186,126)
|
_G.position = vector.new(-2,186,126)
|
||||||
_G.facing = vector.new(-1,0,0)
|
_G.facing = vector.new(-1,0,0)
|
||||||
rednet.open("left")
|
rednet.open("left")
|
||||||
--old_print = _G.print
|
rednet.host("tomfoolery",os.computerLabel())
|
||||||
--[[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()
|
|
||||||
|
|
||||||
|
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")
|
file = fs.open(arg[1],"w")
|
||||||
while true do
|
repeat
|
||||||
id,message = rednet.receive()
|
id,mess = rednet.receive()
|
||||||
if id == 3 then
|
file.writeLine(mess)
|
||||||
if message=="done" then
|
until not mess
|
||||||
file.close()
|
file.close()
|
||||||
return
|
|
||||||
else
|
|
||||||
print(message)
|
|
||||||
file.writeLine(message)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
while true do
|
while true do
|
||||||
print("rednerd")
|
print("rednerd")
|
||||||
message = {os.pullEvent("rednet_message")}
|
messages = {os.pullEvent("rednet_message")}
|
||||||
print(message[3])
|
print(messages[3])
|
||||||
coroutine.yield()
|
coroutine.yield()
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,84 +1,39 @@
|
||||||
_G.position = vector.new(-1,186,126)
|
_G.position = vector.new(-1,186,126)
|
||||||
_G.facing = vector.new(-1,0,0)
|
_G.facing = vector.new(-1,0,0)
|
||||||
rednet.open("left")
|
rednet.open("left")
|
||||||
--old_print = _G.print
|
rednet.host("tomfoolery",os.computerLabel())
|
||||||
--[[new_print = function(...)
|
forward = {}
|
||||||
x = ""
|
--print(term.native())
|
||||||
for i,v in ipairs(arg) do
|
for i,v in pairs(term.native()) do
|
||||||
x = x..tostring(v).." "
|
print(i,v)
|
||||||
|
forward[i] = function(...)
|
||||||
|
rednet.send(5,{i,{...}})
|
||||||
|
return v(...)
|
||||||
end
|
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
|
end
|
||||||
rednet.host("tomfoolery",os.getComputerLabel())
|
term.redirect(forward)
|
||||||
queue = {}
|
W = window.create(term.current(),1,1,term.getSize())
|
||||||
history = {}
|
W.setBackgroundColor(colors.white)
|
||||||
if true then
|
W.setTextColor(colors.black)
|
||||||
parallel.waitForAll(
|
term.redirect(W)
|
||||||
function()
|
parallel.waitForAll(
|
||||||
while true do
|
function()
|
||||||
--print("reading")
|
shell.run("shell")
|
||||||
while running do
|
end,
|
||||||
coroutine.yield()
|
function()
|
||||||
end
|
while true do
|
||||||
write(
|
id, message, protocol = rednet.receive(
|
||||||
shell.dir().."> "
|
"pocketevent"
|
||||||
)
|
)
|
||||||
table.insert(
|
os.queueEvent(unpack(message))
|
||||||
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
|
||||||
)
|
end
|
||||||
end
|
,
|
||||||
rednet.receive()
|
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")
|
rednet.send(id,"halt")
|
||||||
id,message = rednet.receve()
|
id,messages = rednet.receve()
|
||||||
end
|
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
|
end
|
||||||
end
|
end
|
||||||
while true do
|
while false do
|
||||||
thing = read( nil, nil,
|
thing = read( nil, nil,
|
||||||
function(str)
|
function(str)
|
||||||
copy = require("rednetcopy")
|
copy = require("rednetcopy")
|
||||||
|
@ -24,15 +24,15 @@ while true do
|
||||||
if #choices > 0 then
|
if #choices > 0 then
|
||||||
return choices
|
return choices
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
name,sub,id = splitprefixes(str,turts)
|
name,sub,id = splitprefixes(str,turts)
|
||||||
--print(name,sub,id)
|
--print(name,sub,id)
|
||||||
--print(sub)
|
--print(sub)
|
||||||
if not id then return end
|
if not id then return end
|
||||||
rednet.send(id,sub,"complete")
|
rednet.send(id,sub,"complete")
|
||||||
_,message = rednet.receive("completed",0.2)
|
_,messages = rednet.receive("completed",0.2)
|
||||||
return message
|
return messages
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
turts = copy.lookup("tomfoolery")
|
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