Stationeers

Stationeers

Not enough ratings
AtmosGasBalancer
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
148.861 KB
22 Jun, 2024 @ 5:23am
24 Jun, 2024 @ 5:21am
3 Change Notes ( view )

Subscribe to download
AtmosGasBalancer

In 1 collection by Wilhelm W. Walrus
Some Good Stuff
11 items
Description
Uses 3 filtration devices to manage the gas balance of your base's atmosphere. Humans only​.

alias intakeVent d0 #this script will balance the ratio of CO2 and O2 in your base via alias co2FilterUnit d1 #filtration, and will automatically handle toxins if they are alias oxyFilterUnit d2 alias toxFilterUnit d3 #though it will only be able to handle 2 toxins at a time. alias gasSensor d4 #changing the filters will automatically change the gasses the script alias toxBypassValve d5 #is looking to filter. define enrichmentBypassValve $40721 define filterTime 240 #fixed time to run the filters once a gas balance issue is detected define maxCO2Ratio 0.20 define maxOxyRatio 0.50 define maxToxRatio 0.005 define minCO2Ratio 0.05 define maxKpa 95 alias timer r15 alias filterType r14 alias slotIndex r13 j DoNextIdle #start in initial idle state AnalyzeGasBalance: l r0 gasSensor RatioOxygen #first, check to see if either oxygen or CO2 are bgt r0 maxOxyRatio DepleteOxygen #over the max ratio and filter if necessary l r0 gasSensor RatioCarbonDioxide bgt r0 maxCO2Ratio DepleteCO2 l r1 gasSensor Pressure slt r0 r0 minCO2Ratio sgt r1 r1 maxKpa and r0 r0 r1 bnez r0 DepleteOxygen #if overpressure and CO2 is low, deplete oxygen bnez r1 DepleteCO2 #else if otherwise overpressure, deplete CO2 l r0 gasSensor RatioPollutant #else, check all toxin concentrations bgt r0 maxToxRatio DepleteToxins l r0 gasSensor RatioVolatiles bgt r0 maxToxRatio DepleteToxins l r0 gasSensor RatioNitrousOxide bgt r0 maxToxRatio DepleteToxins DoNextIdle: move timer 0 #assign idle state, wait a bit for gasses to settle by sensor, s intakeVent Mode 1 #then resume analysis loop s intakeVent On 0 s toxBypassValve On 0 sd enrichmentBypassValve On 0 s co2FilterUnit On 0 s toxFilterUnit On 0 s oxyFilterUnit On 1 #the oxygen unit remains on so its PressureInput can be used s oxyFilterUnit Mode 0 #in any of the loops to determine vent logic. s co2FilterUnit Mode 0 s toxFilterUnit Mode 0 sleep 8 #waiting lets the base atmosphere diffuse a bit around the sensor j AnalyzeGasBalance DepleteOxygen: s oxyFilterUnit Mode 1 #see DepleteCO2 ls r0 oxyFilterUnit 0 Quantity ls r1 oxyFilterUnit 1 Quantity sgtz r0 r0 sgtz r1 r1 or r0 r0 r1 beqz r0 DoNextIdle jal HandleVentAndToxins s toxBypassValve On r0 add timer timer 1 bgt timer filterTime DoNextIdle yield j DepleteOxygen DepleteCO2: s co2FilterUnit Mode 1 s co2FilterUnit On 1 ls r0 co2FilterUnit 0 Quantity #ensure filters have charge ls r1 co2FilterUnit 1 Quantity sgtz r0 r0 sgtz r1 r1 or r0 r0 r1 beqz r0 DoNextIdle jal HandleVentAndToxins #check if toxins can be filtered as well s toxBypassValve On r0 add timer timer 1 bgt timer filterTime DoNextIdle yield j DepleteCO2 DepleteToxins: sd enrichmentBypassValve On 1 jal HandleVentAndToxins #set valve, handle toxins as in depletion loop, but use bnez r0 DoNextIdle #bypass variable as proxy for no more toxin exit condition add timer timer 1 bgt timer filterTime DoNextIdle l r0 oxyFilterUnit PressureInput slt r0 r0 29999 s intakeVent Mode r0 s intakeVent On 1 yield j DepleteToxins HandleVentAndToxins: push ra l r0 oxyFilterUnit PressureInput slt r0 r0 30000 s intakeVent On r0 #handle intake pressure first move filterType 16 #then check each toxin for presence, l r0 oxyFilterUnit RatioPollutantInput #check for valid filter if present, l r1 oxyFilterUnit RatioLiquidPollutantInput #then assign toxin state sgt r2 r0 r1 select r0 r2 r0 r1 jal CheckCanHandleToxin move filterType 8 l r0 oxyFilterUnit RatioVolatilesInput jal CheckCanHandleToxin move filterType 64 l r0 oxyFilterUnit RatioNitrousOxideInput l r1 oxyFilterUnit RatioLiquidNitrousOxideInput sgt r2 r0 r1 select r0 r2 r0 r1 jal CheckCanHandleToxin FinishToxins: pop ra seqz r0 r0 j ra CheckCanHandleToxin: move slotIndex 0 ls r0 toxFilterUnit slotIndex FilterType seq r0 r0 filterType ls r1 toxFilterUnit slotIndex Quantity sgtz r1 r1 and r0 r0 r1 bnez r0 SetToxFilter add slotIndex slotIndex 1 brle slotIndex 1 -7 SetToxFilter: s toxFilterUnit Mode r0 s toxFilterUnit On r0 bnez r0 FinishToxins j ra