2021-08-29 19:37:16 +00:00
|
|
|
# automatic gas-canister filler.
|
|
|
|
# only works with player-made cans, starter-cans
|
|
|
|
# have different hashes that won't work
|
|
|
|
# !!! Remember to set volume pump to no more !!!
|
|
|
|
# !!! than 10l! I have mine at 2l for safety !!!
|
2021-08-29 13:07:24 +00:00
|
|
|
|
|
|
|
alias canister_storage d0
|
2021-08-29 21:10:21 +00:00
|
|
|
alias fill_pump d1
|
|
|
|
alias evac_pump d2
|
|
|
|
alias analyzer d4
|
2021-08-29 13:07:24 +00:00
|
|
|
|
|
|
|
alias canister_present r0
|
|
|
|
alias canister_hash r1
|
2021-08-29 21:10:21 +00:00
|
|
|
alias storage_pressure r2
|
|
|
|
alias gas_to_move r3
|
2021-08-29 19:37:16 +00:00
|
|
|
alias fill_pressure r4
|
|
|
|
alias pump_active r5
|
2021-08-29 13:07:24 +00:00
|
|
|
|
2021-11-15 13:32:10 +00:00
|
|
|
define CANISTER 42280099
|
|
|
|
define SMART_CANISTER -668314371
|
2021-08-29 19:37:16 +00:00
|
|
|
|
|
|
|
start:
|
2021-09-04 11:02:35 +00:00
|
|
|
yield
|
2021-08-29 19:37:16 +00:00
|
|
|
# check if canister is present
|
|
|
|
ls canister_present canister_storage 0 Occupied
|
|
|
|
# identify canister
|
|
|
|
ls canister_hash canister_storage 0 OccupantHash
|
|
|
|
# set safe fill-pressure
|
2021-11-15 13:32:10 +00:00
|
|
|
beq canister_hash CANISTER regular
|
|
|
|
beq canister_hash SMART_CANISTER smart
|
2021-08-29 19:37:16 +00:00
|
|
|
|
|
|
|
regular:
|
|
|
|
move fill_pressure 8000000 # regular can safe max
|
|
|
|
j fill # start filling
|
|
|
|
|
|
|
|
smart:
|
2021-08-29 21:10:21 +00:00
|
|
|
move fill_pressure 18000000 # smart can safe max
|
2021-08-29 19:37:16 +00:00
|
|
|
j fill # start filling
|
|
|
|
|
2021-08-29 21:10:21 +00:00
|
|
|
fill: # fills canister if present and <8Mpa
|
2021-08-29 19:37:16 +00:00
|
|
|
# get canister pressure in Pa
|
2021-08-29 21:10:21 +00:00
|
|
|
ls storage_pressure canister_storage 0 Pressure
|
2021-08-29 19:37:16 +00:00
|
|
|
# is there room in the canister for more gas?
|
2021-08-29 21:10:21 +00:00
|
|
|
slt gas_to_move storage_pressure fill_pressure
|
2021-08-29 19:37:16 +00:00
|
|
|
# is there a can in the slot that has room?
|
2021-08-29 21:10:21 +00:00
|
|
|
and pump_active gas_to_move canister_present
|
|
|
|
# trigger fill pump
|
|
|
|
s fill_pump On pump_active
|
|
|
|
beqz canister_present evac# break if no can
|
|
|
|
j start
|
|
|
|
|
|
|
|
evac: # evacuates pipe on can removed and >0Pa
|
|
|
|
l storage_pressure analyzer Pressure
|
|
|
|
# is there gas in the pipe?
|
|
|
|
sgt gas_to_move storage_pressure 0
|
|
|
|
# trigger evac pump
|
|
|
|
s evac_pump On gas_to_move
|
2021-09-04 12:01:30 +00:00
|
|
|
bgtz gas_to_move evac
|
2021-08-29 19:37:16 +00:00
|
|
|
j start
|