read if gay
This commit is contained in:
parent
4f2631b349
commit
61eefcba8c
24 changed files with 21871 additions and 4224 deletions
20696
computer/1/BUILDCOPY
Normal file
20696
computer/1/BUILDCOPY
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,8 +1,69 @@
|
||||||
|
pp = require("cc.pretty")
|
||||||
|
|
||||||
local filename = "tobuild"
|
local filename = "tobuild"
|
||||||
rednet.open("left")
|
rednet.open("left")
|
||||||
|
function stringtovec(str)
|
||||||
|
parts = {}
|
||||||
|
for part in string.gmatch(str, "([^,]+)") do
|
||||||
|
table.insert(parts,tonumber(part))
|
||||||
|
end
|
||||||
|
return vector.new(unpack(parts))
|
||||||
|
end
|
||||||
|
|
||||||
while true do
|
while true do
|
||||||
id, messages, protocol = rednet.receive()
|
id, message, protocol = rednet.receive()
|
||||||
if protocol == "getnexttobuild" then
|
if protocol == "getnexttobuild" then
|
||||||
|
if message then
|
||||||
|
file = fs.open(
|
||||||
|
filename,
|
||||||
|
"r"
|
||||||
|
)
|
||||||
|
lines = {}
|
||||||
|
vec = stringtovec(message)
|
||||||
|
print(vector.new().tostring(vec))
|
||||||
|
record = nil
|
||||||
|
repeat
|
||||||
|
line = file.readLine()
|
||||||
|
wec = (line and stringtovec(line)) or nil
|
||||||
|
adding = wec
|
||||||
|
if
|
||||||
|
(wec)
|
||||||
|
and (
|
||||||
|
(not record)
|
||||||
|
or
|
||||||
|
(wec.y <= record.y)
|
||||||
|
)
|
||||||
|
then
|
||||||
|
if
|
||||||
|
(not record)
|
||||||
|
or
|
||||||
|
(
|
||||||
|
(vec-wec):length()
|
||||||
|
<
|
||||||
|
(vec-record):length()
|
||||||
|
)
|
||||||
|
then
|
||||||
|
--pp.pretty_print(wec)
|
||||||
|
--write("is better than")
|
||||||
|
--pp.pretty_print(record)
|
||||||
|
adding = record
|
||||||
|
record = wec
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if adding then
|
||||||
|
table.insert(lines,adding:tostring())
|
||||||
|
end
|
||||||
|
until not line
|
||||||
|
rednet.send(id,record:tostring(),"nexttobuild")
|
||||||
|
print(record)
|
||||||
|
file.close()
|
||||||
|
file = fs.open(filename,"w")
|
||||||
|
for i,v in pairs(lines) do
|
||||||
|
file.writeLine(v)
|
||||||
|
end
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
else
|
||||||
file = fs.open(filename,"r")
|
file = fs.open(filename,"r")
|
||||||
line = file.readLine()
|
line = file.readLine()
|
||||||
restof = file.readAll()
|
restof = file.readAll()
|
||||||
|
@ -12,13 +73,14 @@ while true do
|
||||||
file.close()
|
file.close()
|
||||||
print(line)
|
print(line)
|
||||||
rednet.send(id,line,"nexttobuild")
|
rednet.send(id,line,"nexttobuild")
|
||||||
|
end
|
||||||
elseif protocol == "failedtobuild" then
|
elseif protocol == "failedtobuild" then
|
||||||
print(messages.."failed")
|
print(message.."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(messages)
|
file.writeLine(message)
|
||||||
file.write(restof)
|
file.write(restof)
|
||||||
file.close()
|
file.close()
|
||||||
end
|
end
|
||||||
|
|
4621
computer/1/tobuild
4621
computer/1/tobuild
File diff suppressed because it is too large
Load diff
|
@ -1,12 +0,0 @@
|
||||||
function step()
|
|
||||||
exists, data = turtle.inspectDown()
|
|
||||||
if exists then
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function follow_rail()
|
|
||||||
while true do
|
|
||||||
step()
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -9,7 +9,7 @@ return {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "still_milk",
|
name = "still_milk",
|
||||||
amount = 1000,
|
amount = 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "lava",
|
name = "lava",
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
sfx = require("sfx")
|
|
||||||
return
|
|
||||||
parallel.waitForAll(
|
|
||||||
function()
|
|
||||||
while true do
|
|
||||||
sleep(math.random(10, 100))
|
|
||||||
if math.random(10) > 5 then
|
|
||||||
sfx.fail()
|
|
||||||
else
|
|
||||||
sfx.success()
|
|
||||||
end
|
|
||||||
event = { os.pullEventRaw() }
|
|
||||||
if event[1] == "terminate" then
|
|
||||||
shell.exit()
|
|
||||||
os.shutdown()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end, function()
|
|
||||||
term.setCursorPos(1, 1)
|
|
||||||
shell.run("shell")
|
|
||||||
end)
|
|
|
@ -16,6 +16,7 @@ melter_pos = vector.new(-4, 1, -3)
|
||||||
casting_pos = vector.new(-2, 1, -4)
|
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)
|
growth_chamber_pos = vector.new(-3, 2, 0)
|
||||||
|
rolling_mill_pos = vector.new(-3,0,0)
|
||||||
|
|
||||||
function spout(extra_items)
|
function spout(extra_items)
|
||||||
local fluid = extra_items[1]
|
local fluid = extra_items[1]
|
||||||
|
@ -346,8 +347,11 @@ function cast_ingot(source, product, yield)
|
||||||
fluidInvAdd(fluid.name, -(ingot_count * 111))
|
fluidInvAdd(fluid.name, -(ingot_count * 111))
|
||||||
end
|
end
|
||||||
|
|
||||||
function rolling_mill()
|
function rolling_mill(extra_items)
|
||||||
print("unimplemented :3")
|
goTo(rolling_mill_pos, "west")
|
||||||
|
insertForward()
|
||||||
|
sleep(1)
|
||||||
|
takeForward(2)
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -409,15 +409,16 @@ craft tin_ingot
|
||||||
|
|
||||||
iron_wire
|
iron_wire
|
||||||
yield 2
|
yield 2
|
||||||
|
base iron_sheet
|
||||||
steps:
|
steps:
|
||||||
rolling_mill iron_sheet
|
rolling_mill
|
||||||
|
|
||||||
redstone_chip
|
redstone_chip
|
||||||
base electron_tube
|
base electron_tube
|
||||||
intermediate incomplete_redstone_chip
|
intermediate incomplete_redstone_chip
|
||||||
repeat 12
|
repeat 12
|
||||||
steps:
|
steps:
|
||||||
spout molten_copper:41
|
spout molten_copper:41.6
|
||||||
deploy iron_wire
|
deploy iron_wire
|
||||||
press
|
press
|
||||||
|
|
||||||
|
@ -437,3 +438,23 @@ craft copper_casing copper_casing copper_casing copper_sheet water_bucket copper
|
||||||
cobblestone
|
cobblestone
|
||||||
steps:
|
steps:
|
||||||
growth_chamber
|
growth_chamber
|
||||||
|
|
||||||
|
sturdy_sheet
|
||||||
|
base powdered_obsidian
|
||||||
|
intermediate unprocessed_obsidian_sheet
|
||||||
|
repeat 5
|
||||||
|
steps:
|
||||||
|
spout lava:50
|
||||||
|
press
|
||||||
|
press
|
||||||
|
|
||||||
|
precision_mechanism
|
||||||
|
yield 0.8
|
||||||
|
base golden_sheet
|
||||||
|
intermediate incomplete_precision_mechanism
|
||||||
|
repeat 6
|
||||||
|
steps:
|
||||||
|
deploy cogwheel
|
||||||
|
deploy large_cogwheel
|
||||||
|
deploy desh_nugget
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
casting
|
-casting
|
||||||
stock keeping
|
stock keeping
|
||||||
multi-item crafting
|
multi-item crafting
|
||||||
push items into existing stacks in chest
|
push items into existing stacks in chest
|
||||||
|
|
65
computer/18/rail.lua
Normal file
65
computer/18/rail.lua
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
_G.facing = "south"
|
||||||
|
|
||||||
|
local rightOf = {
|
||||||
|
south = "west",
|
||||||
|
west = "north",
|
||||||
|
north = "east",
|
||||||
|
east = "south"
|
||||||
|
}
|
||||||
|
|
||||||
|
local leftOf = {
|
||||||
|
west = "south",
|
||||||
|
north = "west",
|
||||||
|
east = "north",
|
||||||
|
south = "east"
|
||||||
|
}
|
||||||
|
|
||||||
|
local opposite = {
|
||||||
|
west = "east",
|
||||||
|
east = "west",
|
||||||
|
south = "north",
|
||||||
|
north = "south"
|
||||||
|
}
|
||||||
|
|
||||||
|
function step()
|
||||||
|
-- exists, block = turtle.inspectDown()
|
||||||
|
--if not exists then
|
||||||
|
repeat
|
||||||
|
turtle.down()
|
||||||
|
exists, block = turtle.inspectDown()
|
||||||
|
until exists
|
||||||
|
-- end
|
||||||
|
if block.name == "minecraft:rail" then
|
||||||
|
shape = block.state.shape
|
||||||
|
if shape == "ascending_" .. _G.facing then
|
||||||
|
turtle.up()
|
||||||
|
turtle.forward()
|
||||||
|
elseif string.match(shape, _G.facing) or shape == "ascending_" .. opposite[_G.facing] then
|
||||||
|
turtle.forward()
|
||||||
|
elseif string.match(shape, leftOf[_G.facing]) then
|
||||||
|
_G.facing = leftOf[_G.facing]
|
||||||
|
turtle.turnLeft()
|
||||||
|
elseif string.match(shape, rightOf[_G.facing]) then
|
||||||
|
_G.facing = rightOf[_G.facing]
|
||||||
|
turtle.turnRight()
|
||||||
|
else
|
||||||
|
error("i'm lost\n".. shape)
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
elseif block.name == "minecraft:iron_block" then
|
||||||
|
return "done"
|
||||||
|
else
|
||||||
|
return "lost"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function follow_rail(init_dir)
|
||||||
|
_G.facing = init_dir
|
||||||
|
repeat
|
||||||
|
state = step()
|
||||||
|
until state
|
||||||
|
print(state)
|
||||||
|
end
|
||||||
|
|
||||||
|
print("what direction am i facing?")
|
||||||
|
follow_rail(read())
|
32
computer/20/display.lua
Normal file
32
computer/20/display.lua
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
local display = peripheral.wrap("create_source_1")
|
||||||
|
|
||||||
|
local update_interval = 4
|
||||||
|
local messages = {
|
||||||
|
{ "Try the new MEGA MEGA STACK", "2x MEGA! 1$ only! - WOW" },
|
||||||
|
{ "Don't miss our opening day 50% off!" },
|
||||||
|
{ "The best vegan* fast food available", "Guaranteed less than 20% blood content" },
|
||||||
|
}
|
||||||
|
|
||||||
|
local message_index = 1
|
||||||
|
|
||||||
|
function update_display()
|
||||||
|
display.clear()
|
||||||
|
local top_row = messages[message_index][1]
|
||||||
|
local bottom_row = messages[message_index][2]
|
||||||
|
if top_row then
|
||||||
|
display.setCursorPos(1, 1)
|
||||||
|
display.write(top_row)
|
||||||
|
end
|
||||||
|
if bottom_row then
|
||||||
|
display.setCursorPos(1, 2)
|
||||||
|
display.write(bottom_row)
|
||||||
|
end
|
||||||
|
message_index = (message_index % #messages) + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
function display_loop()
|
||||||
|
while true do
|
||||||
|
update_display()
|
||||||
|
sleep(update_interval)
|
||||||
|
end
|
||||||
|
end
|
39
computer/20/fakeread.lua
Normal file
39
computer/20/fakeread.lua
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
local buffer = ""
|
||||||
|
local completion_index = nil
|
||||||
|
local completion_fn = nil
|
||||||
|
local hide_input = false
|
||||||
|
|
||||||
|
KEY_BACKSPACE = 259
|
||||||
|
KEY_ENTER = 257
|
||||||
|
|
||||||
|
function do_event(etype, edata)
|
||||||
|
if etype == "char" then
|
||||||
|
buffer = buffer .. edata
|
||||||
|
if hide_input then
|
||||||
|
write("*")
|
||||||
|
else
|
||||||
|
write(edata)
|
||||||
|
end
|
||||||
|
elseif etype == "key" then
|
||||||
|
if edata == KEY_BACKSPACE and #buffer > 0 then
|
||||||
|
x, y = term.getCursorPos()
|
||||||
|
x = x - 1
|
||||||
|
term.setCursorPos(x, y)
|
||||||
|
write(" ")
|
||||||
|
term.setCursorPos(x, y)
|
||||||
|
buffer = string.sub(buffer, 1, string.len(buffer) - 1)
|
||||||
|
elseif edata == KEY_ENTER then
|
||||||
|
local b = buffer
|
||||||
|
buffer = ""
|
||||||
|
return b
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
do_event = do_event,
|
||||||
|
get_buffer = function() return buffer end,
|
||||||
|
reset_buffer = function() buffer = "" end,
|
||||||
|
set_completion = function(f) completion_fn = f end,
|
||||||
|
hide_input = function(hide) hide_input = hide end,
|
||||||
|
}
|
76
computer/20/gridgui.lua
Normal file
76
computer/20/gridgui.lua
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
require("keybinds")
|
||||||
|
ccstrings = require("cc.strings")
|
||||||
|
|
||||||
|
local row_heights = { 5 }
|
||||||
|
local col_widths = { 5 }
|
||||||
|
local layout = {}
|
||||||
|
|
||||||
|
local sel = {
|
||||||
|
row = 1,
|
||||||
|
col = 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeAt(text, x, y)
|
||||||
|
term.setCursorPos(x, y)
|
||||||
|
write(text)
|
||||||
|
end
|
||||||
|
|
||||||
|
function draw(x_offset, y_offset, draw_cell)
|
||||||
|
local y = 1 + (y_offset or 0)
|
||||||
|
for row = 1, #layout do
|
||||||
|
local height = row_heights[row]
|
||||||
|
local x = 1 + (x_offset or 0)
|
||||||
|
for col = 1, #layout[row] do
|
||||||
|
local width = col_widths[col]
|
||||||
|
|
||||||
|
writeAt("+", x, y)
|
||||||
|
writeAt("+", x + width, y)
|
||||||
|
writeAt("+", x + width, y + height)
|
||||||
|
writeAt("+", x, y + height)
|
||||||
|
|
||||||
|
if sel.col == col and sel.row == row then
|
||||||
|
writeAt(string.rep("-", width - 1), x + 1, y)
|
||||||
|
writeAt(string.rep("-", width - 1), x + 1, y + height)
|
||||||
|
for r = y + 1, y + height - 1 do
|
||||||
|
writeAt("|", x, r)
|
||||||
|
writeAt("|", x + width, r)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
menu_item = layout[row][col]
|
||||||
|
if draw_cell then
|
||||||
|
draw_cell(menu_item, x, y, width, height)
|
||||||
|
elseif type(menu_item) == "string" then
|
||||||
|
writeAt(menu_item, x + 1, y + 1)
|
||||||
|
end
|
||||||
|
x = x + width
|
||||||
|
end
|
||||||
|
y = y + height
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function handleInput(confirm_fn)
|
||||||
|
local _event, key = os.pullEvent("key")
|
||||||
|
if nav.down[key] then
|
||||||
|
sel.row = math.min(sel.row + 1, #layout)
|
||||||
|
elseif nav.up[key] then
|
||||||
|
sel.row = math.max(sel.row - 1, 1)
|
||||||
|
elseif nav.right[key] then
|
||||||
|
sel.col = sel.col + 1
|
||||||
|
elseif nav.left[key] then
|
||||||
|
sel.col = math.max(sel.col - 1, 1)
|
||||||
|
elseif nav.confirm[key] then
|
||||||
|
button = layout[sel.row][sel.col]
|
||||||
|
confirm_fn(button)
|
||||||
|
end
|
||||||
|
sel.col = math.min(sel.col, #layout[sel.row])
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
handleInput = handleInput,
|
||||||
|
draw = draw,
|
||||||
|
setLayout = function (grid, widths, heights)
|
||||||
|
layout = grid
|
||||||
|
col_widths = widths
|
||||||
|
row_heights = heights
|
||||||
|
end,
|
||||||
|
}
|
14
computer/20/keybinds.lua
Normal file
14
computer/20/keybinds.lua
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
nav = { up = {}, down = {}, left = {}, right = {}, confirm = {} }
|
||||||
|
nav.up[keys.up] = 1
|
||||||
|
nav.up[keys.w] = 1
|
||||||
|
nav.up[keys.f] = 1
|
||||||
|
nav.left[keys.left] = 1
|
||||||
|
nav.left[keys.a] = 1
|
||||||
|
nav.left[keys.r] = 1
|
||||||
|
nav.down[keys.down] = 1
|
||||||
|
nav.down[keys.s] = 1
|
||||||
|
nav.right[keys.right] = 1
|
||||||
|
nav.right[keys.d] = 1
|
||||||
|
nav.right[keys.t] = 1
|
||||||
|
nav.confirm[keys.enter] = 1
|
||||||
|
nav.confirm[keys.space] = 1
|
93
computer/20/menu.lua
Normal file
93
computer/20/menu.lua
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
gui = require("gridgui")
|
||||||
|
ccstrings = require("cc.strings")
|
||||||
|
|
||||||
|
local burger_storage = peripheral.wrap("minecraft:chest_0")
|
||||||
|
|
||||||
|
local menu_options = {
|
||||||
|
hamburger = {
|
||||||
|
id = "hamburger",
|
||||||
|
name = "Steamed Hams",
|
||||||
|
description = "normal boring burger, required to be on the menu for legal reasons",
|
||||||
|
price = 13.12,
|
||||||
|
},
|
||||||
|
the_slab = {
|
||||||
|
id = "the_slab",
|
||||||
|
name = "The Slab",
|
||||||
|
description = "Carefully curated human meat (for humans)",
|
||||||
|
price = 0.31,
|
||||||
|
},
|
||||||
|
mega_mega_stack = {
|
||||||
|
id = "mega_mega_stack",
|
||||||
|
name = "Mega Mega Stack",
|
||||||
|
description = "WOW",
|
||||||
|
price = 1,
|
||||||
|
},
|
||||||
|
pickle = {
|
||||||
|
id = "pickle",
|
||||||
|
name = "Just Pickles",
|
||||||
|
description = "Soft on the outside crunchy on the inside",
|
||||||
|
price = 70,
|
||||||
|
},
|
||||||
|
sour_cream = {
|
||||||
|
id = "sour_cream",
|
||||||
|
name = "Sour cream in a cone",
|
||||||
|
price = 50,
|
||||||
|
description = "Aged sour cream left out to aerate for 30 hours",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
local menu_layout = {
|
||||||
|
{ menu_options.the_slab, menu_options.hamburger },
|
||||||
|
{ menu_options.mega_mega_stack, menu_options.pickle },
|
||||||
|
{ menu_options.sour_cream },
|
||||||
|
{ "checkout", "clear" }
|
||||||
|
}
|
||||||
|
|
||||||
|
local in_checkout = false
|
||||||
|
local basket = {}
|
||||||
|
|
||||||
|
function draw_menu_item(menu_item, x, y, width, height)
|
||||||
|
if type(menu_item) == "table" then
|
||||||
|
writeAt(menu_item.name, x + 1, y + 1)
|
||||||
|
writeAt(" $" .. tostring(menu_item.price), x + 1, y + 2)
|
||||||
|
for i, line in pairs(ccstrings.wrap(menu_item.description, width - 1)) do
|
||||||
|
writeAt(line, x + 1, y + 2 + i)
|
||||||
|
end
|
||||||
|
elseif menu_item == "checkout" then
|
||||||
|
writeAt("checkout (" .. #basket .. " items)", x + 1, y + 1)
|
||||||
|
elseif menu_item == "clear" then
|
||||||
|
writeAt("clear", x + 1, y + 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function menu_gui()
|
||||||
|
gui.setLayout(menu_layout, { 25, 24 }, { 6, 6, 6, 2 })
|
||||||
|
while true do
|
||||||
|
term.clear()
|
||||||
|
term.setCursorPos(1, 1)
|
||||||
|
if in_checkout then
|
||||||
|
print("checkout:")
|
||||||
|
gui.draw(30,3, function(i,x,y) writeAt(i,x+2,y+2) end)
|
||||||
|
gui.handleInput(function (c)
|
||||||
|
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
print("Welcome to Spudsy's!")
|
||||||
|
print("menu:")
|
||||||
|
gui.draw(0, 2, draw_menu_item)
|
||||||
|
gui.handleInput(
|
||||||
|
function(button)
|
||||||
|
if button.id then
|
||||||
|
table.insert(basket, button.id)
|
||||||
|
elseif button == "cancel" then
|
||||||
|
basket = {}
|
||||||
|
elseif button == "checkout" then
|
||||||
|
in_checkout = true
|
||||||
|
gui.setLayout({{1,2,3},{4,5,6},{9,8,7},{".",0}}, {4,4,4}, {4,4,4,4})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,48 +1,59 @@
|
||||||
screen = peripheral.wrap("create_source_1")
|
require("display")
|
||||||
|
require("menu")
|
||||||
|
-- fakeread = require("fakeread")
|
||||||
|
-- robot = peripheral.wrap("animatronic_1")
|
||||||
|
|
||||||
robot = peripheral.wrap("animatronic_1")
|
parallel.waitForAny(menu_gui, display_loop)
|
||||||
|
return
|
||||||
|
--[[
|
||||||
|
display_update_interval = 4
|
||||||
|
|
||||||
messages = {
|
--return
|
||||||
"Menu coming soon!",
|
|
||||||
"Don't miss our opening day 50% off!",
|
|
||||||
"The best vegan* fast food available"
|
|
||||||
}
|
|
||||||
rotations = {360-40, 360-20, 0, 360+20, 360+40}
|
|
||||||
|
|
||||||
n=1
|
function start_screen()
|
||||||
function update_rot()
|
term.clear()
|
||||||
n = n%5 + 1
|
term.setCursorPos(1, 1)
|
||||||
target_rot = 180 + rotations[n]
|
term.setCursorBlink(true)
|
||||||
if target_rot > 180 then
|
print("Welcome to Spudsy's!")
|
||||||
target_rot = target_rot - 360
|
fakeread.hide_input(false)
|
||||||
end
|
fakeread.reset_buffer()
|
||||||
robot.setBodyRot(0, target_rot, 0)
|
fakeread.set_completion(menu_autocomplete)
|
||||||
robot.setFace("sad")
|
|
||||||
robot.push()
|
|
||||||
-- sleep(1.5)
|
|
||||||
-- for i = 1, 5 do
|
|
||||||
|
|
||||||
-- end
|
|
||||||
end
|
end
|
||||||
|
start_screen()
|
||||||
|
|
||||||
|
display_timer_id = os.startTimer(display_update_interval)
|
||||||
|
|
||||||
message_time = 5
|
|
||||||
message_index = 1
|
|
||||||
pose_time = 0
|
|
||||||
dt = 0.1
|
|
||||||
while true do
|
while true do
|
||||||
sleep(dt)
|
local etype, edata = os.pullEventRaw()
|
||||||
pose_time = pose_time + dt
|
if etype == "timer" then
|
||||||
if pose_time > 0.4 then
|
if edata == display_timer_id then
|
||||||
pose_time = 0
|
update_display()
|
||||||
--
|
display_timer_id = os.startTimer(display_update_interval)
|
||||||
|
end
|
||||||
|
elseif etype == "terminate" then
|
||||||
|
fakeread.hide_input(true)
|
||||||
|
fakeread.reset_buffer()
|
||||||
|
fakeread.set_completion(nil)
|
||||||
|
write("\ninput password to exit: ")
|
||||||
|
local password
|
||||||
|
repeat
|
||||||
|
etype, edata = os.pullEventRaw()
|
||||||
|
password = fakeread.do_event(etype, edata)
|
||||||
|
until password
|
||||||
|
if password == "password" then
|
||||||
|
print()
|
||||||
|
break
|
||||||
|
else
|
||||||
|
print("\nwrong password")
|
||||||
|
sleep(2)
|
||||||
|
start_screen()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
typed = fakeread.do_event(etype, edata)
|
||||||
|
if typed then
|
||||||
|
print("")
|
||||||
end
|
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
|
end
|
||||||
update_rot()
|
|
||||||
end
|
end
|
||||||
|
]]
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,11 @@ while true do
|
||||||
)or 0 )
|
)or 0 )
|
||||||
end
|
end
|
||||||
if lava > 300 then
|
if lava > 300 then
|
||||||
tonk.pushFluid("left",lava-300)
|
lava = lava - (tonk.pushFluid("left",lava-300))
|
||||||
|
end
|
||||||
|
if lava > 300 then
|
||||||
|
--tonk.pushFluid("create:fluid_tank_1",lava-300)
|
||||||
|
peripheral.call("front","pullFluid","right",lava-300)
|
||||||
end
|
end
|
||||||
counts = {}
|
counts = {}
|
||||||
for i,v in pairs(vault.items()) do
|
for i,v in pairs(vault.items()) do
|
||||||
|
|
|
@ -11,9 +11,9 @@ function build(chunk)
|
||||||
for w = 1,8 do
|
for w = 1,8 do
|
||||||
store[h][w] = {depth = 0}
|
store[h][w] = {depth = 0}
|
||||||
for d = 1,8 do
|
for d = 1,8 do
|
||||||
bool, data = sf.blockat(x+w,z+d,y+h)
|
bool, block = sf.blockat(x+w,z+d,y+h)
|
||||||
if bool then
|
if bool then
|
||||||
store[h][w][d] = data
|
store[h][w][d] = block
|
||||||
store[h][w].depth = d
|
store[h][w].depth = d
|
||||||
grocerylist[store[h][w][d]] =
|
grocerylist[store[h][w][d]] =
|
||||||
(grocerylist[store[h][w][d]] or 0)+1
|
(grocerylist[store[h][w][d]] or 0)+1
|
||||||
|
@ -28,7 +28,7 @@ function build(chunk)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if store.height==0 then
|
if store.height==0 then
|
||||||
print("cell at",x,y,z,"is done")
|
--print("cell at",x,y,z,"is done")
|
||||||
return true
|
return true
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -50,10 +50,7 @@ function build(chunk)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
pf.to(origin + vector.new(x+1,y+8,z+1))
|
pf.to(origin + vector.new(x+1,y+8,z+1))
|
||||||
--print("going")
|
flag = false
|
||||||
--pf.to(origin+vector.new(1,1,1))
|
|
||||||
--im.select("minecraft:barrel")
|
|
||||||
--turtle.placeDown()
|
|
||||||
for w = 1,8 do
|
for w = 1,8 do
|
||||||
for h = 1,8 do
|
for h = 1,8 do
|
||||||
for d = 1,8 do
|
for d = 1,8 do
|
||||||
|
@ -61,10 +58,16 @@ function build(chunk)
|
||||||
pf.to(origin+vector.new(x+w,y+h,z+d))
|
pf.to(origin+vector.new(x+w,y+h,z+d))
|
||||||
im.select(store[h][w][d])
|
im.select(store[h][w][d])
|
||||||
turtle.placeDown()
|
turtle.placeDown()
|
||||||
|
flage = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if flag and im.select("minecraft:birch_sign") then
|
||||||
|
pf.to(position+vector.new(0,1,0))
|
||||||
|
turtle.placeDown(chunk)
|
||||||
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -75,11 +78,14 @@ function stringtovec(str)
|
||||||
end
|
end
|
||||||
return unpack(parts)
|
return unpack(parts)
|
||||||
end
|
end
|
||||||
|
|
||||||
repeat
|
repeat
|
||||||
rednet.send(1,nil,"getnexttobuild")
|
rednet.send(1,(_G.position-origin):tostring(),"getnexttobuild")
|
||||||
print(chunk)
|
|
||||||
_,chunk = rednet.receive("nexttobuild")
|
_,chunk = rednet.receive("nexttobuild")
|
||||||
until not build(chunk)
|
until not build(chunk)
|
||||||
|
|
||||||
rednet.send(1,chunk,"failedtobuild")
|
rednet.send(1,chunk,"failedtobuild")
|
||||||
|
|
||||||
pf.returnHome()
|
pf.returnHome()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,10 @@ function fell(index)
|
||||||
im.select("minecraft:birch_sapling")
|
im.select("minecraft:birch_sapling")
|
||||||
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, block = turtle.inspect()
|
||||||
print(has,data)
|
print(has,block)
|
||||||
if
|
if
|
||||||
has and data.name ==
|
has and block.name ==
|
||||||
"minecraft:birch_log"
|
"minecraft:birch_log"
|
||||||
then
|
then
|
||||||
turtle.dig()
|
turtle.dig()
|
||||||
|
|
14
computer/3/obsidian.lua
Normal file
14
computer/3/obsidian.lua
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
for i = 1,10 do
|
||||||
|
for j = 1,8 do
|
||||||
|
turtle.digDown()
|
||||||
|
turtle.forward()
|
||||||
|
end
|
||||||
|
turtle.turnLeft()
|
||||||
|
turtle.digDown()
|
||||||
|
if math.mod(i,2) == 0 then
|
||||||
|
turtle.forward()
|
||||||
|
else
|
||||||
|
turtle.back()
|
||||||
|
end
|
||||||
|
turtle.turnLeft()
|
||||||
|
end
|
|
@ -11,9 +11,9 @@ function build(chunk)
|
||||||
for w = 1,8 do
|
for w = 1,8 do
|
||||||
store[h][w] = {depth = 0}
|
store[h][w] = {depth = 0}
|
||||||
for d = 1,8 do
|
for d = 1,8 do
|
||||||
bool, data = sf.blockat(x+w,z+d,y+h)
|
bool, block = sf.blockat(x+w,z+d,y+h)
|
||||||
if bool then
|
if bool then
|
||||||
store[h][w][d] = data
|
store[h][w][d] = block
|
||||||
store[h][w].depth = d
|
store[h][w].depth = d
|
||||||
grocerylist[store[h][w][d]] =
|
grocerylist[store[h][w][d]] =
|
||||||
(grocerylist[store[h][w][d]] or 0)+1
|
(grocerylist[store[h][w][d]] or 0)+1
|
||||||
|
@ -73,7 +73,7 @@ function stringtovec(str)
|
||||||
end
|
end
|
||||||
|
|
||||||
repeat
|
repeat
|
||||||
rednet.send(1,nil,"getnexttobuild")
|
rednet.send(1,(_G.position-origin):tostring(),"getnexttobuild")
|
||||||
_,chunk = rednet.receive("nexttobuild")
|
_,chunk = rednet.receive("nexttobuild")
|
||||||
until not build(chunk)
|
until not build(chunk)
|
||||||
|
|
||||||
|
|
17
disk/1/sfx
Normal file
17
disk/1/sfx
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
speaker = peripheral.wrap("left")
|
||||||
|
volume = 2
|
||||||
|
|
||||||
|
return {
|
||||||
|
success = function ()
|
||||||
|
speaker.playNote("pling",volume,4)
|
||||||
|
sleep(0.1)
|
||||||
|
speaker.playNote("pling",volume,8)
|
||||||
|
sleep(0.1)
|
||||||
|
speaker.playNote("pling",volume,16)
|
||||||
|
end,
|
||||||
|
fail = function ()
|
||||||
|
speaker.playNote("didgeridoo", volume, 6)
|
||||||
|
sleep(0.2)
|
||||||
|
speaker.playNote("didgeridoo", volume, 3)
|
||||||
|
end
|
||||||
|
}
|
84
disk/2/st
Normal file
84
disk/2/st
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
_G.position = vector.new(-250,96,106)
|
||||||
|
_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()
|
13
ids.json
13
ids.json
|
@ -1,4 +1,13 @@
|
||||||
{
|
{
|
||||||
"computer": 17,
|
"computer": 22,
|
||||||
"disk": 2
|
"disk": 2,
|
||||||
|
"peripheral.create:fluid_tank": 2,
|
||||||
|
"peripheral.create:item_vault": 0,
|
||||||
|
"peripheral.create:chute": 0,
|
||||||
|
"peripheral.redrouter": 5,
|
||||||
|
"peripheral.computer": 5,
|
||||||
|
"peripheral.turtle": 1,
|
||||||
|
"peripheral.create_source": 1,
|
||||||
|
"peripheral.animatronic": 1,
|
||||||
|
"peripheral.minecraft:chest": 0
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue