pub struct Spawn { /* private fields */ }Expand description
Defines the initial state of a Character that is being created or moved into a Space.
TODO: This is lacking a full set of accessor methods to be viewable+editable.
§Serialization stability warning
This type implements serde::Serialize and serde::Deserialize, but serialization
support is still experimental (as is the game data model in general). We do not guarantee that future versions of all-is-cubes
will be able to deserialize data which is serialized by this version.
Additionally, the serialization schema is designed with serde_json in mind. It is not
guaranteed that using a different data format crate, which may use a different subset of
the information exposed via serde::Serialize, will produce stable results.
Implementations§
Source§impl Spawn
impl Spawn
Sourcepub fn default_for_new_space(bounds: GridAab) -> Self
pub fn default_for_new_space(bounds: GridAab) -> Self
Create the default Spawn configuration for a Space.
TODO: There is no good default, really: we don’t know if it is better to be outside the space looking in or to be within it at some particular position. Come up with some kind of hint that we can use to configure this better without necessarily mandating a specification.
Sourcepub fn set_eye_position(&mut self, position: impl Into<FreePoint>)
pub fn set_eye_position(&mut self, position: impl Into<FreePoint>)
Sets the position at which the character will appear, in terms of its viewpoint.
Sourcepub fn set_bounds(&mut self, bounds: GridAab)
pub fn set_bounds(&mut self, bounds: GridAab)
Sets the bounds within which the character may be placed is allowed.
Sourcepub fn set_look_direction(&mut self, direction: impl Into<FreeVector>)
pub fn set_look_direction(&mut self, direction: impl Into<FreeVector>)
Sets the direction the character should be facing, or looking at.
The results are unspecified but harmless if the direction is zero or NaN.
Sourcepub fn set_inventory(&mut self, inventory: Vec<Slot>)
pub fn set_inventory(&mut self, inventory: Vec<Slot>)
Sets the starting inventory items.
Trait Implementations§
Source§impl<'arbitrary> Arbitrary<'arbitrary> for Spawn
impl<'arbitrary> Arbitrary<'arbitrary> for Spawn
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§impl<'de> Deserialize<'de> for Spawn
Available on crate feature save only.
impl<'de> Deserialize<'de> for Spawn
save only.Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl VisitHandles for Spawn
impl VisitHandles for Spawn
Source§fn visit_handles(&self, visitor: &mut dyn HandleVisitor)
fn visit_handles(&self, visitor: &mut dyn HandleVisitor)
impl Eq for Spawn
impl StructuralPartialEq for Spawn
Auto Trait Implementations§
impl Freeze for Spawn
impl RefUnwindSafe for Spawn
impl Send for Spawn
impl Sync for Spawn
impl Unpin for Spawn
impl UnwindSafe for Spawn
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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 more