def __init__(self, load_ground_objects=True): super(NorthCaucasus, self).__init__() self.kutaisi = ControlPoint.from_airport(caucasus.Kutaisi, LAND, SIZE_SMALL, IMPORTANCE_LOW) self.vaziani = ControlPoint.from_airport(caucasus.Vaziani, LAND, SIZE_SMALL, IMPORTANCE_LOW) self.maykop = ControlPoint.from_airport(caucasus.Maykop_Khanskaya, LAND, SIZE_LARGE, IMPORTANCE_HIGH) self.beslan = ControlPoint.from_airport(caucasus.Beslan, LAND, SIZE_REGULAR, IMPORTANCE_LOW) self.nalchik = ControlPoint.from_airport(caucasus.Nalchik, LAND, SIZE_REGULAR, 1.1) self.mineralnye = ControlPoint.from_airport(caucasus.Mineralnye_Vody, LAND, SIZE_BIG, 1.3) self.mozdok = ControlPoint.from_airport(caucasus.Mozdok, LAND, SIZE_BIG, 1.1) self.carrier_1 = ControlPoint.carrier( "Carrier", mapping.Point(-285810.6875, 496399.1875), 1001) self.lha = ControlPoint.lha("Tarawa", mapping.Point(-326050.6875, 519452.1875), 1002) self.vaziani.frontline_offset = 0.5 self.vaziani.base.strength = 1 self.add_controlpoint(self.kutaisi, connected_to=[self.vaziani]) self.add_controlpoint(self.vaziani, connected_to=[self.beslan, self.kutaisi]) self.add_controlpoint( self.beslan, connected_to=[self.vaziani, self.mozdok, self.nalchik]) self.add_controlpoint( self.nalchik, connected_to=[self.beslan, self.mozdok, self.mineralnye]) self.add_controlpoint( self.mozdok, connected_to=[self.nalchik, self.beslan, self.mineralnye]) self.add_controlpoint( self.mineralnye, connected_to=[self.nalchik, self.mozdok, self.maykop]) self.add_controlpoint(self.maykop, connected_to=[self.mineralnye]) self.add_controlpoint(self.carrier_1, connected_to=[]) self.add_controlpoint(self.lha, connected_to=[]) self.carrier_1.captured = True self.vaziani.captured = True self.kutaisi.captured = True self.carrier_1.captured_invert = True self.maykop.captured_invert = True self.lha.captured = True self.lha.captured_invert = True self.mineralnye.captured_invert = True
def travel(self, vehicle_group, from_node: Node, to_node: Node, terrain: Terrain, speed=32): distance, path = self.shortest_path(from_node.name, to_node.name) last = path[0] for p in path[1:]: current_node = self.node(p) if not self.edge_properties[(last, p)][1]: vehicle_group.add_waypoint( current_node.position + mapping.Point(1, 0, terrain), speed=speed, move_formation=point.PointAction.OffRoad) vehicle_group.add_waypoint( current_node.position, speed=speed, move_formation=point.PointAction.OnRoad) else: vehicle_group.add_waypoint( current_node.position, speed=speed, move_formation=point.PointAction.OnRoad) last = p return distance, path
def __init__(self, _id, name=None, type=""): self.type = type self.position = mapping.Point(0, 0) self.heading = 0 self.id = _id self.skill = Skill.Average # type: Skill self.name = name if name else String()
def __init__(self, load_ground_objects=True): super(WesternGeorgiaInverted, self).__init__() self.kutaisi = ControlPoint.from_airport(caucasus.Kutaisi, LAND, SIZE_SMALL, IMPORTANCE_LOW) self.senaki = ControlPoint.from_airport(caucasus.Senaki_Kolkhi, LAND, SIZE_REGULAR, IMPORTANCE_LOW) self.kobuleti = ControlPoint.from_airport(caucasus.Kobuleti, COAST_A_E, SIZE_SMALL, 1.1) self.sukhumi = ControlPoint.from_airport(caucasus.Sukhumi_Babushara, COAST_DR_E, SIZE_REGULAR, 1.2) self.gudauta = ControlPoint.from_airport(caucasus.Gudauta, COAST_DR_E, SIZE_REGULAR, 1.2) self.sochi = ControlPoint.from_airport(caucasus.Sochi_Adler, COAST_DR_E, SIZE_BIG, IMPORTANCE_HIGH) self.carrier_1 = ControlPoint.carrier( "Carrier", mapping.Point(-285810.6875, 496399.1875)) self.add_controlpoint(self.kutaisi, connected_to=[self.senaki]) self.add_controlpoint( self.senaki, connected_to=[self.kobuleti, self.sukhumi, self.kutaisi]) self.add_controlpoint(self.kobuleti, connected_to=[self.senaki]) self.add_controlpoint(self.sukhumi, connected_to=[self.gudauta, self.senaki]) self.add_controlpoint(self.gudauta, connected_to=[self.sochi, self.sukhumi]) self.add_controlpoint(self.sochi, connected_to=[self.gudauta]) self.add_controlpoint(self.carrier_1) self.carrier_1.captured = True self.sochi.captured = True
def __init__(self): self.alt = 0 self.type = "" self.name = String() self.position = mapping.Point(0, 0) self.speed = 0 self.formation_template = "" self.action = PointAction.None_ # type: PointAction
def add_nav_target_point(self, pos: mapping.Point, text_comment: str): nt = NavTargetPoint() nt.position = mapping.Point(pos.x, pos.y) nt.text_comment = text_comment nt.index = len(self.nav_target_points) + 1 self.nav_target_points.append(nt) return nt
def update_unit_route(self, unit_id, points): group = self.lookup_unit(unit_id) if group is None: raise ValueError(f"no group found with id {unit_id}") for point, new_pos in zip(group.points, points): lat = float(new_pos['lat']) lon = float(new_pos['lon']) x, z = lat_lon_to_xz(lat, lon) point.position = mapping.Point(x, z)
def __init__(self): self.alt = 0 self.type = "" self.name: str = "" self.position = mapping.Point(0, 0) self.speed = 0 self.formation_template = "" self.action = PointAction.None_ # type: PointAction self.landing_refuel_rearm_time: Optional[str] = None
def load_from_dict(self, data): self.current_zone_id = 0 self._zones = [] for x in data["zones"]: imp_zone = data["zones"][x] tz = TriggerZone(imp_zone["zoneId"], mapping.Point(imp_zone["x"], imp_zone["y"]), imp_zone["radius"], imp_zone["hidden"], imp_zone["name"]) tz.color = imp_zone["color"] self._zones.append(tz) self.current_zone_id = max(self.current_zone_id, tz.id)
def add_waypoint(self, pos: mapping.Point, altitude, speed=600, name: String=None) -> MovingPoint: mp = MovingPoint() mp.type = "Turning Point" mp.action = PointAction.TurningPoint mp.name = name if name else String() mp.position = mapping.Point(pos.x, pos.y) mp.alt = altitude mp.speed = speed / 3.6 mp.ETA_locked = False mp.properties = PointProperties() self.add_point(mp) return mp
def load_from_dict(self, data: Dict[str, Any]) -> None: self.current_zone_id = 0 self._zones = [] for x in data["zones"]: imp_zone = data["zones"][x] tz = TriggerZone( imp_zone["zoneId"], mapping.Point(imp_zone["x"], imp_zone["y"], self._terrain), imp_zone["radius"], imp_zone["hidden"], imp_zone["name"], imp_zone["color"], imp_zone.get("properties", {})) self._zones.append(tz) self.current_zone_id = max(self.current_zone_id, tz.id)
def __init__(self, _id, terrain: Terrain, name: Optional[str] = None, type="") -> None: if type == "": breakpoint() self.type = type self._terrain = terrain self.position = mapping.Point(0, 0, self._terrain) self.heading = 0.0 self.id = _id self.skill: Optional[Skill] = Skill.Average self.name: str = name if name else "" self.livery_id: Optional[str] = None
def random_unit_zone(self) -> mapping.Rectangle: if self.unit_zones: return self.unit_zones[random.randrange(0, len(self.unit_zones))] return mapping.Rectangle.from_point( mapping.Point(self.position.x + 500, self.position.y), 200)
def load_from_dict(self, d): self.position = mapping.Point(d["centerX"], d["centerY"]) self.zoom = d["zoom"]
class CaucasusTheater(ConflictTheater): terrain = caucasus.Caucasus() overview_image = "caumap.gif" reference_points = { (-317948.32727306, 635639.37385346): (278.5 * 4, 319 * 4), (-355692.3067714, 617269.96285781): (263 * 4, 352 * 4), } landmap = load_landmap("resources\\caulandmap.p") daytime_map = { "dawn": (6, 9), "day": (9, 18), "dusk": (18, 20), "night": (0, 5), } soganlug = ControlPoint.from_airport(caucasus.Soganlug, LAND, SIZE_SMALL, IMPORTANCE_LOW) kutaisi = ControlPoint.from_airport(caucasus.Kutaisi, LAND, SIZE_SMALL, IMPORTANCE_LOW) senaki = ControlPoint.from_airport(caucasus.Senaki_Kolkhi, LAND, SIZE_REGULAR, IMPORTANCE_LOW) kobuleti = ControlPoint.from_airport(caucasus.Kobuleti, COAST_A_E, SIZE_SMALL, 1.1) batumi = ControlPoint.from_airport(caucasus.Batumi, COAST_DL_E, SIZE_SMALL, 1.3) sukhumi = ControlPoint.from_airport(caucasus.Sukhumi_Babushara, COAST_DR_E, SIZE_REGULAR, 1.2) gudauta = ControlPoint.from_airport(caucasus.Gudauta, COAST_DR_E, SIZE_REGULAR, 1.2) sochi = ControlPoint.from_airport(caucasus.Sochi_Adler, COAST_DR_E, SIZE_BIG, IMPORTANCE_HIGH) gelendzhik = ControlPoint.from_airport(caucasus.Gelendzhik, COAST_DR_E, SIZE_BIG, 1.1) maykop = ControlPoint.from_airport(caucasus.Maykop_Khanskaya, LAND, SIZE_LARGE, IMPORTANCE_HIGH) krasnodar = ControlPoint.from_airport(caucasus.Krasnodar_Center, LAND, SIZE_LARGE, IMPORTANCE_HIGH) krymsk = ControlPoint.from_airport(caucasus.Krymsk, LAND, SIZE_LARGE, 1.2) anapa = ControlPoint.from_airport(caucasus.Anapa_Vityazevo, LAND, SIZE_LARGE, IMPORTANCE_HIGH) beslan = ControlPoint.from_airport(caucasus.Beslan, LAND, SIZE_REGULAR, IMPORTANCE_LOW) nalchik = ControlPoint.from_airport(caucasus.Nalchik, LAND, SIZE_REGULAR, 1.1) mineralnye = ControlPoint.from_airport(caucasus.Mineralnye_Vody, LAND, SIZE_BIG, 1.3) mozdok = ControlPoint.from_airport(caucasus.Mozdok, LAND, SIZE_BIG, 1.1) carrier_1 = ControlPoint.carrier("Carrier", mapping.Point(-305810.6875, 406399.1875)) def __init__(self, load_ground_objects=True): super(CaucasusTheater, self).__init__() self.soganlug.frontline_offset = 0.5 self.soganlug.base.strength = 1 self.add_controlpoint(self.soganlug, connected_to=[self.kutaisi, self.beslan]) self.add_controlpoint( self.beslan, connected_to=[self.soganlug, self.mozdok, self.nalchik]) self.add_controlpoint( self.nalchik, connected_to=[self.beslan, self.mozdok, self.mineralnye]) self.add_controlpoint( self.mozdok, connected_to=[self.nalchik, self.beslan, self.mineralnye]) self.add_controlpoint( self.mineralnye, connected_to=[self.nalchik, self.mozdok, self.maykop]) self.add_controlpoint(self.maykop, connected_to=[self.mineralnye, self.krasnodar]) self.add_controlpoint(self.kutaisi, connected_to=[self.soganlug, self.senaki]) self.add_controlpoint( self.senaki, connected_to=[self.kobuleti, self.sukhumi, self.kutaisi]) self.add_controlpoint(self.kobuleti, connected_to=[self.batumi, self.senaki]) self.add_controlpoint(self.batumi, connected_to=[self.kobuleti]) self.add_controlpoint(self.sukhumi, connected_to=[self.gudauta, self.senaki]) self.add_controlpoint(self.gudauta, connected_to=[self.sochi, self.sukhumi]) self.add_controlpoint(self.sochi, connected_to=[self.gudauta, self.gelendzhik]) self.add_controlpoint(self.gelendzhik, connected_to=[ self.sochi, ]) self.add_controlpoint(self.krymsk, connected_to=[self.anapa, self.krasnodar]) self.add_controlpoint(self.anapa, connected_to=[self.krymsk]) self.add_controlpoint(self.krasnodar, connected_to=[self.krymsk, self.maykop]) self.add_controlpoint(self.carrier_1) self.carrier_1.captured = True self.soganlug.captured = True def add_controlpoint(self, point: ControlPoint, connected_to: typing.Collection[ControlPoint] = []): point.name = " ".join(re.split(r"[ -]", point.name)[:1]) super(CaucasusTheater, self).add_controlpoint(point, connected_to=connected_to)
def __init__(self, load_ground_objects=True): super(CaucasusTheater, self).__init__() self.vaziani = ControlPoint.from_airport(caucasus.Vaziani, LAND, SIZE_SMALL, IMPORTANCE_LOW) self.kutaisi = ControlPoint.from_airport(caucasus.Kutaisi, LAND, SIZE_SMALL, IMPORTANCE_LOW) self.senaki = ControlPoint.from_airport(caucasus.Senaki_Kolkhi, LAND, SIZE_REGULAR, IMPORTANCE_LOW) self.kobuleti = ControlPoint.from_airport(caucasus.Kobuleti, COAST_A_E, SIZE_SMALL, 1.1) self.batumi = ControlPoint.from_airport(caucasus.Batumi, COAST_DL_E, SIZE_SMALL, 1.3) self.sukhumi = ControlPoint.from_airport(caucasus.Sukhumi_Babushara, COAST_DR_E, SIZE_REGULAR, 1.2) self.gudauta = ControlPoint.from_airport(caucasus.Gudauta, COAST_DR_E, SIZE_REGULAR, 1.2) self.sochi = ControlPoint.from_airport(caucasus.Sochi_Adler, COAST_DR_E, SIZE_BIG, IMPORTANCE_HIGH) self.gelendzhik = ControlPoint.from_airport(caucasus.Gelendzhik, COAST_DR_E, SIZE_BIG, 1.1) self.maykop = ControlPoint.from_airport(caucasus.Maykop_Khanskaya, LAND, SIZE_LARGE, IMPORTANCE_HIGH) self.krasnodar = ControlPoint.from_airport(caucasus.Krasnodar_Center, LAND, SIZE_LARGE, IMPORTANCE_HIGH) self.krymsk = ControlPoint.from_airport(caucasus.Krymsk, LAND, SIZE_LARGE, 1.2) self.anapa = ControlPoint.from_airport(caucasus.Anapa_Vityazevo, LAND, SIZE_LARGE, IMPORTANCE_HIGH) self.beslan = ControlPoint.from_airport(caucasus.Beslan, LAND, SIZE_REGULAR, IMPORTANCE_LOW) self.nalchik = ControlPoint.from_airport(caucasus.Nalchik, LAND, SIZE_REGULAR, 1.1) self.mineralnye = ControlPoint.from_airport(caucasus.Mineralnye_Vody, LAND, SIZE_BIG, 1.3) self.mozdok = ControlPoint.from_airport(caucasus.Mozdok, LAND, SIZE_BIG, 1.1) self.carrier_1 = ControlPoint.carrier( "Carrier", mapping.Point(-305810.6875, 406399.1875), 1001) self.lha = ControlPoint.lha("Tarawa", mapping.Point(-326050.6875, 519452.1875), 1002) self.vaziani.frontline_offset = 0.5 self.vaziani.base.strength = 1 self.add_controlpoint(self.vaziani, connected_to=[self.kutaisi, self.beslan]) self.add_controlpoint( self.beslan, connected_to=[self.vaziani, self.mozdok, self.nalchik]) self.add_controlpoint( self.nalchik, connected_to=[self.beslan, self.mozdok, self.mineralnye]) self.add_controlpoint( self.mozdok, connected_to=[self.nalchik, self.beslan, self.mineralnye]) self.add_controlpoint( self.mineralnye, connected_to=[self.nalchik, self.mozdok, self.maykop]) self.add_controlpoint(self.maykop, connected_to=[self.mineralnye, self.krasnodar]) self.add_controlpoint(self.kutaisi, connected_to=[self.vaziani, self.senaki]) self.add_controlpoint( self.senaki, connected_to=[self.kobuleti, self.sukhumi, self.kutaisi]) self.add_controlpoint(self.kobuleti, connected_to=[self.batumi, self.senaki]) self.add_controlpoint(self.batumi, connected_to=[self.kobuleti]) self.add_controlpoint(self.sukhumi, connected_to=[self.gudauta, self.senaki]) self.add_controlpoint(self.gudauta, connected_to=[self.sochi, self.sukhumi]) self.add_controlpoint(self.sochi, connected_to=[self.gudauta, self.gelendzhik]) self.add_controlpoint(self.gelendzhik, connected_to=[self.sochi, self.krymsk]) self.add_controlpoint( self.krymsk, connected_to=[self.anapa, self.krasnodar, self.gelendzhik]) self.add_controlpoint(self.anapa, connected_to=[self.krymsk]) self.add_controlpoint(self.krasnodar, connected_to=[self.krymsk, self.maykop]) self.add_controlpoint(self.carrier_1) self.add_controlpoint(self.lha) self.carrier_1.captured = True self.carrier_1.captured_invert = True self.lha.captured = True self.lha.captured_invert = True self.batumi.captured = True self.anapa.captured_invert = True
def load_from_dict(self, d): self.position = mapping.Point(d["x"], d["y"]) self.heading = math.degrees(d["heading"]) self.skill = Skill(d.get("skill")) if d.get("skill") else None
def _convert_point(terrain, p): lat = float(p['lat']) lon = float(p['lon']) x, z = lat_lon_to_xz(terrain.name, lat, lon) return mapping.Point(x, z)
def __init__(self): self.position = mapping.Point(0, 0) self.text_comment = "" self.index = 0
def create_from_dict(cls, d): t = cls() t.position = mapping.Point(d["x"], d["y"]) t.text_comment = d["text_comment"] t.index = d["index"] return t
def create_from_dict(cls, d: Dict[str, Any], terrain: Terrain) -> NavTargetPoint: t = cls(mapping.Point(d["x"], d["y"], terrain)) t.text_comment = d["text_comment"] t.index = d["index"] return t
class NorthCaucasus(ConflictTheater): terrain = caucasus.Caucasus() overview_image = "caumap.gif" reference_points = { (-317948.32727306, 635639.37385346): (278.5 * 4, 319 * 4), (-355692.3067714, 617269.96285781): (263 * 4, 352 * 4), } landmap = load_landmap("resources\\caulandmap.p") daytime_map = { "dawn": (6, 9), "day": (9, 18), "dusk": (18, 20), "night": (0, 5), } carrier_1 = ControlPoint.carrier("Carrier", mapping.Point(-305810.6875, 406399.1875)) def __init__(self, load_ground_objects=True): super(NorthCaucasus, self).__init__() self.kutaisi = ControlPoint.from_airport(caucasus.Kutaisi, LAND, SIZE_SMALL, IMPORTANCE_LOW) self.vaziani = ControlPoint.from_airport(caucasus.Vaziani, LAND, SIZE_SMALL, IMPORTANCE_LOW) self.maykop = ControlPoint.from_airport(caucasus.Maykop_Khanskaya, LAND, SIZE_LARGE, IMPORTANCE_HIGH) self.beslan = ControlPoint.from_airport(caucasus.Beslan, LAND, SIZE_REGULAR, IMPORTANCE_LOW) self.nalchik = ControlPoint.from_airport(caucasus.Nalchik, LAND, SIZE_REGULAR, 1.1) self.mineralnye = ControlPoint.from_airport(caucasus.Mineralnye_Vody, LAND, SIZE_BIG, 1.3) self.mozdok = ControlPoint.from_airport(caucasus.Mozdok, LAND, SIZE_BIG, 1.1) self.carrier_1 = ControlPoint.carrier( "Carrier", mapping.Point(-285810.6875, 496399.1875)) self.vaziani.frontline_offset = 0.5 self.vaziani.base.strength = 1 self.add_controlpoint(self.kutaisi, connected_to=[self.vaziani]) self.add_controlpoint(self.vaziani, connected_to=[self.beslan, self.kutaisi]) self.add_controlpoint( self.beslan, connected_to=[self.vaziani, self.mozdok, self.nalchik]) self.add_controlpoint( self.nalchik, connected_to=[self.beslan, self.mozdok, self.mineralnye]) self.add_controlpoint( self.mozdok, connected_to=[self.nalchik, self.beslan, self.mineralnye]) self.add_controlpoint( self.mineralnye, connected_to=[self.nalchik, self.mozdok, self.maykop]) self.add_controlpoint(self.maykop, connected_to=[self.mineralnye]) self.add_controlpoint(self.carrier_1, connected_to=[]) self.carrier_1.captured = True self.vaziani.captured = True self.kutaisi.captured = True
def load_from_dict(self, d: Dict[str, Any]) -> None: self.position = mapping.Point(d["x"], d["y"], self._terrain) self.heading = math.degrees(d["heading"]) self.skill = Skill(d.get("skill")) if d.get("skill") else None self.livery_id = d.get("livery_id")