Add files via upload

This commit is contained in:
StormFusions
2021-05-15 21:51:23 +01:00
committed by GitHub
parent a1e3b5659c
commit c5a213f68f
+12 -37
View File
@@ -1,5 +1,5 @@
os.loadAPI("lib/f") os.loadAPI("lib/f.lua")
os.loadAPI("lib/button") os.loadAPI("lib/button")
local targetStrength = 50 local targetStrength = 50
@@ -14,36 +14,7 @@ local version = 0.2
local autoInputGate = 1 local autoInputGate = 1
local curInputGate = 222000 local curInputGate = 222000
local sides = {
"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
end
local mon, monitor, monX, monY local mon, monitor, monX, monY
@@ -60,18 +31,22 @@ local emergencyTemp = false
monitor = f.periphSearch("monitor") monitor = f.periphSearch("monitor")
inputFluxgate = f.periphSearch("flux_gate") inputFluxgate = f.periphSearch("flux_gate")
fluxgate = getPeripheral("flux_gate") fluxgate = f.getPeripheral("flux_gate")
reactor = getPeripheral("draconic_reactor") reactor = f.getPeripheral("draconic_reactor")
if monitor == null then if monitor == nil then
error("No valid monitor was found") error("No valid monitor was found")
end end
if fluxgate == null then if fluxgate == nil then
error("No valid fluxgate was found") error("No valid fluxgate was found")
end end
if reactor == null then if inputFluxgate == nil then
error("No input fluxgate was found")
end
if reactor == nil then
error("No reactor was found") error("No reactor was found")
end end
@@ -79,6 +54,8 @@ monX, monY = monitor.getSize()
mon = {} mon = {}
mon.monitor, mon.X, mon.Y = monitor, monX, monY mon.monitor, mon.X, mon.Y = monitor, monX, monY
f.firstSet(mon)
function mon.clear() function mon.clear()
mon.monitor.setBackgroundColor(colors.black) mon.monitor.setBackgroundColor(colors.black)
mon.monitor.clear() mon.monitor.clear()
@@ -86,8 +63,6 @@ function mon.clear()
button.screen() button.screen()
end end
mon.clear()
function save_config() function save_config()
sw = fs.open("reactorconfig.txt", "w") sw = fs.open("reactorconfig.txt", "w")
sw.writeLine(version) sw.writeLine(version)