stationeers_ic10/automated_canister_filling.ic10

56 lines
1.4 KiB
Plaintext
Raw Normal View History

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
2021-08-29 21:26:24 +00:00
# !!! Remember to set volume pump to 10l !!!
2021-08-29 13:07:24 +00:00
2021-08-29 21:26:24 +00:00
alias tank_storage d0
alias fill_pump d1
alias evac_pump d2
2021-08-29 21:26:24 +00:00
alias analyzer d3
2021-08-29 13:07:24 +00:00
2021-08-29 21:26:24 +00:00
alias tank_present r0
alias tank_hash r1
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-08-29 21:26:24 +00:00
define canister_hash 42280099
define smart_canister_hash -668314371
2021-08-29 19:37:16 +00:00
start:
# check if canister is present
2021-08-29 21:26:24 +00:00
ls tank_present tank_storage 0 Occupied
2021-08-29 19:37:16 +00:00
# identify canister
2021-08-29 21:26:24 +00:00
ls tank_hash tank_storage 0 OccupantHash
2021-08-29 19:37:16 +00:00
# set safe fill-pressure
2021-08-29 21:26:24 +00:00
beq tank_hash canister_hash regular
beq tank_hash smart_canister_hash smart
2021-08-29 19:37:16 +00:00
regular:
2021-08-29 21:26:24 +00:00
move fill_pressure 8000000 # regular tank safe max
2021-08-29 19:37:16 +00:00
j fill # start filling
smart:
2021-08-29 21:26:24 +00:00
move fill_pressure 18000000 # smart tank safe max
2021-08-29 19:37:16 +00:00
j fill # start filling
2021-08-29 21:26:24 +00:00
fill: # fills tank if present and has room
# get tank pressure in Pa
ls storage_pressure tank_storage 0 Pressure
# is there room in the tank for more gas?
slt gas_to_move storage_pressure fill_pressure
2021-08-29 21:26:24 +00:00
# is there a tank in the slot that has room?
and pump_active gas_to_move tank_present
# trigger fill pump
s fill_pump On pump_active
2021-08-29 21:26:24 +00:00
beqz tank_present evac # break if no tank
j start
2021-08-29 21:26:24 +00:00
evac: # evacuates pipe on tank 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-08-29 19:37:16 +00:00
j start