def from_data(cls, data: dict[str, Any]) -> PatrolConfig: altitude = data.get("altitude", None) speed = data.get("speed", None) return PatrolConfig( feet(altitude) if altitude is not None else None, knots(speed) if speed is not None else None, )
def steam_into_wind(self, group: ShipGroup) -> Optional[int]: wind = self.game.conditions.weather.wind.at_0m brc = wind.direction + 180 # Aim for 25kts over the deck. carrier_speed = knots(25) - mps(wind.speed) for attempt in range(5): point = group.points[0].position.point_from_heading( brc, 100000 - attempt * 20000) if self.game.theater.is_in_sea(point): group.points[0].speed = carrier_speed.meters_per_second group.add_waypoint(point, carrier_speed.kph) return brc return None
def generate_cargo_ship(self, ship: CargoShip) -> ShipGroup: country = self.mission.country( self.game.coalition_for(ship.player_owned).country_name) waypoints = ship.route group = self.mission.ship_group( country, ship.name, HandyWind, position=waypoints[0], group_size=1, ) for waypoint in waypoints[1:]: # 12 knots is very slow but it's also nearly the max allowed by DCS for this # type of ship. group.add_waypoint(waypoint, speed=knots(12).kph) self.unit_map.add_cargo_ship(group, ship) return group
def patrol_speed(self) -> Speed: altitude = self.layout.patrol_start.alt if self.flight.unit_type.preferred_patrol_speed(altitude) is not None: return self.flight.unit_type.preferred_patrol_speed(altitude) return knots(390)
def patrol_speed(self) -> Speed: # TODO: Could use self.flight.unit_type.preferred_patrol_speed(altitude). if self.flight.unit_type.patrol_speed is not None: return self.flight.unit_type.patrol_speed # ~280 knots IAS at 21000. return knots(400)