Add files via upload
This commit is contained in:
@@ -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)
|
||||||
Reference in New Issue
Block a user