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.twigs"), 6),
|
||||||
(Item("common.items.crafting_ing.stones"), 6),
|
(Item("common.items.crafting_ing.stones"), 6),
|
||||||
],
|
],
|
||||||
|
craft_sprite: Some(CraftingBench),
|
||||||
),
|
),
|
||||||
"mortar_pestle": (
|
"mortar_pestle": (
|
||||||
output: ("common.items.crafting_tools.mortar_pestle", 1),
|
output: ("common.items.crafting_tools.mortar_pestle", 1),
|
||||||
@ -28,6 +29,7 @@
|
|||||||
(Item("common.items.ore.velorite"), 1),
|
(Item("common.items.ore.velorite"), 1),
|
||||||
(Item("common.items.crafting_tools.craftsman_hammer"), 0),
|
(Item("common.items.crafting_tools.craftsman_hammer"), 0),
|
||||||
],
|
],
|
||||||
|
craft_sprite: Some(Anvil),
|
||||||
),
|
),
|
||||||
"potion_s": (
|
"potion_s": (
|
||||||
output: ("common.items.consumable.potion_minor", 1),
|
output: ("common.items.consumable.potion_minor", 1),
|
||||||
@ -36,6 +38,7 @@
|
|||||||
(Item("common.items.food.apple"), 4),
|
(Item("common.items.food.apple"), 4),
|
||||||
(Item("common.items.crafting_ing.honey"), 1),
|
(Item("common.items.crafting_ing.honey"), 1),
|
||||||
],
|
],
|
||||||
|
craft_sprite: Some(Cauldron),
|
||||||
),
|
),
|
||||||
"potion_m": (
|
"potion_m": (
|
||||||
output: ("common.items.consumable.potion_med", 1),
|
output: ("common.items.consumable.potion_med", 1),
|
||||||
@ -43,6 +46,7 @@
|
|||||||
(Item("common.items.consumable.potion_minor"), 2),
|
(Item("common.items.consumable.potion_minor"), 2),
|
||||||
(Item("common.items.ore.veloritefrag"), 4),
|
(Item("common.items.ore.veloritefrag"), 4),
|
||||||
],
|
],
|
||||||
|
craft_sprite: Some(Cauldron),
|
||||||
),
|
),
|
||||||
"collar_basic": (
|
"collar_basic": (
|
||||||
output: ("common.items.utility.collar", 1),
|
output: ("common.items.utility.collar", 1),
|
||||||
@ -128,6 +132,7 @@
|
|||||||
(Item("common.items.food.apple"), 4),
|
(Item("common.items.food.apple"), 4),
|
||||||
(Item("common.items.crafting_tools.mortar_pestle"), 0),
|
(Item("common.items.crafting_tools.mortar_pestle"), 0),
|
||||||
],
|
],
|
||||||
|
craft_sprite: Some(Cauldron),
|
||||||
),
|
),
|
||||||
"salad_plain": (
|
"salad_plain": (
|
||||||
output: ("common.items.food.plainsalad", 1),
|
output: ("common.items.food.plainsalad", 1),
|
||||||
@ -135,7 +140,6 @@
|
|||||||
(Item("common.items.food.lettuce"), 1),
|
(Item("common.items.food.lettuce"), 1),
|
||||||
(Item("common.items.crafting_ing.bowl"), 1),
|
(Item("common.items.crafting_ing.bowl"), 1),
|
||||||
],
|
],
|
||||||
craft_sprite: Some(Pot),
|
|
||||||
),
|
),
|
||||||
"salad_tomato": (
|
"salad_tomato": (
|
||||||
output: ("common.items.food.tomatosalad", 1),
|
output: ("common.items.food.tomatosalad", 1),
|
||||||
@ -167,6 +171,7 @@
|
|||||||
(Item("common.items.flowers.sunflower"), 4),
|
(Item("common.items.flowers.sunflower"), 4),
|
||||||
(Item("common.items.crafting_ing.honey"), 1),
|
(Item("common.items.crafting_ing.honey"), 1),
|
||||||
],
|
],
|
||||||
|
craft_sprite: Some(Cauldron),
|
||||||
),
|
),
|
||||||
"Plain Cloth Glider": (
|
"Plain Cloth Glider": (
|
||||||
output: ("common.items.glider.glider_basic_white", 1),
|
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.craftsman_hammer"), 0),
|
||||||
(Item("common.items.crafting_tools.sewing_set"), 0),
|
(Item("common.items.crafting_tools.sewing_set"), 0),
|
||||||
],
|
],
|
||||||
|
craft_sprite: Some(CraftingBench),
|
||||||
),
|
),
|
||||||
"Red Cloth Glider": (
|
"Red Cloth Glider": (
|
||||||
output: ("common.items.glider.glider_basic_red", 1),
|
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.craftsman_hammer"), 0),
|
||||||
(Item("common.items.crafting_tools.sewing_set"), 0),
|
(Item("common.items.crafting_tools.sewing_set"), 0),
|
||||||
],
|
],
|
||||||
|
craft_sprite: Some(CraftingBench),
|
||||||
),
|
),
|
||||||
"Leaves Glider": (
|
"Leaves Glider": (
|
||||||
output: ("common.items.glider.glider_leaves", 1),
|
output: ("common.items.glider.glider_leaves", 1),
|
||||||
@ -198,6 +205,7 @@
|
|||||||
(Item("common.items.crafting_tools.craftsman_hammer"), 0),
|
(Item("common.items.crafting_tools.craftsman_hammer"), 0),
|
||||||
(Item("common.items.crafting_tools.sewing_set"), 0),
|
(Item("common.items.crafting_tools.sewing_set"), 0),
|
||||||
],
|
],
|
||||||
|
craft_sprite: Some(CraftingBench),
|
||||||
),
|
),
|
||||||
"Sand Raptor Wings": (
|
"Sand Raptor Wings": (
|
||||||
output: ("common.items.glider.glider_sandraptor", 1),
|
output: ("common.items.glider.glider_sandraptor", 1),
|
||||||
@ -210,6 +218,7 @@
|
|||||||
(Item("common.items.crafting_tools.craftsman_hammer"), 0),
|
(Item("common.items.crafting_tools.craftsman_hammer"), 0),
|
||||||
(Item("common.items.crafting_tools.sewing_set"), 0),
|
(Item("common.items.crafting_tools.sewing_set"), 0),
|
||||||
],
|
],
|
||||||
|
craft_sprite: Some(CraftingBench),
|
||||||
),
|
),
|
||||||
"Snow Raptor Wings": (
|
"Snow Raptor Wings": (
|
||||||
output: ("common.items.glider.glider_snowraptor", 1),
|
output: ("common.items.glider.glider_snowraptor", 1),
|
||||||
@ -223,6 +232,7 @@
|
|||||||
(Item("common.items.crafting_tools.craftsman_hammer"), 0),
|
(Item("common.items.crafting_tools.craftsman_hammer"), 0),
|
||||||
(Item("common.items.crafting_tools.sewing_set"), 0),
|
(Item("common.items.crafting_tools.sewing_set"), 0),
|
||||||
],
|
],
|
||||||
|
craft_sprite: Some(CraftingBench),
|
||||||
),
|
),
|
||||||
"Wood Raptor Wings": (
|
"Wood Raptor Wings": (
|
||||||
output: ("common.items.glider.glider_woodraptor", 1),
|
output: ("common.items.glider.glider_woodraptor", 1),
|
||||||
@ -235,6 +245,7 @@
|
|||||||
(Item("common.items.crafting_tools.craftsman_hammer"), 0),
|
(Item("common.items.crafting_tools.craftsman_hammer"), 0),
|
||||||
(Item("common.items.crafting_tools.sewing_set"), 0),
|
(Item("common.items.crafting_tools.sewing_set"), 0),
|
||||||
],
|
],
|
||||||
|
craft_sprite: Some(CraftingBench),
|
||||||
),
|
),
|
||||||
"Soothing Loop": (
|
"Soothing Loop": (
|
||||||
output: ("common.items.weapons.sceptre.loops0", 1),
|
output: ("common.items.weapons.sceptre.loops0", 1),
|
||||||
@ -252,6 +263,7 @@
|
|||||||
(Item("common.items.crafting_ing.twigs"), 6),
|
(Item("common.items.crafting_ing.twigs"), 6),
|
||||||
(Item("common.items.crafting_ing.stones"), 0),
|
(Item("common.items.crafting_ing.stones"), 0),
|
||||||
],
|
],
|
||||||
|
craft_sprite: Some(CraftingBench),
|
||||||
),
|
),
|
||||||
"Forest Spirit": (
|
"Forest Spirit": (
|
||||||
output: ("common.items.weapons.sword.wood-2", 1),
|
output: ("common.items.weapons.sword.wood-2", 1),
|
||||||
@ -261,6 +273,7 @@
|
|||||||
(Item("common.items.ore.veloritefrag"), 1),
|
(Item("common.items.ore.veloritefrag"), 1),
|
||||||
(Item("common.items.crafting_ing.stones"), 0),
|
(Item("common.items.crafting_ing.stones"), 0),
|
||||||
],
|
],
|
||||||
|
craft_sprite: Some(Anvil),
|
||||||
),
|
),
|
||||||
"adventure back": (
|
"adventure back": (
|
||||||
output: ("common.items.armor.agile.back", 1),
|
output: ("common.items.armor.agile.back", 1),
|
||||||
@ -384,6 +397,7 @@
|
|||||||
(Item("common.items.crafting_ing.twigs"), 4),
|
(Item("common.items.crafting_ing.twigs"), 4),
|
||||||
(Item("common.items.crafting_tools.craftsman_hammer"), 0),
|
(Item("common.items.crafting_tools.craftsman_hammer"), 0),
|
||||||
],
|
],
|
||||||
|
craft_sprite: Some(Anvil),
|
||||||
),
|
),
|
||||||
"cloth_scraps": (
|
"cloth_scraps": (
|
||||||
output: ("common.items.crafting_ing.cloth_scraps", 1),
|
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,
|
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,
|
recipe::RecipeBook,
|
||||||
resources::{DeltaTime, PlayerEntity, TimeOfDay},
|
resources::{DeltaTime, PlayerEntity, TimeOfDay},
|
||||||
terrain::{
|
terrain::{
|
||||||
block::Block, map::MapConfig, neighbors, BiomeKind, SitesKind, TerrainChunk,
|
block::Block, map::MapConfig, neighbors, BiomeKind, SitesKind, SpriteKind, TerrainChunk,
|
||||||
TerrainChunkSize, SpriteKind,
|
TerrainChunkSize,
|
||||||
},
|
},
|
||||||
trade::{PendingTrade, SitePrices, TradeAction, TradeId, TradeResult},
|
trade::{PendingTrade, SitePrices, TradeAction, TradeId, TradeResult},
|
||||||
uid::{Uid, UidAllocator},
|
uid::{Uid, UidAllocator},
|
||||||
@ -970,27 +970,37 @@ impl Client {
|
|||||||
|
|
||||||
pub fn recipe_book(&self) -> &RecipeBook { &self.recipe_book }
|
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>> {
|
pub fn can_craft_recipe(&self, recipe: &str) -> Option<Option<SpriteKind>> {
|
||||||
self.recipe_book
|
self.recipe_book
|
||||||
.get(recipe)
|
.get(recipe)
|
||||||
.zip(self.inventories().get(self.entity()))
|
.zip(self.inventories().get(self.entity()))
|
||||||
.map(|(recipe, inv)| if inv.contains_ingredients(&*recipe).is_ok() {
|
.map(|(recipe, inv)| {
|
||||||
Some(recipe.craft_sprite)
|
if inv.contains_ingredients(&*recipe).is_ok() {
|
||||||
} else {
|
Some(recipe.craft_sprite)
|
||||||
None
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.unwrap_or(None)
|
.unwrap_or(None)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn craft_recipe(&mut self, recipe: &str, craft_sprite: Option<(Vec3<i32>, SpriteKind)>) -> bool {
|
pub fn craft_recipe(
|
||||||
if self.can_craft_recipe(recipe).map_or(false, |cs| cs.map_or(true, |cs| Some(cs) == craft_sprite.map(|(_, s)| s))) {
|
&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(
|
self.send_msg(ClientGeneral::ControlEvent(ControlEvent::InventoryEvent(
|
||||||
InventoryEvent::CraftRecipe {
|
InventoryEvent::CraftRecipe {
|
||||||
recipe: recipe.to_string(),
|
recipe: recipe.to_string(),
|
||||||
craft_sprite: craft_sprite.map(|(pos, _)| pos),
|
craft_sprite: craft_sprite.map(|(pos, _)| pos),
|
||||||
}
|
},
|
||||||
)));
|
)));
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
|
@ -78,7 +78,13 @@ impl From<InventoryEvent> for InventoryManip {
|
|||||||
InventoryEvent::Drop(inv) => Self::Drop(Slot::Inventory(inv)),
|
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::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 super::{tool, ItemKind, ItemTag, Quality, RawItemDef, TagExampleInfo, ToolKind};
|
||||||
use crate::recipe::{RawRecipeBook, RawRecipeInput, RawRecipe};
|
use crate::recipe::{RawRecipe, RawRecipeBook, RawRecipeInput};
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -234,10 +234,7 @@ fn make_weapon_def(toolkind: ToolKind) -> (String, RawItemDef) {
|
|||||||
(identifier, item)
|
(identifier, item)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_recipe_def(
|
fn make_recipe_def(identifier: String, toolkind: ToolKind) -> RawRecipe {
|
||||||
identifier: String,
|
|
||||||
toolkind: ToolKind,
|
|
||||||
) -> RawRecipe {
|
|
||||||
let output = (identifier, 1);
|
let output = (identifier, 1);
|
||||||
let mut inputs = Vec::new();
|
let mut inputs = Vec::new();
|
||||||
for &modkind in &MODKINDS {
|
for &modkind in &MODKINDS {
|
||||||
|
@ -99,9 +99,7 @@ pub(crate) struct RawRecipe {
|
|||||||
#[derive(Clone, Deserialize)]
|
#[derive(Clone, Deserialize)]
|
||||||
#[serde(transparent)]
|
#[serde(transparent)]
|
||||||
#[allow(clippy::type_complexity)]
|
#[allow(clippy::type_complexity)]
|
||||||
pub(crate) struct RawRecipeBook(
|
pub(crate) struct RawRecipeBook(pub(crate) HashMap<String, RawRecipe>);
|
||||||
pub(crate) HashMap<String, RawRecipe>,
|
|
||||||
);
|
|
||||||
|
|
||||||
impl assets::Asset for RawRecipeBook {
|
impl assets::Asset for RawRecipeBook {
|
||||||
type Loader = assets::RonLoader;
|
type Loader = assets::RonLoader;
|
||||||
@ -144,14 +142,27 @@ impl assets::Compound for RecipeBook {
|
|||||||
let recipes = raw
|
let recipes = raw
|
||||||
.0
|
.0
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(name, RawRecipe { output, inputs, craft_sprite })| {
|
.map(
|
||||||
let inputs = inputs
|
|(
|
||||||
.iter()
|
name,
|
||||||
.map(load_recipe_input)
|
RawRecipe {
|
||||||
.collect::<Result<Vec<_>, _>>()?;
|
output,
|
||||||
let output = load_item_def(output)?;
|
inputs,
|
||||||
Ok((name.clone(), Recipe { output, inputs, craft_sprite: *craft_sprite }))
|
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>>()?;
|
.collect::<Result<_, assets::Error>>()?;
|
||||||
|
|
||||||
Ok(RecipeBook { recipes })
|
Ok(RecipeBook { recipes })
|
||||||
|
@ -143,6 +143,10 @@ make_case_elim!(
|
|||||||
RedAlgae = 0x74,
|
RedAlgae = 0x74,
|
||||||
UnderwaterVent = 0x75,
|
UnderwaterVent = 0x75,
|
||||||
Lantern = 0x76,
|
Lantern = 0x76,
|
||||||
|
CraftingBench = 0x77,
|
||||||
|
Forge = 0x78,
|
||||||
|
Cauldron = 0x79,
|
||||||
|
Anvil = 0x7A,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -184,6 +188,10 @@ impl SpriteKind {
|
|||||||
SpriteKind::Mud => 0.36,
|
SpriteKind::Mud => 0.36,
|
||||||
SpriteKind::ChestBuried => 0.91,
|
SpriteKind::ChestBuried => 0.91,
|
||||||
SpriteKind::StonyCoral => 1.4,
|
SpriteKind::StonyCoral => 1.4,
|
||||||
|
SpriteKind::CraftingBench => 1.18,
|
||||||
|
SpriteKind::Forge => 2.7,
|
||||||
|
SpriteKind::Cauldron => 1.27,
|
||||||
|
SpriteKind::Anvil => 1.1,
|
||||||
// TODO: Find suitable heights.
|
// TODO: Find suitable heights.
|
||||||
SpriteKind::BarrelCactus
|
SpriteKind::BarrelCactus
|
||||||
| SpriteKind::RoundCactus
|
| SpriteKind::RoundCactus
|
||||||
@ -309,6 +317,10 @@ impl SpriteKind {
|
|||||||
| SpriteKind::VialEmpty
|
| SpriteKind::VialEmpty
|
||||||
| SpriteKind::FireBowlGround
|
| SpriteKind::FireBowlGround
|
||||||
| SpriteKind::Lantern
|
| 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.");
|
.expect("We know entity exists since we got its inventory.");
|
||||||
drop(inventories);
|
drop(inventories);
|
||||||
},
|
},
|
||||||
comp::InventoryManip::CraftRecipe { recipe, craft_sprite } => {
|
comp::InventoryManip::CraftRecipe {
|
||||||
|
recipe,
|
||||||
|
craft_sprite,
|
||||||
|
} => {
|
||||||
let recipe_book = default_recipe_book().read();
|
let recipe_book = default_recipe_book().read();
|
||||||
let craft_result = recipe_book
|
let craft_result = recipe_book
|
||||||
.get(&recipe)
|
.get(&recipe)
|
||||||
|
@ -434,16 +434,23 @@ impl<'a> Widget for Crafting<'a> {
|
|||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
let state = if self.client.available_recipes()
|
let state =
|
||||||
.get(name.as_str())
|
if self
|
||||||
.map_or(false, |cs| cs.map_or(true, |cs| Some(cs) == self.show.craft_sprite.map(|(_, s)| s)))
|
.client
|
||||||
{
|
.available_recipes()
|
||||||
RecipeIngredientQuantity::All
|
.get(name.as_str())
|
||||||
} else if at_least_some_ingredients {
|
.map_or(false, |cs| {
|
||||||
RecipeIngredientQuantity::Some
|
cs.map_or(true, |cs| {
|
||||||
} else {
|
Some(cs) == self.show.craft_sprite.map(|(_, s)| s)
|
||||||
RecipeIngredientQuantity::None
|
})
|
||||||
};
|
})
|
||||||
|
{
|
||||||
|
RecipeIngredientQuantity::All
|
||||||
|
} else if at_least_some_ingredients {
|
||||||
|
RecipeIngredientQuantity::Some
|
||||||
|
} else {
|
||||||
|
RecipeIngredientQuantity::None
|
||||||
|
};
|
||||||
(name, recipe, state)
|
(name, recipe, state)
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
@ -532,7 +539,11 @@ impl<'a> Widget for Crafting<'a> {
|
|||||||
.client
|
.client
|
||||||
.available_recipes()
|
.available_recipes()
|
||||||
.get(recipe_name.as_str())
|
.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
|
// Craft button
|
||||||
if Button::image(self.imgs.button)
|
if Button::image(self.imgs.button)
|
||||||
|
@ -22,10 +22,10 @@ mod social;
|
|||||||
mod trade;
|
mod trade;
|
||||||
pub mod util;
|
pub mod util;
|
||||||
|
|
||||||
|
pub use crafting::CraftingTab;
|
||||||
pub use hotbar::{SlotContents as HotbarSlotContents, State as HotbarState};
|
pub use hotbar::{SlotContents as HotbarSlotContents, State as HotbarState};
|
||||||
pub use item_imgs::animate_by_pulse;
|
pub use item_imgs::animate_by_pulse;
|
||||||
pub use settings_window::ScaleChange;
|
pub use settings_window::ScaleChange;
|
||||||
pub use crafting::CraftingTab;
|
|
||||||
|
|
||||||
use bag::Bag;
|
use bag::Bag;
|
||||||
use buffs::BuffsBar;
|
use buffs::BuffsBar;
|
||||||
@ -75,7 +75,7 @@ use common::{
|
|||||||
BuffKind, Item,
|
BuffKind, Item,
|
||||||
},
|
},
|
||||||
outcome::Outcome,
|
outcome::Outcome,
|
||||||
terrain::{TerrainChunk, SpriteKind},
|
terrain::{SpriteKind, TerrainChunk},
|
||||||
trade::{ReducedInventory, TradeAction},
|
trade::{ReducedInventory, TradeAction},
|
||||||
uid::Uid,
|
uid::Uid,
|
||||||
util::srgba_to_linear,
|
util::srgba_to_linear,
|
||||||
@ -381,7 +381,10 @@ pub enum Event {
|
|||||||
Logout,
|
Logout,
|
||||||
Quit,
|
Quit,
|
||||||
|
|
||||||
CraftRecipe { recipe: String, craft_sprite: Option<(Vec3<i32>, SpriteKind)> },
|
CraftRecipe {
|
||||||
|
recipe: String,
|
||||||
|
craft_sprite: Option<(Vec3<i32>, SpriteKind)>,
|
||||||
|
},
|
||||||
InviteMember(Uid),
|
InviteMember(Uid),
|
||||||
AcceptInvite,
|
AcceptInvite,
|
||||||
DeclineInvite,
|
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.selected_crafting_tab(tab);
|
||||||
self.crafting(true);
|
self.crafting(true);
|
||||||
self.craft_sprite = craft_sprite;
|
self.craft_sprite = craft_sprite;
|
||||||
@ -1406,7 +1413,8 @@ impl Hud {
|
|||||||
.set(overitem_id, ui_widgets);
|
.set(overitem_id, ui_widgets);
|
||||||
} else if let Some(sprite) = block.get_sprite() {
|
} else if let Some(sprite) = block.get_sprite() {
|
||||||
overitem::Overitem::new(
|
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,
|
overitem::TEXT_COLOR,
|
||||||
pos.distance_squared(player_pos),
|
pos.distance_squared(player_pos),
|
||||||
&self.fonts,
|
&self.fonts,
|
||||||
@ -2443,7 +2451,10 @@ impl Hud {
|
|||||||
{
|
{
|
||||||
match event {
|
match event {
|
||||||
crafting::Event::CraftRecipe(recipe) => {
|
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 => {
|
crafting::Event::Close => {
|
||||||
self.show.stats = false;
|
self.show.stats = false;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
use crate::hud::CraftingTab;
|
||||||
use common::{
|
use common::{
|
||||||
terrain::{BlockKind, SpriteKind, TerrainChunk},
|
terrain::{BlockKind, SpriteKind, TerrainChunk},
|
||||||
vol::{IntoVolIterator, RectRasterableVol},
|
vol::{IntoVolIterator, RectRasterableVol},
|
||||||
@ -5,7 +6,6 @@ use common::{
|
|||||||
use common_base::span;
|
use common_base::span;
|
||||||
use rand::prelude::*;
|
use rand::prelude::*;
|
||||||
use vek::*;
|
use vek::*;
|
||||||
use crate::hud::CraftingTab;
|
|
||||||
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
pub enum Interaction {
|
pub enum Interaction {
|
||||||
@ -115,7 +115,18 @@ impl BlocksOfInterest {
|
|||||||
Some(SpriteKind::WhiteFlower) => flowers.push(pos),
|
Some(SpriteKind::WhiteFlower) => flowers.push(pos),
|
||||||
Some(SpriteKind::YellowFlower) => flowers.push(pos),
|
Some(SpriteKind::YellowFlower) => flowers.push(pos),
|
||||||
Some(SpriteKind::Sunflower) => 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,
|
key_state::KeyState,
|
||||||
menu::char_selection::CharSelectionState,
|
menu::char_selection::CharSelectionState,
|
||||||
render::Renderer,
|
render::Renderer,
|
||||||
scene::{camera, CameraMode, Scene, SceneData, terrain::Interaction},
|
scene::{camera, terrain::Interaction, CameraMode, Scene, SceneData},
|
||||||
settings::Settings,
|
settings::Settings,
|
||||||
window::{AnalogGameInput, Event, GameInput},
|
window::{AnalogGameInput, Event, GameInput},
|
||||||
Direction, Error, GlobalState, PlayState, PlayStateResult,
|
Direction, Error, GlobalState, PlayState, PlayStateResult,
|
||||||
@ -591,16 +591,20 @@ impl PlayState for SessionState {
|
|||||||
if let Some(interactable) = self.interactable {
|
if let Some(interactable) = self.interactable {
|
||||||
let mut client = self.client.borrow_mut();
|
let mut client = self.client.borrow_mut();
|
||||||
match interactable {
|
match interactable {
|
||||||
Interactable::Block(block, pos, interaction) => match interaction {
|
Interactable::Block(block, pos, interaction) => {
|
||||||
Interaction::Collect => {
|
match interaction {
|
||||||
if block.is_collectible() {
|
Interaction::Collect => {
|
||||||
client.collect_block(pos);
|
if block.is_collectible() {
|
||||||
}
|
client.collect_block(pos);
|
||||||
},
|
}
|
||||||
Interaction::Craft(tab) => self.hud.show.open_crafting_tab(
|
},
|
||||||
tab,
|
Interaction::Craft(tab) => {
|
||||||
block.get_sprite().map(|s| (pos, s)),
|
self.hud.show.open_crafting_tab(
|
||||||
),
|
tab,
|
||||||
|
block.get_sprite().map(|s| (pos, s)),
|
||||||
|
)
|
||||||
|
},
|
||||||
|
}
|
||||||
},
|
},
|
||||||
Interactable::Entity(entity) => {
|
Interactable::Entity(entity) => {
|
||||||
if client
|
if client
|
||||||
@ -1187,7 +1191,10 @@ impl PlayState for SessionState {
|
|||||||
client.request_site_economy(id);
|
client.request_site_economy(id);
|
||||||
},
|
},
|
||||||
|
|
||||||
HudEvent::CraftRecipe { recipe, craft_sprite } => {
|
HudEvent::CraftRecipe {
|
||||||
|
recipe,
|
||||||
|
craft_sprite,
|
||||||
|
} => {
|
||||||
self.client.borrow_mut().craft_recipe(&recipe, craft_sprite);
|
self.client.borrow_mut().craft_recipe(&recipe, craft_sprite);
|
||||||
},
|
},
|
||||||
HudEvent::InviteMember(uid) => {
|
HudEvent::InviteMember(uid) => {
|
||||||
|
@ -300,9 +300,7 @@ impl Archetype for House {
|
|||||||
Ori::North => 4,
|
Ori::North => 4,
|
||||||
};
|
};
|
||||||
let end_window = BlockMask::new(
|
let end_window = BlockMask::new(
|
||||||
Block::air(attr.window)
|
Block::air(attr.window).with_ori(end_ori).unwrap(),
|
||||||
.with_ori(end_ori)
|
|
||||||
.unwrap(),
|
|
||||||
structural_layer,
|
structural_layer,
|
||||||
);
|
);
|
||||||
let fire = BlockMask::new(Block::air(SpriteKind::Ember), foundation_layer);
|
let fire = BlockMask::new(Block::air(SpriteKind::Ember), foundation_layer);
|
||||||
@ -532,19 +530,19 @@ impl Archetype for House {
|
|||||||
center_offset.x,
|
center_offset.x,
|
||||||
center_offset.y,
|
center_offset.y,
|
||||||
z + 100,
|
z + 100,
|
||||||
)) % 5
|
)) % 8
|
||||||
{
|
{
|
||||||
0..=1 => SpriteKind::Crate,
|
0..=1 => SpriteKind::Crate,
|
||||||
2 => SpriteKind::Bench,
|
2 => SpriteKind::Bench,
|
||||||
3 => SpriteKind::ChairSingle,
|
3 => SpriteKind::Anvil,
|
||||||
4 => SpriteKind::FireBowlGround,
|
4 => SpriteKind::Cauldron,
|
||||||
|
5 => SpriteKind::CraftingBench,
|
||||||
|
6 => SpriteKind::FireBowlGround,
|
||||||
|
//8 => SpriteKind::Forge,
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
|
|
||||||
return BlockMask::new(
|
return BlockMask::new(Block::air(furniture).with_ori(end_ori).unwrap(), 1);
|
||||||
Block::air(furniture).with_ori(end_ori).unwrap(),
|
|
||||||
1,
|
|
||||||
);
|
|
||||||
} else if (!attr.storey_fill.has_lower() && profile.y < ceil_height)
|
} else if (!attr.storey_fill.has_lower() && profile.y < ceil_height)
|
||||||
|| (!attr.storey_fill.has_upper() && profile.y >= ceil_height)
|
|| (!attr.storey_fill.has_upper() && profile.y >= ceil_height)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user