Compare commits
	
		
			No commits in common. "0544d04e859182057e486dcc31871152df6b71d7" and "c95443ce126a53eb3f26c4f06df81b0b671f99d5" have entirely different histories.
		
	
	
		
			0544d04e85
			...
			c95443ce12
		
	
		
@ -1,4 +1,4 @@
 | 
			
		||||
Set up on the computer with `wget https://git.navidsassan.ch/navid.sassan/computercraft/raw/branch/master/get get`. Make sure to enable the http API in the computercraft config file on the server.
 | 
			
		||||
Set up on the computer with `wget https://git.navidsassan.ch/navid.sassan/computercraft/-/raw/master/get get`.
 | 
			
		||||
 | 
			
		||||
Then use `get README.md` for example, to download the `README.md`.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										38
									
								
								react
									
									
									
									
									
								
							
							
						
						
									
										38
									
								
								react
									
									
									
									
									
								
							@ -3,6 +3,18 @@
 | 
			
		||||
--import utils for lamp rednet stuffs
 | 
			
		||||
require("git-scripts.utils")
 | 
			
		||||
 | 
			
		||||
--regulate in between these in normal operation
 | 
			
		||||
NORMAL_THRESHOLD_U = 8000000
 | 
			
		||||
NORMAL_THRESHOLD_L = 7000000
 | 
			
		||||
--control rod pos for normal operation
 | 
			
		||||
NORMAL_ROD_POS = 81
 | 
			
		||||
 | 
			
		||||
--proportionally increase production when energy
 | 
			
		||||
--storage drops below this level
 | 
			
		||||
--(by removing control rods)
 | 
			
		||||
HIGH_THRESHOLD = 6000000
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
local active = false
 | 
			
		||||
local ctrl_rods = NORMAL_ROD_POS
 | 
			
		||||
 | 
			
		||||
@ -16,21 +28,7 @@ if modemSide then --not nil
 | 
			
		||||
    lampID = rednet.lookup("reactLamp", "reactLamp")
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
--regulate in between these in normal operation
 | 
			
		||||
NORMAL_THRESHOLD_U = 0.8 * reactor.getEnergyCapacity()
 | 
			
		||||
NORMAL_THRESHOLD_L = 0.7 * reactor.getEnergyCapacity()
 | 
			
		||||
--control rod pos for normal operation
 | 
			
		||||
NORMAL_ROD_POS = 81
 | 
			
		||||
 | 
			
		||||
--proportionally increase production when energy
 | 
			
		||||
--storage drops below this level
 | 
			
		||||
--(by removing control rods)
 | 
			
		||||
HIGH_THRESHOLD = 0.6 * reactor.getEnergyCapacity()
 | 
			
		||||
 | 
			
		||||
print("Monitoring reactor...")
 | 
			
		||||
print("NORMAL_THRESHOLD_U: " .. NORMAL_THRESHOLD_U)
 | 
			
		||||
print("NORMAL_THRESHOLD_L: " .. NORMAL_THRESHOLD_L)
 | 
			
		||||
print("HIGH_THRESHOLD: " .. HIGH_THRESHOLD)
 | 
			
		||||
 | 
			
		||||
while (true)
 | 
			
		||||
do
 | 
			
		||||
@ -44,7 +42,7 @@ do
 | 
			
		||||
    mon.write(energy)
 | 
			
		||||
    mon.write("RF")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
    if (energy > NORMAL_THRESHOLD_U)
 | 
			
		||||
    then
 | 
			
		||||
        active = false
 | 
			
		||||
@ -59,10 +57,10 @@ do
 | 
			
		||||
            end
 | 
			
		||||
        end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    --actually set state
 | 
			
		||||
    mon.setCursorPos(1, 2)
 | 
			
		||||
    if (active)
 | 
			
		||||
    if (active) 
 | 
			
		||||
    then
 | 
			
		||||
        reactor.setActive(true)
 | 
			
		||||
        mon.write("On")
 | 
			
		||||
@ -70,7 +68,7 @@ do
 | 
			
		||||
        reactor.setActive(false)
 | 
			
		||||
        mon.write("Off")
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    mon.setCursorPos(1, 4)
 | 
			
		||||
    reactor.setAllControlRodLevels(ctrl_rods)
 | 
			
		||||
    mon.write(ctrl_rods)
 | 
			
		||||
@ -81,12 +79,12 @@ do
 | 
			
		||||
    mon.setCursorPos(1, 3)
 | 
			
		||||
    mon.write(math.floor(reactor.getEnergyProducedLastTick()))
 | 
			
		||||
    mon.write("RF/t")
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    --also check if fuel has run out
 | 
			
		||||
    --(if the fuel inside the reactor isn't
 | 
			
		||||
    --getting refilled anymore)
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    local deltaFuel = reactor.getFuelAmountMax() - reactor.getFuelAmount()
 | 
			
		||||
    if (deltaFuel > 2000) --more than 2 buckets (1 for core possibly not being full, another for waste)
 | 
			
		||||
    then
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user