Keep factory debug output off the monitor
This commit is contained in:
@@ -132,8 +132,6 @@ local readMethods = {
|
||||
"stock",
|
||||
}
|
||||
|
||||
local monitorName = nil
|
||||
|
||||
for peripheralIndex, name in ipairs(names) do
|
||||
local methods = peripheral.getMethods(name) or {}
|
||||
table.sort(methods)
|
||||
@@ -145,12 +143,6 @@ for peripheralIndex, name in ipairs(names) do
|
||||
emit("Type(s): " .. table.concat(types, ", "))
|
||||
emit("Methods (" .. tostring(#methods) .. "): " .. table.concat(methods, ", "))
|
||||
|
||||
for _, peripheralType in ipairs(types) do
|
||||
if peripheralType == "monitor" and monitorName == nil then
|
||||
monitorName = name
|
||||
end
|
||||
end
|
||||
|
||||
for _, method in ipairs(readMethods) do
|
||||
if hasMethod(methods, method) then
|
||||
local ok, value = safeRead(name, method)
|
||||
@@ -171,29 +163,6 @@ file.write(table.concat(lines, "\n"))
|
||||
file.write("\n")
|
||||
file.close()
|
||||
|
||||
if monitorName then
|
||||
local monitor = peripheral.wrap(monitorName)
|
||||
monitor.setBackgroundColor(colors.black)
|
||||
monitor.setTextColor(colors.white)
|
||||
monitor.setTextScale(0.5)
|
||||
monitor.clear()
|
||||
|
||||
local width, height = monitor.getSize()
|
||||
local function centered(row, text, color)
|
||||
if row < 1 or row > height then
|
||||
return
|
||||
end
|
||||
monitor.setTextColor(color or colors.white)
|
||||
monitor.setCursorPos(math.max(1, math.floor((width - #text) / 2) + 1), row)
|
||||
monitor.write(text:sub(1, width))
|
||||
end
|
||||
|
||||
centered(math.max(1, math.floor(height / 2) - 2), "CREATE FACTORY DEBUG", colors.cyan)
|
||||
centered(math.max(1, math.floor(height / 2)), "DUMP COMPLETE", colors.lime)
|
||||
centered(math.max(1, math.floor(height / 2) + 1), tostring(#names) .. " peripherals found", colors.white)
|
||||
centered(math.max(1, math.floor(height / 2) + 3), OUTPUT_FILE, colors.lightGray)
|
||||
end
|
||||
|
||||
print("")
|
||||
print("Debug complete.")
|
||||
print("Created: " .. OUTPUT_FILE)
|
||||
|
||||
Reference in New Issue
Block a user