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:
File diff suppressed because it is too large
Load Diff
@ -229,6 +229,7 @@ fn make_recipe_def(identifier: String, toolkind: ToolKind) -> RawRecipe {
|
|||||||
output,
|
output,
|
||||||
inputs,
|
inputs,
|
||||||
craft_sprite: None,
|
craft_sprite: None,
|
||||||
|
is_recycling: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ pub struct Recipe {
|
|||||||
pub output: (Arc<ItemDef>, u32),
|
pub output: (Arc<ItemDef>, u32),
|
||||||
pub inputs: Vec<(RecipeInput, u32)>,
|
pub inputs: Vec<(RecipeInput, u32)>,
|
||||||
pub craft_sprite: Option<SpriteKind>,
|
pub craft_sprite: Option<SpriteKind>,
|
||||||
|
pub is_recycling: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::type_complexity)]
|
#[allow(clippy::type_complexity)]
|
||||||
@ -93,8 +94,8 @@ pub enum RawRecipeInput {
|
|||||||
pub(crate) struct RawRecipe {
|
pub(crate) struct RawRecipe {
|
||||||
pub(crate) output: (String, u32),
|
pub(crate) output: (String, u32),
|
||||||
pub(crate) inputs: Vec<(RawRecipeInput, u32)>,
|
pub(crate) inputs: Vec<(RawRecipeInput, u32)>,
|
||||||
#[serde(default)]
|
|
||||||
pub(crate) craft_sprite: Option<SpriteKind>,
|
pub(crate) craft_sprite: Option<SpriteKind>,
|
||||||
|
pub(crate) is_recycling: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Deserialize)]
|
#[derive(Clone, Deserialize)]
|
||||||
@ -112,11 +113,13 @@ impl assets::Compound for RecipeBook {
|
|||||||
cache: &assets::AssetCache<S>,
|
cache: &assets::AssetCache<S>,
|
||||||
specifier: &str,
|
specifier: &str,
|
||||||
) -> Result<Self, assets::Error> {
|
) -> Result<Self, assets::Error> {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn load_item_def(spec: &(String, u32)) -> Result<(Arc<ItemDef>, u32), assets::Error> {
|
fn load_item_def(spec: &(String, u32)) -> Result<(Arc<ItemDef>, u32), assets::Error> {
|
||||||
let def = Arc::<ItemDef>::load_cloned(&spec.0)?;
|
let def = Arc::<ItemDef>::load_cloned(&spec.0)?;
|
||||||
Ok((def, spec.1))
|
Ok((def, spec.1))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn load_recipe_input(
|
fn load_recipe_input(
|
||||||
spec: &(RawRecipeInput, u32),
|
spec: &(RawRecipeInput, u32),
|
||||||
@ -149,6 +152,7 @@ impl assets::Compound for RecipeBook {
|
|||||||
output,
|
output,
|
||||||
inputs,
|
inputs,
|
||||||
craft_sprite,
|
craft_sprite,
|
||||||
|
is_recycling,
|
||||||
},
|
},
|
||||||
)| {
|
)| {
|
||||||
let inputs = inputs
|
let inputs = inputs
|
||||||
@ -160,6 +164,7 @@ impl assets::Compound for RecipeBook {
|
|||||||
output,
|
output,
|
||||||
inputs,
|
inputs,
|
||||||
craft_sprite: *craft_sprite,
|
craft_sprite: *craft_sprite,
|
||||||
|
is_recycling: *is_recycling,
|
||||||
}))
|
}))
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user