Example #1
0
 def _import_static_point(mission, group: unitgroup.Group, imp_group) -> unitgroup.Group:
     for imp_point_idx in imp_group["route"]["points"]:
         imp_point = imp_group["route"]["points"][imp_point_idx]
         point = StaticPoint()
         point.load_from_dict(imp_point, mission.translation)
         group.add_point(point)
     return group
Example #2
0
    def _import_static_point(mission, group: unitgroup.Group,
                             imp_group) -> unitgroup.Group:
        keys = Coalition._sort_keys(imp_group["route"]["points"])

        for imp_point_idx in keys:
            imp_point = imp_group["route"]["points"][imp_point_idx]
            point = StaticPoint(Point(0, 0, mission.terrain))
            point.load_from_dict(imp_point, mission.translation)
            group.add_point(point)
        return group
    def generate(self) -> None:

        if self.cp.captured:
            country_name = self.game.player_country
        else:
            country_name = self.game.enemy_country
        country = self.m.country(country_name)

        for i, helipad in enumerate(self.cp.helipads):
            name = self.cp.name + "_helipad_" + str(i)
            logging.info("Generating helipad : " + name)
            pad = SingleHeliPad(name=(name + "_unit"))
            pad.position = Point(helipad.x, helipad.y)
            pad.heading = helipad.heading
            # pad.heliport_frequency = self.radio_registry.alloc_uhf() TODO : alloc radio & callsign
            sg = unitgroup.StaticGroup(self.m.next_group_id(), name)
            sg.add_unit(pad)
            sp = StaticPoint()
            sp.position = pad.position
            sg.add_point(sp)
            country.add_static_group(sg)