mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Make backpacks distinct ArmorKinds, fix visual offsets of carried weapons
This commit is contained in:
parent
0f2d4c261a
commit
9dd5cd24d1
@ -2,10 +2,10 @@ ItemDef(
|
||||
name: "Merchant Backpack",
|
||||
description: "",
|
||||
kind: Armor((
|
||||
kind: Back,
|
||||
kind: Backpack,
|
||||
stats: FromSet("Merchant"),
|
||||
)),
|
||||
quality: High,
|
||||
slots: 18,
|
||||
tags: [],
|
||||
)
|
||||
)
|
||||
|
@ -2,9 +2,9 @@ ItemDef(
|
||||
name: "Miner's Backpack",
|
||||
description: "Battered from heavy rocks being carried inside.",
|
||||
kind: Armor((
|
||||
kind: Back,
|
||||
kind: Backpack,
|
||||
stats: FromSet("Miner"),
|
||||
)),
|
||||
quality: High,
|
||||
tags: [],
|
||||
)
|
||||
)
|
||||
|
@ -2,11 +2,11 @@ ItemDef(
|
||||
name: "Traveler's Backpack",
|
||||
description: "Comfortable and with enough capacity, its a hoarder's best friend.",
|
||||
kind: Armor((
|
||||
kind: Back,
|
||||
kind: Backpack,
|
||||
stats: Direct((
|
||||
)),
|
||||
)),
|
||||
quality: Epic,
|
||||
tags: [Bag],
|
||||
slots: 20,
|
||||
)
|
||||
)
|
||||
|
@ -2,7 +2,7 @@ ItemDef(
|
||||
name: "Rugged Backpack",
|
||||
description: "Keeps all your stuff together.",
|
||||
kind: Armor((
|
||||
kind: Back,
|
||||
kind: Backpack,
|
||||
stats: Direct((
|
||||
protection: Some(Normal(0.0)),
|
||||
poise_resilience: Some(Normal(0.0)),
|
||||
|
@ -14,6 +14,7 @@ hud-bag-glider = Glider
|
||||
hud-bag-belt = Belt
|
||||
hud-bag-ring = Ring
|
||||
hud-bag-back = Back
|
||||
hud-bag-backpack = Backpack
|
||||
hud-bag-legs = Legs
|
||||
hud-bag-feet = Feet
|
||||
hud-bag-mainhand = Mainhand
|
||||
|
@ -149,7 +149,7 @@
|
||||
color: None
|
||||
),
|
||||
"common.items.armor.merchant.back": (
|
||||
vox_spec: ("armor.merchant.back", (-9.0, -7.0, -12.0)),
|
||||
vox_spec: ("armor.merchant.back", (-8.0, -7.0, -11.0)),
|
||||
color: None
|
||||
),
|
||||
},
|
||||
|
@ -203,6 +203,7 @@ fn get_armor_kind(kind: &ArmorKind) -> String {
|
||||
ArmorKind::Pants => "Pants".to_string(),
|
||||
ArmorKind::Foot => "Foot".to_string(),
|
||||
ArmorKind::Back => "Back".to_string(),
|
||||
ArmorKind::Backpack => "Backpack".to_string(),
|
||||
ArmorKind::Ring => "Ring".to_string(),
|
||||
ArmorKind::Neck => "Neck".to_string(),
|
||||
ArmorKind::Head => "Head".to_string(),
|
||||
|
@ -75,6 +75,7 @@ impl From<&Item> for Body {
|
||||
ArmorKind::Pants => Body::Armor(ItemDropArmorKind::Pants),
|
||||
ArmorKind::Foot => Body::Armor(ItemDropArmorKind::Foot),
|
||||
ArmorKind::Back => Body::Armor(ItemDropArmorKind::Back),
|
||||
ArmorKind::Backpack => Body::Armor(ItemDropArmorKind::Back),
|
||||
ArmorKind::Ring => Body::Armor(ItemDropArmorKind::Ring),
|
||||
ArmorKind::Neck => Body::Armor(ItemDropArmorKind::Neck),
|
||||
ArmorKind::Head => Body::Armor(ItemDropArmorKind::Head),
|
||||
|
@ -23,6 +23,7 @@ pub enum ArmorKind {
|
||||
Head,
|
||||
Tabard,
|
||||
Bag,
|
||||
Backpack,
|
||||
}
|
||||
|
||||
impl ArmorKind {
|
||||
@ -35,6 +36,7 @@ impl ArmorKind {
|
||||
ArmorKind::Pants => true,
|
||||
ArmorKind::Foot => true,
|
||||
ArmorKind::Back => true,
|
||||
ArmorKind::Backpack => true,
|
||||
ArmorKind::Ring => false,
|
||||
ArmorKind::Neck => false,
|
||||
ArmorKind::Head => true,
|
||||
@ -252,6 +254,7 @@ impl Armor {
|
||||
ArmorKind::Pants => 2.0,
|
||||
ArmorKind::Foot => 1.0,
|
||||
ArmorKind::Back => 0.5,
|
||||
ArmorKind::Backpack => 1.0,
|
||||
ArmorKind::Ring => 0.0,
|
||||
ArmorKind::Neck => 0.0,
|
||||
ArmorKind::Head => 0.0,
|
||||
|
@ -142,6 +142,7 @@ impl ArmorSlot {
|
||||
| (Self::Ring1, ArmorKind::Ring)
|
||||
| (Self::Ring2, ArmorKind::Ring)
|
||||
| (Self::Back, ArmorKind::Back)
|
||||
| (Self::Back, ArmorKind::Backpack)
|
||||
| (Self::Belt, ArmorKind::Belt)
|
||||
| (Self::Legs, ArmorKind::Pants)
|
||||
| (Self::Feet, ArmorKind::Foot)
|
||||
|
@ -497,8 +497,11 @@ fn backpack_crash() {
|
||||
let mut inv = Inventory::with_empty();
|
||||
|
||||
let backpack = Item::new_from_asset_expect("common.items.armor.misc.back.backpack");
|
||||
inv.loadout
|
||||
.swap(EquipSlot::Armor(ArmorSlot::Back), Some(backpack), Time(0.0));
|
||||
inv.loadout.swap(
|
||||
EquipSlot::Armor(ArmorSlot::Backpack),
|
||||
Some(backpack),
|
||||
Time(0.0),
|
||||
);
|
||||
|
||||
fill_inv_slots(&mut inv, 35);
|
||||
|
||||
@ -507,7 +510,7 @@ fn backpack_crash() {
|
||||
|
||||
let returned_items = inv.swap_inventory_loadout(
|
||||
InvSlotId::new(9, 17),
|
||||
EquipSlot::Armor(ArmorSlot::Back),
|
||||
EquipSlot::Armor(ArmorSlot::Backpack),
|
||||
Time(0.0),
|
||||
);
|
||||
assert_eq!(18, returned_items.len());
|
||||
|
@ -89,17 +89,17 @@ impl Animation for IdleAnimation {
|
||||
match hands {
|
||||
(Some(Hands::Two), _) | (None, Some(Hands::Two)) => match active_tool_kind {
|
||||
Some(ToolKind::Bow) => {
|
||||
next.main.position = Vec3::new(0.0, -5.0, 6.0);
|
||||
next.main.position = Vec3::new(0.0, -5.0 - skeleton.back_carry_offset, 6.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
||||
},
|
||||
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
||||
next.main.position = Vec3::new(2.0, -5.0, -1.0);
|
||||
next.main.position = Vec3::new(2.0, -5.0 - skeleton.back_carry_offset, -1.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(PI / 2.0);
|
||||
},
|
||||
_ => {
|
||||
next.main.position = Vec3::new(-7.0, -5.0, 15.0);
|
||||
next.main.position = Vec3::new(-7.0, -5. - skeleton.back_carry_offset, 15.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
||||
},
|
||||
@ -110,12 +110,12 @@ impl Animation for IdleAnimation {
|
||||
match hands {
|
||||
(Some(Hands::One), _) => match active_tool_kind {
|
||||
Some(ToolKind::Dagger) => {
|
||||
next.main.position = Vec3::new(5.0, 1.0, 2.0);
|
||||
next.main.position = Vec3::new(5.0, 1.0 - skeleton.back_carry_offset, 2.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(2.0 * PI);
|
||||
},
|
||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
||||
next.main.position = Vec3::new(-4.0, -5.0, 10.0);
|
||||
next.main.position = Vec3::new(-4.0, -4.0 - skeleton.back_carry_offset, 10.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_y(2.35) * Quaternion::rotation_z(PI / 2.0);
|
||||
},
|
||||
@ -127,12 +127,12 @@ impl Animation for IdleAnimation {
|
||||
match hands {
|
||||
(None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind {
|
||||
Some(ToolKind::Dagger) => {
|
||||
next.second.position = Vec3::new(-5.0, 1.0, 2.0);
|
||||
next.second.position = Vec3::new(-5.0, 1.0 - skeleton.back_carry_offset, 2.0);
|
||||
next.second.orientation =
|
||||
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(-2.0 * PI);
|
||||
},
|
||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
||||
next.second.position = Vec3::new(4.0, -6.0, 10.0);
|
||||
next.second.position = Vec3::new(4.0, -5.0 - skeleton.back_carry_offset, 10.0);
|
||||
next.second.orientation =
|
||||
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-PI / 2.0);
|
||||
},
|
||||
|
@ -144,27 +144,27 @@ impl Animation for JumpAnimation {
|
||||
|
||||
match main_tool {
|
||||
Some(ToolKind::Dagger) => {
|
||||
next.main.position = Vec3::new(5.0, 1.0, 2.0);
|
||||
next.main.position = Vec3::new(5.0, 1.0 - skeleton.back_carry_offset, 2.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(2.0 * PI);
|
||||
},
|
||||
Some(ToolKind::Shield) => {
|
||||
next.main.position = Vec3::new(-0.0, -5.0, 3.0);
|
||||
next.main.position = Vec3::new(-0.0, -5.0 - skeleton.back_carry_offset, 3.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI);
|
||||
},
|
||||
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
||||
next.main.position = Vec3::new(2.0, -5.0, -1.0);
|
||||
next.main.position = Vec3::new(2.0, -5.0 - skeleton.back_carry_offset, -1.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(PI / 2.0);
|
||||
},
|
||||
Some(ToolKind::Bow) => {
|
||||
next.main.position = Vec3::new(0.0, -5.0, 6.0);
|
||||
next.main.position = Vec3::new(0.0, -5.0 - skeleton.back_carry_offset, 6.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
||||
},
|
||||
_ => {
|
||||
next.main.position = Vec3::new(-7.0, -5.0, 15.0);
|
||||
next.main.position = Vec3::new(-7.0, -5.0 - skeleton.back_carry_offset, 15.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
||||
},
|
||||
@ -172,18 +172,18 @@ impl Animation for JumpAnimation {
|
||||
|
||||
match second_tool_kind {
|
||||
Some(ToolKind::Dagger) => {
|
||||
next.second.position = Vec3::new(-5.0, 1.0, 2.0);
|
||||
next.second.position = Vec3::new(-5.0, 1.0 - skeleton.back_carry_offset, 2.0);
|
||||
next.second.orientation =
|
||||
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(-2.0 * PI);
|
||||
},
|
||||
Some(ToolKind::Shield) => {
|
||||
next.second.position = Vec3::new(0.0, -4.0, 3.0);
|
||||
next.second.position = Vec3::new(0.0, -4.5 - skeleton.back_carry_offset, 3.0);
|
||||
next.second.orientation =
|
||||
Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI);
|
||||
},
|
||||
|
||||
_ => {
|
||||
next.second.position = Vec3::new(-7.0, -5.0, 15.0);
|
||||
next.second.position = Vec3::new(-7.0, -5.0 - skeleton.back_carry_offset, 15.0);
|
||||
next.second.orientation =
|
||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
||||
},
|
||||
@ -211,7 +211,7 @@ impl Animation for JumpAnimation {
|
||||
match hands {
|
||||
(Some(Hands::One), _) => match active_tool_kind {
|
||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
||||
next.main.position = Vec3::new(-4.0, -5.0, 10.0);
|
||||
next.main.position = Vec3::new(-4.0, -5.0 - skeleton.back_carry_offset, 10.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_y(2.35) * Quaternion::rotation_z(PI / 2.0);
|
||||
},
|
||||
@ -223,7 +223,7 @@ impl Animation for JumpAnimation {
|
||||
match hands {
|
||||
(None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind {
|
||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
||||
next.second.position = Vec3::new(4.0, -6.0, 10.0);
|
||||
next.second.position = Vec3::new(4.0, -6.0 - skeleton.back_carry_offset, 10.0);
|
||||
next.second.orientation =
|
||||
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-PI / 2.0);
|
||||
},
|
||||
|
@ -86,6 +86,8 @@ skeleton_impls!(struct CharacterSkeleton {
|
||||
control_r,
|
||||
:: // Begin non-bone fields
|
||||
holding_lantern: bool,
|
||||
// The offset from the back that carried weapons should be given to avoid clipping due to, say, a backpack
|
||||
back_carry_offset: f32,
|
||||
main_weapon_trail: bool,
|
||||
off_weapon_trail: bool,
|
||||
// Cannot exist at same time as weapon trails. Since gliding and attacking are mutually exclusive, should never be a concern.
|
||||
@ -93,9 +95,10 @@ skeleton_impls!(struct CharacterSkeleton {
|
||||
});
|
||||
|
||||
impl CharacterSkeleton {
|
||||
pub fn new(holding_lantern: bool) -> Self {
|
||||
pub fn new(holding_lantern: bool, back_carry_offset: f32) -> Self {
|
||||
Self {
|
||||
holding_lantern,
|
||||
back_carry_offset,
|
||||
..Self::default()
|
||||
}
|
||||
}
|
||||
|
@ -215,27 +215,27 @@ impl Animation for RunAnimation {
|
||||
|
||||
match main_tool {
|
||||
Some(ToolKind::Dagger) => {
|
||||
next.main.position = Vec3::new(5.0, 1.0, 2.0);
|
||||
next.main.position = Vec3::new(5.0, 1.0 - skeleton.back_carry_offset, 2.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(2.0 * PI);
|
||||
},
|
||||
Some(ToolKind::Shield) => {
|
||||
next.main.position = Vec3::new(-0.0, -5.0, 3.0);
|
||||
next.main.position = Vec3::new(-0.0, -5.0 - skeleton.back_carry_offset, 3.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI);
|
||||
},
|
||||
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
||||
next.main.position = Vec3::new(2.0, -5.0, -1.0);
|
||||
next.main.position = Vec3::new(2.0, -5.0 - skeleton.back_carry_offset, -1.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(PI / 2.0);
|
||||
},
|
||||
Some(ToolKind::Bow) => {
|
||||
next.main.position = Vec3::new(0.0, -5.0, 6.0);
|
||||
next.main.position = Vec3::new(0.0, -5.0 - skeleton.back_carry_offset, 6.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
||||
},
|
||||
_ => {
|
||||
next.main.position = Vec3::new(-7.0, -5.0, 15.0);
|
||||
next.main.position = Vec3::new(-7.0, -5.0 - skeleton.back_carry_offset, 15.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0 + shorte * -0.2);
|
||||
},
|
||||
@ -243,17 +243,17 @@ impl Animation for RunAnimation {
|
||||
|
||||
match second_tool_kind {
|
||||
Some(ToolKind::Dagger) => {
|
||||
next.second.position = Vec3::new(-5.0, 1.0, 2.0);
|
||||
next.second.position = Vec3::new(-5.0, 1.0 - skeleton.back_carry_offset, 2.0);
|
||||
next.second.orientation =
|
||||
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(-2.0 * PI);
|
||||
},
|
||||
Some(ToolKind::Shield) => {
|
||||
next.second.position = Vec3::new(0.0, -4.0, 3.0);
|
||||
next.second.position = Vec3::new(0.0, -4.5 - skeleton.back_carry_offset, 3.0);
|
||||
next.second.orientation =
|
||||
Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI);
|
||||
},
|
||||
_ => {
|
||||
next.second.position = Vec3::new(-7.0, -5.0, 15.0);
|
||||
next.second.position = Vec3::new(-7.0, -5.0 - skeleton.back_carry_offset, 15.0);
|
||||
next.second.orientation =
|
||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
||||
},
|
||||
@ -288,7 +288,7 @@ impl Animation for RunAnimation {
|
||||
match hands {
|
||||
(Some(Hands::One), _) => match active_tool_kind {
|
||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
||||
next.main.position = Vec3::new(-4.0, -5.0, 10.0);
|
||||
next.main.position = Vec3::new(-4.0, -4.5 - skeleton.back_carry_offset, 10.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_y(2.35) * Quaternion::rotation_z(PI / 2.0);
|
||||
},
|
||||
@ -300,7 +300,7 @@ impl Animation for RunAnimation {
|
||||
match hands {
|
||||
(None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind {
|
||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
||||
next.second.position = Vec3::new(4.0, -6.0, 10.0);
|
||||
next.second.position = Vec3::new(4.0, -5.0 - skeleton.back_carry_offset, 10.0);
|
||||
next.second.orientation =
|
||||
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-PI / 2.0);
|
||||
},
|
||||
|
@ -111,17 +111,17 @@ impl Animation for StandAnimation {
|
||||
match (hands, active_tool_kind, second_tool_kind) {
|
||||
((Some(Hands::Two), _), tool, _) | ((None, Some(Hands::Two)), _, tool) => match tool {
|
||||
Some(ToolKind::Bow) => {
|
||||
next.main.position = Vec3::new(0.0, -5.0, 6.0);
|
||||
next.main.position = Vec3::new(0.0, -5.0 - skeleton.back_carry_offset, 6.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
||||
},
|
||||
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
||||
next.main.position = Vec3::new(2.0, -5.0, -1.0);
|
||||
next.main.position = Vec3::new(2.0, -5.0 - skeleton.back_carry_offset, -1.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(PI / 2.0);
|
||||
},
|
||||
_ => {
|
||||
next.main.position = Vec3::new(-7.0, -5.0, 15.0);
|
||||
next.main.position = Vec3::new(-7.0, -5.0 - skeleton.back_carry_offset, 15.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
||||
},
|
||||
@ -132,17 +132,17 @@ impl Animation for StandAnimation {
|
||||
match hands {
|
||||
(Some(Hands::One), _) => match active_tool_kind {
|
||||
Some(ToolKind::Dagger) => {
|
||||
next.main.position = Vec3::new(5.0, 1.0, 2.0);
|
||||
next.main.position = Vec3::new(5.0, 1.0 - skeleton.back_carry_offset, 2.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(2.0 * PI);
|
||||
},
|
||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
||||
next.main.position = Vec3::new(-4.0, -5.0, 10.0);
|
||||
next.main.position = Vec3::new(-4.0, -4.5 - skeleton.back_carry_offset, 10.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
||||
},
|
||||
Some(ToolKind::Shield) => {
|
||||
next.main.position = Vec3::new(-0.0, -4.0, 3.0);
|
||||
next.main.position = Vec3::new(-0.0, -4.0 - skeleton.back_carry_offset, 3.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI);
|
||||
},
|
||||
@ -153,17 +153,17 @@ impl Animation for StandAnimation {
|
||||
match hands {
|
||||
(None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind {
|
||||
Some(ToolKind::Dagger) => {
|
||||
next.second.position = Vec3::new(-5.0, 1.0, 2.0);
|
||||
next.second.position = Vec3::new(-5.0, 1.0 - skeleton.back_carry_offset, 2.0);
|
||||
next.second.orientation =
|
||||
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(-2.0 * PI);
|
||||
},
|
||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
||||
next.second.position = Vec3::new(4.0, -6.0, 10.0);
|
||||
next.second.position = Vec3::new(4.0, -5.0 - skeleton.back_carry_offset, 10.0);
|
||||
next.second.orientation =
|
||||
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-PI / 2.0);
|
||||
},
|
||||
Some(ToolKind::Shield) => {
|
||||
next.second.position = Vec3::new(0.0, -4.0, 3.0);
|
||||
next.second.position = Vec3::new(0.0, -4.0 - skeleton.back_carry_offset, 3.0);
|
||||
next.second.orientation =
|
||||
Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI);
|
||||
},
|
||||
|
@ -293,6 +293,7 @@ fn armor_kind<'a>(armor: &Armor, i18n: &'a Localization) -> Cow<'a, str> {
|
||||
ArmorKind::Pants => i18n.get_msg("hud-bag-legs"),
|
||||
ArmorKind::Foot => i18n.get_msg("hud-bag-feet"),
|
||||
ArmorKind::Back => i18n.get_msg("hud-bag-back"),
|
||||
ArmorKind::Backpack => i18n.get_msg("hud-bag-backpack"),
|
||||
ArmorKind::Ring => i18n.get_msg("hud-bag-ring"),
|
||||
ArmorKind::Neck => i18n.get_msg("hud-bag-neck"),
|
||||
ArmorKind::Head => i18n.get_msg("hud-bag-head"),
|
||||
|
@ -37,8 +37,9 @@ use anim::{
|
||||
use common::{
|
||||
comp::{
|
||||
inventory::slot::EquipSlot,
|
||||
item::{Hands, ItemKind, ToolKind},
|
||||
item::{armor::ArmorKind, Hands, ItemKind, ToolKind},
|
||||
ship::{self, figuredata::VOXEL_COLLIDER_MANIFEST},
|
||||
slot::ArmorSlot,
|
||||
Body, CharacterActivity, CharacterState, Collider, Controller, Health, Inventory, Item,
|
||||
ItemKey, Last, LightAnimation, LightEmitter, Object, Ori, PhysicsState, PoiseState, Pos,
|
||||
Scale, Vel,
|
||||
@ -1107,6 +1108,21 @@ impl FigureMgr {
|
||||
&& !character.map_or(false, |c| c.is_using_hands())
|
||||
&& physics.in_liquid().is_none();
|
||||
|
||||
let back_carry_offset = inventory
|
||||
.and_then(|i| i.equipped(EquipSlot::Armor(ArmorSlot::Back)))
|
||||
.and_then(|i| {
|
||||
if let ItemKind::Armor(armor) = i.kind().as_ref() {
|
||||
match &armor.kind {
|
||||
ArmorKind::Backpack => Some(4.0),
|
||||
ArmorKind::Back => Some(1.5),
|
||||
_ => None,
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.unwrap_or(0.0);
|
||||
|
||||
let state = self
|
||||
.states
|
||||
.character_states
|
||||
@ -1114,7 +1130,7 @@ impl FigureMgr {
|
||||
.or_insert_with(|| {
|
||||
FigureState::new(
|
||||
renderer,
|
||||
CharacterSkeleton::new(holding_lantern),
|
||||
CharacterSkeleton::new(holding_lantern, back_carry_offset),
|
||||
body,
|
||||
)
|
||||
});
|
||||
@ -1141,7 +1157,7 @@ impl FigureMgr {
|
||||
// Standing or Skating
|
||||
(true, false, false, false, _) | (_, _, false, false, true) => {
|
||||
anim::character::StandAnimation::update_skeleton(
|
||||
&CharacterSkeleton::new(holding_lantern),
|
||||
&CharacterSkeleton::new(holding_lantern, back_carry_offset),
|
||||
(
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
@ -1160,7 +1176,7 @@ impl FigureMgr {
|
||||
// Running
|
||||
(true, true, false, false, _) => {
|
||||
anim::character::RunAnimation::update_skeleton(
|
||||
&CharacterSkeleton::new(holding_lantern),
|
||||
&CharacterSkeleton::new(holding_lantern, back_carry_offset),
|
||||
(
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
@ -1182,7 +1198,7 @@ impl FigureMgr {
|
||||
// In air
|
||||
(false, _, false, false, _) => {
|
||||
anim::character::JumpAnimation::update_skeleton(
|
||||
&CharacterSkeleton::new(holding_lantern),
|
||||
&CharacterSkeleton::new(holding_lantern, back_carry_offset),
|
||||
(
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
@ -1200,7 +1216,7 @@ impl FigureMgr {
|
||||
},
|
||||
// Swim
|
||||
(_, _, true, false, _) => anim::character::SwimAnimation::update_skeleton(
|
||||
&CharacterSkeleton::new(holding_lantern),
|
||||
&CharacterSkeleton::new(holding_lantern, back_carry_offset),
|
||||
(
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
@ -1218,7 +1234,7 @@ impl FigureMgr {
|
||||
),
|
||||
// Mount
|
||||
(_, _, _, true, _) => anim::character::MountAnimation::update_skeleton(
|
||||
&CharacterSkeleton::new(holding_lantern),
|
||||
&CharacterSkeleton::new(holding_lantern, back_carry_offset),
|
||||
(
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
|
Loading…
Reference in New Issue
Block a user