-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathprinter-logistics.ic10
More file actions
117 lines (117 loc) · 2.52 KB
/
printer-logistics.ic10
File metadata and controls
117 lines (117 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# Based on Printer Logistics V4 by CowsAreEvil
alias printer d0
alias stacker d1 # Optional
alias sorter d2 # Optional
alias vending d3 # Optional
alias button d4 # Optional
alias counter r10
alias ingot r11
alias oldimport r12
define CLEARINGOT -1
define STACKSIZE 36
setup:
move sp 0
push HASH("ItemWaspaloyIngot")
push HASH("Waspaloy")
push HASH("ItemStelliteIngot")
push HASH("Stellite")
push HASH("ItemInconelIngot")
push HASH("Inconel")
push HASH("ItemHastelloyIngot")
push HASH("Hastelloy")
push HASH("ItemAstroloyIngot")
push HASH("Astroloy")
push HASH("ItemSolderIngot")
push HASH("Solder")
push HASH("ItemInvarIngot")
push HASH("Invar")
push HASH("ItemElectrumIngot")
push HASH("Electrum")
push HASH("ItemConstantanIngot")
push HASH("Constantan")
push HASH("ItemSilverIngot")
push HASH("Silver")
push HASH("ItemNickelIngot")
push HASH("Nickel")
push HASH("ItemLeadIngot")
push HASH("Lead")
push 0 # above ingots requested as required
push 0 # below ingots are kept in stock
push HASH("ItemSteelIngot")
push HASH("Steel")
push HASH("ItemSiliconIngot")
push HASH("Silicon")
push HASH("ItemGoldIngot")
push HASH("Gold")
push HASH("ItemCopperIngot")
push HASH("Copper")
push HASH("ItemIronIngot")
push HASH("Iron")
move ingot CLEARINGOT
s db Setting ingot
bdns sorter start
s sorter Mode 2
s sorter On 1
start:
bdns button checkCounter
l r0 button Setting
beqz r0 checkSorter
move ingot CLEARINGOT
s db Setting ingot
checkSorter:
bdns sorter checkCounter
ls r0 sorter 0 Occupied
beqz r0 checkIngotArrived
ls r0 sorter 0 OccupantHash
seq r0 r0 ingot
s sorter Output r0
checkIngotArrived:
l r0 printer ImportCount
ble r0 oldimport checkCounter
move ingot CLEARINGOT
s db Setting ingot
move oldimport r0
checkCounter:
bdns stacker checkRestock
l counter stacker Setting
l r0 printer Activate
bnez r0 continueCounter
s printer ClearMemory 1
move oldimport 0
beqz r0 checkRestock
continueCounter:
l r0 printer ExportCount
blt r0 counter checkRestock
s printer Activate 0
checkRestock:
yield
bdns vending start
l r0 printer Open
bnez r0 start
bne ingot CLEARINGOT start
move sp STACKSIZE
move r3 0
checkRestockLoop:
beqz sp start
pop r1 # regent hash
pop r0 # item hash
beqz r0 checkRestockFlipType
bnez r3 checkRestockJIT
checkRestockBasic:
lr r2 printer Contents r1
slt r2 r2 50
select ingot r2 r0 ingot
j continueRestock
checkRestockFlipType:
move r3 1
j checkRestockLoop
checkRestockJIT:
lr r2 printer Required r1
select ingot r2 r0 ingot
continueRestock:
bne ingot CLEARINGOT requestIngot
j checkRestockLoop
requestIngot:
s db Setting ingot
s vending RequestHash ingot
j start