Fix body parts not changing

This commit is contained in:
timokoesters 2020-03-16 22:04:49 +01:00
parent 11e4289f28
commit b040e18246
5 changed files with 28 additions and 11 deletions

View File

@ -34,5 +34,9 @@
PlateGreen0: (
vox_spec: ("armor.chest.plate_green-0", (-7.0, -3.5, 2.0)),
color: None
),
None: (
vox_spec: ("armor.chest.none", (-7.0, -3.5, 2.0)),
color: None
)
})
})

View File

@ -483,6 +483,7 @@ pub enum Chest {
Kimono = 6,
Assassin = 7,
PlateGreen0 = 8,
None = 9,
}
pub const ALL_CHESTS: [Chest; 9] = [
Chest::Blue,

View File

@ -210,7 +210,7 @@ impl<'a> System<'a> for Sys {
primary_ability: Some(CharacterAbility::BasicMelee {
buildup_duration: Duration::from_millis(50),
recover_duration: Duration::from_millis(50),
base_damage: 10,
base_damage: 1,
}),
secondary_ability: None,
block_ability: None,
@ -251,7 +251,7 @@ impl<'a> System<'a> for Sys {
primary_ability: Some(CharacterAbility::BasicMelee {
buildup_duration: Duration::from_millis(800),
recover_duration: Duration::from_millis(200),
base_damage: 130,
base_damage: 13,
}),
secondary_ability: None,
block_ability: None,

View File

@ -6,7 +6,7 @@ use crate::{
};
use common::{
assets::watch::ReloadIndicator,
comp::{Body, CharacterState, ItemKind, Loadout, ToolKind},
comp::{Body, CharacterState, Item, ItemKind, Loadout, ToolKind},
};
use hashbrown::{hash_map::Entry, HashMap};
use std::{
@ -17,19 +17,25 @@ use std::{
#[derive(PartialEq, Eq, Hash, Clone)]
enum FigureKey {
Simple(Body),
Complex(Body, CameraMode, Option<CharacterCacheKey>),
Complex(Body, CameraMode, CharacterCacheKey),
}
#[derive(PartialEq, Eq, Hash, Clone)]
struct CharacterCacheKey {
state: Discriminant<CharacterState>, // TODO: Can this be simplified?
active_tool: Option<Discriminant<ToolKind>>, // TODO: Can this be simplified?
state: Option<Discriminant<CharacterState>>, // TODO: Can this be simplified?
active_tool: Option<Discriminant<ToolKind>>,
shoulder: Option<Item>,
chest: Option<Item>,
belt: Option<Item>,
hand: Option<Item>,
pants: Option<Item>,
foot: Option<Item>,
}
impl CharacterCacheKey {
fn from(cs: &CharacterState, loadout: &Loadout) -> Self {
fn from(cs: Option<&CharacterState>, loadout: &Loadout) -> Self {
Self {
state: discriminant(&cs),
state: cs.map(|cs| discriminant(cs)),
active_tool: if let Some(ItemKind::Tool(tool)) =
loadout.active_item.as_ref().map(|i| &i.item.kind)
{
@ -37,6 +43,12 @@ impl CharacterCacheKey {
} else {
None
},
shoulder: loadout.shoulder.clone(),
chest: loadout.chest.clone(),
belt: loadout.belt.clone(),
hand: loadout.hand.clone(),
pants: loadout.pants.clone(),
foot: loadout.foot.clone(),
}
}
}
@ -74,7 +86,7 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
FigureKey::Complex(
body,
camera_mode,
character_state.map(|cs| CharacterCacheKey::from(cs, loadout)),
CharacterCacheKey::from(character_state, loadout),
)
} else {
FigureKey::Simple(body)

View File

@ -366,7 +366,7 @@ impl HumArmorChestSpec {
{
chest
} else {
&Chest::Blue
&Chest::None
};
let spec = match self.0.get(&chest) {