Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Device detection
- isError=0
- 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"
- local peripheralList = peripheral.getNames()
- CellSide=detectDevice("tile_enderio_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_enderio_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
- message = {}
- modem = peripheral.wrap("left")
- while true do
- --Get storage values
- message["energy"] = cell.getEnergyStored("unknown")
- message["maxenergy"] = cell.getMaxEnergyStored("unknown")
- --print(message["energy"])
- modem.open(200)
- modem.transmit(200,200,textutils.serialize(message))
- sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement