def _import_moving_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 = MovingPoint() point.load_from_dict(imp_point, mission.translation) group.add_point(point) return group
def add_runway_waypoint( self, airport: Airport, runway: Optional[Runway] = None, distance=random.randrange(6000, 8000, 100) ) -> MovingPoint: """Adds a waypoint parallel to the given runway heading, for start or approach. :param airport: start airport object :param runway: runway for heading direction, if None first(default) airport runway will be used. :param distance: distance of the waypoint from the airport :return: MovePoint object describing the waypoint """ runway = runway if runway else airport.runways[0] mp = MovingPoint() mp.type = "Turning Point" mp.action = PointAction.TurningPoint mp.alt_type = "RADIO" mp.position = airport.position.point_from_heading( runway.heading, distance) mp.alt = 300 mp.speed = 200 / 3.6 mp.ETA_locked = False mp.properties = PointProperties() self.add_point(mp) return mp
def add_waypoint(self, position: mapping.Point, speed=20) -> MovingPoint: mp = MovingPoint(position) mp.type = "Turning Point" mp.action = PointAction.TurningPoint mp.speed = speed / 3.6 mp.ETA_locked = False self.add_point(mp) return mp
def _import_moving_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 = MovingPoint(Point(0, 0, mission.terrain)) point.load_from_dict(imp_point, mission.translation) group.add_point(point) return group
def add_waypoint(self, position: mapping.Point, move_formation: PointAction=PointAction.OffRoad, speed=32) -> MovingPoint: mp = MovingPoint() mp.type = "Turning Point" mp.action = move_formation mp.position = copy.copy(position) mp.speed = speed / 3.6 mp.ETA_locked = False self.add_point(mp) return mp
def land_at(self, airport: Airport) -> MovingPoint: mp = MovingPoint(airport.position) mp.type = "Land" mp.action = PointAction.Landing mp.airdrome_id = airport.id mp.alt = 0 mp.speed = 0 mp.ETA_locked = False mp.properties = PointProperties() self.add_point(mp) return mp
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