Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- define Sorter -1009150565
- define Vending -443130773 #-1577831321
- define Lever 1220484876
- alias Tmp r0
- alias Tmp2 r1
- alias Counter r2
- alias VendBlocking r3
- alias Ident r4
- alias StackHolder r5
- alias SlotPointer r6
- alias HashRecipe r7
- alias CurrentQuantity r8
- alias StackQuant r9
- alias Item r10
- alias MaxItems r11
- alias OrderItem r12
- alias OrderQuant r13
- alias Activity r14
- l Ident db ReferenceId
- s db Setting Ident
- sbn Sorter Ident On 1
- sbn Sorter Ident Mode 2
- sbn Sorter Ident Lock 1
- sbn Vending Ident On 1
- sbn Vending Ident Lock 1
- move sp 0
- push 0
- brlt sp 512 -1
- move sp 0
- move HashRecipe 2060134443 #Cable Coil Heavy
- move StackQuant 2
- jal setInventory
- move HashRecipe -466050668 #Cable Coil
- move StackQuant 1
- jal setInventory
- move HashRecipe 1025254665 #Basic Chute
- move StackQuant 3
- jal setInventory
- move HashRecipe -744098481 #IC 10
- move StackQuant 3
- jal setInventory
- add MaxItems sp 1
- handleSorter:
- yield
- lbns Item Sorter Ident 0 OccupantHash 3
- beqz Item handleRequest
- move sp 1
- peek Tmp #handleSorterLoop:
- seq Tmp2 Item Tmp
- brnez Tmp2 3 #To found
- add sp sp 3
- brnez Tmp -4 #To handleSorterLoop
- add sp sp Tmp2 #found:
- pop Tmp
- add Tmp Tmp Tmp2
- push Tmp
- sbn Sorter Ident Output Tmp2
- handleRequest:
- l SlotPointer d0:0 Channel0
- l HashRecipe d0:0 Channel1
- l StackQuant d0:0 Channel2
- l VendBlocking d0:0 Channel6
- beqz SlotPointer handleStock
- breq VendBlocking Ident 14 #To myJob
- bnez VendBlocking handleStock
- beqz HashRecipe handleStock
- move sp 1
- peek Tmp2 #handleRequestLoop:
- beqz Tmp2 handleStock
- add sp sp 3
- brne HashRecipe Tmp2 -3 #To handleRequestLoop
- sub sp sp 2
- pop Tmp
- beqz Tmp handleStock
- move StackHolder sp
- s d0:0 Channel6 Ident
- j handleStock
- sub StackQuant StackQuant 1 #myJob:
- brgtz StackQuant 5 #To didntFinishJob
- s d0:0 Channel0 0
- s d0:0 Channel1 0
- s d0:0 Channel3 0
- s d0:0 Channel6 0
- s d0:0 Channel2 StackQuant #didntFinishJob:
- move sp StackHolder
- add sp sp 1
- pop Counter
- sub Counter Counter 1
- push Counter
- sbn Vending Ident RequestHash HashRecipe
- sleep 1
- bgtz Counter handleStock
- s d0:0 Channel6 0
- handleStock:
- lbn Tmp Lever HASH("OrderLever") Setting 3
- beq Tmp 1 handleSorter
- yield
- l SlotPointer d0:0 Channel0
- breq SlotPointer Ident 17 #To orderNow
- breqz SlotPointer 3
- rand Activity
- mul Activity Activity 1000
- add Activity Activity 10
- sub Activity Activity 1
- bgtz Activity handleSorter
- move sp MaxItems
- pop Tmp #findUnderStock:
- pop Tmp
- pop Tmp2
- brgt Tmp Tmp2 3 #To requestUnderStock
- brgt sp 1 -4 #To findUnderStock
- j handleSorter
- pop OrderItem #requestUnderStock:
- s d0:0 Channel0 Ident
- j handleSorter
- s d0:0 Channel0 1 #orderNow:
- s d0:0 Channel1 OrderItem
- s d0:0 Channel2 1
- s d0:0 Channel6 -1
- j handleSorter
- setInventory:
- move SlotPointer 2
- move CurrentQuantity 0
- lbns Tmp Vending Ident SlotPointer OccupantHash 3 #getCurrentQuantityLoop:
- brne Tmp HashRecipe 2
- add CurrentQuantity CurrentQuantity 1
- add SlotPointer SlotPointer 1
- brlt SlotPointer 101 -4 #To getCurrentQuantityLoop
- push HashRecipe
- push CurrentQuantity
- push StackQuant
- j ra
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement