-- -- dc_probe.lua -- -- Discovery probe for the data-center multiblock. Writes a full report to a -- FILE (the terminal is too small to scroll through). Dumps every attached -- peripheral: name, type, the methods it exposes, and - if it behaves like an -- inventory - its size and current contents, with getItemDetail on the first -- occupied slot so we can see the real item shape (e.g. a data model's name). -- -- Run this on the computer wired to ONE data center, with its model + input -- ports attached and (ideally) a model loaded and some inputs in a port. -- -- dc_probe -- dump every peripheral -> dc_probe.txt -- dc_probe minecraft:barrel -- only peripherals whose type/name contains this -- -- Then send me the report. Easiest: pastebin put dc_probe.txt and give me the -- URL. Or open it with: edit dc_probe.txt -- local filter = ... local OUT = "dc_probe.txt" local f = fs.open(OUT, "w") if not f then error("dc_probe: could not open " .. OUT .. " for writing", 0) end local function w(s) f.writeLine(s or "") end local function rule(ch) w(string.rep(ch or "-", 50)) end local names = peripheral.getNames() w("dc_probe report - " .. os.date("%Y-%m-%d %H:%M:%S")) w("Found " .. #names .. " peripheral(s)" .. (filter and (" (filter: " .. filter .. ")") or "") .. ":") rule("=") local dumped = 0 for _, name in ipairs(names) do local ptype = peripheral.getType(name) if not filter or (ptype and ptype:find(filter, 1, true)) or name:find(filter, 1, true) then dumped = dumped + 1 w(name .. " [" .. tostring(ptype) .. "]") -- methods local methods = peripheral.getMethods(name) or {} table.sort(methods) if #methods > 0 then w(" methods (" .. #methods .. "):") local line = " " for i, mth in ipairs(methods) do line = line .. mth if i < #methods then line = line .. ", " end if #line > 60 then w(line); line = " " end end if line ~= " " then w(line) end end -- inventory peek local p = peripheral.wrap(name) if p and p.list then local oks, sz = pcall(p.size) w(" inventory size: " .. tostring(oks and sz or "?")) local ok, list = pcall(p.list) if ok and list then local shown = false for slot, item in pairs(list) do w(string.format(" slot %d: %s x%d", slot, item.name, item.count)) if not shown and p.getItemDetail then local ok2, det = pcall(p.getItemDetail, slot) if ok2 and type(det) == "table" then w(" detail.displayName = " .. tostring(det.displayName)) w(" detail.name = " .. tostring(det.name)) if det.nbt then w(" detail.nbt = " .. tostring(det.nbt)) end if det.tags then local tcount = 0 for _ in pairs(det.tags) do tcount = tcount + 1 end w(" detail.tags = " .. tcount .. " tag(s)") end end shown = true end end if next(list) == nil then w(" (empty)") end else w(" (list() failed)") end end rule("-") end end f.close() -- short summary to the screen so you know it worked print("Wrote " .. dumped .. " peripheral(s) to /" .. OUT) print("") print("Send it to me - easiest:") print(" pastebin put " .. OUT) print("then give me the URL. Or read it with: edit " .. OUT)