Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Reactor Steam variant V1
- differs from regular recator by tracking the steam and water levels and removing the energy buffer marker, as that is no longer needed
- colours:
- 8192 = green
- 16384 = red
- 32768 = black
- 16 = yellow
- pastebin get rxqvHs3z startup
- --]]
- reactor = peripheral.wrap("right")
- monitor = peripheral.wrap("left")
- MAXWIDTH = 29
- MAXHIGHT = 26
- GRAPHMAX = 20 -- Max for the left side graphs, giving space for controll rod graph
- FUELMAX = reactor.getFuelAmountMax()
- WATERMAX = reactor.getCoolantAmountMax()
- STEAMMAX = reactor.getHotFluidAmountMax()
- HEATMAX = 2000
- monitor.setBackgroundColour(32768)
- monitor.clear()
- monitor.setCursorBlink(false)
- while(reactor.getActive)
- do
- fuel = reactor.getFuelAmount()
- reactorEnergy = reactor.getEnergyStored()
- controlRodLevel = reactor.getControlRodLevel(1)
- water = reactor.getCoolantAmount()
- steam = reactor.getHotFluidAmount()
- heat = reactor.getFuelTemperature()
- --Level marker for reactor fuel Level
- monitor.setBackgroundColour(32768)
- monitor.setTextColor(1)
- monitor.setCursorPos(1,1)
- monitor.write("Fuel Level:")
- monitor.setCursorPos(1,2)
- monitor.write("--------------------")
- -- i reprecents the hight and pos of the graph while j is the width of the graph
- for i=3,5,1
- do
- for j = 1, GRAPHMAX, 1
- do
- monitor.setCursorPos(j,i)
- if(0<j and j<=5)
- then
- monitor.setBackgroundColour(16384)
- if( ((fuel/FUELMAX)*20) >= j )
- then
- monitor.setTextColor(1)
- else
- monitor.setTextColor(16384)
- end
- monitor.write("|")
- elseif(5<j and j<=10)
- then
- monitor.setBackgroundColour(2)
- if( ((fuel/FUELMAX)*20) >= j )
- then
- monitor.setTextColor(1)
- else
- monitor.setTextColor(2)
- end
- monitor.write("|")
- elseif(10<j)
- then
- monitor.setBackgroundColour(8192)
- if( ((fuel/FUELMAX)*20) >= j )
- then
- monitor.setTextColor(1)
- else
- monitor.setTextColor(8192)
- end
- monitor.write("|")
- end
- end
- end
- --Water Level marker
- monitor.setBackgroundColour(32768)
- monitor.setTextColor(1)
- monitor.setCursorPos(1,6)
- monitor.write("Water Level:")
- monitor.setCursorPos(1,7)
- monitor.write("--------------------")
- -- i reprecents the hight and pos of the graph while j is the width of the graph
- for i=8,10,1
- do
- for j = 1, GRAPHMAX, 1
- do
- monitor.setCursorPos(j,i)
- if(0<j and j<=5)
- then
- monitor.setBackgroundColour(16384)
- if( ((water/WATERMAX)*20) >= j )
- then
- monitor.setTextColor(1)
- else
- monitor.setTextColor(16384)
- end
- monitor.write("|")
- elseif(5<j and j<=10)
- then
- monitor.setBackgroundColour(2)
- if( ((water/WATERMAX)*20) >= j )
- then
- monitor.setTextColor(1)
- else
- monitor.setTextColor(2)
- end
- monitor.write("|")
- elseif(10<j)
- then
- monitor.setBackgroundColour(8192)
- if( ((water/WATERMAX)*20) >= j )
- then
- monitor.setTextColor(1)
- else
- monitor.setTextColor(8192)
- end
- monitor.write("|")
- end
- end
- end
- --Heat Level
- monitor.setBackgroundColour(32768)
- monitor.setTextColor(1)
- monitor.setCursorPos(1,11)
- monitor.write("Heat Level:")
- monitor.setCursorPos(1,12)
- monitor.write("--------------------")
- -- i reprecents the hight and pos of the graph while j is the width of the graph
- for i=13,15,1
- do
- for j = 1, GRAPHMAX, 1
- do
- monitor.setCursorPos(j,i)
- if(0<j and j<=10)
- then
- monitor.setBackgroundColour(8192)
- if( ((heat/HEATMAX)*20) >= j )
- then
- monitor.setTextColor(1)
- else
- monitor.setTextColor(8192)
- end
- monitor.write("|")
- elseif(10<j and j<=15)
- then
- monitor.setBackgroundColour(2)
- if( ((heat/HEATMAX)*20) >= j )
- then
- monitor.setTextColor(1)
- else
- monitor.setTextColor(2)
- end
- monitor.write("|")
- elseif(15<j)
- then
- monitor.setBackgroundColour(16384)
- if( ((heat/HEATMAX)*20) >= j )
- then
- monitor.setTextColor(1)
- else
- monitor.setTextColor(16384)
- end
- monitor.write("|")
- end
- end
- end
- --steam level
- monitor.setTextColor(1)
- monitor.setBackgroundColour(32768)
- monitor.setCursorPos(1,16)
- monitor.write("Power Per Tick:")
- monitor.setCursorPos(1,17)
- monitor.write("--------------------")
- -- i reprecents the hight and pos of the graph while j is the width of the graph
- for i=18,20,1
- do
- for j = 1, GRAPHMAX, 1
- do
- monitor.setCursorPos(j,i)
- if(0<j and j<=10)
- then
- monitor.setBackgroundColour(8192)
- if( ((steam/STEAMMAX)*20) >= j )
- then
- monitor.setTextColor(1)
- else
- monitor.setTextColor(8192)
- end
- monitor.write("|")
- elseif(10<j and j<=15)
- then
- monitor.setBackgroundColour(2)
- if( ((steam/STEAMMAX)*20) >= j )
- then
- monitor.setTextColor(1)
- else
- monitor.setTextColor(2)
- end
- monitor.write("|")
- elseif(15<j)
- then
- monitor.setBackgroundColour(16384)
- if( ((steam/STEAMMAX)*20) >= j )
- then
- monitor.setTextColor(1)
- else
- monitor.setTextColor(16384)
- end
- monitor.write("|")
- end
- end
- end
- --Control rod Level
- monitor.setBackgroundColour(32768)
- monitor.setTextColor(1)
- monitor.setCursorPos(21,2)
- monitor.write(" Control")
- monitor.setCursorPos(21,3)
- monitor.write(" Rod:")
- monitor.setCursorPos(21,4)
- monitor.write(" ")
- monitor.write(math.floor((controlRodLevel/100) *100))
- monitor.write("%")
- monitor.setCursorPos(21,5)
- monitor.write("---------")
- for i=21, 29 ,1
- do
- for j = 6, MAXHIGHT, 1
- do
- monitor.setCursorPos(i,j)
- if( (((controlRodLevel/100) * 20) + 6) >= j and 22<i and i<28)
- then
- monitor.setTextColor(32768)
- else
- monitor.setTextColor(16)
- end
- monitor.setBackgroundColour(16)
- monitor.write("|")
- end
- end
- --Control rod adjustment
- inverseSteamLvl = math.floor((steam/STEAMMAX) * 100)
- reactor.setAllControlRodLevels(inverseSteamLvl)
- sleep(.01)
- --End WhileLoop
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement