Merge branch 'cultists-hotfix' into 'master'

Shoulder offsets, meta.ron versioning

See merge request veloren/veloren!959
This commit is contained in:
Monty Marz 2020-05-01 21:27:12 +00:00
commit 40ab94673e
7 changed files with 34 additions and 24 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -113,21 +113,21 @@
),
CultistPurple: (
left: (
vox_spec: ("armor.shoulder.cultist_right", (-2.0, -3.5, 1.0)),
vox_spec: ("armor.shoulder.cultist_right", (-2.0, -3.5, 0.0)),
color: Some((30, 0, 64))
),
right: (
vox_spec: ("armor.shoulder.cultist_right", (-2.9, -3.5, 1.0)),
vox_spec: ("armor.shoulder.cultist_right", (-2.9, -3.5, 0.0)),
color: Some((30, 0, 64))
)
),
CultistBlue: (
left: (
vox_spec: ("armor.shoulder.cultist_right", (-2.0, -3.5, 1.0)),
vox_spec: ("armor.shoulder.cultist_right", (-2.0, -3.5, 0.0)),
color: Some((57, 81, 132))
),
right: (
vox_spec: ("armor.shoulder.cultist_right", (-2.9, -3.5, 1.0)),
vox_spec: ("armor.shoulder.cultist_right", (-2.9, -3.5, 0.0)),
color: Some((57, 81, 132))
)
),

View File

@ -1,3 +1,6 @@
// Note: If you changes here "break" old character saves you can change the
// version in voxygen\src\meta.rs in order to reset save files to being empty
use crate::comp::{
body::object, projectile, Body, CharacterAbility, Gravity, HealthChange, HealthSource,
LightEmitter, Projectile,

View File

@ -31,6 +31,7 @@ pub use self::{
use super::{Bone, Skeleton};
use crate::render::FigureBoneData;
use common::comp;
#[derive(Clone, Default)]
pub struct CharacterSkeleton {
head: Bone,
@ -167,18 +168,18 @@ impl SkeletonAttr {
pub fn calculate_scale(body: &comp::humanoid::Body) -> f32 {
use comp::humanoid::{BodyType::*, Race::*};
match (body.race, body.body_type) {
(Orc, Male) => 0.95 * 1.2,
(Orc, Female) => 0.85 * 1.2,
(Human, Male) => 0.85 * 1.2,
(Human, Female) => 0.8 * 1.2,
(Elf, Male) => 0.85 * 1.2,
(Elf, Female) => 0.8 * 1.2,
(Dwarf, Male) => 0.7 * 1.2,
(Dwarf, Female) => 0.65 * 1.2,
(Undead, Male) => 0.8 * 1.2,
(Undead, Female) => 0.75 * 1.2,
(Danari, Male) => 0.58 * 1.2,
(Danari, Female) => 0.58 * 1.2,
(Orc, Male) => 1.14,
(Orc, Female) => 1.02,
(Human, Male) => 1.02,
(Human, Female) => 0.96,
(Elf, Male) => 1.02,
(Elf, Female) => 0.96,
(Dwarf, Male) => 0.84,
(Dwarf, Female) => 0.78,
(Undead, Male) => 0.96,
(Undead, Female) => 0.9,
(Danari, Male) => 0.696,
(Danari, Female) => 0.696,
}
}
}
@ -206,7 +207,7 @@ impl<'a> From<&'a comp::humanoid::Body> for SkeletonAttr {
(Orc, Male) => (0.0, 14.0),
(Orc, Female) => (0.0, 14.0),
(Human, Male) => (0.3, 13.5),
(Human, Female) => (-0.6, 13.5),
(Human, Female) => (0.0, 13.8),
(Elf, Male) => (0.0, 13.5),
(Elf, Female) => (0.0, 13.5),
(Dwarf, Male) => (0.0, 14.5),

View File

@ -4,6 +4,7 @@ use log::warn;
use serde_derive::{Deserialize, Serialize};
use std::{fs, io::Write, path::PathBuf};
const VALID_VERSION: u32 = 0; // Change this if you broke charsaves
#[derive(Clone, Debug, Serialize, Deserialize)]
#[repr(C)]
pub struct CharacterData {
@ -13,11 +14,12 @@ pub struct CharacterData {
}
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
#[serde(default)]
//#[serde(default)]
#[repr(C)]
pub struct Meta {
pub characters: Vec<CharacterData>,
pub selected_character: usize,
pub version: u32,
}
impl Meta {
@ -38,8 +40,12 @@ impl Meta {
let path = Self::get_meta_path();
if let Ok(file) = fs::File::open(&path) {
match ron::de::from_reader(file) {
Ok(s) => return s,
match ron::de::from_reader::<_, Meta>(file) {
Ok(s) => {
if s.version == VALID_VERSION {
return s;
}
},
Err(e) => {
log::warn!("Failed to parse meta file! Fallback to default. {}", e);
// Rename the corrupted settings file