Ejemplo n.º 1
0
    def setup_airport(self, airport: dcs.terrain.Airport, side: str,
                      air_def_units: List[Type[dcs.unittype.VehicleType]]):
        airport.set_coalition(side)

        if not airport.civilian:
            if airport.is_red():
                vg = dcs.templates.VehicleTemplate.Russia.sa10_site(
                    self.m,
                    airport.random_unit_zone().center(), 180)
                vg.hidden = self.hide
            elif airport.is_blue():
                dcs.templates.VehicleTemplate.USA.patriot_site(
                    self.m,
                    airport.random_unit_zone().center(), 330)
        else:
            slots = len(airport.parking_slots)
            airdef = int(round(random.random() + slots / 20, 0))
            if airdef:
                vg = self.m.vehicle_group(
                    self.m.country("Russia") if airport.is_red() else
                    self.m.country("USA"), airport.name + " Air Defense",
                    air_def_units[random.randrange(0, len(air_def_units))],
                    airport.random_unit_zone().random_point(), 180)
                if airport.is_red():
                    vg.hidden = self.hide

                for i in range(1, airdef):
                    _type = air_def_units[random.randrange(
                        0, len(air_def_units))]
                    u = self.m.vehicle(
                        airport.name + " Air Defense #" + str(i), _type)
                    vg.add_unit(u)
                vg.formation_scattered(random.randrange(0, 359))

        return airport
Ejemplo n.º 2
0
    def setup_airport(self, airport: dcs.terrain.Airport, side: str, air_def_units: List[dcs.unittype.VehicleType]):
        airport.set_coalition(side)

        if not airport.civilian:
            if airport.is_red():
                vg = dcs.templates.VehicleTemplate.Russia.sa10_site(self.m, airport.random_unit_zone().center(), 180)
                vg.hidden = self.hide
            elif airport.is_blue():
                dcs.templates.VehicleTemplate.USA.patriot_site(self.m, airport.random_unit_zone().center(), 330)
        else:
            slots = len(airport.parking_slots)
            airdef = int(round(random.random() + slots/20, 0))
            if airdef:
                vg = self.m.vehicle_group(
                    self.m.country("Russia") if airport.is_red() else self.m.country("USA"),
                    airport.name + " Air Defense",
                    air_def_units[random.randrange(0, len(air_def_units))],
                    airport.random_unit_zone().random_point(), 180)
                if airport.is_red():
                    vg.hidden = self.hide

                for i in range(1, airdef):
                    _type = air_def_units[random.randrange(0, len(air_def_units))]
                    u = self.m.vehicle(airport.name + " Air Defense #" + str(i), _type)
                    vg.add_unit(u)
                vg.formation_scattered(random.randrange(0, 359))

        return airport
Ejemplo n.º 3
0
 def setup_airport(self, airport: dcs.terrain.Airport, side: str, air_def_units: List[dcs.unittype.VehicleType]):
     airport.set_coalition(side)
     return airport