mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Altered Item structure
This commit is contained in:
parent
995090d2d4
commit
331b6c8b3a
@ -2,7 +2,7 @@ use specs::{Component, FlaggedStorage};
|
|||||||
use specs_idvs::IDVStorage;
|
use specs_idvs::IDVStorage;
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
pub enum Weapon {
|
pub enum Tool {
|
||||||
Daggers,
|
Daggers,
|
||||||
SwordShield,
|
SwordShield,
|
||||||
Sword,
|
Sword,
|
||||||
@ -11,14 +11,29 @@ pub enum Weapon {
|
|||||||
Bow,
|
Bow,
|
||||||
Staff,
|
Staff,
|
||||||
}
|
}
|
||||||
pub const ALL_WEAPONS: [Weapon; 7] = [
|
|
||||||
Weapon::Daggers,
|
impl Tool {
|
||||||
Weapon::SwordShield,
|
pub fn name(&self) -> &'static str {
|
||||||
Weapon::Sword,
|
match self {
|
||||||
Weapon::Axe,
|
Tool::Daggers => "daggers",
|
||||||
Weapon::Hammer,
|
Tool::SwordShield => "sword and shield",
|
||||||
Weapon::Bow,
|
Tool::Sword => "sword",
|
||||||
Weapon::Staff,
|
Tool::Axe => "axe",
|
||||||
|
Tool::Hammer => "hammer",
|
||||||
|
Tool::Bow => "bow",
|
||||||
|
Tool::Staff => "staff",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const ALL_TOOLS: [Tool; 7] = [
|
||||||
|
Tool::Daggers,
|
||||||
|
Tool::SwordShield,
|
||||||
|
Tool::Sword,
|
||||||
|
Tool::Axe,
|
||||||
|
Tool::Hammer,
|
||||||
|
Tool::Bow,
|
||||||
|
Tool::Staff,
|
||||||
];
|
];
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
@ -37,10 +52,34 @@ pub enum Armor {
|
|||||||
Necklace,
|
Necklace,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Armor {
|
||||||
|
pub fn name(&self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
Armor::Helmet => "helmet",
|
||||||
|
Armor::Shoulders => "shoulder pads",
|
||||||
|
Armor::Chestplate => "chestplate",
|
||||||
|
Armor::Belt => "belt",
|
||||||
|
Armor::Gloves => "gloves",
|
||||||
|
Armor::Pants => "pants",
|
||||||
|
Armor::Boots => "boots",
|
||||||
|
Armor::Back => "back",
|
||||||
|
Armor::Tabard => "tabard",
|
||||||
|
Armor::Gem => "gem",
|
||||||
|
Armor::Necklace => "necklace",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
|
pub enum ConsumptionEffect {
|
||||||
|
Health(i32),
|
||||||
|
Xp(i32),
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
pub enum Item {
|
pub enum Item {
|
||||||
Weapon {
|
Tool {
|
||||||
kind: Weapon,
|
kind: Tool,
|
||||||
damage: i32,
|
damage: i32,
|
||||||
strength: i32,
|
strength: i32,
|
||||||
},
|
},
|
||||||
@ -49,12 +88,40 @@ pub enum Item {
|
|||||||
defense: i32,
|
defense: i32,
|
||||||
health_bonus: i32,
|
health_bonus: i32,
|
||||||
},
|
},
|
||||||
|
Consumable {
|
||||||
|
effect: ConsumptionEffect,
|
||||||
|
},
|
||||||
|
Ingredient,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Item {
|
||||||
|
pub fn name(&self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
Item::Tool { kind, .. } => kind.name(),
|
||||||
|
Item::Armor { kind, .. } => kind.name(),
|
||||||
|
Item::Consumable { .. } => "<consumable>",
|
||||||
|
Item::Ingredient => "<ingredient>",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn category(&self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
Item::Tool { .. } => "tool",
|
||||||
|
Item::Armor { .. } => "armour",
|
||||||
|
Item::Consumable { .. } => "consumable",
|
||||||
|
Item::Ingredient => "ingredient",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn description(&self) -> String {
|
||||||
|
format!("{} ({})", self.name(), self.category())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Item {
|
impl Default for Item {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Item::Weapon {
|
Item::Tool {
|
||||||
kind: Weapon::Hammer,
|
kind: Tool::Hammer,
|
||||||
damage: 0,
|
damage: 0,
|
||||||
strength: 0,
|
strength: 0,
|
||||||
}
|
}
|
||||||
|
@ -547,7 +547,7 @@ fn handle_object(server: &mut Server, entity: EcsEntity, args: String, _action:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
server
|
server
|
||||||
.create_object(pos, ori, obj_type)
|
.create_object(pos, obj_type)
|
||||||
.with(comp::Ori(
|
.with(comp::Ori(
|
||||||
// converts player orientation into a 90° rotation for the object by using the axis with the highest value
|
// converts player orientation into a 90° rotation for the object by using the axis with the highest value
|
||||||
ori.0
|
ori.0
|
||||||
|
@ -155,14 +155,12 @@ impl Server {
|
|||||||
pub fn create_object(
|
pub fn create_object(
|
||||||
&mut self,
|
&mut self,
|
||||||
pos: comp::Pos,
|
pos: comp::Pos,
|
||||||
ori: comp::Ori,
|
|
||||||
object: comp::object::Body,
|
object: comp::object::Body,
|
||||||
) -> EcsEntityBuilder {
|
) -> EcsEntityBuilder {
|
||||||
self.state
|
self.state
|
||||||
.ecs_mut()
|
.ecs_mut()
|
||||||
.create_entity_synced()
|
.create_entity_synced()
|
||||||
.with(pos)
|
.with(pos)
|
||||||
.with(ori)
|
|
||||||
.with(comp::Vel(Vec3::zero()))
|
.with(comp::Vel(Vec3::zero()))
|
||||||
.with(comp::Ori(Vec3::unit_y()))
|
.with(comp::Ori(Vec3::unit_y()))
|
||||||
.with(comp::Body::Object(object))
|
.with(comp::Body::Object(object))
|
||||||
|
@ -2,7 +2,7 @@ use super::{
|
|||||||
super::{Animation, SkeletonAttr},
|
super::{Animation, SkeletonAttr},
|
||||||
CharacterSkeleton,
|
CharacterSkeleton,
|
||||||
};
|
};
|
||||||
use common::comp::item::Weapon;
|
use common::comp::item::Tool;
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{f32::consts::PI, ops::Mul};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
@ -61,9 +61,9 @@ impl Animation for CidleAnimation {
|
|||||||
next.shorts.ori = Quaternion::rotation_x(0.0);
|
next.shorts.ori = Quaternion::rotation_x(0.0);
|
||||||
next.shorts.scale = Vec3::one();
|
next.shorts.scale = Vec3::one();
|
||||||
|
|
||||||
match Weapon::Hammer {
|
match Tool::Hammer {
|
||||||
//TODO: Inventory
|
//TODO: Inventory
|
||||||
Weapon::Sword => {
|
Tool::Sword => {
|
||||||
next.l_hand.offset = Vec3::new(
|
next.l_hand.offset = Vec3::new(
|
||||||
-6.0 + wave_ultra_slow_cos * 1.0,
|
-6.0 + wave_ultra_slow_cos * 1.0,
|
||||||
3.5 + wave_ultra_slow_cos * 0.5,
|
3.5 + wave_ultra_slow_cos * 0.5,
|
||||||
@ -88,7 +88,7 @@ impl Animation for CidleAnimation {
|
|||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
next.weapon.scale = Vec3::one();
|
next.weapon.scale = Vec3::one();
|
||||||
}
|
}
|
||||||
Weapon::Axe => {
|
Tool::Axe => {
|
||||||
next.l_hand.offset = Vec3::new(
|
next.l_hand.offset = Vec3::new(
|
||||||
-6.0 + wave_ultra_slow_cos * 1.0,
|
-6.0 + wave_ultra_slow_cos * 1.0,
|
||||||
3.5 + wave_ultra_slow_cos * 0.5,
|
3.5 + wave_ultra_slow_cos * 0.5,
|
||||||
@ -113,7 +113,7 @@ impl Animation for CidleAnimation {
|
|||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
next.weapon.scale = Vec3::one();
|
next.weapon.scale = Vec3::one();
|
||||||
}
|
}
|
||||||
Weapon::Hammer => {
|
Tool::Hammer => {
|
||||||
next.l_hand.offset = Vec3::new(-7.0, 8.25, 2.0);
|
next.l_hand.offset = Vec3::new(-7.0, 8.25, 2.0);
|
||||||
next.l_hand.ori = Quaternion::rotation_x(-0.3)
|
next.l_hand.ori = Quaternion::rotation_x(-0.3)
|
||||||
* Quaternion::rotation_y(-1.2)
|
* Quaternion::rotation_y(-1.2)
|
||||||
@ -134,7 +134,7 @@ impl Animation for CidleAnimation {
|
|||||||
* Quaternion::rotation_z(wave_ultra_slow * 0.2);
|
* Quaternion::rotation_z(wave_ultra_slow * 0.2);
|
||||||
next.weapon.scale = Vec3::one();
|
next.weapon.scale = Vec3::one();
|
||||||
}
|
}
|
||||||
Weapon::Staff => {
|
Tool::Staff => {
|
||||||
next.l_hand.offset = Vec3::new(
|
next.l_hand.offset = Vec3::new(
|
||||||
-6.0 + wave_ultra_slow_cos * 1.0,
|
-6.0 + wave_ultra_slow_cos * 1.0,
|
||||||
3.5 + wave_ultra_slow_cos * 0.5,
|
3.5 + wave_ultra_slow_cos * 0.5,
|
||||||
@ -159,7 +159,7 @@ impl Animation for CidleAnimation {
|
|||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
next.weapon.scale = Vec3::one();
|
next.weapon.scale = Vec3::one();
|
||||||
}
|
}
|
||||||
Weapon::SwordShield => {
|
Tool::SwordShield => {
|
||||||
next.l_hand.offset = Vec3::new(
|
next.l_hand.offset = Vec3::new(
|
||||||
-6.0 + wave_ultra_slow_cos * 1.0,
|
-6.0 + wave_ultra_slow_cos * 1.0,
|
||||||
3.5 + wave_ultra_slow_cos * 0.5,
|
3.5 + wave_ultra_slow_cos * 0.5,
|
||||||
@ -184,7 +184,7 @@ impl Animation for CidleAnimation {
|
|||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
next.weapon.scale = Vec3::one();
|
next.weapon.scale = Vec3::one();
|
||||||
}
|
}
|
||||||
Weapon::Bow => {
|
Tool::Bow => {
|
||||||
next.l_hand.offset = Vec3::new(
|
next.l_hand.offset = Vec3::new(
|
||||||
-6.0 + wave_ultra_slow_cos * 1.0,
|
-6.0 + wave_ultra_slow_cos * 1.0,
|
||||||
3.5 + wave_ultra_slow_cos * 0.5,
|
3.5 + wave_ultra_slow_cos * 0.5,
|
||||||
@ -209,7 +209,7 @@ impl Animation for CidleAnimation {
|
|||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
next.weapon.scale = Vec3::one();
|
next.weapon.scale = Vec3::one();
|
||||||
}
|
}
|
||||||
Weapon::Daggers => {
|
Tool::Daggers => {
|
||||||
next.l_hand.offset = Vec3::new(
|
next.l_hand.offset = Vec3::new(
|
||||||
-6.0 + wave_ultra_slow_cos * 1.0,
|
-6.0 + wave_ultra_slow_cos * 1.0,
|
||||||
3.5 + wave_ultra_slow_cos * 0.5,
|
3.5 + wave_ultra_slow_cos * 0.5,
|
||||||
|
@ -2,7 +2,7 @@ use super::{
|
|||||||
super::{Animation, SkeletonAttr},
|
super::{Animation, SkeletonAttr},
|
||||||
CharacterSkeleton,
|
CharacterSkeleton,
|
||||||
};
|
};
|
||||||
use common::comp::item::Weapon;
|
use common::comp::item::Tool;
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
@ -43,9 +43,9 @@ impl Animation for CjumpAnimation {
|
|||||||
next.shorts.ori = Quaternion::rotation_z(0.0);
|
next.shorts.ori = Quaternion::rotation_z(0.0);
|
||||||
next.shorts.scale = Vec3::one();
|
next.shorts.scale = Vec3::one();
|
||||||
|
|
||||||
match Weapon::Hammer {
|
match Tool::Hammer {
|
||||||
//TODO: Inventory
|
//TODO: Inventory
|
||||||
Weapon::Sword => {
|
Tool::Sword => {
|
||||||
next.l_hand.offset = Vec3::new(-7.0, 3.25, 0.25 + wave_stop * 2.0);
|
next.l_hand.offset = Vec3::new(-7.0, 3.25, 0.25 + wave_stop * 2.0);
|
||||||
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
||||||
next.l_hand.scale = Vec3::one() * 1.01;
|
next.l_hand.scale = Vec3::one() * 1.01;
|
||||||
@ -62,7 +62,7 @@ impl Animation for CjumpAnimation {
|
|||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
next.weapon.scale = Vec3::one();
|
next.weapon.scale = Vec3::one();
|
||||||
}
|
}
|
||||||
Weapon::Axe => {
|
Tool::Axe => {
|
||||||
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0);
|
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0);
|
||||||
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
||||||
next.l_hand.scale = Vec3::one() * 1.01;
|
next.l_hand.scale = Vec3::one() * 1.01;
|
||||||
@ -79,7 +79,7 @@ impl Animation for CjumpAnimation {
|
|||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
next.weapon.scale = Vec3::one();
|
next.weapon.scale = Vec3::one();
|
||||||
}
|
}
|
||||||
Weapon::Hammer => {
|
Tool::Hammer => {
|
||||||
next.l_hand.offset = Vec3::new(-7.0, 8.25, 2.0 + wave_stop * 2.0);
|
next.l_hand.offset = Vec3::new(-7.0, 8.25, 2.0 + wave_stop * 2.0);
|
||||||
next.l_hand.ori = Quaternion::rotation_x(-0.3)
|
next.l_hand.ori = Quaternion::rotation_x(-0.3)
|
||||||
* Quaternion::rotation_y(-1.2)
|
* Quaternion::rotation_y(-1.2)
|
||||||
@ -100,7 +100,7 @@ impl Animation for CjumpAnimation {
|
|||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
next.weapon.scale = Vec3::one();
|
next.weapon.scale = Vec3::one();
|
||||||
}
|
}
|
||||||
Weapon::Staff => {
|
Tool::Staff => {
|
||||||
next.l_hand.offset = Vec3::new(-7.0, 7.5, 0.0);
|
next.l_hand.offset = Vec3::new(-7.0, 7.5, 0.0);
|
||||||
next.l_hand.ori = Quaternion::rotation_x(-0.3)
|
next.l_hand.ori = Quaternion::rotation_x(-0.3)
|
||||||
* Quaternion::rotation_y(-1.7)
|
* Quaternion::rotation_y(-1.7)
|
||||||
@ -121,7 +121,7 @@ impl Animation for CjumpAnimation {
|
|||||||
* Quaternion::rotation_z(1.0);
|
* Quaternion::rotation_z(1.0);
|
||||||
next.weapon.scale = Vec3::one();
|
next.weapon.scale = Vec3::one();
|
||||||
}
|
}
|
||||||
Weapon::SwordShield => {
|
Tool::SwordShield => {
|
||||||
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0);
|
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0);
|
||||||
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
||||||
next.l_hand.scale = Vec3::one() * 1.01;
|
next.l_hand.scale = Vec3::one() * 1.01;
|
||||||
@ -138,7 +138,7 @@ impl Animation for CjumpAnimation {
|
|||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
next.weapon.scale = Vec3::one();
|
next.weapon.scale = Vec3::one();
|
||||||
}
|
}
|
||||||
Weapon::Bow => {
|
Tool::Bow => {
|
||||||
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0);
|
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0);
|
||||||
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
||||||
next.l_hand.scale = Vec3::one() * 1.01;
|
next.l_hand.scale = Vec3::one() * 1.01;
|
||||||
@ -155,7 +155,7 @@ impl Animation for CjumpAnimation {
|
|||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
next.weapon.scale = Vec3::one();
|
next.weapon.scale = Vec3::one();
|
||||||
}
|
}
|
||||||
Weapon::Daggers => {
|
Tool::Daggers => {
|
||||||
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0);
|
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0);
|
||||||
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
||||||
next.l_hand.scale = Vec3::one() * 1.01;
|
next.l_hand.scale = Vec3::one() * 1.01;
|
||||||
|
@ -2,7 +2,7 @@ use super::{
|
|||||||
super::{Animation, SkeletonAttr},
|
super::{Animation, SkeletonAttr},
|
||||||
CharacterSkeleton,
|
CharacterSkeleton,
|
||||||
};
|
};
|
||||||
use common::comp::item::Weapon;
|
use common::comp::item::Tool;
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
use std::ops::Mul;
|
use std::ops::Mul;
|
||||||
use vek::*;
|
use vek::*;
|
||||||
@ -61,9 +61,9 @@ impl Animation for CrunAnimation {
|
|||||||
next.shorts.ori = Quaternion::rotation_z(wave * 0.6);
|
next.shorts.ori = Quaternion::rotation_z(wave * 0.6);
|
||||||
next.shorts.scale = Vec3::one();
|
next.shorts.scale = Vec3::one();
|
||||||
|
|
||||||
match Weapon::Hammer {
|
match Tool::Hammer {
|
||||||
//TODO: Inventory
|
//TODO: Inventory
|
||||||
Weapon::Sword => {
|
Tool::Sword => {
|
||||||
next.l_hand.offset = Vec3::new(-6.0, 3.75, 0.25);
|
next.l_hand.offset = Vec3::new(-6.0, 3.75, 0.25);
|
||||||
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
||||||
next.l_hand.scale = Vec3::one() * 1.01;
|
next.l_hand.scale = Vec3::one() * 1.01;
|
||||||
@ -80,7 +80,7 @@ impl Animation for CrunAnimation {
|
|||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
next.weapon.scale = Vec3::one();
|
next.weapon.scale = Vec3::one();
|
||||||
}
|
}
|
||||||
Weapon::Axe => {
|
Tool::Axe => {
|
||||||
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0);
|
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0);
|
||||||
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
||||||
next.l_hand.scale = Vec3::one() * 1.01;
|
next.l_hand.scale = Vec3::one() * 1.01;
|
||||||
@ -97,7 +97,7 @@ impl Animation for CrunAnimation {
|
|||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
next.weapon.scale = Vec3::one();
|
next.weapon.scale = Vec3::one();
|
||||||
}
|
}
|
||||||
Weapon::Hammer => {
|
Tool::Hammer => {
|
||||||
next.l_hand.offset = Vec3::new(-7.0, 8.25, 3.0);
|
next.l_hand.offset = Vec3::new(-7.0, 8.25, 3.0);
|
||||||
next.l_hand.ori = Quaternion::rotation_x(-0.3)
|
next.l_hand.ori = Quaternion::rotation_x(-0.3)
|
||||||
* Quaternion::rotation_y(-1.2)
|
* Quaternion::rotation_y(-1.2)
|
||||||
@ -118,7 +118,7 @@ impl Animation for CrunAnimation {
|
|||||||
* Quaternion::rotation_z(wave * -0.25);
|
* Quaternion::rotation_z(wave * -0.25);
|
||||||
next.weapon.scale = Vec3::one();
|
next.weapon.scale = Vec3::one();
|
||||||
}
|
}
|
||||||
Weapon::Staff => {
|
Tool::Staff => {
|
||||||
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0);
|
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0);
|
||||||
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
||||||
next.l_hand.scale = Vec3::one() * 1.01;
|
next.l_hand.scale = Vec3::one() * 1.01;
|
||||||
@ -135,7 +135,7 @@ impl Animation for CrunAnimation {
|
|||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
next.weapon.scale = Vec3::one();
|
next.weapon.scale = Vec3::one();
|
||||||
}
|
}
|
||||||
Weapon::SwordShield => {
|
Tool::SwordShield => {
|
||||||
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0);
|
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0);
|
||||||
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
||||||
next.l_hand.scale = Vec3::one() * 1.01;
|
next.l_hand.scale = Vec3::one() * 1.01;
|
||||||
@ -152,7 +152,7 @@ impl Animation for CrunAnimation {
|
|||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
next.weapon.scale = Vec3::one();
|
next.weapon.scale = Vec3::one();
|
||||||
}
|
}
|
||||||
Weapon::Bow => {
|
Tool::Bow => {
|
||||||
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0);
|
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0);
|
||||||
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
||||||
next.l_hand.scale = Vec3::one() * 1.01;
|
next.l_hand.scale = Vec3::one() * 1.01;
|
||||||
@ -169,7 +169,7 @@ impl Animation for CrunAnimation {
|
|||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
next.weapon.scale = Vec3::one();
|
next.weapon.scale = Vec3::one();
|
||||||
}
|
}
|
||||||
Weapon::Daggers => {
|
Tool::Daggers => {
|
||||||
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0);
|
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0);
|
||||||
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
||||||
next.l_hand.scale = Vec3::one() * 1.01;
|
next.l_hand.scale = Vec3::one() * 1.01;
|
||||||
|
@ -5,7 +5,7 @@ pub mod quadruped;
|
|||||||
pub mod quadrupedmedium;
|
pub mod quadrupedmedium;
|
||||||
|
|
||||||
use crate::render::FigureBoneData;
|
use crate::render::FigureBoneData;
|
||||||
use common::comp::{self, item::Weapon};
|
use common::comp::{self, item::Tool};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
@ -145,25 +145,25 @@ impl<'a> From<&'a comp::humanoid::Body> for SkeletonAttr {
|
|||||||
(Danari, Male) => 0.0,
|
(Danari, Male) => 0.0,
|
||||||
(Danari, Female) => 0.0,
|
(Danari, Female) => 0.0,
|
||||||
},
|
},
|
||||||
weapon_x: match Weapon::Hammer {
|
weapon_x: match Tool::Hammer {
|
||||||
// TODO: Inventory
|
// TODO: Inventory
|
||||||
Weapon::Sword => 0.0,
|
Tool::Sword => 0.0,
|
||||||
Weapon::Axe => 3.0,
|
Tool::Axe => 3.0,
|
||||||
Weapon::Hammer => 0.0,
|
Tool::Hammer => 0.0,
|
||||||
Weapon::SwordShield => 3.0,
|
Tool::SwordShield => 3.0,
|
||||||
Weapon::Staff => 3.0,
|
Tool::Staff => 3.0,
|
||||||
Weapon::Bow => 0.0,
|
Tool::Bow => 0.0,
|
||||||
Weapon::Daggers => 0.0,
|
Tool::Daggers => 0.0,
|
||||||
},
|
},
|
||||||
weapon_y: match Weapon::Hammer {
|
weapon_y: match Tool::Hammer {
|
||||||
// TODO: Inventory
|
// TODO: Inventory
|
||||||
Weapon::Sword => -1.25,
|
Tool::Sword => -1.25,
|
||||||
Weapon::Axe => 0.0,
|
Tool::Axe => 0.0,
|
||||||
Weapon::Hammer => -2.0,
|
Tool::Hammer => -2.0,
|
||||||
Weapon::SwordShield => 0.0,
|
Tool::SwordShield => 0.0,
|
||||||
Weapon::Staff => 0.0,
|
Tool::Staff => 0.0,
|
||||||
Weapon::Bow => -2.0,
|
Tool::Bow => -2.0,
|
||||||
Weapon::Daggers => -2.0,
|
Tool::Daggers => -2.0,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ use crate::{
|
|||||||
GlobalState,
|
GlobalState,
|
||||||
};
|
};
|
||||||
use client::Client;
|
use client::Client;
|
||||||
use common::comp::{humanoid, item::Weapon};
|
use common::comp::{humanoid, item::Tool};
|
||||||
use conrod_core::{
|
use conrod_core::{
|
||||||
color,
|
color,
|
||||||
color::TRANSPARENT,
|
color::TRANSPARENT,
|
||||||
@ -109,7 +109,7 @@ widget_ids! {
|
|||||||
body_type_1,
|
body_type_1,
|
||||||
body_type_2,
|
body_type_2,
|
||||||
|
|
||||||
// Weapons
|
// Tools
|
||||||
sword,
|
sword,
|
||||||
sword_button,
|
sword_button,
|
||||||
daggers,
|
daggers,
|
||||||
@ -152,7 +152,7 @@ image_ids! {
|
|||||||
slider_range: "voxygen/element/slider/track.png",
|
slider_range: "voxygen/element/slider/track.png",
|
||||||
slider_indicator: "voxygen/element/slider/indicator.png",
|
slider_indicator: "voxygen/element/slider/indicator.png",
|
||||||
|
|
||||||
// Weapon Icons
|
// Tool Icons
|
||||||
daggers: "voxygen/element/icons/daggers.png",
|
daggers: "voxygen/element/icons/daggers.png",
|
||||||
sword: "voxygen/element/icons/sword.png",
|
sword: "voxygen/element/icons/sword.png",
|
||||||
axe: "voxygen/element/icons/axe.png",
|
axe: "voxygen/element/icons/axe.png",
|
||||||
@ -209,7 +209,7 @@ pub struct CharSelectionUi {
|
|||||||
character_creation: bool,
|
character_creation: bool,
|
||||||
pub character_name: String,
|
pub character_name: String,
|
||||||
pub character_body: humanoid::Body,
|
pub character_body: humanoid::Body,
|
||||||
pub character_weapon: Weapon, // TODO: Move into ecs inventory struct?
|
pub character_weapon: Tool, // TODO: Move into ecs inventory struct?
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CharSelectionUi {
|
impl CharSelectionUi {
|
||||||
@ -235,7 +235,7 @@ impl CharSelectionUi {
|
|||||||
character_creation: false,
|
character_creation: false,
|
||||||
character_name: "Character Name".to_string(),
|
character_name: "Character Name".to_string(),
|
||||||
character_body: humanoid::Body::random(),
|
character_body: humanoid::Body::random(),
|
||||||
character_weapon: Weapon::Sword,
|
character_weapon: Tool::Sword,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,7 +344,7 @@ impl CharSelectionUi {
|
|||||||
.was_clicked()
|
.was_clicked()
|
||||||
{
|
{
|
||||||
self.character_creation = true;
|
self.character_creation = true;
|
||||||
self.character_weapon = Weapon::Sword;
|
self.character_weapon = Tool::Sword;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alpha Version
|
// Alpha Version
|
||||||
@ -553,7 +553,7 @@ impl CharSelectionUi {
|
|||||||
self.character_body.body_type = humanoid::BodyType::Female;
|
self.character_body.body_type = humanoid::BodyType::Female;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alignment for Races and Weapons
|
// Alignment for Races and Tools
|
||||||
Rectangle::fill_with([214.0, 304.0], color::TRANSPARENT)
|
Rectangle::fill_with([214.0, 304.0], color::TRANSPARENT)
|
||||||
.mid_bottom_with_margin_on(self.ids.creation_buttons_alignment_1, -324.0)
|
.mid_bottom_with_margin_on(self.ids.creation_buttons_alignment_1, -324.0)
|
||||||
.set(self.ids.creation_buttons_alignment_2, ui_widgets);
|
.set(self.ids.creation_buttons_alignment_2, ui_widgets);
|
||||||
@ -710,7 +710,7 @@ impl CharSelectionUi {
|
|||||||
.w_h(70.0, 70.0)
|
.w_h(70.0, 70.0)
|
||||||
.bottom_left_with_margins_on(self.ids.creation_buttons_alignment_2, 0.0, 0.0)
|
.bottom_left_with_margins_on(self.ids.creation_buttons_alignment_2, 0.0, 0.0)
|
||||||
.set(self.ids.hammer, ui_widgets);
|
.set(self.ids.hammer, ui_widgets);
|
||||||
if Button::image(if let Weapon::Hammer = self.character_weapon {
|
if Button::image(if let Tool::Hammer = self.character_weapon {
|
||||||
self.imgs.icon_border_pressed
|
self.imgs.icon_border_pressed
|
||||||
} else {
|
} else {
|
||||||
self.imgs.icon_border
|
self.imgs.icon_border
|
||||||
@ -721,7 +721,7 @@ impl CharSelectionUi {
|
|||||||
.set(self.ids.hammer_button, ui_widgets)
|
.set(self.ids.hammer_button, ui_widgets)
|
||||||
.was_clicked()
|
.was_clicked()
|
||||||
{
|
{
|
||||||
self.character_weapon = Weapon::Hammer;
|
self.character_weapon = Tool::Hammer;
|
||||||
}
|
}
|
||||||
// REMOVE THIS AFTER IMPLEMENTATION
|
// REMOVE THIS AFTER IMPLEMENTATION
|
||||||
/*Rectangle::fill_with([67.0, 67.0], color::rgba(0.0, 0.0, 0.0, 0.8))
|
/*Rectangle::fill_with([67.0, 67.0], color::rgba(0.0, 0.0, 0.0, 0.8))
|
||||||
@ -734,7 +734,7 @@ impl CharSelectionUi {
|
|||||||
.w_h(70.0, 70.0)
|
.w_h(70.0, 70.0)
|
||||||
.right_from(self.ids.hammer, 2.0)
|
.right_from(self.ids.hammer, 2.0)
|
||||||
.set(self.ids.bow, ui_widgets);
|
.set(self.ids.bow, ui_widgets);
|
||||||
if Button::image(if let Weapon::Bow = self.character_weapon {
|
if Button::image(if let Tool::Bow = self.character_weapon {
|
||||||
self.imgs.icon_border_pressed
|
self.imgs.icon_border_pressed
|
||||||
} else {
|
} else {
|
||||||
self.imgs.icon_border
|
self.imgs.icon_border
|
||||||
@ -745,7 +745,7 @@ impl CharSelectionUi {
|
|||||||
.set(self.ids.bow_button, ui_widgets)
|
.set(self.ids.bow_button, ui_widgets)
|
||||||
.was_clicked()
|
.was_clicked()
|
||||||
{
|
{
|
||||||
//self.character_weapon = Weapon::Bow;
|
//self.character_weapon = Tool::Bow;
|
||||||
}
|
}
|
||||||
// REMOVE THIS AFTER IMPLEMENTATION
|
// REMOVE THIS AFTER IMPLEMENTATION
|
||||||
Rectangle::fill_with([67.0, 67.0], color::rgba(0.0, 0.0, 0.0, 0.8))
|
Rectangle::fill_with([67.0, 67.0], color::rgba(0.0, 0.0, 0.0, 0.8))
|
||||||
@ -756,7 +756,7 @@ impl CharSelectionUi {
|
|||||||
.w_h(70.0, 70.0)
|
.w_h(70.0, 70.0)
|
||||||
.right_from(self.ids.bow, 2.0)
|
.right_from(self.ids.bow, 2.0)
|
||||||
.set(self.ids.staff, ui_widgets);
|
.set(self.ids.staff, ui_widgets);
|
||||||
if Button::image(if let Weapon::Staff = self.character_weapon {
|
if Button::image(if let Tool::Staff = self.character_weapon {
|
||||||
self.imgs.icon_border_pressed
|
self.imgs.icon_border_pressed
|
||||||
} else {
|
} else {
|
||||||
self.imgs.icon_border
|
self.imgs.icon_border
|
||||||
@ -767,7 +767,7 @@ impl CharSelectionUi {
|
|||||||
.set(self.ids.staff_button, ui_widgets)
|
.set(self.ids.staff_button, ui_widgets)
|
||||||
.was_clicked()
|
.was_clicked()
|
||||||
{
|
{
|
||||||
//self.character_weapon = Weapon::Staff;
|
//self.character_weapon = Tool::Staff;
|
||||||
}
|
}
|
||||||
// REMOVE THIS AFTER IMPLEMENTATION
|
// REMOVE THIS AFTER IMPLEMENTATION
|
||||||
Rectangle::fill_with([67.0, 67.0], color::rgba(0.0, 0.0, 0.0, 0.8))
|
Rectangle::fill_with([67.0, 67.0], color::rgba(0.0, 0.0, 0.0, 0.8))
|
||||||
@ -778,7 +778,7 @@ impl CharSelectionUi {
|
|||||||
.w_h(70.0, 70.0)
|
.w_h(70.0, 70.0)
|
||||||
.up_from(self.ids.hammer, 2.0)
|
.up_from(self.ids.hammer, 2.0)
|
||||||
.set(self.ids.sword, ui_widgets);
|
.set(self.ids.sword, ui_widgets);
|
||||||
if Button::image(if let Weapon::Sword = self.character_weapon {
|
if Button::image(if let Tool::Sword = self.character_weapon {
|
||||||
self.imgs.icon_border_pressed
|
self.imgs.icon_border_pressed
|
||||||
} else {
|
} else {
|
||||||
self.imgs.icon_border
|
self.imgs.icon_border
|
||||||
@ -789,7 +789,7 @@ impl CharSelectionUi {
|
|||||||
.set(self.ids.sword_button, ui_widgets)
|
.set(self.ids.sword_button, ui_widgets)
|
||||||
.was_clicked()
|
.was_clicked()
|
||||||
{
|
{
|
||||||
self.character_weapon = Weapon::Sword;
|
self.character_weapon = Tool::Sword;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Daggers
|
// Daggers
|
||||||
@ -797,7 +797,7 @@ impl CharSelectionUi {
|
|||||||
.w_h(70.0, 70.0)
|
.w_h(70.0, 70.0)
|
||||||
.right_from(self.ids.sword, 2.0)
|
.right_from(self.ids.sword, 2.0)
|
||||||
.set(self.ids.daggers, ui_widgets);
|
.set(self.ids.daggers, ui_widgets);
|
||||||
if Button::image(if let Weapon::Daggers = self.character_weapon {
|
if Button::image(if let Tool::Daggers = self.character_weapon {
|
||||||
self.imgs.icon_border_pressed
|
self.imgs.icon_border_pressed
|
||||||
} else {
|
} else {
|
||||||
self.imgs.icon_border
|
self.imgs.icon_border
|
||||||
@ -808,7 +808,7 @@ impl CharSelectionUi {
|
|||||||
.set(self.ids.daggers_button, ui_widgets)
|
.set(self.ids.daggers_button, ui_widgets)
|
||||||
.was_clicked()
|
.was_clicked()
|
||||||
{
|
{
|
||||||
// self.character_weapon = Weapon::Daggers;
|
// self.character_weapon = Tool::Daggers;
|
||||||
} // REMOVE THIS AFTER IMPLEMENTATION
|
} // REMOVE THIS AFTER IMPLEMENTATION
|
||||||
Rectangle::fill_with([67.0, 67.0], color::rgba(0.0, 0.0, 0.0, 0.8))
|
Rectangle::fill_with([67.0, 67.0], color::rgba(0.0, 0.0, 0.0, 0.8))
|
||||||
.middle_of(self.ids.daggers)
|
.middle_of(self.ids.daggers)
|
||||||
@ -819,7 +819,7 @@ impl CharSelectionUi {
|
|||||||
.w_h(70.0, 70.0)
|
.w_h(70.0, 70.0)
|
||||||
.right_from(self.ids.daggers, 2.0)
|
.right_from(self.ids.daggers, 2.0)
|
||||||
.set(self.ids.axe, ui_widgets);
|
.set(self.ids.axe, ui_widgets);
|
||||||
if Button::image(if let Weapon::Axe = self.character_weapon {
|
if Button::image(if let Tool::Axe = self.character_weapon {
|
||||||
self.imgs.icon_border_pressed
|
self.imgs.icon_border_pressed
|
||||||
} else {
|
} else {
|
||||||
self.imgs.icon_border
|
self.imgs.icon_border
|
||||||
@ -830,7 +830,7 @@ impl CharSelectionUi {
|
|||||||
.set(self.ids.axe_button, ui_widgets)
|
.set(self.ids.axe_button, ui_widgets)
|
||||||
.was_clicked()
|
.was_clicked()
|
||||||
{
|
{
|
||||||
self.character_weapon = Weapon::Axe;
|
self.character_weapon = Tool::Axe;
|
||||||
}
|
}
|
||||||
// REMOVE THIS AFTER IMPLEMENTATION
|
// REMOVE THIS AFTER IMPLEMENTATION
|
||||||
/*Rectangle::fill_with([67.0, 67.0], color::rgba(0.0, 0.0, 0.0, 0.8))
|
/*Rectangle::fill_with([67.0, 67.0], color::rgba(0.0, 0.0, 0.0, 0.8))
|
||||||
|
@ -12,7 +12,7 @@ use crate::{
|
|||||||
use client::Client;
|
use client::Client;
|
||||||
use common::{
|
use common::{
|
||||||
assets,
|
assets,
|
||||||
comp::{self, humanoid, item::Weapon, object, quadruped, quadruped_medium, Body},
|
comp::{self, humanoid, item::Tool, object, quadruped, quadruped_medium, Body},
|
||||||
figure::Segment,
|
figure::Segment,
|
||||||
terrain::TerrainChunkSize,
|
terrain::TerrainChunkSize,
|
||||||
vol::VolSize,
|
vol::VolSize,
|
||||||
@ -61,7 +61,7 @@ impl FigureModelCache {
|
|||||||
Some(Self::load_right_hand(body.hand)),
|
Some(Self::load_right_hand(body.hand)),
|
||||||
Some(Self::load_left_foot(body.foot)),
|
Some(Self::load_left_foot(body.foot)),
|
||||||
Some(Self::load_right_foot(body.foot)),
|
Some(Self::load_right_foot(body.foot)),
|
||||||
Some(Self::load_weapon(Weapon::Hammer)), // TODO: Inventory
|
Some(Self::load_weapon(Tool::Hammer)), // TODO: Inventory
|
||||||
Some(Self::load_left_shoulder(body.shoulder)),
|
Some(Self::load_left_shoulder(body.shoulder)),
|
||||||
Some(Self::load_right_shoulder(body.shoulder)),
|
Some(Self::load_right_shoulder(body.shoulder)),
|
||||||
Some(Self::load_draw()),
|
Some(Self::load_draw()),
|
||||||
@ -312,15 +312,15 @@ impl FigureModelCache {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_weapon(weapon: Weapon) -> Mesh<FigurePipeline> {
|
fn load_weapon(weapon: Tool) -> Mesh<FigurePipeline> {
|
||||||
let (name, offset) = match weapon {
|
let (name, offset) = match weapon {
|
||||||
Weapon::Sword => ("weapon/sword/rusty_2h.vox", Vec3::new(-1.5, -6.5, -4.0)),
|
Tool::Sword => ("weapon/sword/rusty_2h.vox", Vec3::new(-1.5, -6.5, -4.0)),
|
||||||
Weapon::Axe => ("weapon/axe/rusty_2h.vox", Vec3::new(-1.5, -6.5, -4.0)),
|
Tool::Axe => ("weapon/axe/rusty_2h.vox", Vec3::new(-1.5, -6.5, -4.0)),
|
||||||
Weapon::Hammer => ("weapon/hammer/rusty_2h.vox", Vec3::new(-2.5, -5.5, -4.0)),
|
Tool::Hammer => ("weapon/hammer/rusty_2h.vox", Vec3::new(-2.5, -5.5, -4.0)),
|
||||||
Weapon::Daggers => ("weapon/hammer/rusty_2h.vox", Vec3::new(-2.5, -5.5, -4.0)),
|
Tool::Daggers => ("weapon/hammer/rusty_2h.vox", Vec3::new(-2.5, -5.5, -4.0)),
|
||||||
Weapon::SwordShield => ("weapon/axe/rusty_2h.vox", Vec3::new(-2.5, -6.5, -2.0)),
|
Tool::SwordShield => ("weapon/axe/rusty_2h.vox", Vec3::new(-2.5, -6.5, -2.0)),
|
||||||
Weapon::Bow => ("weapon/hammer/rusty_2h.vox", Vec3::new(-2.5, -5.5, -4.0)),
|
Tool::Bow => ("weapon/hammer/rusty_2h.vox", Vec3::new(-2.5, -5.5, -4.0)),
|
||||||
Weapon::Staff => ("weapon/axe/rusty_2h.vox", Vec3::new(-2.5, -6.5, -2.0)),
|
Tool::Staff => ("weapon/axe/rusty_2h.vox", Vec3::new(-2.5, -6.5, -2.0)),
|
||||||
};
|
};
|
||||||
Self::load_mesh(name, offset)
|
Self::load_mesh(name, offset)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user