mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Move equipment from loadout into body
This commit is contained in:
parent
817cd24d54
commit
1f78344d6f
@ -1,8 +0,0 @@
|
||||
Item(
|
||||
name: "Assassin Chest",
|
||||
description: "Only the best for a member of the creed.",
|
||||
kind: Armor(
|
||||
kind: Chest(Assassin),
|
||||
stats: 20,
|
||||
),
|
||||
)
|
@ -1,8 +0,0 @@
|
||||
Item(
|
||||
name: "Iron Chestplate",
|
||||
description: "Arrows to the stomach are soooo last update.",
|
||||
kind: Armor(
|
||||
kind: Chest(PlateGreen0),
|
||||
stats: 20,
|
||||
),
|
||||
)
|
@ -26,7 +26,7 @@ impl Component for CharacterAbility {
|
||||
type Storage = DenseVecStorage<Self>;
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[derive(Clone, PartialEq, Eq, Hash, Debug, Serialize, Deserialize)]
|
||||
pub struct ItemConfig {
|
||||
pub item: Item,
|
||||
pub primary_ability: Option<CharacterAbility>,
|
||||
@ -35,7 +35,7 @@ pub struct ItemConfig {
|
||||
pub dodge_ability: Option<CharacterAbility>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
#[derive(Clone, PartialEq, Eq, Hash, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct Loadout {
|
||||
pub active_item: Option<ItemConfig>,
|
||||
pub second_item: Option<ItemConfig>,
|
||||
|
@ -5,12 +5,6 @@ use vek::Rgb;
|
||||
pub struct Body {
|
||||
pub race: Race,
|
||||
pub body_type: BodyType,
|
||||
pub chest: Chest,
|
||||
pub belt: Belt,
|
||||
pub pants: Pants,
|
||||
pub hand: Hand,
|
||||
pub foot: Foot,
|
||||
pub shoulder: Shoulder,
|
||||
pub hair_style: u8,
|
||||
pub beard: u8,
|
||||
pub eyebrows: Eyebrows,
|
||||
@ -33,12 +27,6 @@ impl Body {
|
||||
Self {
|
||||
race,
|
||||
body_type,
|
||||
chest: *(&ALL_CHESTS).choose(rng).unwrap(),
|
||||
belt: *(&ALL_BELTS).choose(rng).unwrap(),
|
||||
pants: *(&ALL_PANTS).choose(rng).unwrap(),
|
||||
hand: *(&ALL_HANDS).choose(rng).unwrap(),
|
||||
foot: *(&ALL_FEET).choose(rng).unwrap(),
|
||||
shoulder: *(&ALL_SHOULDERS).choose(rng).unwrap(),
|
||||
hair_style: rng.gen_range(0, race.num_hair_styles(body_type)),
|
||||
beard: rng.gen_range(0, race.num_beards(body_type)),
|
||||
eyebrows: *(&ALL_EYEBROWS).choose(rng).unwrap(),
|
||||
|
@ -129,48 +129,26 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Inv
|
||||
if let Some(loadout) =
|
||||
state.ecs().write_storage::<comp::Loadout>().get_mut(entity)
|
||||
{
|
||||
if let Some(comp::Body::Humanoid(body)) =
|
||||
state.ecs().write_storage::<comp::Body>().get_mut(entity)
|
||||
{
|
||||
use comp::item::Armor::*;
|
||||
let slot = match kind.clone() {
|
||||
Shoulder(shoulder) => {
|
||||
body.shoulder = shoulder;
|
||||
&mut loadout.shoulder
|
||||
},
|
||||
Chest(chest) => {
|
||||
body.chest = chest;
|
||||
&mut loadout.chest
|
||||
},
|
||||
Belt(belt) => {
|
||||
body.belt = belt;
|
||||
&mut loadout.belt
|
||||
},
|
||||
Hand(hand) => {
|
||||
body.hand = hand;
|
||||
&mut loadout.hand
|
||||
},
|
||||
Pants(pants) => {
|
||||
body.pants = pants;
|
||||
&mut loadout.pants
|
||||
},
|
||||
Foot(foot) => {
|
||||
body.foot = foot;
|
||||
&mut loadout.foot
|
||||
},
|
||||
};
|
||||
use comp::item::Armor::*;
|
||||
let slot = match kind.clone() {
|
||||
Shoulder(_) => &mut loadout.shoulder,
|
||||
Chest(_) => &mut loadout.chest,
|
||||
Belt(_) => &mut loadout.belt,
|
||||
Hand(_) => &mut loadout.hand,
|
||||
Pants(_) => &mut loadout.pants,
|
||||
Foot(_) => &mut loadout.foot,
|
||||
};
|
||||
|
||||
// Insert old item into inventory
|
||||
if let Some(old_item) = slot.take() {
|
||||
state
|
||||
.ecs()
|
||||
.write_storage::<comp::Inventory>()
|
||||
.get_mut(entity)
|
||||
.map(|inv| inv.insert(slot_idx, old_item));
|
||||
}
|
||||
|
||||
*slot = Some(item);
|
||||
// Insert old item into inventory
|
||||
if let Some(old_item) = slot.take() {
|
||||
state
|
||||
.ecs()
|
||||
.write_storage::<comp::Inventory>()
|
||||
.get_mut(entity)
|
||||
.map(|inv| inv.insert(slot_idx, old_item));
|
||||
}
|
||||
|
||||
*slot = Some(item);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -112,18 +112,12 @@ impl PlayState for CharSelectionState {
|
||||
}
|
||||
|
||||
// Render the scene.
|
||||
let item = self
|
||||
.char_selection_ui
|
||||
.get_character_data()
|
||||
.and_then(|data| data.tool)
|
||||
.and_then(|tool| assets::load_cloned::<comp::Item>(&tool).ok());
|
||||
let item_kind = item.map(|i| i.kind);
|
||||
|
||||
let loadout = self.char_selection_ui.get_loadout();
|
||||
self.scene.render(
|
||||
global_state.window.renderer_mut(),
|
||||
self.client.borrow().get_tick(),
|
||||
humanoid_body.clone(),
|
||||
item_kind.as_ref(),
|
||||
loadout,
|
||||
);
|
||||
|
||||
// Draw the UI to the screen.
|
||||
|
@ -12,7 +12,7 @@ use crate::{
|
||||
};
|
||||
use client::Client;
|
||||
use common::{
|
||||
assets::load_expect,
|
||||
assets::{load_expect, load_glob},
|
||||
comp::{self, humanoid},
|
||||
};
|
||||
use conrod_core::{
|
||||
@ -22,6 +22,7 @@ use conrod_core::{
|
||||
widget::{text_box::Event as TextBoxEvent, Button, Image, Rectangle, Scrollbar, Text, TextBox},
|
||||
widget_ids, Borderable, Color, Colorable, Labelable, Positionable, Sizeable, UiCell, Widget,
|
||||
};
|
||||
use std::{borrow::Borrow, sync::Arc};
|
||||
|
||||
const STARTER_HAMMER: &str = "common.items.weapons.starter_hammer";
|
||||
const STARTER_BOW: &str = "common.items.weapons.starter_bow";
|
||||
@ -251,6 +252,7 @@ pub enum Mode {
|
||||
Create {
|
||||
name: String,
|
||||
body: humanoid::Body,
|
||||
loadout: comp::Loadout,
|
||||
tool: Option<&'static str>,
|
||||
},
|
||||
}
|
||||
@ -263,7 +265,7 @@ pub struct CharSelectionUi {
|
||||
fonts: ConrodVoxygenFonts,
|
||||
//character_creation: bool,
|
||||
info_content: InfoContent,
|
||||
voxygen_i18n: std::sync::Arc<VoxygenLocalization>,
|
||||
voxygen_i18n: Arc<VoxygenLocalization>,
|
||||
//deletion_confirmation: bool,
|
||||
/*
|
||||
pub character_name: String,
|
||||
@ -317,7 +319,12 @@ impl CharSelectionUi {
|
||||
pub fn get_character_data(&self) -> Option<CharacterData> {
|
||||
match &self.mode {
|
||||
Mode::Select(data) => data.clone(),
|
||||
Mode::Create { name, body, tool } => Some(CharacterData {
|
||||
Mode::Create {
|
||||
name,
|
||||
body,
|
||||
loadout,
|
||||
tool,
|
||||
} => Some(CharacterData {
|
||||
name: name.clone(),
|
||||
body: comp::Body::Humanoid(body.clone()),
|
||||
tool: tool.map(|specifier| specifier.to_string()),
|
||||
@ -325,6 +332,27 @@ impl CharSelectionUi {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_loadout(&mut self) -> Option<&comp::Loadout> {
|
||||
match &mut self.mode {
|
||||
Mode::Select(_) => None,
|
||||
Mode::Create {
|
||||
name,
|
||||
body,
|
||||
loadout,
|
||||
tool,
|
||||
} => {
|
||||
loadout.active_item = tool.map(|tool| comp::ItemConfig {
|
||||
item: (*load_expect::<comp::Item>(tool)).clone(),
|
||||
primary_ability: None,
|
||||
secondary_ability: None,
|
||||
block_ability: None,
|
||||
dodge_ability: None,
|
||||
});
|
||||
Some(loadout)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Split this into multiple modules or functions.
|
||||
fn update_layout(&mut self, global_state: &mut GlobalState, client: &Client) -> Vec<Event> {
|
||||
let mut events = Vec::new();
|
||||
@ -646,13 +674,19 @@ impl CharSelectionUi {
|
||||
self.mode = Mode::Create {
|
||||
name: "Character Name".to_string(),
|
||||
body: humanoid::Body::random(),
|
||||
loadout: comp::Loadout::default(),
|
||||
tool: Some(STARTER_SWORD),
|
||||
};
|
||||
}
|
||||
},
|
||||
// Character_Creation
|
||||
// //////////////////////////////////////////////////////////////////////
|
||||
Mode::Create { name, body, tool } => {
|
||||
Mode::Create {
|
||||
name,
|
||||
body,
|
||||
loadout,
|
||||
tool,
|
||||
} => {
|
||||
let mut to_select = false;
|
||||
// Back Button
|
||||
if Button::image(self.imgs.button)
|
||||
@ -1266,20 +1300,27 @@ impl CharSelectionUi {
|
||||
.set(self.ids.beard_slider, ui_widgets);
|
||||
}
|
||||
// Chest
|
||||
let current_chest = body.chest;
|
||||
let armor = load_glob::<comp::Item>("common.items.armor.chest.*")
|
||||
.expect("Unable to load armor!");
|
||||
if let Some(new_val) = char_slider(
|
||||
self.ids.beard_slider,
|
||||
self.voxygen_i18n.get("char_selection.chest_color"),
|
||||
self.ids.chest_text,
|
||||
humanoid::ALL_CHESTS.len() - 1,
|
||||
humanoid::ALL_CHESTS
|
||||
armor.len() - 1,
|
||||
armor
|
||||
.iter()
|
||||
.position(|&c| c == current_chest)
|
||||
.position(|c| {
|
||||
loadout
|
||||
.chest
|
||||
.as_ref()
|
||||
.map(|lc| lc == c.borrow())
|
||||
.unwrap_or_default()
|
||||
})
|
||||
.unwrap_or(0),
|
||||
self.ids.chest_slider,
|
||||
ui_widgets,
|
||||
) {
|
||||
body.chest = humanoid::ALL_CHESTS[new_val];
|
||||
loadout.chest = Some((*armor[new_val]).clone());
|
||||
}
|
||||
// Pants
|
||||
/*let current_pants = body.pants;
|
||||
|
@ -6,7 +6,7 @@ use crate::{
|
||||
};
|
||||
use common::{
|
||||
assets::watch::ReloadIndicator,
|
||||
comp::{Body, CharacterState, ItemKind},
|
||||
comp::{Body, CharacterState, ItemKind, Loadout},
|
||||
};
|
||||
use hashbrown::{hash_map::Entry, HashMap};
|
||||
use std::{
|
||||
@ -19,7 +19,7 @@ enum FigureKey {
|
||||
Simple(Body),
|
||||
Complex(
|
||||
Body,
|
||||
Option<ItemKind>,
|
||||
Option<Loadout>,
|
||||
CameraMode,
|
||||
Option<CharacterStateCacheKey>,
|
||||
),
|
||||
@ -58,7 +58,7 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
|
||||
&mut self,
|
||||
renderer: &mut Renderer,
|
||||
body: Body,
|
||||
item_kind: Option<&ItemKind>,
|
||||
loadout: Option<&Loadout>,
|
||||
tick: u64,
|
||||
camera_mode: CameraMode,
|
||||
character_state: Option<&CharacterState>,
|
||||
@ -67,10 +67,10 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
|
||||
for<'a> &'a common::comp::Body: std::convert::TryInto<Skel::Attr>,
|
||||
Skel::Attr: Default,
|
||||
{
|
||||
let key = if item_kind.is_some() {
|
||||
let key = if loadout.is_some() {
|
||||
FigureKey::Complex(
|
||||
body,
|
||||
item_kind.cloned(),
|
||||
loadout.cloned(),
|
||||
camera_mode,
|
||||
character_state.map(|cs| CharacterStateCacheKey::from(cs)),
|
||||
)
|
||||
@ -106,6 +106,10 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
|
||||
let humanoid_armor_foot_spec =
|
||||
HumArmorFootSpec::load_watched(&mut self.manifest_indicator);
|
||||
|
||||
// TODO: This is bad code, maybe this method should return Option<_>
|
||||
let default_loadout = Loadout::default();
|
||||
let loadout = loadout.unwrap_or(&default_loadout);
|
||||
|
||||
[
|
||||
match camera_mode {
|
||||
CameraMode::ThirdPerson => {
|
||||
@ -124,21 +128,21 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
|
||||
CameraMode::FirstPerson => None,
|
||||
},
|
||||
match camera_mode {
|
||||
CameraMode::ThirdPerson => {
|
||||
Some(humanoid_armor_chest_spec.mesh_chest(&body))
|
||||
},
|
||||
CameraMode::ThirdPerson => Some(
|
||||
humanoid_armor_chest_spec.mesh_chest(&body, loadout),
|
||||
),
|
||||
CameraMode::FirstPerson => None,
|
||||
},
|
||||
match camera_mode {
|
||||
CameraMode::ThirdPerson => {
|
||||
Some(humanoid_armor_belt_spec.mesh_belt(&body))
|
||||
Some(humanoid_armor_belt_spec.mesh_belt(&body, loadout))
|
||||
},
|
||||
CameraMode::FirstPerson => None,
|
||||
},
|
||||
match camera_mode {
|
||||
CameraMode::ThirdPerson => {
|
||||
Some(humanoid_armor_pants_spec.mesh_pants(&body))
|
||||
},
|
||||
CameraMode::ThirdPerson => Some(
|
||||
humanoid_armor_pants_spec.mesh_pants(&body, loadout),
|
||||
),
|
||||
CameraMode::FirstPerson => None,
|
||||
},
|
||||
if camera_mode == CameraMode::FirstPerson
|
||||
@ -148,34 +152,42 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
|
||||
{
|
||||
None
|
||||
} else {
|
||||
Some(humanoid_armor_hand_spec.mesh_left_hand(&body))
|
||||
Some(
|
||||
humanoid_armor_hand_spec.mesh_left_hand(&body, loadout),
|
||||
)
|
||||
},
|
||||
if character_state.map(|cs| cs.is_dodge()).unwrap_or_default() {
|
||||
None
|
||||
} else {
|
||||
Some(humanoid_armor_hand_spec.mesh_right_hand(&body))
|
||||
},
|
||||
match camera_mode {
|
||||
CameraMode::ThirdPerson => {
|
||||
Some(humanoid_armor_foot_spec.mesh_left_foot(&body))
|
||||
},
|
||||
CameraMode::FirstPerson => None,
|
||||
},
|
||||
match camera_mode {
|
||||
CameraMode::ThirdPerson => {
|
||||
Some(humanoid_armor_foot_spec.mesh_right_foot(&body))
|
||||
},
|
||||
CameraMode::FirstPerson => None,
|
||||
Some(
|
||||
humanoid_armor_hand_spec
|
||||
.mesh_right_hand(&body, loadout),
|
||||
)
|
||||
},
|
||||
match camera_mode {
|
||||
CameraMode::ThirdPerson => Some(
|
||||
humanoid_armor_shoulder_spec.mesh_left_shoulder(&body),
|
||||
humanoid_armor_foot_spec.mesh_left_foot(&body, loadout),
|
||||
),
|
||||
CameraMode::FirstPerson => None,
|
||||
},
|
||||
match camera_mode {
|
||||
CameraMode::ThirdPerson => Some(
|
||||
humanoid_armor_shoulder_spec.mesh_right_shoulder(&body),
|
||||
humanoid_armor_foot_spec
|
||||
.mesh_right_foot(&body, loadout),
|
||||
),
|
||||
CameraMode::FirstPerson => None,
|
||||
},
|
||||
match camera_mode {
|
||||
CameraMode::ThirdPerson => Some(
|
||||
humanoid_armor_shoulder_spec
|
||||
.mesh_left_shoulder(&body, loadout),
|
||||
),
|
||||
CameraMode::FirstPerson => None,
|
||||
},
|
||||
match camera_mode {
|
||||
CameraMode::ThirdPerson => Some(
|
||||
humanoid_armor_shoulder_spec
|
||||
.mesh_right_shoulder(&body, loadout),
|
||||
),
|
||||
CameraMode::FirstPerson => None,
|
||||
},
|
||||
@ -187,7 +199,9 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
|
||||
})
|
||||
.unwrap_or_default()
|
||||
{
|
||||
Some(mesh_main(item_kind))
|
||||
Some(mesh_main(
|
||||
loadout.active_item.as_ref().map(|i| &i.item.kind),
|
||||
))
|
||||
} else {
|
||||
None
|
||||
},
|
||||
|
@ -14,11 +14,11 @@ use common::{
|
||||
Belt, Body, BodyType, Chest, EyeColor, Eyebrows, Foot, Hand, Pants, Race, Shoulder,
|
||||
Skin,
|
||||
},
|
||||
item::{ToolData, ToolKind},
|
||||
item::{Armor, ToolData, ToolKind},
|
||||
object,
|
||||
quadruped_medium::{BodyType as QMBodyType, Species as QMSpecies},
|
||||
quadruped_small::{BodyType as QSBodyType, Species as QSSpecies},
|
||||
Item, ItemKind,
|
||||
Item, ItemKind, Loadout,
|
||||
},
|
||||
figure::{DynaUnionizer, MatSegment, Material, Segment},
|
||||
};
|
||||
@ -293,11 +293,21 @@ impl HumArmorShoulderSpec {
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
pub fn mesh_left_shoulder(&self, body: &Body) -> Mesh<FigurePipeline> {
|
||||
let spec = match self.0.get(&body.shoulder) {
|
||||
pub fn mesh_left_shoulder(&self, body: &Body, loadout: &Loadout) -> Mesh<FigurePipeline> {
|
||||
let shoulder = if let Some(ItemKind::Armor {
|
||||
kind: Armor::Shoulder(shoulder),
|
||||
..
|
||||
}) = loadout.shoulder.as_ref().map(|i| &i.kind)
|
||||
{
|
||||
shoulder
|
||||
} else {
|
||||
&Shoulder::None
|
||||
};
|
||||
|
||||
let spec = match self.0.get(&shoulder) {
|
||||
Some(spec) => spec,
|
||||
None => {
|
||||
error!("No shoulder specification exists for {:?}", body.shoulder);
|
||||
error!("No shoulder specification exists for {:?}", shoulder);
|
||||
return load_mesh("not_found", Vec3::new(-3.0, -3.5, 0.1));
|
||||
},
|
||||
};
|
||||
@ -312,11 +322,21 @@ impl HumArmorShoulderSpec {
|
||||
generate_mesh(&shoulder_segment, Vec3::from(spec.left.vox_spec.1))
|
||||
}
|
||||
|
||||
pub fn mesh_right_shoulder(&self, body: &Body) -> Mesh<FigurePipeline> {
|
||||
let spec = match self.0.get(&body.shoulder) {
|
||||
pub fn mesh_right_shoulder(&self, body: &Body, loadout: &Loadout) -> Mesh<FigurePipeline> {
|
||||
let shoulder = if let Some(ItemKind::Armor {
|
||||
kind: Armor::Shoulder(shoulder),
|
||||
..
|
||||
}) = loadout.shoulder.as_ref().map(|i| &i.kind)
|
||||
{
|
||||
shoulder
|
||||
} else {
|
||||
&Shoulder::None
|
||||
};
|
||||
|
||||
let spec = match self.0.get(&shoulder) {
|
||||
Some(spec) => spec,
|
||||
None => {
|
||||
error!("No shoulder specification exists for {:?}", body.shoulder);
|
||||
error!("No shoulder specification exists for {:?}", shoulder);
|
||||
return load_mesh("not_found", Vec3::new(-2.0, -3.5, 0.1));
|
||||
},
|
||||
};
|
||||
@ -338,11 +358,21 @@ impl HumArmorChestSpec {
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
pub fn mesh_chest(&self, body: &Body) -> Mesh<FigurePipeline> {
|
||||
let spec = match self.0.get(&body.chest) {
|
||||
pub fn mesh_chest(&self, body: &Body, loadout: &Loadout) -> Mesh<FigurePipeline> {
|
||||
let chest = if let Some(ItemKind::Armor {
|
||||
kind: Armor::Chest(chest),
|
||||
..
|
||||
}) = loadout.chest.as_ref().map(|i| &i.kind)
|
||||
{
|
||||
chest
|
||||
} else {
|
||||
&Chest::Blue
|
||||
};
|
||||
|
||||
let spec = match self.0.get(&chest) {
|
||||
Some(spec) => spec,
|
||||
None => {
|
||||
error!("No chest specification exists for {:?}", body.chest);
|
||||
error!("No chest specification exists for {:?}", loadout.chest);
|
||||
return load_mesh("not_found", Vec3::new(-7.0, -3.5, 2.0));
|
||||
},
|
||||
};
|
||||
@ -381,11 +411,21 @@ impl HumArmorHandSpec {
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
pub fn mesh_left_hand(&self, body: &Body) -> Mesh<FigurePipeline> {
|
||||
let spec = match self.0.get(&body.hand) {
|
||||
pub fn mesh_left_hand(&self, body: &Body, loadout: &Loadout) -> Mesh<FigurePipeline> {
|
||||
let hand = if let Some(ItemKind::Armor {
|
||||
kind: Armor::Hand(hand),
|
||||
..
|
||||
}) = loadout.hand.as_ref().map(|i| &i.kind)
|
||||
{
|
||||
hand
|
||||
} else {
|
||||
&Hand::Bare
|
||||
};
|
||||
|
||||
let spec = match self.0.get(&hand) {
|
||||
Some(spec) => spec,
|
||||
None => {
|
||||
error!("No hand specification exists for {:?}", body.hand);
|
||||
error!("No hand specification exists for {:?}", hand);
|
||||
return load_mesh("not_found", Vec3::new(-1.5, -1.5, -7.0));
|
||||
},
|
||||
};
|
||||
@ -400,11 +440,21 @@ impl HumArmorHandSpec {
|
||||
generate_mesh(&hand_segment, Vec3::from(spec.left.vox_spec.1))
|
||||
}
|
||||
|
||||
pub fn mesh_right_hand(&self, body: &Body) -> Mesh<FigurePipeline> {
|
||||
let spec = match self.0.get(&body.hand) {
|
||||
pub fn mesh_right_hand(&self, body: &Body, loadout: &Loadout) -> Mesh<FigurePipeline> {
|
||||
let hand = if let Some(ItemKind::Armor {
|
||||
kind: Armor::Hand(hand),
|
||||
..
|
||||
}) = loadout.hand.as_ref().map(|i| &i.kind)
|
||||
{
|
||||
hand
|
||||
} else {
|
||||
&Hand::Bare
|
||||
};
|
||||
|
||||
let spec = match self.0.get(&hand) {
|
||||
Some(spec) => spec,
|
||||
None => {
|
||||
error!("No hand specification exists for {:?}", body.hand);
|
||||
error!("No hand specification exists for {:?}", hand);
|
||||
return load_mesh("not_found", Vec3::new(-1.5, -1.5, -7.0));
|
||||
},
|
||||
};
|
||||
@ -426,11 +476,21 @@ impl HumArmorBeltSpec {
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
pub fn mesh_belt(&self, body: &Body) -> Mesh<FigurePipeline> {
|
||||
let spec = match self.0.get(&body.belt) {
|
||||
pub fn mesh_belt(&self, body: &Body, loadout: &Loadout) -> Mesh<FigurePipeline> {
|
||||
let belt = if let Some(ItemKind::Armor {
|
||||
kind: Armor::Belt(belt),
|
||||
..
|
||||
}) = loadout.belt.as_ref().map(|i| &i.kind)
|
||||
{
|
||||
belt
|
||||
} else {
|
||||
&Belt::Dark
|
||||
};
|
||||
|
||||
let spec = match self.0.get(&belt) {
|
||||
Some(spec) => spec,
|
||||
None => {
|
||||
error!("No belt specification exists for {:?}", body.belt);
|
||||
error!("No belt specification exists for {:?}", belt);
|
||||
return load_mesh("not_found", Vec3::new(-4.0, -3.5, 2.0));
|
||||
},
|
||||
};
|
||||
@ -452,11 +512,21 @@ impl HumArmorPantsSpec {
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
pub fn mesh_pants(&self, body: &Body) -> Mesh<FigurePipeline> {
|
||||
let spec = match self.0.get(&body.pants) {
|
||||
pub fn mesh_pants(&self, body: &Body, loadout: &Loadout) -> Mesh<FigurePipeline> {
|
||||
let pants = if let Some(ItemKind::Armor {
|
||||
kind: Armor::Pants(pants),
|
||||
..
|
||||
}) = loadout.pants.as_ref().map(|i| &i.kind)
|
||||
{
|
||||
pants
|
||||
} else {
|
||||
&Pants::Dark
|
||||
};
|
||||
|
||||
let spec = match self.0.get(&pants) {
|
||||
Some(spec) => spec,
|
||||
None => {
|
||||
error!("No pants specification exists for {:?}", body.pants);
|
||||
error!("No pants specification exists for {:?}", pants);
|
||||
return load_mesh("not_found", Vec3::new(-5.0, -3.5, 1.0));
|
||||
},
|
||||
};
|
||||
@ -495,11 +565,21 @@ impl HumArmorFootSpec {
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
pub fn mesh_left_foot(&self, body: &Body) -> Mesh<FigurePipeline> {
|
||||
let spec = match self.0.get(&body.foot) {
|
||||
pub fn mesh_left_foot(&self, body: &Body, loadout: &Loadout) -> Mesh<FigurePipeline> {
|
||||
let foot = if let Some(ItemKind::Armor {
|
||||
kind: Armor::Foot(foot),
|
||||
..
|
||||
}) = loadout.foot.as_ref().map(|i| &i.kind)
|
||||
{
|
||||
foot
|
||||
} else {
|
||||
&Foot::Bare
|
||||
};
|
||||
|
||||
let spec = match self.0.get(&foot) {
|
||||
Some(spec) => spec,
|
||||
None => {
|
||||
error!("No foot specification exists for {:?}", body.foot);
|
||||
error!("No foot specification exists for {:?}", foot);
|
||||
return load_mesh("not_found", Vec3::new(-2.5, -3.5, -9.0));
|
||||
},
|
||||
};
|
||||
@ -514,11 +594,21 @@ impl HumArmorFootSpec {
|
||||
generate_mesh(&foot_segment, Vec3::from(spec.vox_spec.1))
|
||||
}
|
||||
|
||||
pub fn mesh_right_foot(&self, body: &Body) -> Mesh<FigurePipeline> {
|
||||
let spec = match self.0.get(&body.foot) {
|
||||
pub fn mesh_right_foot(&self, body: &Body, loadout: &Loadout) -> Mesh<FigurePipeline> {
|
||||
let foot = if let Some(ItemKind::Armor {
|
||||
kind: Armor::Foot(foot),
|
||||
..
|
||||
}) = loadout.foot.as_ref().map(|i| &i.kind)
|
||||
{
|
||||
foot
|
||||
} else {
|
||||
&Foot::Bare
|
||||
};
|
||||
|
||||
let spec = match self.0.get(&foot) {
|
||||
Some(spec) => spec,
|
||||
None => {
|
||||
error!("No foot specification exists for {:?}", body.foot);
|
||||
error!("No foot specification exists for {:?}", foot);
|
||||
return load_mesh("not_found", Vec3::new(-2.5, -3.5, -9.0));
|
||||
},
|
||||
};
|
||||
|
@ -400,7 +400,7 @@ impl FigureMgr {
|
||||
.get_or_create_model(
|
||||
renderer,
|
||||
*body,
|
||||
active_item_kind,
|
||||
loadout,
|
||||
tick,
|
||||
CameraMode::default(),
|
||||
None,
|
||||
@ -580,7 +580,7 @@ impl FigureMgr {
|
||||
.get_or_create_model(
|
||||
renderer,
|
||||
*body,
|
||||
active_item_kind,
|
||||
loadout,
|
||||
tick,
|
||||
CameraMode::default(),
|
||||
None,
|
||||
@ -661,7 +661,7 @@ impl FigureMgr {
|
||||
.get_or_create_model(
|
||||
renderer,
|
||||
*body,
|
||||
active_item_kind,
|
||||
loadout,
|
||||
tick,
|
||||
CameraMode::default(),
|
||||
None,
|
||||
@ -744,7 +744,7 @@ impl FigureMgr {
|
||||
.get_or_create_model(
|
||||
renderer,
|
||||
*body,
|
||||
active_item_kind,
|
||||
loadout,
|
||||
tick,
|
||||
CameraMode::default(),
|
||||
None,
|
||||
@ -819,7 +819,7 @@ impl FigureMgr {
|
||||
.get_or_create_model(
|
||||
renderer,
|
||||
*body,
|
||||
active_item_kind,
|
||||
loadout,
|
||||
tick,
|
||||
CameraMode::default(),
|
||||
None,
|
||||
@ -894,7 +894,7 @@ impl FigureMgr {
|
||||
.get_or_create_model(
|
||||
renderer,
|
||||
*body,
|
||||
active_item_kind,
|
||||
loadout,
|
||||
tick,
|
||||
CameraMode::default(),
|
||||
None,
|
||||
@ -969,7 +969,7 @@ impl FigureMgr {
|
||||
.get_or_create_model(
|
||||
renderer,
|
||||
*body,
|
||||
active_item_kind,
|
||||
loadout,
|
||||
tick,
|
||||
CameraMode::default(),
|
||||
None,
|
||||
@ -1044,7 +1044,7 @@ impl FigureMgr {
|
||||
.get_or_create_model(
|
||||
renderer,
|
||||
*body,
|
||||
active_item_kind,
|
||||
loadout,
|
||||
tick,
|
||||
CameraMode::default(),
|
||||
None,
|
||||
@ -1119,7 +1119,7 @@ impl FigureMgr {
|
||||
.get_or_create_model(
|
||||
renderer,
|
||||
*body,
|
||||
active_item_kind,
|
||||
loadout,
|
||||
tick,
|
||||
CameraMode::default(),
|
||||
None,
|
||||
@ -1194,7 +1194,7 @@ impl FigureMgr {
|
||||
.get_or_create_model(
|
||||
renderer,
|
||||
*body,
|
||||
active_item_kind,
|
||||
loadout,
|
||||
tick,
|
||||
CameraMode::default(),
|
||||
None,
|
||||
@ -1386,7 +1386,7 @@ impl FigureMgr {
|
||||
.get_or_create_model(
|
||||
renderer,
|
||||
*body,
|
||||
active_item_kind,
|
||||
loadout,
|
||||
tick,
|
||||
player_camera_mode,
|
||||
character_state,
|
||||
@ -1402,7 +1402,7 @@ impl FigureMgr {
|
||||
.get_or_create_model(
|
||||
renderer,
|
||||
*body,
|
||||
active_item_kind,
|
||||
loadout,
|
||||
tick,
|
||||
player_camera_mode,
|
||||
character_state,
|
||||
@ -1418,7 +1418,7 @@ impl FigureMgr {
|
||||
.get_or_create_model(
|
||||
renderer,
|
||||
*body,
|
||||
active_item_kind,
|
||||
loadout,
|
||||
tick,
|
||||
player_camera_mode,
|
||||
character_state,
|
||||
@ -1434,7 +1434,7 @@ impl FigureMgr {
|
||||
.get_or_create_model(
|
||||
renderer,
|
||||
*body,
|
||||
active_item_kind,
|
||||
loadout,
|
||||
tick,
|
||||
player_camera_mode,
|
||||
character_state,
|
||||
@ -1450,7 +1450,7 @@ impl FigureMgr {
|
||||
.get_or_create_model(
|
||||
renderer,
|
||||
*body,
|
||||
active_item_kind,
|
||||
loadout,
|
||||
tick,
|
||||
player_camera_mode,
|
||||
character_state,
|
||||
@ -1466,7 +1466,7 @@ impl FigureMgr {
|
||||
.get_or_create_model(
|
||||
renderer,
|
||||
*body,
|
||||
active_item_kind,
|
||||
loadout,
|
||||
tick,
|
||||
player_camera_mode,
|
||||
character_state,
|
||||
@ -1482,7 +1482,7 @@ impl FigureMgr {
|
||||
.get_or_create_model(
|
||||
renderer,
|
||||
*body,
|
||||
active_item_kind,
|
||||
loadout,
|
||||
tick,
|
||||
player_camera_mode,
|
||||
character_state,
|
||||
@ -1498,7 +1498,7 @@ impl FigureMgr {
|
||||
.get_or_create_model(
|
||||
renderer,
|
||||
*body,
|
||||
active_item_kind,
|
||||
loadout,
|
||||
tick,
|
||||
player_camera_mode,
|
||||
character_state,
|
||||
@ -1514,7 +1514,7 @@ impl FigureMgr {
|
||||
.get_or_create_model(
|
||||
renderer,
|
||||
*body,
|
||||
active_item_kind,
|
||||
loadout,
|
||||
tick,
|
||||
player_camera_mode,
|
||||
character_state,
|
||||
@ -1530,7 +1530,7 @@ impl FigureMgr {
|
||||
.get_or_create_model(
|
||||
renderer,
|
||||
*body,
|
||||
active_item_kind,
|
||||
loadout,
|
||||
tick,
|
||||
player_camera_mode,
|
||||
character_state,
|
||||
@ -1546,7 +1546,7 @@ impl FigureMgr {
|
||||
.get_or_create_model(
|
||||
renderer,
|
||||
*body,
|
||||
active_item_kind,
|
||||
loadout,
|
||||
tick,
|
||||
player_camera_mode,
|
||||
character_state,
|
||||
|
@ -15,7 +15,7 @@ use crate::{
|
||||
window::{Event, PressState},
|
||||
};
|
||||
use common::{
|
||||
comp::{humanoid, Body, ItemKind},
|
||||
comp::{humanoid, Body, ItemKind, Loadout},
|
||||
terrain::BlockKind,
|
||||
vol::{BaseVol, ReadVol, Vox},
|
||||
};
|
||||
@ -208,7 +208,7 @@ impl Scene {
|
||||
renderer: &mut Renderer,
|
||||
tick: u64,
|
||||
body: Option<humanoid::Body>,
|
||||
active_item_kind: Option<&ItemKind>,
|
||||
loadout: Option<&Loadout>,
|
||||
) {
|
||||
renderer.render_skybox(&self.skybox.model, &self.globals, &self.skybox.locals);
|
||||
|
||||
@ -218,7 +218,7 @@ impl Scene {
|
||||
.get_or_create_model(
|
||||
renderer,
|
||||
Body::Humanoid(body),
|
||||
active_item_kind,
|
||||
loadout,
|
||||
tick,
|
||||
CameraMode::default(),
|
||||
None,
|
||||
|
Loading…
Reference in New Issue
Block a user