Add files via upload

This commit is contained in:
StormFusions
2021-05-15 19:51:51 +01:00
committed by GitHub
parent 0654715438
commit f41ebbe4a2
+34 -6
View File
@@ -2,9 +2,6 @@
os.loadAPI("lib/f") os.loadAPI("lib/f")
os.loadAPI("lib/button") os.loadAPI("lib/button")
local reactorSide = "back"
local fluxgateSide = "left"
local targetStrength = 50 local targetStrength = 50
local maxTemp = 8000 local maxTemp = 8000
local safeTemp = 3000 local safeTemp = 3000
@@ -12,11 +9,42 @@ local lowFieldPer = 15
local activateOnCharge = true local activateOnCharge = true
local version = 0.1 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
local reactor local reactor
@@ -32,8 +60,8 @@ local emergencyTemp = false
monitor = f.periphSearch("monitor") monitor = f.periphSearch("monitor")
inputFluxgate = f.periphSearch("flux_gate") inputFluxgate = f.periphSearch("flux_gate")
fluxgate = peripheral.wrap(fluxgateSide) fluxgate = getPeripheral("flux_gate")
reactor = peripheral.wrap(reactorSide) reactor = getPeripheral("draconic_reactor")
if monitor == null then if monitor == null then
error("No valid monitor was found") error("No valid monitor was found")