New miningTurtle.lua: sits on top of a cobble gen, continuously digs down, and pushes items into networked chests via wired modem. Features: - Configurable mine interval, dump threshold, fuel slot - Auto-dumps inventory when slots fill or timer expires - Auto-refuels from designated fuel slot - Remote reboot via SYSTEM_CHANNEL - Stats display (mined, dumped, uptime, fuel) - Persistent config in usr/config/inventory-manager/.miner_config Also adds: - startup/miner.lua: auto-update + launch script for standalone use - .package: new 'Mining Turtle' role (option 4) in setup wizard - autorun/startup.lua: detects .miner_config and launches miningTurtle
116 lines
4.1 KiB
Plaintext
116 lines
4.1 KiB
Plaintext
{
|
|
title = "Inventory Manager",
|
|
description = "Automated inventory management system for CC:Tweaked. Tracks items across networked storage, crafting turtles, furnaces, and alerts. Includes web dashboard via bridge computer.",
|
|
repository = "gitea://git.spatulaa.com/MayaTheShy/Inventory-Manager-CC/main/",
|
|
exclude = {
|
|
"^web/", "^__tests__/", "^startup/",
|
|
"%.md$", "%.json$", "^%.git", "^LICENSE$", "^node_modules/",
|
|
"%.bak$", "^listDevicesByType%.lua$",
|
|
},
|
|
install = [[
|
|
local cfgDir = "usr/config/inventory-manager"
|
|
if not fs.isDir(cfgDir) then fs.makeDir(cfgDir) end
|
|
local function ask(prompt, default)
|
|
if default and #default > 0 then
|
|
write(prompt .. " [" .. default .. "]: ")
|
|
else
|
|
write(prompt .. ": ")
|
|
end
|
|
local val = read()
|
|
if not val or #val == 0 then return default end
|
|
return val
|
|
end
|
|
|
|
print("")
|
|
print("-- Inventory Manager Setup --")
|
|
print("")
|
|
print("Which role(s) will this computer run?")
|
|
print(" 1) Inventory Manager (main controller)")
|
|
print(" 2) Inventory Client (display-only)")
|
|
print(" 3) Web Bridge (HTTP forwarder)")
|
|
print(" 4) Mining Turtle (cobble miner)")
|
|
print(" 5) Skip setup")
|
|
print("")
|
|
write("Choice (1/2/3/4/5): ")
|
|
local choice = read()
|
|
|
|
if choice == "1" then
|
|
print("")
|
|
print("-- Manager Configuration --")
|
|
local monitorSide = ask("Monitor side", "left")
|
|
local smelterMonitorSide = ask("Smelter monitor side", "top")
|
|
local dropperName = ask("Dropper peripheral name", "minecraft:dropper_9")
|
|
local barrelName = ask("Barrel peripheral name", "minecraft:barrel_0")
|
|
local serverUrl = ask("Web server URL (blank to skip)", "")
|
|
|
|
local cfg = {
|
|
monitorSide = monitorSide,
|
|
smelterMonitorSide = smelterMonitorSide,
|
|
dropperName = dropperName,
|
|
barrelName = barrelName,
|
|
}
|
|
local f = fs.open(fs.combine(cfgDir, ".manager_config"), "w")
|
|
f.write(textutils.serialiseJSON(cfg))
|
|
f.close()
|
|
print("Saved manager config.")
|
|
|
|
if serverUrl and #serverUrl > 0 then
|
|
local bcfg = { serverUrl = serverUrl }
|
|
local bf = fs.open(fs.combine(cfgDir, ".webbridge_config"), "w")
|
|
bf.write(textutils.serialiseJSON(bcfg))
|
|
bf.close()
|
|
print("Saved web bridge config.")
|
|
end
|
|
|
|
elseif choice == "2" then
|
|
print("")
|
|
print("-- Client Configuration --")
|
|
local monitorSide = ask("Monitor side", "left")
|
|
local smelterMonitorSide = ask("Smelter monitor side", "top")
|
|
local dropperName = ask("Dropper peripheral name (blank if none)", "")
|
|
local barrelName = ask("Barrel peripheral name (blank if none)", "")
|
|
|
|
local cfg = {
|
|
monitorSide = monitorSide,
|
|
smelterMonitorSide = smelterMonitorSide,
|
|
}
|
|
if dropperName and #dropperName > 0 then cfg.dropperName = dropperName end
|
|
if barrelName and #barrelName > 0 then cfg.barrelName = barrelName end
|
|
|
|
local f = fs.open(fs.combine(cfgDir, ".client_config"), "w")
|
|
f.write(textutils.serialiseJSON(cfg))
|
|
f.close()
|
|
print("Saved client config.")
|
|
|
|
elseif choice == "3" then
|
|
print("")
|
|
print("-- Web Bridge Configuration --")
|
|
local serverUrl = ask("Web server URL", "http://localhost")
|
|
|
|
local cfg = { serverUrl = serverUrl }
|
|
local f = fs.open(fs.combine(cfgDir, ".webbridge_config"), "w")
|
|
f.write(textutils.serialiseJSON(cfg))
|
|
f.close()
|
|
print("Saved web bridge config.")
|
|
|
|
elseif choice == "4" then
|
|
print("")
|
|
print("-- Mining Turtle Configuration --")
|
|
local mineInterval = ask("Mine interval in seconds", "0.5")
|
|
local dumpThreshold = ask("Dump when N slots full", "14")
|
|
|
|
local cfg = {
|
|
mineInterval = tonumber(mineInterval) or 0.5,
|
|
dumpThreshold = tonumber(dumpThreshold) or 14,
|
|
}
|
|
local f = fs.open(fs.combine(cfgDir, ".miner_config"), "w")
|
|
f.write(textutils.serialiseJSON(cfg))
|
|
f.close()
|
|
print("Saved miner config.")
|
|
|
|
else
|
|
print("Skipped — edit config files manually later.")
|
|
end
|
|
]],
|
|
}
|