View difference between Paste ID: qRuxjpxx and K6B8FCrK
SHOW: | | - or go back to the newest paste.
1-
local reactor = peripheral.wrap("BigReactors-Reactor_0")
1+
local mon = peripheral.wrap("right")
2-
rednet.open("left")
2+
rednet.open("top")
3
mon.clear()
4-
mainframe = 160
4+
5-
monitor = 161
5+
-- Print
6
mon.setCursorPos(1,1)
7
mon.setTextColor(colors.blue)
8-
-- Print to monitor
8+
mon.setTextScale(2)
9-
	energy = reactor.getEnergyStored()
9+
mon.write("Reactor")
10-
	fuel = reactor.getFuelAmount()
10+
11-
	maxfuel = reactor.getFuelAmountMax()
11+
12-
	active = reactor.getActive()
12+
-- Reactor
13
	id, msg = rednet.receive()
14-
	table = {energy, fuel, maxfuel, active}
14+
	table = textutils.unserialize(msg)
15-
	msg = textutils.serialize(table)
15+
16
	energy = table[1]
17-
	rednet.send(monitor, msg)
17+
	fuel = table[2]
18
	maxfuel = table[3]
19-
-- Commands
19+
	active = table[4]
20-
	id, cmd = rednet.receive(1)
20+
21
-- Status
22-
	if cmd == "ron" then
22+
    mon.setCursorPos(1,3)
23-
		reactor.setActive(true)
23+
    mon.setTextColor(colors.green)
24-
	elseif cmd == "roff" then
24+
    mon.write("Status: ")
25-
		reactor.setActive(false)
25+
	mon.setTextColor(colors.red)
26-
	elseif cmd == "status" then
26+
	if active == true then
27-
		rednet.send(mainframe, active)
27+
		mon.write("Online")
28
	else
29
		mon.write("Offline")
30-
-- Auto turn on
30+
31-
	if energy < 5000000 then
31+
	
32-
		reactor.setActive(true)
32+
-- Fuel
33-
	elseif energy > 5500000 then
33+
	mon.setCursorPos(1,4)	 
34-
		reactor.setActive(false)
34+
	mon.setTextColor(colors.green)
35
	mon.write("Fuel: ")
36
37
	mon.setTextColor(colors.red)
38
	mon.write(fuel)
39
	mon.write("/")
40
	mon.write(maxfuel)
41
42
-- Energy
43
	mon.setCursorPos(1,5)
44
	mon.setTextColor(colors.green)
45
	mon.write("Energy: ")
46
	mon.setTextColor(colors.red)
47
	mon.write(energy)
48
	mon.write("/10000000")
49
50
-- Lava and water tank
51
--	mon.setCursorPos(1,7)
52
--	mon.setTextColor(colors.green)
53
--	mon.write("Tanks: ")
54
--	mon.setTextColor(colors.red)
55
--	mon.write(energy)
56
57
	sleep(0)
58
end