pub struct CraftingContext {
pub recipe_book: RecipeBook,
pub mastery: MasterySystem,
pub discovery: RecipeDiscovery,
pub economy: Economy,
pub market: MarketBoard,
}Expand description
A single crafting session context bundling all subsystems.
Fields§
§recipe_book: RecipeBook§mastery: MasterySystem§discovery: RecipeDiscovery§economy: Economy§market: MarketBoardImplementations§
Source§impl CraftingContext
impl CraftingContext
Sourcepub fn tick(&mut self, dt: f32, current_time: f32)
pub fn tick(&mut self, dt: f32, current_time: f32)
Advance all time-dependent systems by dt seconds.
current_time is the absolute game time in seconds.
Sourcepub fn award_crafting_xp(
&mut self,
category: &RecipeCategory,
xp: u32,
) -> Vec<String>
pub fn award_crafting_xp( &mut self, category: &RecipeCategory, xp: u32, ) -> Vec<String>
Award crafting XP in a category and return any newly unlocked recipe IDs.
Sourcepub fn attempt_discovery(
&mut self,
ingredient_ids: &[String],
rng: f32,
) -> Option<String>
pub fn attempt_discovery( &mut self, ingredient_ids: &[String], rng: f32, ) -> Option<String>
Attempt to discover a recipe from a set of ingredient ids.
rng should be a value in [0.0, 1.0).
Sourcepub fn get_recipe(&self, id: &str) -> Option<&Recipe>
pub fn get_recipe(&self, id: &str) -> Option<&Recipe>
Look up a recipe by id.
Sourcepub fn market_price(&self, item_id: &str) -> Option<u64>
pub fn market_price(&self, item_id: &str) -> Option<u64>
Get the current market price for an item (in copper), or None if not tracked.
Sourcepub fn market_currency(&self, item_id: &str) -> Option<Currency>
pub fn market_currency(&self, item_id: &str) -> Option<Currency>
Get the current market price as a Currency value.
Trait Implementations§
Source§impl Clone for CraftingContext
impl Clone for CraftingContext
Source§fn clone(&self) -> CraftingContext
fn clone(&self) -> CraftingContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CraftingContext
impl Debug for CraftingContext
Auto Trait Implementations§
impl Freeze for CraftingContext
impl RefUnwindSafe for CraftingContext
impl Send for CraftingContext
impl Sync for CraftingContext
impl Unpin for CraftingContext
impl UnsafeUnpin for CraftingContext
impl UnwindSafe for CraftingContext
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.