Advertisement
isgrimur

Stationeers : GasNeed-Master (1.1.0.3)

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