-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAutomated Rocket.ic10
126 lines (116 loc) · 2.75 KB
/
Automated Rocket.ic10
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
118
119
120
121
122
123
124
125
126
#Automated Rocket based on Script by Acilec
alias rocket d0
alias launchButton d1
alias autoRestartSwitch d2
alias siloDisplay d3
alias modeDisplay d4
alias fuelPump d5
define TARGETFUELPRESSURE 10000
define SILO 906210602
define OREMINING -2027419821
define ICEMINING 74521920
define SCRAPMINING -1446002463
define GASMINING -1969723301
alias fuelLeft r15
alias returnFuel r14
alias rocketMode r13
alias launchButtonState r12
alias siloQantity r11
alias quantityMax r10
alias countdown r9
alias collectableGoods r8
alias isUnloading r7
alias autoRestart r6
Main:
yield
s rocket Activate 0
sb OREMINING Activate 0
sb ICEMINING Activate 0
sb GASMINING Activate 0
sb SCRAPMINING Activate 0
jal LoadData
jal UpdateDisplay
beqal rocketMode 0 HandleIdle # Idle on Launch Pad
beqal rocketMode 2 HandleRocketInSpace # Traveling in space
beqal rocketMode 3 HandleRocketInSpace # Arriving at location
beqal rocketMode 4 HandleRocketInSpace # Idle in Space
beqal rocketMode 7 HandleOutOfFuel # Out of fuel in Space, RIP rocket
j Main
LoadData:
lb quantityMax SILO Maximum 1
# Real maximum is 6 times higher than reported by the Maximum property
mul quantityMax quantityMax 6
lb siloQantity SILO Quantity 1
l rocketMode rocket Mode
breqz rocketMode 2 # can't read collectableGoods when idling
l collectableGoods rocket CollectableGoods
l fuelLeft rocket Fuel
l returnFuel rocket ReturnFuelCost
l launchButtonState launchButton Setting
brdns autoRestartSwitch 2
l autoRestart autoRestartSwitch Setting
j ra
HandleIdle: #0
snez isUnloading siloQantity
sb SILO Open isUnloading
sle r0 fuelLeft TARGETFUELPRESSURE
s fuelPump On r0
nor r0 isUnloading r0
and r0 r0 autoRestart
bnez r0 Countdown
bnez launchButtonState Countdown
j ra
HandleRocketInSpace: #2,3, 4
sb SILO Open 0
bnez launchButtonState Returnhome
bge siloQantity quantityMax Returnhome
jal DoFuelCheck
bnez collectableGoods StartMining
beqz collectableGoods Travel
j Main
HandleOutOfFuel: #7
hcf
Countdown:
# ONLY LAUNCH WITH ENOUGH Fuel
ble fuelLeft TARGETFUELPRESSURE Main
sb SILO Open 0
move countdown 10
s modeDisplay Color 4 # red
DoingCountdown:
s modeDisplay Setting countdown
beqz countdown Launching
sub countdown countdown 1
sleep 1
l launchButtonState launchButton Setting
beq launchButtonState 1 Main # ABORT LAUNCH
j DoingCountdown
Launching:
s rocket Activate 1
sleep 2
j Main
DoFuelCheck:
mul returnFuel returnFuel 1.2 #Save some fuel
bge returnFuel fuelLeft Returnhome
j ra
StartMining:
yield
sb OREMINING Activate 1
sb ICEMINING Activate 1
sb GASMINING Activate 1
sb SCRAPMINING Activate 1
yield
j Main
Travel:
s rocket Activate 2
j Main
Returnhome:
s rocket Activate 5
sleep 2
j Main
UpdateDisplay:
div r0 siloQantity quantityMax
s modeDisplay Color 2 # green
s modeDisplay Setting rocketMode
s siloDisplay Setting r0
s siloDisplay Mode 1
j ra