Advertisement
Myros27

Untitled

Mar 26th, 2024 (edited)
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.01 KB | None | 0 0
  1. define Sorter -1009150565
  2. define Vending -443130773 #-1577831321
  3. define Lever 1220484876
  4. alias Tmp r0
  5. alias Tmp2 r1
  6. alias Counter r2
  7. alias VendBlocking r3
  8. alias Ident r4
  9. alias StackHolder r5
  10. alias SlotPointer r6
  11. alias HashRecipe r7
  12. alias CurrentQuantity r8
  13. alias StackQuant r9
  14. alias Item r10
  15. alias MaxItems r11
  16. alias OrderItem r12
  17. alias OrderQuant r13
  18. alias Activity r14
  19. l Ident db ReferenceId
  20. s db Setting Ident
  21. sbn Sorter Ident On 1
  22. sbn Sorter Ident Mode 2
  23. sbn Sorter Ident Lock 1
  24. sbn Vending Ident On 1
  25. sbn Vending Ident Lock 1
  26. move sp 0
  27. push 0
  28. brlt sp 512 -1
  29. move sp 0
  30. move HashRecipe 2060134443 #Cable Coil Heavy
  31. move StackQuant 2
  32. jal setInventory
  33. move HashRecipe -466050668 #Cable Coil
  34. move StackQuant 1
  35. jal setInventory
  36. move HashRecipe 1025254665 #Basic Chute
  37. move StackQuant 3
  38. jal setInventory
  39. move HashRecipe -744098481 #IC 10
  40. move StackQuant 3
  41. jal setInventory
  42. add MaxItems sp 1
  43. handleSorter:
  44. yield
  45. lbns Item Sorter Ident 0 OccupantHash 3
  46. beqz Item handleRequest
  47. move sp 1
  48. peek Tmp #handleSorterLoop:
  49. seq Tmp2 Item Tmp
  50. brnez Tmp2 3 #To found
  51. add sp sp 3
  52. brnez Tmp -4 #To handleSorterLoop
  53. add sp sp Tmp2 #found:
  54. pop Tmp
  55. add Tmp Tmp Tmp2
  56. push Tmp
  57. sbn Sorter Ident Output Tmp2
  58. handleRequest:
  59. l SlotPointer d0:0 Channel0
  60. l HashRecipe d0:0 Channel1
  61. l StackQuant d0:0 Channel2
  62. l VendBlocking d0:0 Channel6
  63. beqz SlotPointer handleStock
  64. breq VendBlocking Ident 14 #To myJob
  65. bnez VendBlocking handleStock
  66. beqz HashRecipe handleStock
  67. move sp 1
  68. peek Tmp2 #handleRequestLoop:
  69. beqz Tmp2 handleStock
  70. add sp sp 3
  71. brne HashRecipe Tmp2 -3 #To handleRequestLoop
  72. sub sp sp 2
  73. pop Tmp
  74. beqz Tmp handleStock
  75. move StackHolder sp
  76. s d0:0 Channel6 Ident
  77. j handleStock
  78. sub StackQuant StackQuant 1 #myJob:
  79. brgtz StackQuant 5 #To didntFinishJob
  80. s d0:0 Channel0 0
  81. s d0:0 Channel1 0
  82. s d0:0 Channel3 0
  83. s d0:0 Channel6 0
  84. s d0:0 Channel2 StackQuant #didntFinishJob:
  85. move sp StackHolder
  86. add sp sp 1
  87. pop Counter
  88. sub Counter Counter 1
  89. push Counter
  90. sbn Vending Ident RequestHash HashRecipe
  91. sleep 1
  92. bgtz Counter handleStock
  93. s d0:0 Channel6 0
  94. handleStock:
  95. lbn Tmp Lever HASH("OrderLever") Setting 3
  96. beq Tmp 1 handleSorter
  97. yield
  98. l SlotPointer d0:0 Channel0
  99. breq SlotPointer Ident 17 #To orderNow
  100. breqz SlotPointer 3
  101. rand Activity
  102. mul Activity Activity 1000
  103. add Activity Activity 10
  104. sub Activity Activity 1
  105. bgtz Activity handleSorter
  106. move sp MaxItems
  107. pop Tmp #findUnderStock:
  108. pop Tmp
  109. pop Tmp2
  110. brgt Tmp Tmp2 3 #To requestUnderStock
  111. brgt sp 1 -4 #To findUnderStock
  112. j handleSorter
  113. pop OrderItem #requestUnderStock:
  114. s d0:0 Channel0 Ident
  115. j handleSorter
  116. s d0:0 Channel0 1 #orderNow:
  117. s d0:0 Channel1 OrderItem
  118. s d0:0 Channel2 1
  119. s d0:0 Channel6 -1
  120. j handleSorter
  121. setInventory:
  122. move SlotPointer 2
  123. move CurrentQuantity 0
  124. lbns Tmp Vending Ident SlotPointer OccupantHash 3 #getCurrentQuantityLoop:
  125. brne Tmp HashRecipe 2
  126. add CurrentQuantity CurrentQuantity 1
  127. add SlotPointer SlotPointer 1
  128. brlt SlotPointer 101 -4 #To getCurrentQuantityLoop
  129. push HashRecipe
  130. push CurrentQuantity
  131. push StackQuant
  132. j ra
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement