a
This commit is contained in:
parent
12ffbdc45d
commit
13ddce15ae
15 changed files with 8967 additions and 61 deletions
|
@ -1,4 +1,5 @@
|
||||||
noteblock = peripheral.wrap("right")
|
noteblock = peripheral.wrap("right")
|
||||||
|
sfx = require("sfx")
|
||||||
speaker = peripheral.wrap("left")
|
speaker = peripheral.wrap("left")
|
||||||
instruments = {
|
instruments = {
|
||||||
"harp",
|
"harp",
|
||||||
|
@ -42,6 +43,13 @@ while true do
|
||||||
--os.reboot()
|
--os.reboot()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
parallel.waitForAll(sound,sound,sound,sound,sound)
|
while true do
|
||||||
|
sound()
|
||||||
|
if math.random(100) > 97 then
|
||||||
|
sfx.success()
|
||||||
|
sleep(random(1,4))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
--parallel.waitForAll(sound,sound,sound,sound,sound)
|
||||||
peripheral.call("top","turnOn")
|
peripheral.call("top","turnOn")
|
||||||
-- os.reboot()
|
-- os.reboot()
|
||||||
|
|
|
@ -24,21 +24,20 @@ function takeForward(slot)
|
||||||
turtle.suckDown()
|
turtle.suckDown()
|
||||||
end
|
end
|
||||||
|
|
||||||
function insertForwardDepot(count)
|
function insertDepot(count)
|
||||||
turtle.dropDown(count)
|
turtle.dropDown(count)
|
||||||
peripheral.call("front", "pullItem", "bottom")
|
peripheral.call("front", "pullItem", "bottom")
|
||||||
end
|
end
|
||||||
|
|
||||||
function takeForwardDepot()
|
function takeDepot()
|
||||||
-- pDown.pullItems("front", slot, 64, 1)
|
|
||||||
peripheral.call("front", "pushItem", "bottom")
|
peripheral.call("front", "pushItem", "bottom")
|
||||||
turtle.suckDown()
|
turtle.suckDown()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function takeItems(type, count)
|
function takeItems(type, count)
|
||||||
item_list = pFront.list()
|
local item_list = pFront.list()
|
||||||
slot = findItems(item_list, type)
|
local slot = findItems(item_list, type)
|
||||||
|
|
||||||
if slot == nil then
|
if slot == nil then
|
||||||
printError("could not find item " .. type .. " in chest")
|
printError("could not find item " .. type .. " in chest")
|
||||||
|
|
|
@ -2,7 +2,6 @@ require("inventory")
|
||||||
require("pathfinding")
|
require("pathfinding")
|
||||||
|
|
||||||
function mill(extra_items)
|
function mill(extra_items)
|
||||||
-- 0.4 second/item
|
|
||||||
go_to(vector.new(-4,0,0),"south")
|
go_to(vector.new(-4,0,0),"south")
|
||||||
item_count = 0
|
item_count = 0
|
||||||
if turtle.getItemCount() ~= 0 then
|
if turtle.getItemCount() ~= 0 then
|
||||||
|
@ -15,16 +14,17 @@ function mill(extra_items)
|
||||||
insertForward(1, item.count)
|
insertForward(1, item.count)
|
||||||
end
|
end
|
||||||
print(item_count,"items")
|
print(item_count,"items")
|
||||||
sleep(0.5)
|
while peripheral.call("front", "getItemDetail", 1) do
|
||||||
sleep(0.4 * item_count)
|
sleep(0.1)
|
||||||
for i = 1, 10 do
|
end
|
||||||
|
for i = 2, 10 do
|
||||||
takeForward(i)
|
takeForward(i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function deploy(extra_items, nbt)
|
function deploy(extra_items, nbt)
|
||||||
-- extra_items should only be one item
|
-- extra_items should only be one item
|
||||||
go_to(vector.new(2,0,0), "south")
|
go_to(vector.new(2,0,0), "south")
|
||||||
insertForwardDepot(1)
|
insertDepot(1)
|
||||||
goUp()
|
goUp()
|
||||||
goUp()
|
goUp()
|
||||||
selectItem(extra_items[1].name, nbt)
|
selectItem(extra_items[1].name, nbt)
|
||||||
|
@ -33,7 +33,7 @@ function deploy(extra_items, nbt)
|
||||||
|
|
||||||
goDown()
|
goDown()
|
||||||
goDown()
|
goDown()
|
||||||
takeForwardDepot()
|
takeDepot()
|
||||||
end
|
end
|
||||||
function deploy_tool(extra_items)
|
function deploy_tool(extra_items)
|
||||||
deploy(extra_items, true)
|
deploy(extra_items, true)
|
||||||
|
@ -62,9 +62,9 @@ function furnace(extra_items)
|
||||||
end
|
end
|
||||||
function press(_)
|
function press(_)
|
||||||
go_to(vector.new(-1,0,0), "south")
|
go_to(vector.new(-1,0,0), "south")
|
||||||
insertForwardDepot(1)
|
insertDepot(1)
|
||||||
sleep(1)
|
sleep(1)
|
||||||
takeForwardDepot()
|
takeDepot()
|
||||||
end
|
end
|
||||||
function compact(extra_items) end
|
function compact(extra_items) end
|
||||||
function mix(extra_items)
|
function mix(extra_items)
|
||||||
|
@ -83,17 +83,24 @@ function mix(extra_items)
|
||||||
takeForward(10)
|
takeForward(10)
|
||||||
end
|
end
|
||||||
function craft(extra_items)
|
function craft(extra_items)
|
||||||
slot = 5
|
-- for i = 1, 16 do
|
||||||
|
-- if turtle.getItemCount(i) ~= 0 then
|
||||||
|
-- turtle.select(i)
|
||||||
|
-- turtle.drop()
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
local slot = 0
|
||||||
|
print(len(extra_items), "extra items")
|
||||||
for _, item in pairs(extra_items) do
|
for _, item in pairs(extra_items) do
|
||||||
slot = slot + 1
|
slot = slot + 1
|
||||||
if slot == 9 then
|
if slot == 4 then
|
||||||
slot = 10
|
slot = 5
|
||||||
elseif slot == 13 then
|
elseif slot == 8 then
|
||||||
slot = 14
|
slot = 9
|
||||||
end
|
end
|
||||||
if item.name ~= "nil" then
|
if item.name ~= "nil" then
|
||||||
selectItem(item.name)
|
turtle.select(slot)
|
||||||
turtle.transferTo(slot, 1)
|
takeItems(item.name, item.count)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
turtle.craft()
|
turtle.craft()
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
pp = require("cc.pretty")
|
pp = require("cc.pretty")
|
||||||
|
|
||||||
if _G.pos == nil then
|
-- if _G.pos == nil then
|
||||||
_G.facing = "south"
|
_G.facing = "south"
|
||||||
_G.pos = vector.new(0,0,0)
|
_G.pos = vector.new(0,0,0)
|
||||||
file = fs.open("pos.txt", "r")
|
-- file = fs.open("pos.txt", "r")
|
||||||
data = splitString(file.readAll())
|
-- data = splitString(file.readAll())
|
||||||
_G.pos.x = tonumber(data[1])
|
-- _G.pos.x = tonumber(data[1])
|
||||||
_G.pos.y = tonumber(data[2])
|
-- _G.pos.y = tonumber(data[2])
|
||||||
_G.pos.z = tonumber(data[3])
|
-- _G.pos.z = tonumber(data[3])
|
||||||
_G.facing = data[4]
|
-- _G.facing = data[4]
|
||||||
end
|
-- end
|
||||||
|
|
||||||
local up = vector.new(0,1,0)
|
local up = vector.new(0,1,0)
|
||||||
|
|
||||||
|
@ -35,9 +35,9 @@ local vecOf = {
|
||||||
}
|
}
|
||||||
|
|
||||||
function savePos()
|
function savePos()
|
||||||
fs.delete("pos.txt")
|
-- fs.delete("pos.txt")
|
||||||
file = fs.open("pos.txt", "w")
|
-- file = fs.open("pos.txt", "w")
|
||||||
file.write(_G.pos.x .. " " .. _G.pos.y .. " " .. _G.pos.z .. " " .. _G.facing)
|
-- file.write(_G.pos.x .. " " .. _G.pos.y .. " " .. _G.pos.z .. " " .. _G.facing)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -112,8 +112,7 @@ end
|
||||||
function go_to(target, face)
|
function go_to(target, face)
|
||||||
while target ~= _G.pos do
|
while target ~= _G.pos do
|
||||||
stepTo(target)
|
stepTo(target)
|
||||||
-- print(_G.pos, _G.facing, target, face)
|
-- print(_G.pos, _G.facing)
|
||||||
print(_G.pos, _G.facing)
|
|
||||||
end
|
end
|
||||||
if face and face ~= _G.facing then
|
if face and face ~= _G.facing then
|
||||||
if rightOf[_G.facing] == face then
|
if rightOf[_G.facing] == face then
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
0 0 0 south
|
|
|
@ -115,3 +115,48 @@ gravel
|
||||||
base cobblestone
|
base cobblestone
|
||||||
steps:
|
steps:
|
||||||
mill
|
mill
|
||||||
|
|
||||||
|
fluid_valve
|
||||||
|
steps:
|
||||||
|
craft iron_sheet fluid_pipe
|
||||||
|
|
||||||
|
black_dye
|
||||||
|
base charcoal
|
||||||
|
steps:
|
||||||
|
mill
|
||||||
|
|
||||||
|
black_concrete_powder
|
||||||
|
steps:
|
||||||
|
craft black_dye sand sand sand sand gravel gravel gravel gravel
|
||||||
|
|
||||||
|
rose_quartz_lamp
|
||||||
|
steps:
|
||||||
|
craft polished_rose_quartz redstone zinc_ingot
|
||||||
|
|
||||||
|
smart_fluid_pipe
|
||||||
|
steps:
|
||||||
|
craft filter bronze_sheet nil comparator observer nil fluid_valve fluid_pipe
|
||||||
|
|
||||||
|
comparator
|
||||||
|
steps:
|
||||||
|
craft nil redstone_torch nil redstone_torch quartz redstone_torch stone stone stone
|
||||||
|
|
||||||
|
redstone_torch
|
||||||
|
steps:
|
||||||
|
craft redstone nil nil stick
|
||||||
|
|
||||||
|
observer
|
||||||
|
steps:
|
||||||
|
craft cobblestone cobblestone cobblestone redstone redstone quartz cobblestone cobblestone cobblestone
|
||||||
|
|
||||||
|
fluid_tank
|
||||||
|
steps:
|
||||||
|
craft nil copper_sheet nil copper_sheet barrel copper_sheet nil copper_sheet
|
||||||
|
|
||||||
|
barrel
|
||||||
|
steps:
|
||||||
|
craft birch_planks birch_slab birch_planks birch_planks nil birch_planks birch_planks birch_slab birch_planks
|
||||||
|
|
||||||
|
birch_slab
|
||||||
|
steps:
|
||||||
|
craft birch_planks birch_planks birch_planks
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
s = require("sfx")
|
s = require("sfx")
|
||||||
-- s.success()
|
s.success()
|
||||||
s.fail()
|
--s.fail()
|
||||||
|
|
|
@ -89,9 +89,11 @@ function tryCreating(recipe)
|
||||||
if len(missing_ingredients) == 0 then
|
if len(missing_ingredients) == 0 then
|
||||||
todo[#todo] = nil
|
todo[#todo] = nil
|
||||||
turtle.select(1)
|
turtle.select(1)
|
||||||
|
if recipe.steps[1].machine ~= "craft" then
|
||||||
for item, count in pairs(ingredients) do
|
for item, count in pairs(ingredients) do
|
||||||
takeItems(item, count)
|
takeItems(item, count)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
doRecipe(current_recipe)
|
doRecipe(current_recipe)
|
||||||
-- for item, min_count in pairs(getMissing(keep_stocked)) do
|
-- for item, min_count in pairs(getMissing(keep_stocked)) do
|
||||||
-- table.insert(todo, recipes[item])
|
-- table.insert(todo, recipes[item])
|
||||||
|
|
|
@ -1,4 +1,48 @@
|
||||||
|
term.clear()
|
||||||
|
term.setCursorPos(1,1)
|
||||||
|
print("Chaos Gremlin Protection System")
|
||||||
|
local secret = "mrrrp"
|
||||||
|
local input = ""
|
||||||
|
write("log in: ")
|
||||||
while true do
|
while true do
|
||||||
peripheral.call("bottom","turnOn")
|
local event, extra = os.pullEventRaw()
|
||||||
sleep(0.05)
|
if event == "terminate" then
|
||||||
|
print("\nnice try")
|
||||||
|
write("log in: ")
|
||||||
|
input = ""
|
||||||
|
elseif event == "char" then
|
||||||
|
input = input .. extra
|
||||||
|
write("*")
|
||||||
|
elseif event == "key" then
|
||||||
|
if extra == 259 and #input > 0 then
|
||||||
|
x, y = term.getCursorPos()
|
||||||
|
x = x - 1
|
||||||
|
term.setCursorPos(x, y)
|
||||||
|
write(" ")
|
||||||
|
term.setCursorPos(x, y)
|
||||||
|
input = string.sub(input, 1, string.len(input) - 1)
|
||||||
|
elseif extra == 257 then
|
||||||
|
if input == secret then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
print("\nbegone, intruder\n\""..input.."\" is wrong")
|
||||||
|
write("log in: ")
|
||||||
|
input = ""
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
print()
|
||||||
|
-- w = _G.write
|
||||||
|
-- p = _G.print
|
||||||
|
-- _G.write = function(text)
|
||||||
|
-- return w("meow ")
|
||||||
|
-- end
|
||||||
|
-- _G.print = function (...)
|
||||||
|
-- p("meow ")
|
||||||
|
-- end
|
||||||
|
-- b = term.blit
|
||||||
|
-- term.blit = function(text, fg, bg)
|
||||||
|
-- b("meow", fg, bg)
|
||||||
|
-- end
|
||||||
|
|
|
@ -11,4 +11,4 @@ new_print = function(...)
|
||||||
rednet.broadcast(x)
|
rednet.broadcast(x)
|
||||||
end
|
end
|
||||||
_G.print = new_print
|
_G.print = new_print
|
||||||
|
rednet.host("tomfoolery",os.computerLabel())
|
||||||
|
|
|
@ -17,7 +17,7 @@ function fell(index)
|
||||||
print("going towards tree")
|
print("going towards tree")
|
||||||
pf.lookat(trees[index or math.random(#trees)])
|
pf.lookat(trees[index or math.random(#trees)])
|
||||||
has, data = turtle.inspect()
|
has, data = turtle.inspect()
|
||||||
print(has,data)
|
--print(has,data)
|
||||||
if
|
if
|
||||||
has and data.name ==
|
has and data.name ==
|
||||||
"techreborn:rubber_log"
|
"techreborn:rubber_log"
|
||||||
|
|
|
@ -1,2 +1,6 @@
|
||||||
while true do
|
while true do
|
||||||
{os.pullEvent("rednet_message")}
|
print("rednerd")
|
||||||
|
message = {os.pullEvent("rednet_message")}
|
||||||
|
print(message[3])
|
||||||
|
coroutine.yield()
|
||||||
|
end
|
||||||
|
|
|
@ -10,10 +10,14 @@ new_print = function(...)
|
||||||
old_print(x)
|
old_print(x)
|
||||||
rednet.broadcast(x)
|
rednet.broadcast(x)
|
||||||
end
|
end
|
||||||
_G.print = new_print
|
--_G.print = new_print
|
||||||
while true do
|
rednet.host("tomfoolery",os.computerLabel())
|
||||||
parallel.waitForAny(
|
--while true do
|
||||||
require("rednerd")
|
if not _G.thing or true then
|
||||||
--shell.run("shell")
|
_G.thing = true
|
||||||
|
parallel.waitForAll(
|
||||||
|
function() while true do read() end end,
|
||||||
|
function() shell.run("felling") end,
|
||||||
|
function() while true do id,message = rednet.receive() print(message) end end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
8803
computer/5/logs
8803
computer/5/logs
File diff suppressed because it is too large
Load diff
|
@ -1,11 +1,3 @@
|
||||||
rednet.open("back")
|
rednet.open("back")
|
||||||
--shell.run("report")
|
shell.run("report")
|
||||||
func1 = function()
|
--parallel.waitForAny(func1,func2)
|
||||||
sleep(2)
|
|
||||||
print("func1 terminate")
|
|
||||||
end
|
|
||||||
func2 = function()
|
|
||||||
sleep(1)
|
|
||||||
print("func2 teminate")
|
|
||||||
end
|
|
||||||
parallel.waitForAny(func1,func2)
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue