pub enum TerrainResource {
Grass,
Flower,
Fruit,
Vegetable,
Mushroom,
Loot,
Plant,
Stone,
Wood,
Gem,
Ore,
}
Expand description
Abstractly represents categories of resources that might naturally appear in the world as a product of world generation.
Representing resources abstractly in this way allows us to decouple rtsim
from the rest of the game so that we don’t have to include things like
[common::terrain::BlockKind
] or [common::terrain::SpriteKind
] in rtsim’s
persistence data model (which would require non-trivial migration work if
those enums and their attributes change over time).
Terrain resources are usually tracked per-chunk, but this is not always true. For example, a site might contain farm fields, and those fields might track their resources independently of the chunks they appear in at some future stage of development.
You can determine the rtsim resource represented by a block with
[common::terrain::Block::get_rtsim_resource
].
Going in the other direction is necessarily a stochastic endeavour. For
example, both SpriteKind::Diamond
and SpriteKind::Amethyst
currently map
to TerrainResource::Gem
, which is a lossy conversion: to go back the other
way, we have to pick one or the other with some probability. It might be
desirable to weight this probability according to the commonly accepted
scarcity/value of the item to avoid balancing issues.
If you want to track inventory items with rtsim, see ItemResource
.
Variants§
Trait Implementations§
Source§impl Clone for TerrainResource
impl Clone for TerrainResource
Source§fn clone(&self) -> TerrainResource
fn clone(&self) -> TerrainResource
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for TerrainResource
impl Debug for TerrainResource
Source§impl<'de> Deserialize<'de> for TerrainResource
impl<'de> Deserialize<'de> for TerrainResource
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 Enum for TerrainResource
impl Enum for TerrainResource
Source§impl<V> EnumArray<V> for TerrainResource
impl<V> EnumArray<V> for TerrainResource
Source§impl PartialEq for TerrainResource
impl PartialEq for TerrainResource
Source§impl Serialize for TerrainResource
impl Serialize for TerrainResource
impl Copy for TerrainResource
impl Eq for TerrainResource
impl StructuralPartialEq for TerrainResource
Auto Trait Implementations§
impl Freeze for TerrainResource
impl RefUnwindSafe for TerrainResource
impl Send for TerrainResource
impl Sync for TerrainResource
impl Unpin for TerrainResource
impl UnwindSafe for TerrainResource
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<C, M> ConvertSaveload<M> for C
impl<C, M> ConvertSaveload<M> for C
§type Error = Infallible
type Error = Infallible
§fn convert_into<F>(
&self,
_: F,
) -> Result<<C as ConvertSaveload<M>>::Data, <C as ConvertSaveload<M>>::Error>
fn convert_into<F>( &self, _: F, ) -> Result<<C as ConvertSaveload<M>>::Data, <C as ConvertSaveload<M>>::Error>
Data
) using
entity to marker mapping function§fn convert_from<F>(
data: <C as ConvertSaveload<M>>::Data,
_: F,
) -> Result<C, <C as ConvertSaveload<M>>::Error>
fn convert_from<F>( data: <C as ConvertSaveload<M>>::Data, _: F, ) -> Result<C, <C as ConvertSaveload<M>>::Error>
Data
) using
entity to marker mapping function§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§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 more