2020-08-01 03:52:59 -07:00
|
|
|
def construct(units, template, x, z, angle=0, autorepair=True, autocontinue=True, queued=False):
|
2024-08-22 00:18:20 -07:00
|
|
|
unit_ids = [unit.id() for unit in units]
|
2020-08-01 03:52:59 -07:00
|
|
|
return {
|
2024-08-22 00:18:20 -07:00
|
|
|
"type": "construct",
|
|
|
|
|
"entities": unit_ids,
|
|
|
|
|
"template": template,
|
|
|
|
|
"x": x,
|
|
|
|
|
"z": z,
|
|
|
|
|
"angle": angle,
|
|
|
|
|
"autorepair": autorepair,
|
|
|
|
|
"autocontinue": autocontinue,
|
|
|
|
|
"queued": queued,
|
2020-08-01 03:52:59 -07:00
|
|
|
}
|
|
|
|
|
|
2024-08-22 00:18:20 -07:00
|
|
|
|
2020-08-01 03:52:59 -07:00
|
|
|
def gather(units, target, queued=False):
|
2024-08-22 00:18:20 -07:00
|
|
|
unit_ids = [unit.id() for unit in units]
|
2020-08-01 03:52:59 -07:00
|
|
|
return {
|
2024-08-22 00:18:20 -07:00
|
|
|
"type": "gather",
|
|
|
|
|
"entities": unit_ids,
|
|
|
|
|
"target": target.id(),
|
|
|
|
|
"queued": queued,
|
2020-08-01 03:52:59 -07:00
|
|
|
}
|
|
|
|
|
|
2024-08-22 00:18:20 -07:00
|
|
|
|
2020-08-01 03:52:59 -07:00
|
|
|
def train(entities, unit_type, count=1):
|
2024-08-22 00:18:20 -07:00
|
|
|
entity_ids = [unit.id() for unit in entities]
|
2020-08-01 03:52:59 -07:00
|
|
|
return {
|
2024-08-22 00:18:20 -07:00
|
|
|
"type": "train",
|
|
|
|
|
"entities": entity_ids,
|
|
|
|
|
"template": unit_type,
|
|
|
|
|
"count": count,
|
2020-08-01 03:52:59 -07:00
|
|
|
}
|
|
|
|
|
|
2024-08-22 00:18:20 -07:00
|
|
|
|
2020-08-01 03:52:59 -07:00
|
|
|
def chat(message):
|
2024-08-22 00:18:20 -07:00
|
|
|
return {"type": "aichat", "message": message}
|
|
|
|
|
|
2020-08-01 03:52:59 -07:00
|
|
|
|
|
|
|
|
def reveal_map():
|
2024-08-22 00:18:20 -07:00
|
|
|
return {"type": "reveal-map", "enable": True}
|
|
|
|
|
|
2020-08-01 03:52:59 -07:00
|
|
|
|
|
|
|
|
def walk(units, x, z, queued=False):
|
2024-08-22 00:18:20 -07:00
|
|
|
ids = [unit.id() for unit in units]
|
|
|
|
|
return {"type": "walk", "entities": ids, "x": x, "z": z, "queued": queued}
|
|
|
|
|
|
2020-08-01 03:52:59 -07:00
|
|
|
|
|
|
|
|
def attack(units, target, queued=False, allow_capture=True):
|
2024-08-22 00:18:20 -07:00
|
|
|
unit_ids = [unit.id() for unit in units]
|
2020-08-01 03:52:59 -07:00
|
|
|
return {
|
2024-08-22 00:18:20 -07:00
|
|
|
"type": "attack",
|
|
|
|
|
"entities": unit_ids,
|
|
|
|
|
"target": target.id(),
|
|
|
|
|
"allowCapture": allow_capture,
|
|
|
|
|
"queued": queued,
|
2020-08-01 03:52:59 -07:00
|
|
|
}
|