drabont

Stationeers - CanFiller

Sep 14th, 2020 (edited)
757
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #= CanFiller = v0.5 ================== by swagman =#
  2. #   ___              ___  _  _  _                  #
  3. #  / __| __ _  _ _  | __|(_)| || | ___  _ _   safe #
  4. # | (__ / _` || ' \ | _| | || || |/ -_)| '_|  fast #
  5. #  \___|\__,_||_||_||_|  |_||_||_|\___||_|    smrt #
  6. #==================================================#
  7. # Safety System idea - credit to DrWathson#4813    #
  8. # * automatic temperature correction of pressure   #
  9. # * fill indicator & drain/fill mode switch        #
  10. # * precise and fast pressure regulator            #
  11. # * automatic canister type detection              #
  12. # * automatic drain of other gases                 #
  13. # * clowns, explosions and helicopters...          #
  14. #= 2020.09.15 01:32  https://youtu.be/HOq8KUW60ts =#
  15.  
  16. define smaP 18000 #P for smart canister at 300K
  17. define defP 8000 #P for common canister at 300K
  18. define Vout 165 #filler pipes + canister volume
  19.  
  20. alias GasStr d0
  21. alias PumpDn d1
  22. alias PumpUp d2
  23. alias PipeAn d3
  24. alias DioSld d4
  25. alias LedDsp d5 #optional
  26. alias hash r15
  27. alias trgP r14
  28. alias curP r13
  29. alias oxyP r12
  30. define smart -668314371
  31. wait:
  32. yield
  33. ls r0 GasStr 0 Occupied
  34. s DioSld On r0
  35. s PumpUp On r0
  36. s PumpDn On r0
  37. s PipeAn On r0
  38. bnez r0 work
  39. j wait
  40. work:
  41. ls hash GasStr 0 PrefabHash
  42. beqz hash wait
  43. seq r0 hash smart
  44. select trgP r0 smaP defP
  45. l curP GasStr Pressure
  46. breqz curP 5
  47. l r0 GasStr Temperature
  48. div r0 r0 300
  49. mul r1 trgP r0
  50. min trgP trgP r1
  51. div r0 curP trgP
  52. s DioSld Setting r0
  53. l r0 DioSld On
  54. mul trgP trgP r0
  55. l r0 GasStr RatioOxygen
  56. seq r0 r0 1
  57. select r0 curP r0 1
  58. mul trgP trgP r0
  59. round r0 curP
  60. brdns LedDsp 2
  61. s LedDsp Setting r0
  62. l oxyP PipeAn Pressure
  63. sub r0 trgP curP
  64. sltz r1 r0
  65. brgtz r1 2
  66. round r0 r0
  67. select r2 r1 curP oxyP
  68. mul r0 r0 Vout
  69. div r0 r0 r2
  70. s PumpUp Setting r0
  71. mul r0 -1 r0
  72. s PumpDn Setting r0
  73. yield
  74. bgt r0 10 work
  75. blt r0 -200 work
  76. s PumpDn Setting 0
  77. s PumpUp Setting 0
  78. yield
  79. yield
  80. j work
Add Comment
Please, Sign In to add comment