more sprite stuff and crafting UI update

fix item images
fix CR display
This commit is contained in:
Monty 2021-04-18 02:25:19 +02:00 committed by Monty Marz
parent 1a0f6f03ef
commit a4d56e7843
17 changed files with 182 additions and 38 deletions

View File

@ -1,9 +1,9 @@
ItemDef(
name: "Craftsman Hammer",
description: "Used to craft various items.",
name: "Old Hammer",
description: "You don't quite remember where you got this from...",
kind: Ingredient(
kind: "CraftsmanHammer",
),
quality: Moderate,
quality: Low,
tags: [CraftingTool],
)

View File

@ -0,0 +1,18 @@
ItemDef(
name: "Craftsman Hammer",
description: "Used to craft various items.",
kind: Tool((
kind: Hammer,
hands: One,
stats: Direct((
equip_time_secs: 0.25,
power: 0.2,
poise_strength: 0.25,
speed: 1.5,
crit_chance: 0.0,
crit_mult: 0.0,
)),
)),
quality: Common,
tags: [CraftingTool],
)

View File

@ -1,19 +1,20 @@
{
"crafting_hammer": (
output: ("common.items.crafting_tools.craftsman_hammer", 1),
output: ("common.items.tool.craftsman_hammer", 1),
inputs: [
(Item("common.items.crafting_ing.twigs"), 6),
(Item("common.items.crafting_ing.stones"), 6),
],
craft_sprite: Some(CraftingBench),
craft_sprite: Some(Anvil),
),
"mortar_pestle": (
output: ("common.items.crafting_tools.mortar_pestle", 1),
inputs: [
(Item("common.items.crafting_ing.stones"), 6),
(Item("common.items.food.coconut"), 1),
(Item("common.items.crafting_tools.craftsman_hammer"), 0),
(Item("common.items.tool.craftsman_hammer"), 0),
],
craft_sprite: Some(CraftingBench),
),
"sewing_set": (
output: ("common.items.crafting_tools.sewing_set", 1),
@ -22,12 +23,13 @@
(Item("common.items.crafting_ing.twigs"), 4),
(Item("common.items.crafting_ing.stones"), 2),
],
craft_sprite: Some(CraftingBench),
),
"velorite_frag": (
output: ("common.items.ore.veloritefrag", 2),
inputs: [
(Item("common.items.ore.velorite"), 1),
(Item("common.items.crafting_tools.craftsman_hammer"), 0),
(Item("common.items.tool.craftsman_hammer"), 0),
],
craft_sprite: Some(Anvil),
),
@ -63,6 +65,7 @@
(Item("common.items.ore.veloritefrag"), 2),
(Item("common.items.crafting_tools.mortar_pestle"), 0),
],
craft_sprite: Some(CraftingBench),
),
"firework_blue": (
output: ("common.items.utility.firework_blue", 1),
@ -73,6 +76,7 @@
(Item("common.items.ore.veloritefrag"), 1),
(Item("common.items.crafting_tools.mortar_pestle"), 0),
],
craft_sprite: Some(CraftingBench),
),
"firework_green": (
output: ("common.items.utility.firework_green", 1),
@ -83,6 +87,7 @@
(Item("common.items.ore.veloritefrag"), 1),
(Item("common.items.crafting_tools.mortar_pestle"), 0),
],
craft_sprite: Some(CraftingBench),
),
"firework_purple": (
output: ("common.items.utility.firework_purple", 1),
@ -93,6 +98,7 @@
(Item("common.items.ore.veloritefrag"), 1),
(Item("common.items.crafting_tools.mortar_pestle"), 0),
],
craft_sprite: Some(CraftingBench),
),
"firework_red": (
output: ("common.items.utility.firework_red", 1),
@ -103,6 +109,7 @@
(Item("common.items.ore.veloritefrag"), 1),
(Item("common.items.crafting_tools.mortar_pestle"), 0),
],
craft_sprite: Some(CraftingBench),
),
"firework_white": (
output: ("common.items.utility.firework_white", 1),
@ -113,6 +120,7 @@
(Item("common.items.ore.veloritefrag"), 1),
(Item("common.items.crafting_tools.mortar_pestle"), 0),
],
craft_sprite: Some(CraftingBench),
),
"firework_yellow": (
output: ("common.items.utility.firework_yellow", 1),
@ -123,6 +131,7 @@
(Item("common.items.ore.veloritefrag"), 1),
(Item("common.items.crafting_tools.mortar_pestle"), 0),
],
craft_sprite: Some(CraftingBench),
),
"apple_shroom_curry": (
output: ("common.items.food.apple_mushroom_curry", 1),
@ -132,7 +141,7 @@
(Item("common.items.food.apple"), 4),
(Item("common.items.crafting_tools.mortar_pestle"), 0),
],
craft_sprite: Some(Cauldron),
craft_sprite: Some(CookingPot),
),
"salad_plain": (
output: ("common.items.food.plainsalad", 1),
@ -179,7 +188,7 @@
(Item("common.items.crafting_ing.twigs"), 5),
(Item("common.items.crafting_ing.leather_scraps"), 5),
(Item("common.items.crafting_ing.cloth_scraps"), 10),
(Item("common.items.crafting_tools.craftsman_hammer"), 0),
(Item("common.items.tool.craftsman_hammer"), 0),
(Item("common.items.crafting_tools.sewing_set"), 0),
],
craft_sprite: Some(CraftingBench),
@ -190,7 +199,7 @@
(Item("common.items.crafting_ing.twigs"), 5),
(Item("common.items.crafting_ing.cloth_scraps_red"), 10),
(Item("common.items.crafting_ing.leather_scraps"), 5),
(Item("common.items.crafting_tools.craftsman_hammer"), 0),
(Item("common.items.tool.craftsman_hammer"), 0),
(Item("common.items.crafting_tools.sewing_set"), 0),
],
craft_sprite: Some(CraftingBench),
@ -202,7 +211,7 @@
(Item("common.items.crafting_ing.leather_scraps"), 5),
(Item("common.items.crafting_ing.cloth_scraps"), 5),
(Item("common.items.crafting_ing.emerald"), 1),
(Item("common.items.crafting_tools.craftsman_hammer"), 0),
(Item("common.items.tool.craftsman_hammer"), 0),
(Item("common.items.crafting_tools.sewing_set"), 0),
],
craft_sprite: Some(CraftingBench),
@ -215,7 +224,7 @@
(Item("common.items.crafting_ing.leather_scraps"), 5),
(Item("common.items.crafting_ing.cloth_scraps"), 5),
(Item("common.items.crafting_ing.ruby"), 1),
(Item("common.items.crafting_tools.craftsman_hammer"), 0),
(Item("common.items.tool.craftsman_hammer"), 0),
(Item("common.items.crafting_tools.sewing_set"), 0),
],
craft_sprite: Some(CraftingBench),
@ -229,7 +238,7 @@
(Item("common.items.crafting_ing.cloth_scraps"), 5),
(Item("common.items.crafting_ing.icy_fang"), 1),
(Item("common.items.crafting_ing.ruby"), 1),
(Item("common.items.crafting_tools.craftsman_hammer"), 0),
(Item("common.items.tool.craftsman_hammer"), 0),
(Item("common.items.crafting_tools.sewing_set"), 0),
],
craft_sprite: Some(CraftingBench),
@ -242,7 +251,7 @@
(Item("common.items.crafting_ing.leather_scraps"), 5),
(Item("common.items.crafting_ing.cloth_scraps"), 5),
(Item("common.items.crafting_ing.ruby"), 1),
(Item("common.items.crafting_tools.craftsman_hammer"), 0),
(Item("common.items.tool.craftsman_hammer"), 0),
(Item("common.items.crafting_tools.sewing_set"), 0),
],
craft_sprite: Some(CraftingBench),
@ -253,7 +262,7 @@
(Item("common.items.crafting_ing.twigs"), 20),
(Item("common.items.ore.veloritefrag"), 8),
(Item("common.items.crafting_ing.ruby"), 4),
(Item("common.items.crafting_tools.craftsman_hammer"), 0),
(Item("common.items.tool.craftsman_hammer"), 0),
],
),
"Hunting Bow": (
@ -278,30 +287,37 @@
"adventure back": (
output: ("common.items.armor.agile.back", 1),
inputs: [(Item("common.items.crafting_ing.leather_scraps"), 4)],
craft_sprite: Some(CraftingBench),
),
"adventure belt": (
output: ("common.items.armor.agile.belt", 1),
inputs: [(Item("common.items.crafting_ing.leather_scraps"), 2)],
craft_sprite: Some(CraftingBench),
),
"adventure chest": (
output: ("common.items.armor.agile.chest", 1),
inputs: [(Item("common.items.crafting_ing.leather_scraps"), 12)],
craft_sprite: Some(CraftingBench),
),
"adventure feet": (
output: ("common.items.armor.agile.foot", 1),
inputs: [(Item("common.items.crafting_ing.leather_scraps"), 3)],
craft_sprite: Some(CraftingBench),
),
"adventure hands": (
output: ("common.items.armor.agile.hand", 1),
inputs: [(Item("common.items.crafting_ing.leather_scraps"), 4)],
craft_sprite: Some(CraftingBench),
),
"adventure pants": (
output: ("common.items.armor.agile.pants", 1),
inputs: [(Item("common.items.crafting_ing.leather_scraps"), 8)],
craft_sprite: Some(CraftingBench),
),
"adventure shoulder": (
output: ("common.items.armor.agile.shoulder", 1),
inputs: [(Item("common.items.crafting_ing.leather_scraps"), 12)],
craft_sprite: Some(CraftingBench),
),
"Seashell Necklace": (
output: ("common.items.armor.misc.neck.shell", 1),
@ -311,6 +327,7 @@
(Item("common.items.crafting_ing.seashells"), 3),
(Item("common.items.crafting_tools.sewing_set"), 0),
],
craft_sprite: Some(CraftingBench),
),
"red cloth": (
output: ("common.items.crafting_ing.cloth_scraps_red", 1),
@ -360,6 +377,7 @@
(Item("common.items.armor.misc.bag.tiny_leather_pouch"), 2),
(Item("common.items.crafting_tools.sewing_set"), 0),
],
craft_sprite: Some(CraftingBench),
),
"sturdy red backpack": (
output: ("common.items.armor.misc.bag.sturdy_red_backpack", 1),
@ -395,7 +413,7 @@
(Item("common.items.crafting_ing.cloth_scraps"), 1), // TODO: Replace with plant fiber when obtainable
(Item("common.items.crafting_ing.stones"), 5), // TODO: Replace with iron ingots when obtainable
(Item("common.items.crafting_ing.twigs"), 4),
(Item("common.items.crafting_tools.craftsman_hammer"), 0),
(Item("common.items.tool.craftsman_hammer"), 0),
],
craft_sprite: Some(Anvil),
),
@ -417,7 +435,7 @@
// output: ("common.items.crafting_ing.modular.damage.sword.metal_blade", 1),
// inputs: [
// (Tag(MetalIngot), 5),
// (Item("common.items.crafting_tools.craftsman_hammer"), 0),
// (Item("common.items.tool.craftsman_hammer"), 0),
// ],
//),
}

View File

@ -8,7 +8,12 @@
"hud.crafting.ingredients": "Ingredients:",
"hud.crafting.craft": "Craft",
"hud.crafting.tool_cata": "Requires:",
// Crafting Stations
"hud.crafting.req_crafting_station": "Requires:",
"hud.crafting.anvil": "Anvil",
"hud.crafting.cauldron": "Cauldron",
"hud.crafting.cooking_pot": "Cooking Pot",
"hud.crafting.crafting_bench": "Crafting Bench",
// Tabs
"hud.crafting.tabs.all": "All",
"hud.crafting.tabs.armor": "Armor",

View File

@ -2,6 +2,23 @@
// Vox(specier),
// VoxTrans(specifier, offset, (x_rot, y_rot, z_rot), zoom)
({
// Crafting Stations
Tool("Anvil"): VoxTrans(
"voxel.sprite.anvil.anvil-0",
(0.5, 0.5, 0.0), (0.0, 60.0, 90.0), 1.0,
),
Tool("Cauldron"): VoxTrans(
"voxel.sprite.cauldron.cauldron-0",
(0.0, 0.0, 0.0), (-50.0, 40.0, 30.0), 1.0,
),
Tool("CookingPot"): VoxTrans(
"voxel.sprite.cooking_pot.pot-0",
(0.0, 0.0, 0.0), (0.0, 90.0, 90.0), 1.2,
),
Tool("CraftingBench"): VoxTrans(
"voxel.sprite.crafting_bench.crafting_bench-0",
(0.0, 0.0, 0.0), (-50.0, 40.0, 20.0), 1.0,
),
// Weapons
// Diary Example Images
Tool("example_utility"): VoxTrans(
@ -1920,10 +1937,14 @@
"voxel.object.training_dummy",
(0.0, -1.0, 0.0), (-50.0, 40.0, 20.0), 0.8,
),
// Ingredients
Ingredient("CraftsmanHammer"): VoxTrans( //TODO This should be a 1h hammer!
// Ingredients
Tool("common.items.tool.craftsman_hammer"): VoxTrans(
"voxel.weapon.hammer.craftsman",
(1.0, 1.0, 0.0), (-135.0, 90.0, 0.0), 1.0,
(1.0, -1.0, 0.0), (-135.0, 90.0, 0.0), 0.9,
),
Ingredient("CraftsmanHammer"): VoxTrans(
"voxel.weapon.hammer.craftsman",
(1.0, 1.0, 0.0), (-135.0, 90.0, 0.0), 0.8,
),
Ingredient("SewingSet"): Png(
"element.items.sewing_set",

View File

@ -462,7 +462,11 @@
vox_spec: ("weapon.axe_1h.wood-1", (-1.5, -5.0, -3.0)),
color: None
),
// Hammers
// Hammers
"common.items.tool.craftsman_hammer": (
vox_spec: ("weapon.hammer.craftsman", (-2.5, -5.5, -4.5)),
color: None
),
"common.items.weapons.hammer.hammer_1": (
vox_spec: ("weapon.hammer.2hhammer_rusty", (-2.5, -5.5, -4.5)),
color: None

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/cooking_pot/pot-0.vox (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -2896,4 +2896,15 @@ CraftingBench: Some((
],
wind_sway: 0.0,
)),
// Cooking Pot
CookingPot: Some((
variations: [
(
model: "voxygen.voxel.sprite.cooking_pot.pot-0",
offset: (-9.0, -10.0, 0.0),
lod_axes: (0.0, 0.0, 0.0),
),
],
wind_sway: 0.0,
)),
)

Binary file not shown.

View File

@ -147,6 +147,7 @@ make_case_elim!(
Forge = 0x78,
Cauldron = 0x79,
Anvil = 0x7A,
CookingPot = 0x7B,
}
);
@ -192,6 +193,7 @@ impl SpriteKind {
SpriteKind::Forge => 2.7,
SpriteKind::Cauldron => 1.27,
SpriteKind::Anvil => 1.1,
SpriteKind::CookingPot => 1.82,
// TODO: Find suitable heights.
SpriteKind::BarrelCactus
| SpriteKind::RoundCactus
@ -321,6 +323,7 @@ impl SpriteKind {
| SpriteKind::Forge
| SpriteKind::Cauldron
| SpriteKind::Anvil
| SpriteKind::CookingPot
)
}
}

View File

@ -1,6 +1,6 @@
use super::{
img_ids::{Imgs, ImgsRot},
item_imgs::{animate_by_pulse, ItemImgs},
item_imgs::{animate_by_pulse, ItemImgs, ItemKey::Tool},
Show, TEXT_COLOR, TEXT_DULL_RED_COLOR, TEXT_GRAY_COLOR, UI_HIGHLIGHT_0, UI_MAIN,
};
use crate::{
@ -20,6 +20,7 @@ use common::{
Inventory,
},
recipe::RecipeInput,
terrain::SpriteKind,
};
use conrod_core::{
color, image,
@ -59,6 +60,9 @@ widget_ids! {
ingredient_img[],
req_text[],
ingredients_txt,
req_station_title,
req_station_img,
req_station_txt,
output_img_frame,
output_img,
output_amount,
@ -657,14 +661,66 @@ impl<'a> Widget for Crafting<'a> {
.set(state.ids.tags_ing[i], ui);
}
}
// Ingredients Text
Text::new(&self.localized_strings.get("hud.crafting.ingredients"))
// Crafting Station Info
if recipe.craft_sprite.is_some() {
Text::new(
&self
.localized_strings
.get("hud.crafting.req_crafting_station"),
)
.top_left_with_margins_on(state.ids.align_ing, 10.0, 5.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(18))
.color(TEXT_COLOR)
.set(state.ids.ingredients_txt, ui);
.set(state.ids.req_station_title, ui);
let station_img = match recipe.craft_sprite {
Some(SpriteKind::Anvil) => "Anvil",
Some(SpriteKind::Cauldron) => "Cauldron",
Some(SpriteKind::CookingPot) => "CookingPot",
Some(SpriteKind::CraftingBench) => "CraftingBench",
None => "CraftsmanHammer",
_ => "CraftsmanHammer",
};
Image::new(animate_by_pulse(
&self
.item_imgs
.img_ids_or_not_found_img(Tool(station_img.to_string())),
self.pulse,
))
.w_h(25.0, 25.0)
.down_from(state.ids.req_station_title, 10.0)
.parent(state.ids.align_ing)
.set(state.ids.req_station_img, ui);
let station_name = match recipe.craft_sprite {
Some(SpriteKind::Anvil) => "hud.crafting.anvil",
Some(SpriteKind::Cauldron) => "hud.crafting.cauldron",
Some(SpriteKind::CookingPot) => "hud.crafting.cooking_pot",
Some(SpriteKind::CraftingBench) => "hud.crafting.crafting_bench",
_ => "",
};
Text::new(&self.localized_strings.get(station_name))
.right_from(state.ids.req_station_img, 10.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(14))
.color(if self.show.craft_sprite.is_some() {
TEXT_COLOR
} else {
TEXT_DULL_RED_COLOR
})
.set(state.ids.req_station_txt, ui);
}
// Ingredients Text
let mut ing_txt = Text::new(&self.localized_strings.get("hud.crafting.ingredients"))
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(18))
.color(TEXT_COLOR);
if recipe.craft_sprite.is_some() {
ing_txt = ing_txt.down_from(state.ids.req_station_img, 10.0);
} else {
ing_txt = ing_txt.top_left_with_margins_on(state.ids.align_ing, 10.0, 5.0);
};
ing_txt.set(state.ids.ingredients_txt, ui);
// Ingredient images with tooltip
if state.ids.ingredient_frame.len() < recipe.inputs().len() {

View File

@ -3487,11 +3487,11 @@ fn try_hotbar_slot_from_input(input: GameInput) -> Option<hotbar::Slot> {
}
pub fn cr_color(combat_rating: f32) -> Color {
let common = 4.3;
let moderate = 6.0;
let high = 8.0;
let epic = 10.0;
let legendary = 79.0;
let common = 2.0;
let moderate = 3.5;
let high = 6.5;
let epic = 8.5;
let legendary = 10.4;
let artifact = 122.0;
let debug = 200.0;

View File

@ -127,6 +127,9 @@ impl BlocksOfInterest {
Some(SpriteKind::Anvil) => {
interactables.push((pos, Interaction::Craft(CraftingTab::Weapon)))
},
Some(SpriteKind::CookingPot) => {
interactables.push((pos, Interaction::Craft(CraftingTab::Food)))
},
_ => {},
},
}

View File

@ -535,9 +535,10 @@ impl Archetype for House {
0..=1 => SpriteKind::Crate,
2 => SpriteKind::Bench,
3 => SpriteKind::Anvil,
4 => SpriteKind::Cauldron,
4 => SpriteKind::CookingPot,
5 => SpriteKind::CraftingBench,
6 => SpriteKind::FireBowlGround,
//7 => SpriteKind::Cauldron,
//8 => SpriteKind::Forge,
_ => unreachable!(),
};
@ -561,7 +562,7 @@ impl Archetype for House {
center_offset.x,
center_offset.y,
z + 100,
)) % 12
)) % 13
{
0 => SpriteKind::Planter,
1 => SpriteKind::ChairSingle,
@ -585,6 +586,7 @@ impl Archetype for House {
SpriteKind::VialEmpty
}
},
11 => SpriteKind::Cauldron,
_ => {
if dynamic_rng.gen_range(0..2) == 0 {
SpriteKind::Bowl