mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
fmt, add sprites
This commit is contained in:
parent
5598d07944
commit
a1fe7c12c3
@ -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),
|
||||
|
BIN
assets/voxygen/voxel/armor/bonerattler/chest.vox
(Stored with Git LFS)
BIN
assets/voxygen/voxel/armor/bonerattler/chest.vox
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/anvil/anvil-0.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/sprite/anvil/anvil-0.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/cauldron/cauldron-0.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/sprite/cauldron/cauldron-0.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/crafting_bench/crafting_bench-0.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/sprite/crafting_bench/crafting_bench-0.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/forge/forge-0.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/sprite/forge/forge-0.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -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,
|
||||
)),
|
||||
)
|
||||
|
@ -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<String, Option<SpriteKind>> { &self.available_recipes }
|
||||
pub fn available_recipes(&self) -> &HashMap<String, Option<SpriteKind>> {
|
||||
&self.available_recipes
|
||||
}
|
||||
|
||||
pub fn can_craft_recipe(&self, recipe: &str) -> Option<Option<SpriteKind>> {
|
||||
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<i32>, 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<i32>, 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 {
|
||||
|
@ -76,9 +76,15 @@ impl From<InventoryEvent> 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,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -99,9 +99,7 @@ pub(crate) struct RawRecipe {
|
||||
#[derive(Clone, Deserialize)]
|
||||
#[serde(transparent)]
|
||||
#[allow(clippy::type_complexity)]
|
||||
pub(crate) struct RawRecipeBook(
|
||||
pub(crate) HashMap<String, RawRecipe>,
|
||||
);
|
||||
pub(crate) struct RawRecipeBook(pub(crate) HashMap<String, RawRecipe>);
|
||||
|
||||
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::<Result<Vec<_>, _>>()?;
|
||||
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::<Result<Vec<_>, _>>()?;
|
||||
let output = load_item_def(output)?;
|
||||
Ok((name.clone(), Recipe {
|
||||
output,
|
||||
inputs,
|
||||
craft_sprite: *craft_sprite,
|
||||
}))
|
||||
},
|
||||
)
|
||||
.collect::<Result<_, assets::Error>>()?;
|
||||
|
||||
Ok(RecipeBook { recipes })
|
||||
|
@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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<i32>, SpriteKind)> },
|
||||
CraftRecipe {
|
||||
recipe: String,
|
||||
craft_sprite: Option<(Vec3<i32>, SpriteKind)>,
|
||||
},
|
||||
InviteMember(Uid),
|
||||
AcceptInvite,
|
||||
DeclineInvite,
|
||||
@ -560,7 +563,11 @@ impl Show {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn open_crafting_tab(&mut self, tab: CraftingTab, craft_sprite: Option<(Vec3<i32>, SpriteKind)>) {
|
||||
pub fn open_crafting_tab(
|
||||
&mut self,
|
||||
tab: CraftingTab,
|
||||
craft_sprite: Option<(Vec3<i32>, 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;
|
||||
|
@ -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)))
|
||||
},
|
||||
_ => {},
|
||||
},
|
||||
}
|
||||
|
@ -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) => {
|
||||
|
@ -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,
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user