-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkamikase.code
92 lines (66 loc) · 2.3 KB
/
kamikase.code
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
// will fill all flare with explosive ressources
import onOff
import idBots
import msg
set appro container1
set switch switch1
set message message1
set radiusApproche 6 // max working radius: 8
ubind @flare
if @unit == null // no bot of that type
print "[yellow] no bots of the choosen type, \n"
print "you can pick another kind of bot in the instruction 'ubind' at the begining of the programme"
msg.printAndWait("", message)
end
set coreX null
set coreY null
// where to take ressource from, appro or core
if appro != null
print "[green] appro not null, will replace core to take ressource from"
msg.printAndWait(appro, message)
// appro position, default to core if null
sensor coreX appro @x
sensor coreY appro @y
set core appro
// get core position
#ref getCorePos
// require to have a @unite
if coreX == null
msg.printAndWait("looking for core, this is done once", message)
ulocate building core false @copper coreX coreY coreFound core
if coreFound == false
msg.printAndWait("[red] core not found, searching again", message)
msg.printAndWait(core, message)
msg.printAndWait(coreFound, message)
jump getCorePos
msg.printAndWait("[green] core found", message)
set reset false
// --- Prog Loop ---
#ref loop
// switch to turn off
isOn = onOff.isOn(switch)
if isOn != true
msg.printAndWait("[yellow] process is turn off", message)
set reset true // will reset after switch On
jump loop
if reset == true
msg.printAndWait("reset prog", message)
end // to reset procId and botOwnedNb
for unit in [@flare, @horizon]
ubind unit
if @unit != null
sensor botFlag @unit @flag
if botFlag == 0
ucontrol flag 666 null null null null
sensor botFlag @unit @flag
if botFlag == 666
sensor payload @unit @totalItems
if payload == 0
ucontrol approach coreX coreY radiusApproche null null
ucontrol itemTake core @blast-compound 800 null null
else
sensor transportedRessource @unit @firstItem
if transportedRessource != @blast-compound
ucontrol approach coreX coreY radiusApproche null null
ucontrol itemDrop core 800 null null null
jump loop