pub struct Airships {
pub airship_docks: Vec<AirshipDockPositions>,
pub routes: Vec<Vec<AirshipRouteLeg>>,
pub spawning_locations: Vec<AirshipSpawningLocation>,
}
Expand description
Data for airship operations. This is generated world data.
Fields§
§airship_docks: Vec<AirshipDockPositions>
§routes: Vec<Vec<AirshipRouteLeg>>
§spawning_locations: Vec<AirshipSpawningLocation>
Implementations§
Source§impl Airships
impl Airships
Sourcepub const AIRSHIP_SPACING: f32 = 5000f32
pub const AIRSHIP_SPACING: f32 = 5000f32
The nominal distance between airships when they are first spawned in the world.
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 CRUISE_HEIGHTS: [f32; 4]
pub const CRUISE_HEIGHTS: [f32; 4]
The cruising height varies by route index and there can be only four routes.
const DEFAULT_DOCK_DURATION: f32 = 60f32
const DOCKING_TRANSITION_OFFSET: f32 = 175f32
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 MIN_SPAWN_POINT_DIST_FROM_DOCK: f32 = 300f32
const MIN_SPAWN_POINT_DIST_FROM_DOCK: f32 = 300f32
The minimum distance from the docking position where the airship can be initially placed in the world.
Sourceconst SPAWN_TARGET_DIST_INCREMENT: f32 = 47f32
const SPAWN_TARGET_DIST_INCREMENT: f32 = 47f32
The algorithm that computes where to initially place airships in the world (spawning locations) increments the candidate location of the first airship on each route by this amount. This is just a prime number that is small enough that the AIRSHIP_SPACING is not exceeded by the expected number of iterations required to find a starting spawning point such that all airships are not too close to docking positions when spawned. TODO: check that this still if a larger world map is used.
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 assign_docking_platforms(
route_segments: &[Vec<usize>],
dock_locations: &[Vec2<f32>],
) -> Vec<Vec<AirshipRouteLeg>>
fn assign_docking_platforms( route_segments: &[Vec<usize>], dock_locations: &[Vec2<f32>], ) -> Vec<Vec<AirshipRouteLeg>>
Assign the docking platforms for each leg of each route. Each route consists of 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).
Sourcepub fn calculate_spawning_locations(&mut self, all_dock_points: &[Point])
pub fn calculate_spawning_locations(&mut self, all_dock_points: &[Point])
For each route, calculate the location along the route where airships should be initially located when the server starts. This attempts to space airships evenly along the route while ensuring that no airship is too close to a docking position. Each airship needs separation from the docking position such that the airship can initially move forward towards its target docking location when it first starts flying because it will start in the cruise phase of flight.
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_transition_point(
&self,
dock_index: usize,
route_index: usize,
platform: AirshipDockPlatform,
from: Vec2<f32>,
) -> Option<Vec3<f32>>
pub fn approach_transition_point( &self, dock_index: usize, route_index: usize, platform: AirshipDockPlatform, from: Vec2<f32>, ) -> Option<Vec3<f32>>
Compute the transition point where the airship should stop the cruise flight phase and start the docking phase.
F : From position
T : Transition point
D : Docking position
C : Center of the airship dock
X : Airship dock
F
∙
∙
∙
∙
∙
T
∙
∙
D
XXXXX
XX XX
X X
X C X
X X
XX XX
XXXXX
The transition point between cruise flight and docking is on a line between the route leg starting point (F) 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. I.e., the position of the dock for the previous route leg.
§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 approach_for_route_and_leg( &self, route_index: usize, leg_index: usize, ) -> 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.