pub struct Airships {
pub airship_docks: Vec<AirshipDockPositions>,
pub routes: Vec<AirshipRoute>,
pub nominal_speed: f32,
}Expand description
Data for airship operations. This is generated world data.
Fields§
§airship_docks: Vec<AirshipDockPositions>The docking positions for all airship docks in the world.
routes: Vec<AirshipRoute>The routes flown by the collective airships in the world.
nominal_speed: f32The speed of simulated airships (and the nominal speed of loaded airships) in world blocks per second.
Implementations§
Source§impl Airships
impl Airships
Sourcepub const AIRSHIP_ASCENT_DURATION: f64 = 30f64
pub const AIRSHIP_ASCENT_DURATION: f64 = 30f64
The duration of the ascent flight phase.
Sourcepub const AIRSHIP_DESCENT_DURATION: f64 = 30f64
pub const AIRSHIP_DESCENT_DURATION: f64 = 30f64
The duration of the descent flight phase.
Sourcepub const AIRSHIP_DOCKING_DURATION: f64 = 60f64
pub const AIRSHIP_DOCKING_DURATION: f64 = 60f64
The duration of the docked phase.
Sourcepub const AIRSHIP_TIME_SPACING: f64 = 240f64
pub const AIRSHIP_TIME_SPACING: f64 = 240f64
The time spacing between airships on the same route.
Sourceconst AIRSHIP_TO_DOCK_Z_OFFSET: f32 = -3f32
const AIRSHIP_TO_DOCK_Z_OFFSET: f32 = -3f32
The Z offset between the docking alignment point and the AirshipDock plot docking position.
Sourcepub const AIRSHIP_TRANSITION_SPEED_RATIO: f32 = 0.75f32
pub const AIRSHIP_TRANSITION_SPEED_RATIO: f32 = 0.75f32
The ratio of the speed used when transitioning from cruising to docking as a percentage of the nominal airship speed.
Sourcepub const CRUISE_HEIGHTS: [f32; 4]
pub const CRUISE_HEIGHTS: [f32; 4]
The cruising height varies by route index and there can be only four routes.
Sourceconst DOCKING_TRANSITION_OFFSET: f32 = 175f32
const DOCKING_TRANSITION_OFFSET: f32 = 175f32
The distance from the docking position where the airship starts the transition flight phase.
Sourceconst DOCK_ALIGN_POS_PORT: Vec2<f32>
const DOCK_ALIGN_POS_PORT: Vec2<f32>
The vector from the dock alignment point when the airship is docked on the port side.
Sourceconst DOCK_ALIGN_POS_STARBOARD: Vec2<f32>
const DOCK_ALIGN_POS_STARBOARD: Vec2<f32>
The vector from the dock alignment point on the airship when the airship is docked on the starboard side.
Sourceconst DOCK_ALIGN_X: f32 = 18f32
const DOCK_ALIGN_X: f32 = 18f32
The absolute offset from the airship’s position to the docking alignment point on the X axis. The airship is assumed to be facing positive Y.
Sourceconst DOCK_ALIGN_Y: f32 = 1f32
const DOCK_ALIGN_Y: f32 = 1f32
The offset from the airship’s position to the docking alignment point on the Y axis. The airship is assumed to be facing positive Y. This is positive if the docking alignment point is in front of the airship’s center position.
Sourceconst ROUTE_LEG_MIDPOINT_MARGIN: f32 = 200f32
const ROUTE_LEG_MIDPOINT_MARGIN: f32 = 200f32
The minimum distance from the route leg midpoint to the world boundaries.
Sourceconst ROUTE_LEG_MIDPOINT_OFFSET_RADIANS: f32 = 0.0872659981f32
const ROUTE_LEG_MIDPOINT_OFFSET_RADIANS: f32 = 0.0872659981f32
The angle for calculating the route leg midpoint.
pub fn docking_duration() -> f32
Sourcefn all_airshipdock_positions(sites: &Store<Site>) -> Vec<AirshipDockPositions>
fn all_airshipdock_positions(sites: &Store<Site>) -> Vec<AirshipDockPositions>
Get all the airship docking positions from the world sites.
Sourcepub fn increment_route_leg(&self, route_index: usize, leg_index: usize) -> usize
pub fn increment_route_leg(&self, route_index: usize, leg_index: usize) -> usize
Convienence function that returns the next route leg accounting for wrap around.
Sourcepub fn decrement_route_leg(&self, route_index: usize, leg_index: usize) -> usize
pub fn decrement_route_leg(&self, route_index: usize, leg_index: usize) -> usize
Convienence function that returns the previous route leg accounting for wrap around.
Sourcepub fn route_count(&self) -> usize
pub fn route_count(&self) -> usize
Convienence function returning the number of routes.
Sourcepub fn docking_site_count_for_route(&self, route_index: usize) -> usize
pub fn docking_site_count_for_route(&self, route_index: usize) -> usize
Safe function to get the number of AirshipDock sites on a route.
Sourcefn create_route_legs(
&mut self,
route_segments: &[Vec<usize>],
dock_locations: &[Vec2<f32>],
map_size_lg: &MapSizeLg,
) -> Vec<AirshipRoute>
fn create_route_legs( &mut self, route_segments: &[Vec<usize>], dock_locations: &[Vec2<f32>], map_size_lg: &MapSizeLg, ) -> Vec<AirshipRoute>
Calculate the legs for each route. A docking platform is assigned for each leg of each route. Each route in the route_segments argument is a series (Vec) of docking node indices on the docking site graph. This function loops over the routes docking nodes and assigns a docking platform based on the approach direction to each dock node while making sure that no docking platform is used more than once (globally, over all routes). It then calculates the leg segments (flight phases) for each leg of each route. The output is a Vec of up to four routes, each of which is a closed loop of route legs.
pub fn calculate_spawning_locations(&mut self)
Sourcepub fn generate_airship_routes_inner(
&mut self,
map_size_lg: &MapSizeLg,
seed: u32,
_index: Option<&Index>,
_sampler: Option<&WorldSim>,
_map_image_path: Option<&str>,
)
pub fn generate_airship_routes_inner( &mut self, map_size_lg: &MapSizeLg, seed: u32, _index: Option<&Index>, _sampler: Option<&WorldSim>, _map_image_path: Option<&str>, )
Generates the airship routes.
pub fn generate_airship_routes( &mut self, world_sim: &mut WorldSim, index: &Index, )
Sourcepub fn approach_waypoints(
&self,
from_dock_center: &Vec2<f32>,
to_dock_positions: &AirshipDockPositions,
platform: AirshipDockPlatform,
map_size_lg: &MapSizeLg,
) -> (Vec2<f32>, Vec2<f32>)
pub fn approach_waypoints( &self, from_dock_center: &Vec2<f32>, to_dock_positions: &AirshipDockPositions, platform: AirshipDockPlatform, map_size_lg: &MapSizeLg, ) -> (Vec2<f32>, Vec2<f32>)
Compute the route midpoint and the transition point where the airship should stop the cruise flight phase and start the docking phase.
F : From position
M : Midpoint
T : Transition point
D : Docking position
C : Center of the airship dock
X : Airship dock
F
•
•
M
∙
∙
T
∙
∙
D
XXXXX
XX XX
X X
X C X
X X
XX XX
XXXXXThe midpoint is for route leg deconfliction and is where the airship makes a coarse correction to point at the destination. The transition point (T) between cruise flight and docking approach is on a line between the route leg midpoint (M) and the docking position (D), short of the docking position by Airships::DOCKING_TRANSITION_OFFSET blocks.
§Arguments
dock_index- The airship dock index in airship_docks.route_index- The index of the route (outer vector of airships.routes). This is used to determine the cruise height.platform- The platform on the airship dock where the airship is to dock.from- The position from which the airship is approaching the dock.
§Returns
The 2D position calculated with the Z coordinate set to the docking_position.z + cruise height.
fn vec3_relative_eq(a: &Vec3<f32>, b: &Vec3<f32>, epsilon: f32) -> bool
pub fn docking_position_and_dir_for_route_and_leg( from_dock_positions: &AirshipDockPositions, to_dock_positions: &AirshipDockPositions, platform: AirshipDockPlatform, ) -> (Vec3<f32>, Dir)
pub fn approach_for_route_and_leg( &self, route_index: usize, leg_index: usize, map_size_lg: &MapSizeLg, ) -> AirshipDockingApproach
pub fn airship_spawning_locations(&self) -> Vec<AirshipSpawningLocation>
Sourcepub fn route_leg_departure_location(
&self,
route_index: usize,
leg_index: usize,
) -> Vec2<f32>
pub fn route_leg_departure_location( &self, route_index: usize, leg_index: usize, ) -> Vec2<f32>
Get the position a route leg originates from.
Sourcepub fn airship_vec_for_docking_pos(
docking_pos: Vec3<f32>,
airship_dock_center: Vec2<f32>,
docking_side: Option<AirshipDockingSide>,
) -> (Vec3<f32>, Dir)
pub fn airship_vec_for_docking_pos( docking_pos: Vec3<f32>, airship_dock_center: Vec2<f32>, docking_side: Option<AirshipDockingSide>, ) -> (Vec3<f32>, Dir)
Get the position and direction for the airship to dock at the given docking position. If use_starboard_boarding is None, the side for boarding is randomly chosen. The center of the airship position with respect to the docking position is an asymmetrical offset depending on which side of the airship will be used for boarding and where the captain is located on the airship. The returned position is the position where the captain will be when the airship is docked (because the captain NPC is the one that is positioned in the agent or rtsim code).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Airships
impl RefUnwindSafe for Airships
impl Send for Airships
impl Sync for Airships
impl Unpin for Airships
impl UnwindSafe for Airships
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
Source§fn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Source§impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
Source§fn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Source§impl<Context> SubContext<Context> for Context
impl<Context> SubContext<Context> for Context
fn sub_context(self) -> Context
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.§impl<T> TryConv for T
impl<T> TryConv for T
§impl<T> TryDefault for Twhere
T: Default,
impl<T> TryDefault for Twhere
T: Default,
§fn try_default() -> Result<T, String>
fn try_default() -> Result<T, String>
§fn unwrap_default() -> Self
fn unwrap_default() -> Self
try_default and panics on an error case.