Advertisement
isgrimur

Stationeers : GasNeed-Master (1.2.0.4)

Feb 21st, 2020
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. # GasNeed-Master (1.2.0.4)
  2. # - 1.2. add pressure target
  3. # If all ratios are fulfilled, require gas (highest)
  4. # until max pressure is reached.
  5. # Writes gas need key to housing based on required
  6. # ratio settings in cGas1r, cGas2r, ...
  7. # 1010 : error, missing gas reading device
  8. alias dHousing db
  9. alias dMaster d0
  10. alias dGasRead d1
  11. # required gas ratios
  12. define cGasPt 55 # pressure target, ignore if 0
  13. define cGasPk 1 # gas to fill key, ignore if 0
  14. define cGas1r 0.40 # RatioOxygen
  15. define cGas2r 0.06 # RatioCarbonDioxide
  16. define cGas3r 0.01 # RatioNitrogen
  17. define cGas4r 0.00 # RatioPollutant
  18. define cGas5r 0.00 # RatioVolatiles
  19. define cGas6r 0.00 # RatioWater
  20. define cGas7r 0.00 # RatioNitrousOxide
  21. #define cGas8r 0.00 # some new gas
  22. # registers
  23. alias rRa r0 # dynamic jump point
  24. alias rReturn r1
  25. alias rR r2 # reference
  26. alias rC r3 # compare
  27. alias rK r4 # key
  28. alias rD r5 # defined compare
  29. alias rP r6 # priority, activate if presse needed
  30. # loop
  31. jLoop:
  32. move rReturn 1010 # error return
  33. bdns dGasRead jLoopDone
  34. move rReturn 0 # default return
  35. # prepare compare
  36. l rR dGasRead RatioOxygen # first reference
  37. select rR rR rR 1 # !zero
  38. select rD cGas1r cGas1r 1 # !zero
  39. div rR rR rD # calc ratio
  40. move rK 0 # init key (raised by fx)
  41. # init gas key
  42. l rC dGasRead RatioCarbonDioxide # read compare
  43. move rD cGas2r
  44. jal jFxFindNeed
  45. l rC dGasRead RatioNitrogen
  46. move rD cGas3r
  47. jal jFxFindNeed
  48. l rC dGasRead RatioPollutant
  49. move rD cGas4r
  50. jal jFxFindNeed
  51. l rC dGasRead RatioVolatiles
  52. move rD cGas5r
  53. jal jFxFindNeed
  54. l rC dGasRead RatioWater
  55. move rD cGas6r
  56. jal jFxFindNeed
  57. l rC dGasRead RatioNitrousOxide
  58. move rD cGas7r
  59. jal jFxFindNeed
  60. move rD 1 # set final compare to fulfilled
  61. jal jFxFindNeed
  62. # l rC dGasRead SomeNewGas9
  63. # move rD cGas5r
  64. # jal jFxFindNeed
  65.  
  66. # pressure target
  67. bgtz rReturn jLoopDone # not idle : skip
  68. beqz cGasPt jLoopDone # not set : skip
  69. beqz cGasPk jLoopDone # not set : skip
  70. l rP dGasRead Pressure
  71. bge rP cGasPt jLoopDone # target reached
  72. move rReturn cGasPk
  73. #brlt A b # ...
  74. jLoopDone:
  75. s dHousing Setting rReturn
  76. yield
  77. j jLoop
  78. jFxFindNeed:
  79. add rK rK 1
  80. select rC rC rC 1 # set fulfilled if zero
  81. select rD rD rD 1 # set fulfilled if zero
  82. div rC rC rD
  83. brge rR 1 3 # reference >= 1 : fulfilled
  84. brge rR rC 2 # reference >= compare : not priority
  85. move rReturn rK # set need to gas key
  86. move rR rC # store compare as new reference
  87. j ra
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement