Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Program name: EZ-NUKE reactor control system
- Version: v0002 Pre-alpha
- Programmer: ScatmanJohn
- Last update: 8.1.2014
- Pastebin: http://pastebin.com/sUiYsgmp
- Description:
- This program controls a Big Reactors nuclear reactor
- in Minecraft with a Computercraft computer, using Computercraft's
- own wired modem connected to the reactors computer control port.
- Resources:
- Reactor control:
- http://pastebin.com/HjUVNDau
- FC API:
- http://pastebin.com/A9hcbZWe
- Monitor size is X: 29, Y: 12 with a 3x2 size
- ]]--
- print("Initializing program...");
- function wrapThis(thing)
- local wrapped, i = nil, 0
- while wrapped == nil and i <= 100 do
- wrapped = peripheral.wrap(thing.."_"..i)
- i = i + 1
- end
- if wrapped == nil then
- side = getDeviceSide(thing)
- if side ~= nil then
- return peripheral.wrap(side)
- else
- return nil
- end
- else
- return wrapped
- end
- end
- -- Then initialize the monitor
- local monitor = wrapThis("monitor")
- if monitor == nil then
- print("Can't find monitor.")
- end
- local inittext = "Monitor initialized"
- local monitorx, monitory = monitor.getSize()
- local textx, texty = monitorx/4, monitory/2
- monitor.clear()
- monitor.setCursorPos(textx, texty)
- monitor.write(inittext)
- monitor.setCursorPos(1,1)
- monitor.write("1")
- monitor.setCursorPos(1,monitory)
- monitor.write("3")
- monitor.setCursorPos(monitorx,1)
- monitor.write("2")
- monitor.setCursorPos(monitorx,monitory)
- monitor.write("4")
- print("X size: "..monitorx.." characters.")
- print("Y size: "..monitory.." characters.")
- -- Let's connect to the reactor peripheral
- local reactor = wrapThis("BigReactors-Reactor")
- if reactor == nil then
- print("Can't find reactor.")
- end
- local temp = reactor.getTemperature()
- print("Temperature: "..temp)
- print("Everything went better than expected.")
- -- Begin loop to fetch reactor data and display it on the monitor
- --[[
- while 1 do
- -- Retrieve reactor data
- -- Prepare the printable elements
- -- Print elements in their spots on the monitor
- end
- ]]--
- --[[ OLD CODE USED FOR TESTING
- print("Program loaded. Scanning for reactor...");
- local reactor
- reactor = peripheral.wrap("back")
- isactive = reactor.getActive();
- if isactive == true
- print("Reactor active.");
- monitor.print("All's well!");
- else
- print("Reactor inactive.");
- end
- ]]--
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement