Add werewolf npc

This commit is contained in:
Snowram 2020-08-09 02:36:55 +02:00 committed by Robin Gilh
parent 64e928444b
commit ae07c9ffb5
20 changed files with 179 additions and 22 deletions

@ -573,6 +573,10 @@
"dullahan": {
"keyword": "dullahan",
"generic": "Dullahan"
},
"werewolf": {
"keyword": "werewolf",
"generic": "Werewolf"
}
}
},

@ -239,8 +239,6 @@
central: ("npc.troll.female.hammer"),
)
),
(Dullahan, Male): (
head: (
offset: (-8.0, -5.0, -6.0),
@ -271,7 +269,6 @@
central: ("npc.cyclops.male.hammer"),
)
),
(Dullahan, Female): (
head: (
offset: (-8.0, -5.0, -6.0),
@ -302,4 +299,64 @@
central: ("npc.cyclops.male.hammer"),
)
),
})
(Werewolf, Male): (
head: (
offset: (-5.0, -7.5, -6.5),
center: ("npc.werewolf.male.head"),
),
torso_upper: (
offset: (-8.0, -12.5, -10.5),
center: ("npc.werewolf.male.torso_upper"),
),
torso_lower: (
offset: (-6.0, -5.5, -4.0),
center: ("npc.werewolf.male.torso_lower"),
),
jaw: (
offset: (-2.0, 0.0, -2.0),
center: ("npc.werewolf.male.jaw"),
),
tail: (
offset: (-4.0, -27.0, -6.0),
center: ("npc.werewolf.male.tail"),
),
second: (
offset: (0.0, 0.0, 0.0),
center: ("armor.empty"),
),
main: (
offset: (-1.5, -9.0, -10.0),
center: ("armor.empty"),
)
),
(Werewolf, Female): (
head: (
offset: (-5.0, -7.5, -6.5),
center: ("npc.werewolf.male.head"),
),
torso_upper: (
offset: (-8.0, -12.5, -10.5),
center: ("npc.werewolf.male.torso_upper"),
),
torso_lower: (
offset: (-6.0, -5.5, -4.0),
center: ("npc.werewolf.male.torso_lower"),
),
jaw: (
offset: (-2.0, 0.0, -2.0),
center: ("npc.werewolf.male.jaw"),
),
tail: (
offset: (-4.0, -27.0, -6.0),
center: ("npc.werewolf.male.tail"),
),
second: (
offset: (0.0, 0.0, 0.0),
center: ("armor.empty"),
),
main: (
offset: (-1.5, -9.0, -10.0),
center: ("armor.empty"),
)
),
})

@ -339,4 +339,72 @@
lateral: ("npc.dullahan.male.foot_r"),
),
),
})
(Werewolf, Male): (
shoulder_l: (
offset: (-4.0, -4.5, -5.0),
lateral: ("npc.werewolf.male.shoulder_l"),
),
shoulder_r: (
offset: (-4.0, -4.5, -5.0),
lateral: ("npc.werewolf.male.shoulder_r"),
),
hand_l: (
offset: (-3.0, -3.0, -13.0),
lateral: ("npc.werewolf.male.hand_l"),
),
hand_r: (
offset: (-3.0, -3.0, -13.0),
lateral: ("npc.werewolf.male.hand_r"),
),
leg_l: (
offset: (-2.5, -4.0, -3.5),
lateral: ("npc.werewolf.male.leg_l"),
),
leg_r: (
offset: (-2.5, -4.0, -3.5),
lateral: ("npc.werewolf.male.leg_r"),
),
foot_l: (
offset: (-3.5, -6.0, -5.5),
lateral: ("npc.werewolf.male.foot_l"),
),
foot_r: (
offset: (-3.5, -6.0, -5.5),
lateral: ("npc.werewolf.male.foot_r"),
),
),
(Werewolf, Female): (
shoulder_l: (
offset: (-4.0, -4.5, -5.0),
lateral: ("npc.werewolf.male.shoulder_l"),
),
shoulder_r: (
offset: (-4.0, -4.5, -5.0),
lateral: ("npc.werewolf.male.shoulder_r"),
),
hand_l: (
offset: (-3.0, -3.0, -13.0),
lateral: ("npc.werewolf.male.hand_l"),
),
hand_r: (
offset: (-3.0, -3.0, -13.0),
lateral: ("npc.werewolf.male.hand_r"),
),
leg_l: (
offset: (-2.5, -4.0, -3.5),
lateral: ("npc.werewolf.male.leg_l"),
),
leg_r: (
offset: (-2.5, -4.0, -3.5),
lateral: ("npc.werewolf.male.leg_r"),
),
foot_l: (
offset: (-3.5, -6.0, -5.5),
lateral: ("npc.werewolf.male.foot_l"),
),
foot_r: (
offset: (-3.5, -6.0, -5.5),
lateral: ("npc.werewolf.male.foot_r"),
),
),
})

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -39,6 +39,7 @@ make_case_elim!(
Wendigo = 2,
Troll = 3,
Dullahan = 4,
Werewolf = 5,
}
);
@ -52,6 +53,7 @@ pub struct AllSpecies<SpeciesMeta> {
pub wendigo: SpeciesMeta,
pub troll: SpeciesMeta,
pub dullahan: SpeciesMeta,
pub werewolf: SpeciesMeta,
}
impl<'a, SpeciesMeta> core::ops::Index<&'a Species> for AllSpecies<SpeciesMeta> {
@ -65,16 +67,18 @@ impl<'a, SpeciesMeta> core::ops::Index<&'a Species> for AllSpecies<SpeciesMeta>
Species::Wendigo => &self.wendigo,
Species::Troll => &self.troll,
Species::Dullahan => &self.dullahan,
Species::Werewolf => &self.werewolf,
}
}
}
pub const ALL_SPECIES: [Species; 5] = [
pub const ALL_SPECIES: [Species; 6] = [
Species::Ogre,
Species::Cyclops,
Species::Wendigo,
Species::Troll,
Species::Dullahan,
Species::Werewolf,
];
impl<'a, SpeciesMeta: 'a> IntoIterator for &'a AllSpecies<SpeciesMeta> {

@ -26,6 +26,9 @@ impl Animation for IdleAnimation {
let lab = 1.0;
let torso = (anim_time as f32 * lab as f32 + 1.5 * PI).sin();
let slower = (anim_time as f32 * 1.0 + PI).sin();
let slow = (anim_time as f32 * 3.5 + PI).sin();
let look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
@ -38,8 +41,18 @@ impl Animation for IdleAnimation {
.sin()
* 0.25,
);
let wave_slow = (anim_time as f32 * 0.8).sin();
let tailmove = Vec2::new(
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(7331.0)
.sin()
* 0.25,
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(1337.0)
.sin()
* 0.125,
);
next.head.position = Vec3::new(
0.0,
@ -65,17 +78,18 @@ impl Animation for IdleAnimation {
);
next.lower_torso.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.lower_torso.scale = Vec3::one() * 1.02;
next.jaw.position = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
next.jaw.orientation = Quaternion::rotation_x(wave_slow * 0.09);
next.jaw.scale = Vec3::one();
next.tail.position = Vec3::new(
next.jaw.position = Vec3::new(
0.0,
skeleton_attr.tail.0,
skeleton_attr.tail.1 + torso * 0.0,
skeleton_attr.jaw.0 - slower * 0.12,
skeleton_attr.jaw.1 + slow * 0.2,
);
next.tail.orientation = Quaternion::rotation_z(0.0);
next.jaw.orientation = Quaternion::rotation_x(slow * 0.05);
next.jaw.scale = Vec3::one() * 1.02;
next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.orientation =
Quaternion::rotation_z(0.0 + slow * 0.2 + tailmove.x) * Quaternion::rotation_x(0.0);
next.tail.scale = Vec3::one();
next.control.position = Vec3::new(0.0, 0.0, 0.0);

@ -129,6 +129,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Wendigo, _) => (3.0, 13.5),
(Troll, _) => (6.0, 10.0),
(Dullahan, _) => (3.0, 6.0),
(Werewolf, _) => (19.0, 1.0),
},
jaw: match (body.species, body.body_type) {
(Ogre, _) => (0.0, 0.0),
@ -136,6 +137,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Wendigo, _) => (0.0, 0.0),
(Troll, _) => (2.0, -4.0),
(Dullahan, _) => (0.0, 0.0),
(Werewolf, _) => (-2.5, -4.5),
},
upper_torso: match (body.species, body.body_type) {
(Ogre, Male) => (0.0, 28.0),
@ -144,6 +146,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Wendigo, _) => (-1.0, 29.0),
(Troll, _) => (-1.0, 27.5),
(Dullahan, _) => (0.0, 29.0),
(Werewolf, _) => (3.0, 30.5),
},
lower_torso: match (body.species, body.body_type) {
(Ogre, Male) => (1.0, -7.0),
@ -152,6 +155,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Wendigo, _) => (-1.5, -6.0),
(Troll, _) => (1.0, -10.5),
(Dullahan, _) => (0.0, -6.5),
(Werewolf, _) => (1.0, -14.5),
},
tail: match (body.species, body.body_type) {
(Ogre, _) => (0.0, 0.0),
@ -159,6 +163,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Wendigo, _) => (0.0, 0.0),
(Troll, _) => (0.0, 0.0),
(Dullahan, _) => (0.0, 0.0),
(Werewolf, _) => (-5.5, 2.0),
},
shoulder: match (body.species, body.body_type) {
(Ogre, Male) => (12.0, 0.5, 0.0),
@ -167,6 +172,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Wendigo, _) => (9.0, 0.5, -0.5),
(Troll, _) => (11.0, 0.5, -1.5),
(Dullahan, _) => (14.0, 0.5, 4.5),
(Werewolf, _) => (9.0, 4.0, -6.5),
},
hand: match (body.species, body.body_type) {
(Ogre, Male) => (14.5, 0.0, -2.0),
@ -175,6 +181,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Wendigo, _) => (12.0, 0.0, -0.5),
(Troll, _) => (11.5, 0.0, -1.5),
(Dullahan, _) => (14.5, 0.0, -2.5),
(Werewolf, _) => (10.0, 2.5, -11.0),
},
leg: match (body.species, body.body_type) {
(Ogre, Male) => (0.0, 0.0, -4.0),
@ -183,6 +190,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Wendigo, _) => (2.0, 2.0, -2.5),
(Troll, _) => (5.0, 0.0, -6.0),
(Dullahan, _) => (0.0, 0.0, -5.0),
(Werewolf, _) => (4.5, 0.5, -3.0),
},
foot: match (body.species, body.body_type) {
(Ogre, Male) => (4.0, 2.5, 8.0),
@ -191,6 +199,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Wendigo, _) => (5.0, 0.5, 6.0),
(Troll, _) => (6.0, 0.5, 4.0),
(Dullahan, _) => (4.0, 2.5, 8.0),
(Werewolf, _) => (5.5, 6.5, 6.0),
},
}
}

@ -2,7 +2,7 @@ use super::{
super::{vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use std::f32::consts::PI;
use std::{f32::consts::PI, ops::Mul};
pub struct RunAnimation;
@ -82,11 +82,12 @@ impl Animation for RunAnimation {
next.lower_torso.scale = Vec3::one() * 1.02;
next.jaw.position = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
next.jaw.orientation = Quaternion::rotation_z(0.0);
next.jaw.scale = Vec3::one();
next.jaw.orientation = Quaternion::rotation_x(0.0);
next.jaw.scale = Vec3::one() * 1.02;
next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1 * 0.0);
next.tail.orientation = Quaternion::rotation_z(0.0);
next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.orientation =
Quaternion::rotation_x(shortalt * 0.3);
next.tail.scale = Vec3::one();
next.second.position = Vec3::new(0.0, 0.0, 0.0);