mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Add is_recycling field to recipe book
This commit is contained in:
parent
123b2814cf
commit
12243bd0c0
File diff suppressed because it is too large
Load Diff
@ -229,6 +229,7 @@ fn make_recipe_def(identifier: String, toolkind: ToolKind) -> RawRecipe {
|
||||
output,
|
||||
inputs,
|
||||
craft_sprite: None,
|
||||
is_recycling: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ pub struct Recipe {
|
||||
pub output: (Arc<ItemDef>, u32),
|
||||
pub inputs: Vec<(RecipeInput, u32)>,
|
||||
pub craft_sprite: Option<SpriteKind>,
|
||||
pub is_recycling: bool,
|
||||
}
|
||||
|
||||
#[allow(clippy::type_complexity)]
|
||||
@ -93,8 +94,8 @@ pub enum RawRecipeInput {
|
||||
pub(crate) struct RawRecipe {
|
||||
pub(crate) output: (String, u32),
|
||||
pub(crate) inputs: Vec<(RawRecipeInput, u32)>,
|
||||
#[serde(default)]
|
||||
pub(crate) craft_sprite: Option<SpriteKind>,
|
||||
pub(crate) is_recycling: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize)]
|
||||
@ -112,11 +113,13 @@ impl assets::Compound for RecipeBook {
|
||||
cache: &assets::AssetCache<S>,
|
||||
specifier: &str,
|
||||
) -> Result<Self, assets::Error> {
|
||||
|
||||
#[inline]
|
||||
fn load_item_def(spec: &(String, u32)) -> Result<(Arc<ItemDef>, u32), assets::Error> {
|
||||
let def = Arc::<ItemDef>::load_cloned(&spec.0)?;
|
||||
Ok((def, spec.1))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn load_recipe_input(
|
||||
spec: &(RawRecipeInput, u32),
|
||||
@ -149,6 +152,7 @@ impl assets::Compound for RecipeBook {
|
||||
output,
|
||||
inputs,
|
||||
craft_sprite,
|
||||
is_recycling,
|
||||
},
|
||||
)| {
|
||||
let inputs = inputs
|
||||
@ -160,6 +164,7 @@ impl assets::Compound for RecipeBook {
|
||||
output,
|
||||
inputs,
|
||||
craft_sprite: *craft_sprite,
|
||||
is_recycling: *is_recycling,
|
||||
}))
|
||||
},
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user