Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- isError=0
- --NbReactors=2
- function detectDevice(DeviceName)
- DeviceSide="none"
- for k,v in pairs(redstone.getSides()) do
- if peripheral.getType(v)==DeviceName then
- DeviceSide = v
- break
- end
- end
- return(DeviceSide)
- end
- cell="none"
- monitor="none"
- reactor="none" --{}
- --for x = 0, NbReactors-1 do
- -- table.insert(reactors, "none")
- --end
- local peripheralList = peripheral.getNames()
- CellSide=detectDevice("cofh_thermalexpansion_energycell")
- if CellSide~="none" then
- cell=peripheral.wrap(CellSide)
- print ("TE Energy cell on the " .. CellSide .. " connected.")
- else
- CellSide=detectDevice("tile_blockcapacitorbank_name")
- if CellSide~="none" then
- cell=peripheral.wrap(CellSide)
- print ("EnderIO capacitorbank on the " .. CellSide .. " connected.")
- else
- for Index = 1, #peripheralList do
- if string.find(peripheralList[Index], "cofh_thermalexpansion_energycell") then
- cell=peripheral.wrap(peripheralList[Index])
- print ("TE Energy cell on wired modem: "..peripheralList[Index].." connected")
- elseif string.find(peripheralList[Index], "tile_blockcapacitorbank_name") then
- cell=peripheral.wrap(peripheralList[Index])
- print ("EnderIO capacitorbank on wired modem: "..peripheralList[Index].." connected")
- end
- end --for
- if cell == "none" then
- print("No Energy storage found. Halting script!")
- return
- end
- end
- end
- MonitorSide=detectDevice("monitor")
- if MonitorSide~="none" then
- monitor=peripheral.wrap(MonitorSide)
- print ("Monitor on the " .. MonitorSide .. " connected")
- else
- for Index = 1, #peripheralList do
- if string.find(peripheralList[Index], "monitor") then
- monitor=peripheral.wrap(peripheralList[Index])
- print ("Monitor on wired modem: "..peripheralList[Index].." connected")
- end
- end --for
- if monitor == "none" then
- print ("Warning - No Monitor attached, continuing without.")
- end
- end
- ReactorSide=detectDevice("fissionreactor")
- if ReactorSide~="none" then
- reactor=peripheral.wrap(ReactorSide)
- print("Reactor on the " ..ReactorSide .. " connected")
- else
- for Index = 1, #peripheralList do
- if string.find(peripheralList[Index], "monitor") then
- reactor=peripheral.wrap(peripheralList[Index])
- print("Reactor on wired modem: "..peripheralList[Index].." connected")
- end
- end
- if reactor == "none" then
- print("Warning No Reactor Attatched !")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement