pub struct Recipe {
pub id: String,
pub name: String,
pub category: RecipeCategory,
pub ingredients: Vec<Ingredient>,
pub results: Vec<CraftResult>,
pub required_level: u32,
pub required_tools: Vec<String>,
pub duration_secs: f32,
pub experience_reward: u32,
pub discovery_chance: f32,
}Expand description
A complete crafting recipe.
Fields§
§id: String§name: String§category: RecipeCategory§ingredients: Vec<Ingredient>§results: Vec<CraftResult>§required_level: u32Minimum crafting skill level required.
required_tools: Vec<String>Tool item IDs required to be at the workbench.
duration_secs: f32Base crafting time in seconds.
experience_reward: u32Experience awarded on completion.
discovery_chance: f32Probability (0.0–1.0) that the player learns this recipe upon discovery attempt.
Implementations§
Source§impl Recipe
impl Recipe
pub fn new( id: impl Into<String>, name: impl Into<String>, category: RecipeCategory, ) -> Self
pub fn with_ingredient(self, ing: Ingredient) -> Self
pub fn with_result(self, res: CraftResult) -> Self
pub fn with_level(self, level: u32) -> Self
pub fn with_tool(self, tool: impl Into<String>) -> Self
pub fn with_duration(self, secs: f32) -> Self
pub fn with_experience(self, xp: u32) -> Self
pub fn with_discovery_chance(self, chance: f32) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Recipe
impl RefUnwindSafe for Recipe
impl Send for Recipe
impl Sync for Recipe
impl Unpin for Recipe
impl UnsafeUnpin for Recipe
impl UnwindSafe for Recipe
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.