Skip to content

Instantly share code, notes, and snippets.

@BryanHaley
BryanHaley / update.lua
Last active July 1, 2021 23:50
File Updater Script
FILES = {
["foofile1"] = "url1",
["foofile2"] = "url2"
}
function update_file(filename, url)
local cacheBreak = tostring(math.random(0, 99999))
res, err = http.get(url .. "?breaker=" .. cacheBreak)
if not res then error(err) end
@BryanHaley
BryanHaley / pos.lua
Last active July 13, 2021 06:36
COMPUTERCRAFT: Point of sale machine for potato vending machine
-- Globals
STATES = {}
CURRENT_STATE = nil
NUM_SLOTS = 16
PRICES = {
["minecraft:coal"] = 1,
["minecraft:iron_ingot"] = 6,
["minecraft:diamond"] = 45,
@BryanHaley
BryanHaley / farm.lua
Last active July 13, 2021 03:02
COMPUTERCRAFT: Potato Farmer
START_X = 109
START_Y = 57
START_Z = 769
FARM_X_END_EVEN = 108
FARM_X_END_ODD = 97
FARM_Z_START = 769
FARM_Z_END = 782
NUM_SLOTS = 16
@BryanHaley
BryanHaley / kelp.lua
Last active July 3, 2021 04:10
COMPUTERCRAFT: Kelp Farming Turtle
-- Globals
FARM_X_SIZE = 14
FARM_Y_SIZE = 13
NUM_SLOTS = 16
-- Utils
function harvest_kelp()
@BryanHaley
BryanHaley / bamboo.lua
Last active July 10, 2021 19:51
COMPUTERCRAFT: Bamboo Farming Turtle
START_X = 109
START_Y = 61
START_Z = 769
FARM_X_END_EVEN = 108
FARM_X_END_ODD = 97
FARM_Z_START = 769
FARM_Z_END = 782
NUM_SLOTS = 16