Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Script i used in minecraft modpack Skyfactory 2.4
- -- simply place 4 solar generator from extra utilities around a pc en start the script
- -- when the solars are full of power the pc wil apply a redstone signal to the corrensponding side
- -- to enable the discharging mode. and when empty will begin to fill up again.
- -- working on a sensor on the top of the pc to drain the solars when its night time.
- local debug = false -- will turn on debug feedback on screen
- while true do
- for a,v in pairs(rs.getSides()) do
- if debug then
- print("found ".. peripheral.getType(v) .. "on the " .. v) -- easy for new types of machines
- end
- if peripheral.getType(v) == "extrautils_generatorsolar" then
- local solar = peripheral.wrap(v)
- if solar.getEnergyStored() == solar.getMaxEnergyStored() then -- when full enable redstone signal
- if debug then
- print(v.." solar = discharging") -- Display debug info
- end
- rs.setOutput(v, true)
- end
- if solar.getEnergyStored() == 0 then -- when empty disable redstone signal
- if debug then
- print(v.." solar = charging") -- Display debug info
- end
- rs.setOutput(v, false)
- end
- end
- end
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement