Add files via upload

This commit is contained in:
StormFusions
2021-05-15 21:51:06 +01:00
committed by GitHub
parent 370960ed2c
commit a1e3b5659c
+40 -7
View File
@@ -2,8 +2,37 @@
-- peripheral identification -- peripheral identification
-- --
local monitorr = peripheral.find("monitor") local sides = {
monitorr.setTextScale(0.5) "left",
"right",
"back",
"front",
"bottom",
}
function Identify(name, data)
if name == data then
return true
else
return false
end
end
function getPeripheral(id)
local names = peripheral.getNames()
for k, v in pairs(names) do
local Type = peripheral.getType(v)
local isType = Identify(id, Type)
if isType then
for _, t in pairs(sides) do
if v == t then
return peripheral.wrap(t)
end
end
end
end
return nil
end
function periphSearch(type) function periphSearch(type)
local names = peripheral.getNames() local names = peripheral.getNames()
@@ -13,7 +42,7 @@ function periphSearch(type)
return peripheral.wrap(name) return peripheral.wrap(name)
end end
end end
return null return nil
end end
-- formatting -- formatting
@@ -88,12 +117,16 @@ function progress_bar(mon, x, y, length, minVal, maxVal, bar_color, bg_color)
end end
function clear(mon) function firstSet(mon)
term.clear() mon.monitor.setTextScale(1)
term.setCursorPos(1,1)
mon.monitor.setBackgroundColor(colors.black) mon.monitor.setBackgroundColor(colors.black)
mon.monitor.clear() mon.monitor.clear()
mon.monitor.setCursorPos(1,1) mon.monitor.setCursorPos(1,1)
end end
monitorr.setTextScale(0.5)
local monitor = peripheral.find("monitor")
if monitor == nil then
error("Monitor not found. Make sure it connected!")
end
monitor.setTextScale(0.5)