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")
|
||||
sfx = require("sfx")
|
||||
speaker = peripheral.wrap("left")
|
||||
instruments = {
|
||||
"harp",
|
||||
|
@ -42,6 +43,13 @@ while true do
|
|||
--os.reboot()
|
||||
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")
|
||||
-- os.reboot()
|
||||
|
|
|
@ -24,21 +24,20 @@ function takeForward(slot)
|
|||
turtle.suckDown()
|
||||
end
|
||||
|
||||
function insertForwardDepot(count)
|
||||
function insertDepot(count)
|
||||
turtle.dropDown(count)
|
||||
peripheral.call("front", "pullItem", "bottom")
|
||||
end
|
||||
|
||||
function takeForwardDepot()
|
||||
-- pDown.pullItems("front", slot, 64, 1)
|
||||
function takeDepot()
|
||||
peripheral.call("front", "pushItem", "bottom")
|
||||
turtle.suckDown()
|
||||
end
|
||||
|
||||
|
||||
function takeItems(type, count)
|
||||
item_list = pFront.list()
|
||||
slot = findItems(item_list, type)
|
||||
local item_list = pFront.list()
|
||||
local slot = findItems(item_list, type)
|
||||
|
||||
if slot == nil then
|
||||
printError("could not find item " .. type .. " in chest")
|
||||
|
|
|
@ -2,7 +2,6 @@ require("inventory")
|
|||
require("pathfinding")
|
||||
|
||||
function mill(extra_items)
|
||||
-- 0.4 second/item
|
||||
go_to(vector.new(-4,0,0),"south")
|
||||
item_count = 0
|
||||
if turtle.getItemCount() ~= 0 then
|
||||
|
@ -15,16 +14,17 @@ function mill(extra_items)
|
|||
insertForward(1, item.count)
|
||||
end
|
||||
print(item_count,"items")
|
||||
sleep(0.5)
|
||||
sleep(0.4 * item_count)
|
||||
for i = 1, 10 do
|
||||
while peripheral.call("front", "getItemDetail", 1) do
|
||||
sleep(0.1)
|
||||
end
|
||||
for i = 2, 10 do
|
||||
takeForward(i)
|
||||
end
|
||||
end
|
||||
function deploy(extra_items, nbt)
|
||||
-- extra_items should only be one item
|
||||
go_to(vector.new(2,0,0), "south")
|
||||
insertForwardDepot(1)
|
||||
insertDepot(1)
|
||||
goUp()
|
||||
goUp()
|
||||
selectItem(extra_items[1].name, nbt)
|
||||
|
@ -33,7 +33,7 @@ function deploy(extra_items, nbt)
|
|||
|
||||
goDown()
|
||||
goDown()
|
||||
takeForwardDepot()
|
||||
takeDepot()
|
||||
end
|
||||
function deploy_tool(extra_items)
|
||||
deploy(extra_items, true)
|
||||
|
@ -62,9 +62,9 @@ function furnace(extra_items)
|
|||
end
|
||||
function press(_)
|
||||
go_to(vector.new(-1,0,0), "south")
|
||||
insertForwardDepot(1)
|
||||
insertDepot(1)
|
||||
sleep(1)
|
||||
takeForwardDepot()
|
||||
takeDepot()
|
||||
end
|
||||
function compact(extra_items) end
|
||||
function mix(extra_items)
|
||||
|
@ -83,17 +83,24 @@ function mix(extra_items)
|
|||
takeForward(10)
|
||||
end
|
||||
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
|
||||
slot = slot + 1
|
||||
if slot == 9 then
|
||||
slot = 10
|
||||
elseif slot == 13 then
|
||||
slot = 14
|
||||
if slot == 4 then
|
||||
slot = 5
|
||||
elseif slot == 8 then
|
||||
slot = 9
|
||||
end
|
||||
if item.name ~= "nil" then
|
||||
selectItem(item.name)
|
||||
turtle.transferTo(slot, 1)
|
||||
turtle.select(slot)
|
||||
takeItems(item.name, item.count)
|
||||
end
|
||||
end
|
||||
turtle.craft()
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
pp = require("cc.pretty")
|
||||
|
||||
if _G.pos == nil then
|
||||
_G.facing = "south"
|
||||
_G.pos = vector.new(0,0,0)
|
||||
file = fs.open("pos.txt", "r")
|
||||
data = splitString(file.readAll())
|
||||
_G.pos.x = tonumber(data[1])
|
||||
_G.pos.y = tonumber(data[2])
|
||||
_G.pos.z = tonumber(data[3])
|
||||
_G.facing = data[4]
|
||||
end
|
||||
-- if _G.pos == nil then
|
||||
_G.facing = "south"
|
||||
_G.pos = vector.new(0,0,0)
|
||||
-- file = fs.open("pos.txt", "r")
|
||||
-- data = splitString(file.readAll())
|
||||
-- _G.pos.x = tonumber(data[1])
|
||||
-- _G.pos.y = tonumber(data[2])
|
||||
-- _G.pos.z = tonumber(data[3])
|
||||
-- _G.facing = data[4]
|
||||
-- end
|
||||
|
||||
local up = vector.new(0,1,0)
|
||||
|
||||
|
@ -35,9 +35,9 @@ local vecOf = {
|
|||
}
|
||||
|
||||
function savePos()
|
||||
fs.delete("pos.txt")
|
||||
file = fs.open("pos.txt", "w")
|
||||
file.write(_G.pos.x .. " " .. _G.pos.y .. " " .. _G.pos.z .. " " .. _G.facing)
|
||||
-- fs.delete("pos.txt")
|
||||
-- file = fs.open("pos.txt", "w")
|
||||
-- file.write(_G.pos.x .. " " .. _G.pos.y .. " " .. _G.pos.z .. " " .. _G.facing)
|
||||
end
|
||||
|
||||
|
||||
|
@ -112,8 +112,7 @@ end
|
|||
function go_to(target, face)
|
||||
while target ~= _G.pos do
|
||||
stepTo(target)
|
||||
-- print(_G.pos, _G.facing, target, face)
|
||||
print(_G.pos, _G.facing)
|
||||
-- print(_G.pos, _G.facing)
|
||||
end
|
||||
if face and face ~= _G.facing then
|
||||
if rightOf[_G.facing] == face then
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
0 0 0 south
|
|
@ -115,3 +115,48 @@ gravel
|
|||
base cobblestone
|
||||
steps:
|
||||
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.success()
|
||||
s.fail()
|
||||
s.success()
|
||||
--s.fail()
|
||||
|
|
|
@ -89,8 +89,10 @@ function tryCreating(recipe)
|
|||
if len(missing_ingredients) == 0 then
|
||||
todo[#todo] = nil
|
||||
turtle.select(1)
|
||||
for item, count in pairs(ingredients) do
|
||||
takeItems(item, count)
|
||||
if recipe.steps[1].machine ~= "craft" then
|
||||
for item, count in pairs(ingredients) do
|
||||
takeItems(item, count)
|
||||
end
|
||||
end
|
||||
doRecipe(current_recipe)
|
||||
-- for item, min_count in pairs(getMissing(keep_stocked)) do
|
||||
|
|
|
@ -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
|
||||
peripheral.call("bottom","turnOn")
|
||||
sleep(0.05)
|
||||
local event, extra = os.pullEventRaw()
|
||||
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
|
||||
|
||||
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)
|
||||
end
|
||||
_G.print = new_print
|
||||
|
||||
rednet.host("tomfoolery",os.computerLabel())
|
||||
|
|
|
@ -17,7 +17,7 @@ function fell(index)
|
|||
print("going towards tree")
|
||||
pf.lookat(trees[index or math.random(#trees)])
|
||||
has, data = turtle.inspect()
|
||||
print(has,data)
|
||||
--print(has,data)
|
||||
if
|
||||
has and data.name ==
|
||||
"techreborn:rubber_log"
|
||||
|
|
|
@ -1,2 +1,6 @@
|
|||
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)
|
||||
rednet.broadcast(x)
|
||||
end
|
||||
_G.print = new_print
|
||||
while true do
|
||||
parallel.waitForAny(
|
||||
require("rednerd")
|
||||
--shell.run("shell")
|
||||
--_G.print = new_print
|
||||
rednet.host("tomfoolery",os.computerLabel())
|
||||
--while true do
|
||||
if not _G.thing or true then
|
||||
_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
|
||||
|
|
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")
|
||||
--shell.run("report")
|
||||
func1 = function()
|
||||
sleep(2)
|
||||
print("func1 terminate")
|
||||
end
|
||||
func2 = function()
|
||||
sleep(1)
|
||||
print("func2 teminate")
|
||||
end
|
||||
parallel.waitForAny(func1,func2)
|
||||
shell.run("report")
|
||||
--parallel.waitForAny(func1,func2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue