From a1fe7c12c3f6d1363372b819da5c441fccc63cf6 Mon Sep 17 00:00:00 2001 From: Monty Date: Sat, 17 Apr 2021 20:35:48 +0200 Subject: [PATCH] fmt, add sprites --- assets/common/recipe_book.ron | 18 +++++++- .../voxygen/voxel/armor/bonerattler/chest.vox | 2 +- assets/voxygen/voxel/sprite/anvil/anvil-0.vox | 3 ++ .../voxel/sprite/cauldron/cauldron-0.vox | 3 ++ .../crafting_bench/crafting_bench-0.vox | 3 ++ assets/voxygen/voxel/sprite/forge/forge-0.vox | 3 ++ assets/voxygen/voxel/sprite_manifest.ron | 44 +++++++++++++++++++ client/src/lib.rs | 30 ++++++++----- common/src/comp/controller.rs | 10 ++++- common/src/comp/inventory/item/modular.rs | 7 +-- common/src/recipe.rs | 33 +++++++++----- common/src/terrain/sprite.rs | 12 +++++ server/src/events/inventory_manip.rs | 5 ++- voxygen/src/hud/crafting.rs | 33 +++++++++----- voxygen/src/hud/mod.rs | 23 +++++++--- voxygen/src/scene/terrain/watcher.rs | 15 ++++++- voxygen/src/session/mod.rs | 31 ++++++++----- .../settlement/building/archetype/house.rs | 20 ++++----- 18 files changed, 221 insertions(+), 74 deletions(-) create mode 100644 assets/voxygen/voxel/sprite/anvil/anvil-0.vox create mode 100644 assets/voxygen/voxel/sprite/cauldron/cauldron-0.vox create mode 100644 assets/voxygen/voxel/sprite/crafting_bench/crafting_bench-0.vox create mode 100644 assets/voxygen/voxel/sprite/forge/forge-0.vox diff --git a/assets/common/recipe_book.ron b/assets/common/recipe_book.ron index a193e72204..6b584e76b1 100644 --- a/assets/common/recipe_book.ron +++ b/assets/common/recipe_book.ron @@ -5,6 +5,7 @@ (Item("common.items.crafting_ing.twigs"), 6), (Item("common.items.crafting_ing.stones"), 6), ], + craft_sprite: Some(CraftingBench), ), "mortar_pestle": ( output: ("common.items.crafting_tools.mortar_pestle", 1), @@ -28,6 +29,7 @@ (Item("common.items.ore.velorite"), 1), (Item("common.items.crafting_tools.craftsman_hammer"), 0), ], + craft_sprite: Some(Anvil), ), "potion_s": ( output: ("common.items.consumable.potion_minor", 1), @@ -36,6 +38,7 @@ (Item("common.items.food.apple"), 4), (Item("common.items.crafting_ing.honey"), 1), ], + craft_sprite: Some(Cauldron), ), "potion_m": ( output: ("common.items.consumable.potion_med", 1), @@ -43,6 +46,7 @@ (Item("common.items.consumable.potion_minor"), 2), (Item("common.items.ore.veloritefrag"), 4), ], + craft_sprite: Some(Cauldron), ), "collar_basic": ( output: ("common.items.utility.collar", 1), @@ -128,14 +132,14 @@ (Item("common.items.food.apple"), 4), (Item("common.items.crafting_tools.mortar_pestle"), 0), ], + craft_sprite: Some(Cauldron), ), "salad_plain": ( output: ("common.items.food.plainsalad", 1), inputs: [ (Item("common.items.food.lettuce"), 1), (Item("common.items.crafting_ing.bowl"), 1), - ], - craft_sprite: Some(Pot), + ], ), "salad_tomato": ( output: ("common.items.food.tomatosalad", 1), @@ -167,6 +171,7 @@ (Item("common.items.flowers.sunflower"), 4), (Item("common.items.crafting_ing.honey"), 1), ], + craft_sprite: Some(Cauldron), ), "Plain Cloth Glider": ( output: ("common.items.glider.glider_basic_white", 1), @@ -177,6 +182,7 @@ (Item("common.items.crafting_tools.craftsman_hammer"), 0), (Item("common.items.crafting_tools.sewing_set"), 0), ], + craft_sprite: Some(CraftingBench), ), "Red Cloth Glider": ( output: ("common.items.glider.glider_basic_red", 1), @@ -187,6 +193,7 @@ (Item("common.items.crafting_tools.craftsman_hammer"), 0), (Item("common.items.crafting_tools.sewing_set"), 0), ], + craft_sprite: Some(CraftingBench), ), "Leaves Glider": ( output: ("common.items.glider.glider_leaves", 1), @@ -198,6 +205,7 @@ (Item("common.items.crafting_tools.craftsman_hammer"), 0), (Item("common.items.crafting_tools.sewing_set"), 0), ], + craft_sprite: Some(CraftingBench), ), "Sand Raptor Wings": ( output: ("common.items.glider.glider_sandraptor", 1), @@ -210,6 +218,7 @@ (Item("common.items.crafting_tools.craftsman_hammer"), 0), (Item("common.items.crafting_tools.sewing_set"), 0), ], + craft_sprite: Some(CraftingBench), ), "Snow Raptor Wings": ( output: ("common.items.glider.glider_snowraptor", 1), @@ -223,6 +232,7 @@ (Item("common.items.crafting_tools.craftsman_hammer"), 0), (Item("common.items.crafting_tools.sewing_set"), 0), ], + craft_sprite: Some(CraftingBench), ), "Wood Raptor Wings": ( output: ("common.items.glider.glider_woodraptor", 1), @@ -235,6 +245,7 @@ (Item("common.items.crafting_tools.craftsman_hammer"), 0), (Item("common.items.crafting_tools.sewing_set"), 0), ], + craft_sprite: Some(CraftingBench), ), "Soothing Loop": ( output: ("common.items.weapons.sceptre.loops0", 1), @@ -252,6 +263,7 @@ (Item("common.items.crafting_ing.twigs"), 6), (Item("common.items.crafting_ing.stones"), 0), ], + craft_sprite: Some(CraftingBench), ), "Forest Spirit": ( output: ("common.items.weapons.sword.wood-2", 1), @@ -261,6 +273,7 @@ (Item("common.items.ore.veloritefrag"), 1), (Item("common.items.crafting_ing.stones"), 0), ], + craft_sprite: Some(Anvil), ), "adventure back": ( output: ("common.items.armor.agile.back", 1), @@ -384,6 +397,7 @@ (Item("common.items.crafting_ing.twigs"), 4), (Item("common.items.crafting_tools.craftsman_hammer"), 0), ], + craft_sprite: Some(Anvil), ), "cloth_scraps": ( output: ("common.items.crafting_ing.cloth_scraps", 1), diff --git a/assets/voxygen/voxel/armor/bonerattler/chest.vox b/assets/voxygen/voxel/armor/bonerattler/chest.vox index d516e45bd8..5ace1bdfbe 100644 --- a/assets/voxygen/voxel/armor/bonerattler/chest.vox +++ b/assets/voxygen/voxel/armor/bonerattler/chest.vox @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:340ef35d35982e51f1d11bd0990bbf3e512aad52332026ccc138a81205faef54 +oid sha256:f8568714be1928adb9dd82a822e7d4830fe350bad3ac756249b3811d58ce9849 size 2624 diff --git a/assets/voxygen/voxel/sprite/anvil/anvil-0.vox b/assets/voxygen/voxel/sprite/anvil/anvil-0.vox new file mode 100644 index 0000000000..34b464714e --- /dev/null +++ b/assets/voxygen/voxel/sprite/anvil/anvil-0.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7e9e1fb7f109970122a3bccf8d9f66cb03db78843e8749d74a0cfcc8658e4425 +size 4432 diff --git a/assets/voxygen/voxel/sprite/cauldron/cauldron-0.vox b/assets/voxygen/voxel/sprite/cauldron/cauldron-0.vox new file mode 100644 index 0000000000..19a04ae7a9 --- /dev/null +++ b/assets/voxygen/voxel/sprite/cauldron/cauldron-0.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5117a009abb9deae9b224936ba7138122a99cdb706b2f992340c4a608b950caf +size 10696 diff --git a/assets/voxygen/voxel/sprite/crafting_bench/crafting_bench-0.vox b/assets/voxygen/voxel/sprite/crafting_bench/crafting_bench-0.vox new file mode 100644 index 0000000000..6df008ffbe --- /dev/null +++ b/assets/voxygen/voxel/sprite/crafting_bench/crafting_bench-0.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:603b2aaeaae6872caf431e394eb97f92a9b85895238cbde80857c9550f826077 +size 3456 diff --git a/assets/voxygen/voxel/sprite/forge/forge-0.vox b/assets/voxygen/voxel/sprite/forge/forge-0.vox new file mode 100644 index 0000000000..3e8d319c49 --- /dev/null +++ b/assets/voxygen/voxel/sprite/forge/forge-0.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a45de7fed286c5b0011ca741e7c51765ae2d3c3260bb2beeae51b6ea3daa8fa5 +size 44800 diff --git a/assets/voxygen/voxel/sprite_manifest.ron b/assets/voxygen/voxel/sprite_manifest.ron index 1afc97ac66..b4a5c38c4b 100644 --- a/assets/voxygen/voxel/sprite_manifest.ron +++ b/assets/voxygen/voxel/sprite_manifest.ron @@ -2852,4 +2852,48 @@ Lantern: Some(( ], wind_sway: 0.0, )), +// Anvil +Anvil: Some(( + variations: [ + ( + model: "voxygen.voxel.sprite.anvil.anvil-0", + offset: (-5.5, -7.0, 0.0), + lod_axes: (0.0, 0.0, 0.0), + ), + ], + wind_sway: 0.0, +)), +// Cauldron +Cauldron: Some(( + variations: [ + ( + model: "voxygen.voxel.sprite.cauldron.cauldron-0", + offset: (-10.0, -10.0, 0.0), + lod_axes: (0.0, 0.0, 0.0), + ), + ], + wind_sway: 0.0, +)), +// Forge +Forge: Some(( + variations: [ + ( + model: "voxygen.voxel.sprite.forge.forge-0", + offset: (-20.0, -20.0, 0.0), + lod_axes: (0.0, 0.0, 0.0), + ), + ], + wind_sway: 0.0, +)), +// Crafting Bench +CraftingBench: Some(( + variations: [ + ( + model: "voxygen.voxel.sprite.crafting_bench.crafting_bench-0", + offset: (-9.5, -7.0, 0.0), + lod_axes: (0.0, 0.0, 0.0), + ), + ], + wind_sway: 0.0, +)), ) diff --git a/client/src/lib.rs b/client/src/lib.rs index 89a0b26021..805b5b1bda 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -35,8 +35,8 @@ use common::{ recipe::RecipeBook, resources::{DeltaTime, PlayerEntity, TimeOfDay}, terrain::{ - block::Block, map::MapConfig, neighbors, BiomeKind, SitesKind, TerrainChunk, - TerrainChunkSize, SpriteKind, + block::Block, map::MapConfig, neighbors, BiomeKind, SitesKind, SpriteKind, TerrainChunk, + TerrainChunkSize, }, trade::{PendingTrade, SitePrices, TradeAction, TradeId, TradeResult}, uid::{Uid, UidAllocator}, @@ -970,27 +970,37 @@ impl Client { pub fn recipe_book(&self) -> &RecipeBook { &self.recipe_book } - pub fn available_recipes(&self) -> &HashMap> { &self.available_recipes } + pub fn available_recipes(&self) -> &HashMap> { + &self.available_recipes + } pub fn can_craft_recipe(&self, recipe: &str) -> Option> { self.recipe_book .get(recipe) .zip(self.inventories().get(self.entity())) - .map(|(recipe, inv)| if inv.contains_ingredients(&*recipe).is_ok() { - Some(recipe.craft_sprite) - } else { - None + .map(|(recipe, inv)| { + if inv.contains_ingredients(&*recipe).is_ok() { + Some(recipe.craft_sprite) + } else { + None + } }) .unwrap_or(None) } - pub fn craft_recipe(&mut self, recipe: &str, craft_sprite: Option<(Vec3, SpriteKind)>) -> bool { - if self.can_craft_recipe(recipe).map_or(false, |cs| cs.map_or(true, |cs| Some(cs) == craft_sprite.map(|(_, s)| s))) { + pub fn craft_recipe( + &mut self, + recipe: &str, + craft_sprite: Option<(Vec3, SpriteKind)>, + ) -> bool { + if self.can_craft_recipe(recipe).map_or(false, |cs| { + cs.map_or(true, |cs| Some(cs) == craft_sprite.map(|(_, s)| s)) + }) { self.send_msg(ClientGeneral::ControlEvent(ControlEvent::InventoryEvent( InventoryEvent::CraftRecipe { recipe: recipe.to_string(), craft_sprite: craft_sprite.map(|(pos, _)| pos), - } + }, ))); true } else { diff --git a/common/src/comp/controller.rs b/common/src/comp/controller.rs index 19dc1eb138..282438ea75 100644 --- a/common/src/comp/controller.rs +++ b/common/src/comp/controller.rs @@ -76,9 +76,15 @@ impl From for InventoryManip { Self::SplitSwap(Slot::Inventory(inv1), Slot::Inventory(inv2)) }, InventoryEvent::Drop(inv) => Self::Drop(Slot::Inventory(inv)), - InventoryEvent::SplitDrop(inv) => Self::SplitDrop(Slot::Inventory(inv)), + InventoryEvent::SplitDrop(inv) => Self::SplitDrop(Slot::Inventory(inv)), InventoryEvent::Sort => Self::Sort, - InventoryEvent::CraftRecipe { recipe, craft_sprite } => Self::CraftRecipe { recipe, craft_sprite }, + InventoryEvent::CraftRecipe { + recipe, + craft_sprite, + } => Self::CraftRecipe { + recipe, + craft_sprite, + }, } } } diff --git a/common/src/comp/inventory/item/modular.rs b/common/src/comp/inventory/item/modular.rs index 416ff688dd..d1f604c8f1 100644 --- a/common/src/comp/inventory/item/modular.rs +++ b/common/src/comp/inventory/item/modular.rs @@ -1,5 +1,5 @@ use super::{tool, ItemKind, ItemTag, Quality, RawItemDef, TagExampleInfo, ToolKind}; -use crate::recipe::{RawRecipeBook, RawRecipeInput, RawRecipe}; +use crate::recipe::{RawRecipe, RawRecipeBook, RawRecipeInput}; use hashbrown::HashMap; use lazy_static::lazy_static; use serde::{Deserialize, Serialize}; @@ -234,10 +234,7 @@ fn make_weapon_def(toolkind: ToolKind) -> (String, RawItemDef) { (identifier, item) } -fn make_recipe_def( - identifier: String, - toolkind: ToolKind, -) -> RawRecipe { +fn make_recipe_def(identifier: String, toolkind: ToolKind) -> RawRecipe { let output = (identifier, 1); let mut inputs = Vec::new(); for &modkind in &MODKINDS { diff --git a/common/src/recipe.rs b/common/src/recipe.rs index 86be1a3637..2a1110948d 100644 --- a/common/src/recipe.rs +++ b/common/src/recipe.rs @@ -99,9 +99,7 @@ pub(crate) struct RawRecipe { #[derive(Clone, Deserialize)] #[serde(transparent)] #[allow(clippy::type_complexity)] -pub(crate) struct RawRecipeBook( - pub(crate) HashMap, -); +pub(crate) struct RawRecipeBook(pub(crate) HashMap); impl assets::Asset for RawRecipeBook { type Loader = assets::RonLoader; @@ -144,14 +142,27 @@ impl assets::Compound for RecipeBook { let recipes = raw .0 .iter() - .map(|(name, RawRecipe { output, inputs, craft_sprite })| { - let inputs = inputs - .iter() - .map(load_recipe_input) - .collect::, _>>()?; - let output = load_item_def(output)?; - Ok((name.clone(), Recipe { output, inputs, craft_sprite: *craft_sprite })) - }) + .map( + |( + name, + RawRecipe { + output, + inputs, + craft_sprite, + }, + )| { + let inputs = inputs + .iter() + .map(load_recipe_input) + .collect::, _>>()?; + let output = load_item_def(output)?; + Ok((name.clone(), Recipe { + output, + inputs, + craft_sprite: *craft_sprite, + })) + }, + ) .collect::>()?; Ok(RecipeBook { recipes }) diff --git a/common/src/terrain/sprite.rs b/common/src/terrain/sprite.rs index 4d3fdd77f7..6aa1cb841d 100644 --- a/common/src/terrain/sprite.rs +++ b/common/src/terrain/sprite.rs @@ -143,6 +143,10 @@ make_case_elim!( RedAlgae = 0x74, UnderwaterVent = 0x75, Lantern = 0x76, + CraftingBench = 0x77, + Forge = 0x78, + Cauldron = 0x79, + Anvil = 0x7A, } ); @@ -184,6 +188,10 @@ impl SpriteKind { SpriteKind::Mud => 0.36, SpriteKind::ChestBuried => 0.91, SpriteKind::StonyCoral => 1.4, + SpriteKind::CraftingBench => 1.18, + SpriteKind::Forge => 2.7, + SpriteKind::Cauldron => 1.27, + SpriteKind::Anvil => 1.1, // TODO: Find suitable heights. SpriteKind::BarrelCactus | SpriteKind::RoundCactus @@ -309,6 +317,10 @@ impl SpriteKind { | SpriteKind::VialEmpty | SpriteKind::FireBowlGround | SpriteKind::Lantern + | SpriteKind::CraftingBench + | SpriteKind::Forge + | SpriteKind::Cauldron + | SpriteKind::Anvil ) } } diff --git a/server/src/events/inventory_manip.rs b/server/src/events/inventory_manip.rs index dfdae58433..50ea7b07e6 100644 --- a/server/src/events/inventory_manip.rs +++ b/server/src/events/inventory_manip.rs @@ -576,7 +576,10 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Inv .expect("We know entity exists since we got its inventory."); drop(inventories); }, - comp::InventoryManip::CraftRecipe { recipe, craft_sprite } => { + comp::InventoryManip::CraftRecipe { + recipe, + craft_sprite, + } => { let recipe_book = default_recipe_book().read(); let craft_result = recipe_book .get(&recipe) diff --git a/voxygen/src/hud/crafting.rs b/voxygen/src/hud/crafting.rs index 630bc3441c..048386c532 100644 --- a/voxygen/src/hud/crafting.rs +++ b/voxygen/src/hud/crafting.rs @@ -434,16 +434,23 @@ impl<'a> Widget for Crafting<'a> { .unwrap_or(false) }) }); - let state = if self.client.available_recipes() - .get(name.as_str()) - .map_or(false, |cs| cs.map_or(true, |cs| Some(cs) == self.show.craft_sprite.map(|(_, s)| s))) - { - RecipeIngredientQuantity::All - } else if at_least_some_ingredients { - RecipeIngredientQuantity::Some - } else { - RecipeIngredientQuantity::None - }; + let state = + if self + .client + .available_recipes() + .get(name.as_str()) + .map_or(false, |cs| { + cs.map_or(true, |cs| { + Some(cs) == self.show.craft_sprite.map(|(_, s)| s) + }) + }) + { + RecipeIngredientQuantity::All + } else if at_least_some_ingredients { + RecipeIngredientQuantity::Some + } else { + RecipeIngredientQuantity::None + }; (name, recipe, state) }) .collect(); @@ -532,7 +539,11 @@ impl<'a> Widget for Crafting<'a> { .client .available_recipes() .get(recipe_name.as_str()) - .map_or(false, |cs| cs.map_or(true, |cs| Some(cs) == self.show.craft_sprite.map(|(_, s)| s))); + .map_or(false, |cs| { + cs.map_or(true, |cs| { + Some(cs) == self.show.craft_sprite.map(|(_, s)| s) + }) + }); // Craft button if Button::image(self.imgs.button) diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 238474b5e3..fd82fd1e9d 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -22,10 +22,10 @@ mod social; mod trade; pub mod util; +pub use crafting::CraftingTab; pub use hotbar::{SlotContents as HotbarSlotContents, State as HotbarState}; pub use item_imgs::animate_by_pulse; pub use settings_window::ScaleChange; -pub use crafting::CraftingTab; use bag::Bag; use buffs::BuffsBar; @@ -75,7 +75,7 @@ use common::{ BuffKind, Item, }, outcome::Outcome, - terrain::{TerrainChunk, SpriteKind}, + terrain::{SpriteKind, TerrainChunk}, trade::{ReducedInventory, TradeAction}, uid::Uid, util::srgba_to_linear, @@ -381,7 +381,10 @@ pub enum Event { Logout, Quit, - CraftRecipe { recipe: String, craft_sprite: Option<(Vec3, SpriteKind)> }, + CraftRecipe { + recipe: String, + craft_sprite: Option<(Vec3, SpriteKind)>, + }, InviteMember(Uid), AcceptInvite, DeclineInvite, @@ -560,7 +563,11 @@ impl Show { } } - pub fn open_crafting_tab(&mut self, tab: CraftingTab, craft_sprite: Option<(Vec3, SpriteKind)>) { + pub fn open_crafting_tab( + &mut self, + tab: CraftingTab, + craft_sprite: Option<(Vec3, SpriteKind)>, + ) { self.selected_crafting_tab(tab); self.crafting(true); self.craft_sprite = craft_sprite; @@ -1406,7 +1413,8 @@ impl Hud { .set(overitem_id, ui_widgets); } else if let Some(sprite) = block.get_sprite() { overitem::Overitem::new( - format!("{:?}", sprite).into(), // TODO: A better way to generate text for this + format!("{:?}", sprite).into(), /* TODO: A better way to generate text + * for this */ overitem::TEXT_COLOR, pos.distance_squared(player_pos), &self.fonts, @@ -2443,7 +2451,10 @@ impl Hud { { match event { crafting::Event::CraftRecipe(recipe) => { - events.push(Event::CraftRecipe { recipe, craft_sprite: self.show.craft_sprite }); + events.push(Event::CraftRecipe { + recipe, + craft_sprite: self.show.craft_sprite, + }); }, crafting::Event::Close => { self.show.stats = false; diff --git a/voxygen/src/scene/terrain/watcher.rs b/voxygen/src/scene/terrain/watcher.rs index 6b5a6eb14f..baf8fff933 100644 --- a/voxygen/src/scene/terrain/watcher.rs +++ b/voxygen/src/scene/terrain/watcher.rs @@ -1,3 +1,4 @@ +use crate::hud::CraftingTab; use common::{ terrain::{BlockKind, SpriteKind, TerrainChunk}, vol::{IntoVolIterator, RectRasterableVol}, @@ -5,7 +6,6 @@ use common::{ use common_base::span; use rand::prelude::*; use vek::*; -use crate::hud::CraftingTab; #[derive(Copy, Clone)] pub enum Interaction { @@ -115,7 +115,18 @@ impl BlocksOfInterest { Some(SpriteKind::WhiteFlower) => flowers.push(pos), Some(SpriteKind::YellowFlower) => flowers.push(pos), Some(SpriteKind::Sunflower) => flowers.push(pos), - Some(SpriteKind::Pot) => interactables.push((pos, Interaction::Craft(CraftingTab::Food))), + Some(SpriteKind::CraftingBench) => { + interactables.push((pos, Interaction::Craft(CraftingTab::All))) + }, + Some(SpriteKind::Forge) => { + interactables.push((pos, Interaction::Craft(CraftingTab::Dismantle))) + }, + Some(SpriteKind::Cauldron) => { + interactables.push((pos, Interaction::Craft(CraftingTab::Potion))) + }, + Some(SpriteKind::Anvil) => { + interactables.push((pos, Interaction::Craft(CraftingTab::Weapon))) + }, _ => {}, }, } diff --git a/voxygen/src/session/mod.rs b/voxygen/src/session/mod.rs index 976347af71..102cfd3201 100644 --- a/voxygen/src/session/mod.rs +++ b/voxygen/src/session/mod.rs @@ -38,7 +38,7 @@ use crate::{ key_state::KeyState, menu::char_selection::CharSelectionState, render::Renderer, - scene::{camera, CameraMode, Scene, SceneData, terrain::Interaction}, + scene::{camera, terrain::Interaction, CameraMode, Scene, SceneData}, settings::Settings, window::{AnalogGameInput, Event, GameInput}, Direction, Error, GlobalState, PlayState, PlayStateResult, @@ -591,16 +591,20 @@ impl PlayState for SessionState { if let Some(interactable) = self.interactable { let mut client = self.client.borrow_mut(); match interactable { - Interactable::Block(block, pos, interaction) => match interaction { - Interaction::Collect => { - if block.is_collectible() { - client.collect_block(pos); - } - }, - Interaction::Craft(tab) => self.hud.show.open_crafting_tab( - tab, - block.get_sprite().map(|s| (pos, s)), - ), + Interactable::Block(block, pos, interaction) => { + match interaction { + Interaction::Collect => { + if block.is_collectible() { + client.collect_block(pos); + } + }, + Interaction::Craft(tab) => { + self.hud.show.open_crafting_tab( + tab, + block.get_sprite().map(|s| (pos, s)), + ) + }, + } }, Interactable::Entity(entity) => { if client @@ -1187,7 +1191,10 @@ impl PlayState for SessionState { client.request_site_economy(id); }, - HudEvent::CraftRecipe { recipe, craft_sprite } => { + HudEvent::CraftRecipe { + recipe, + craft_sprite, + } => { self.client.borrow_mut().craft_recipe(&recipe, craft_sprite); }, HudEvent::InviteMember(uid) => { diff --git a/world/src/site/settlement/building/archetype/house.rs b/world/src/site/settlement/building/archetype/house.rs index 5a124bfb5f..7058736b25 100644 --- a/world/src/site/settlement/building/archetype/house.rs +++ b/world/src/site/settlement/building/archetype/house.rs @@ -300,9 +300,7 @@ impl Archetype for House { Ori::North => 4, }; let end_window = BlockMask::new( - Block::air(attr.window) - .with_ori(end_ori) - .unwrap(), + Block::air(attr.window).with_ori(end_ori).unwrap(), structural_layer, ); let fire = BlockMask::new(Block::air(SpriteKind::Ember), foundation_layer); @@ -532,19 +530,19 @@ impl Archetype for House { center_offset.x, center_offset.y, z + 100, - )) % 5 + )) % 8 { 0..=1 => SpriteKind::Crate, 2 => SpriteKind::Bench, - 3 => SpriteKind::ChairSingle, - 4 => SpriteKind::FireBowlGround, + 3 => SpriteKind::Anvil, + 4 => SpriteKind::Cauldron, + 5 => SpriteKind::CraftingBench, + 6 => SpriteKind::FireBowlGround, + //8 => SpriteKind::Forge, _ => unreachable!(), }; - return BlockMask::new( - Block::air(furniture).with_ori(end_ori).unwrap(), - 1, - ); + return BlockMask::new(Block::air(furniture).with_ori(end_ori).unwrap(), 1); } else if (!attr.storey_fill.has_lower() && profile.y < ceil_height) || (!attr.storey_fill.has_upper() && profile.y >= ceil_height) { @@ -623,7 +621,7 @@ impl Archetype for House { 0 => SpriteKind::HangingSign, 1 | 2 | 3 => SpriteKind::HangingBasket, 4 => SpriteKind::WallSconce, - 5 => SpriteKind::WallLampSmall, + 5 => SpriteKind::WallLampSmall, _ => SpriteKind::DungeonWallDecor, };