forked from BurnySc2/python-sc2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshow_debug.py
36 lines (29 loc) · 1.02 KB
/
show_debug.py
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
""" DEPRECATED - see debug examples in terran/ramp_wall.py """
from sc2 import maps
from sc2.bot_ai import BotAI
from sc2.data import Difficulty, Race
from sc2.main import run_game
from sc2.player import Bot, Computer
class MyBot(BotAI):
async def on_step(self, iteration):
for structure in self.structures:
self._client.debug_text_world(
"\n".join(
[
f"{structure.type_id.name}:{structure.type_id.value}",
f"({structure.position.x:.2f},{structure.position.y:.2f})",
f"{structure.build_progress:.2f}",
] + [repr(x) for x in structure.orders]
),
structure.position3d,
color=(0, 255, 0),
size=12,
)
def main():
run_game(
maps.get("Abyssal Reef LE"),
[Bot(Race.Terran, MyBot()), Computer(Race.Protoss, Difficulty.Medium)],
realtime=True,
)
if __name__ == "__main__":
main()