More arthropod work

This commit is contained in:
Snowram 2021-09-03 01:57:55 +02:00
parent ae71f2e4f0
commit 02ed6ffd60
21 changed files with 420 additions and 65 deletions

View File

@ -228,6 +228,13 @@
secondary: "common.abilities.custom.theropodbasic.dash",
abilities: [],
),
Custom("Arthropod Basic"): (
primary: "common.abilities.custom.arthropodbasic.singlestrike",
secondary: "common.abilities.custom.arthropodbasic.ensnaringweb",
abilities: [
(None, "common.abilities.custom.arthropodbasic.leap"),
],
),
Custom("Turret"): (
primary: "common.abilities.custom.turret.arrows",
secondary: "common.abilities.custom.turret.arrows",

View File

@ -0,0 +1,8 @@
SpriteSummon(
buildup_duration: 0.6,
cast_duration: 0.4,
recover_duration: 0.3,
sprite: EnsnaringWeb,
summon_distance: (0, 8),
sparseness: 0.67,
)

View File

@ -0,0 +1,15 @@
LeapMelee(
energy_cost: 0,
buildup_duration: 0.5,
movement_duration: 0.4,
swing_duration: 0.075,
recover_duration: 0.2,
base_damage: 120,
base_poise_damage: 60,
knockback: 4.0,
range: 4.5,
max_angle: 180.0,
forward_leap_strength: 40.0,
vertical_leap_strength: 10.0,
damage_kind: Crushing,
)

View File

@ -0,0 +1,34 @@
ComboMelee(
stage_data: [
(
stage: 1,
base_damage: 100,
damage_increase: 0,
base_poise_damage: 28,
poise_damage_increase: 0,
knockback: 3.0,
range: 2.7,
angle: 60.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.4,
forward_movement: 1.0,
damage_kind: Crushing,
damage_effect: Some(Buff((
kind: Poisoned,
dur_secs: 10.0,
strength: DamageFraction(1.0),
chance: 1.0,
))),
),
],
initial_energy_gain: 0,
max_energy_gain: 0,
energy_increase: 0,
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.7,
)

View File

@ -0,0 +1,17 @@
ItemDef(
name: "Arthropod Armor",
description: "Worn by arthropods.",
kind: Armor((
kind: Chest("Arthropod"),
stats: (
protection: Normal(100.0),
poise_resilience: Normal(1.0),
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.0,
stealth: 0.0,
),
)),
quality: Legendary,
tags: [],
)

View File

@ -0,0 +1,21 @@
ItemDef(
name: "Arthropod Basic",
description: "testing123",
kind: Tool((
kind: Natural,
hands: Two,
stats: Direct((
equip_time_secs: 0.01,
power: 1.0,
effect_power: 1.0,
speed: 1.0,
crit_chance: 0.1,
range: 1.0,
energy_efficiency: 1.0,
buff_strength: 1.0,
)),
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Arthropod Basic")),
)

View File

@ -0,0 +1,3 @@
[
(1.0, ItemQuantity("common.items.crafting_ing.cloth.silk", 1, 3)),
]

View File

@ -257,11 +257,11 @@
lateral: ("armor.empty"),
),
leg_fl: (
offset: (-11.0, -0.5, -4.5),
offset: (-0.5, 0.0, -4.5),
lateral: ("npc.antlion.male.leg_fr"),
),
leg_fr: (
offset: (-0.0, -0.5, -4.5),
offset: (-0.5, 0.0, -4.5),
lateral: ("npc.antlion.male.leg_fr"),
),
leg_fcl: (
@ -315,11 +315,11 @@
lateral: ("armor.empty"),
),
leg_fl: (
offset: (-11.0, -0.5, -4.5),
offset: (-0.5, 0.0, -4.5),
lateral: ("npc.antlion.male.leg_fr"),
),
leg_fr: (
offset: (-0.0, -0.5, -4.5),
offset: (-0.5, 0.0, -4.5),
lateral: ("npc.antlion.male.leg_fr"),
),
leg_fcl: (

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/misc/ensnaring_web.vox (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -295,7 +295,7 @@ impl Body {
theropod::Species::Yale => 1_000.0,
},
Body::Ship(ship) => ship.mass().0,
Body::Arthropod(body) => 500.0,
Body::Arthropod(_) => 200.0,
};
Mass(m)
}
@ -402,7 +402,19 @@ impl Body {
theropod::Species::Woodraptor => Vec3::new(2.0, 3.0, 2.6),
theropod::Species::Yale => Vec3::new(1.5, 3.2, 4.0),
},
Body::Arthropod(body) => Vec3::new(4.0, 4.0, 4.0),
Body::Arthropod(body) => match body.species {
arthropod::Species::Tarantula => Vec3::new(2.0, 3.0, 2.6),
arthropod::Species::Blackwidow => Vec3::new(2.0, 3.0, 2.6),
arthropod::Species::Antlion => Vec3::new(2.0, 3.0, 2.6),
arthropod::Species::Hornbeetle => Vec3::new(2.0, 3.0, 2.6),
arthropod::Species::Leafbeetle => Vec3::new(2.0, 3.0, 2.6),
arthropod::Species::Stagbeetle => Vec3::new(2.0, 3.0, 2.6),
arthropod::Species::Weevil => Vec3::new(2.0, 3.0, 2.6),
arthropod::Species::Cavespider => Vec3::new(2.0, 3.0, 2.6),
arthropod::Species::Moltencrawler => Vec3::new(2.0, 3.0, 2.6),
arthropod::Species::Mosscrawler => Vec3::new(2.0, 3.0, 2.6),
arthropod::Species::Sandcrawler => Vec3::new(2.0, 3.0, 2.6),
},
}
}

View File

@ -267,7 +267,7 @@ fn default_main_tool(body: &Body) -> Item {
},
Body::Arthropod(arthropod) => match arthropod.species {
_ => Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.theropodbasic",
"common.items.npc_weapons.unique.arthropodbasic",
)),
},
Body::BipedLarge(biped_large) => match (biped_large.species, biped_large.body_type) {
@ -476,6 +476,7 @@ impl LoadoutBuilder {
| theropod::Species::Odonto => Some("common.items.npc_armor.theropod.rugged"),
_ => None,
},
Body::Arthropod(_) => Some("common.items.npc_armor.arthropod.generic"),
_ => None,
};

View File

@ -129,7 +129,19 @@ impl Body {
quadruped_low::Species::Deadwood => 140.0,
},
Body::Ship(_) => 0.0,
Body::Arthropod(_) => 135.0,
Body::Arthropod(arthropod) => match arthropod.species {
arthropod::Species::Tarantula => 135.0,
arthropod::Species::Blackwidow => 110.0,
arthropod::Species::Antlion => 120.0,
arthropod::Species::Hornbeetle => 80.0,
arthropod::Species::Leafbeetle => 80.0,
arthropod::Species::Stagbeetle => 80.0,
arthropod::Species::Weevil => 110.0,
arthropod::Species::Cavespider => 110.0,
arthropod::Species::Moltencrawler => 70.0,
arthropod::Species::Mosscrawler => 70.0,
arthropod::Species::Sandcrawler => 70.0,
},
}
}
@ -245,7 +257,7 @@ impl Body {
| theropod::Species::Woodraptor => Some(0.4 * self.mass().0),
_ => None,
},
Body::QuadrupedMedium(_) => Some(3.0 * self.mass().0),
Body::Arthropod(_) => Some(2.0 * self.mass().0),
_ => Some(0.4 * self.mass().0),
}
.map(|f| f * GRAVITY)

View File

@ -268,7 +268,7 @@ impl Block {
| SpriteKind::SpinningWheel
| SpriteKind::DismantlingBench
| SpriteKind::TanningRack => None,
SpriteKind::EnsnaringVines => Some(0.1),
SpriteKind::EnsnaringVines | SpriteKind::EnsnaringWeb => Some(0.1),
_ => Some(0.25),
}),
}

View File

@ -1689,25 +1689,33 @@ impl<'a> AgentData<'a> {
tgt_data: &TargetData,
read_data: &ReadData,
) {
if attack_data.angle < 70.0
&& attack_data.dist_sqrd < (1.3 * attack_data.min_attack_dist).powi(2)
agent.action_state.timer += read_data.dt.0;
dbg!(agent.action_state.timer);
if agent.action_state.timer > 6.0
&& attack_data.dist_sqrd < (1.5 * attack_data.min_attack_dist).powi(2)
{
controller.inputs.move_dir = Vec2::zero();
if agent.action_state.timer > 5.0 {
controller
.actions
.push(ControlAction::basic_input(InputKind::Secondary));
if matches!(self.char_state, CharacterState::SpriteSummon(c) if matches!(c.stage_section, StageSection::Recover))
{
// Reset timer
agent.action_state.timer = 0.0;
} else if agent.action_state.timer > 2.0 {
controller
.actions
.push(ControlAction::basic_input(InputKind::Secondary));
agent.action_state.timer += read_data.dt.0;
} else {
controller
.actions
.push(ControlAction::basic_input(InputKind::Primary));
agent.action_state.timer += read_data.dt.0;
}
} else if attack_data.dist_sqrd < MAX_PATH_DIST.powi(2) {
self.path_toward_target(agent, controller, tgt_data, read_data, true, false, None);
} else if attack_data.angle < 90.0
&& attack_data.dist_sqrd < (1.5 * attack_data.min_attack_dist).powi(2)
{
controller.inputs.move_dir = Vec2::zero();
controller
.actions
.push(ControlAction::basic_input(InputKind::Primary));
} else if attack_data.angle < 15.0
&& attack_data.dist_sqrd < (6.0 * attack_data.min_attack_dist).powi(2)
{
controller
.actions
.push(ControlAction::basic_input(InputKind::Ability(0)));
} else {
self.path_toward_target(agent, controller, tgt_data, read_data, false, false, None);
}

View File

@ -1,7 +1,6 @@
use super::{super::Animation, ArthropodSkeleton, SkeletonAttr};
//use std::{f32::consts::PI, ops::Mul};
use super::super::vek::*;
use std::ops::Mul;
pub struct IdleAnimation;
@ -39,23 +38,23 @@ impl Animation for IdleAnimation {
next.leg_fl.position = Vec3::new(-s_a.leg_f.0, s_a.leg_f.1, s_a.leg_f.2);
next.leg_fr.position = Vec3::new(s_a.leg_f.0, s_a.leg_f.1, s_a.leg_f.2);
next.leg_fl.orientation = Quaternion::rotation_z(0.1);
next.leg_fr.orientation = Quaternion::rotation_z(-0.1);
next.leg_fl.orientation = Quaternion::rotation_z(s_a.leg_ori.0);
next.leg_fr.orientation = Quaternion::rotation_z(-s_a.leg_ori.0);
next.leg_fcl.position = Vec3::new(-s_a.leg_fc.0, s_a.leg_fc.1, s_a.leg_fc.2);
next.leg_fcr.position = Vec3::new(s_a.leg_fc.0, s_a.leg_fc.1, s_a.leg_fc.2);
next.leg_fcl.orientation = Quaternion::rotation_z(-0.3);
next.leg_fcr.orientation = Quaternion::rotation_z(0.3);
next.leg_fcl.orientation = Quaternion::rotation_z(s_a.leg_ori.1);
next.leg_fcr.orientation = Quaternion::rotation_z(-s_a.leg_ori.1);
next.leg_bcl.position = Vec3::new(-s_a.leg_bc.0, s_a.leg_bc.1, s_a.leg_bc.2);
next.leg_bcr.position = Vec3::new(s_a.leg_bc.0, s_a.leg_bc.1, s_a.leg_bc.2);
next.leg_bcl.orientation = Quaternion::rotation_z(0.0);
next.leg_bcr.orientation = Quaternion::rotation_z(0.0);
next.leg_bcl.orientation = Quaternion::rotation_z(s_a.leg_ori.2);
next.leg_bcr.orientation = Quaternion::rotation_z(-s_a.leg_ori.2);
next.leg_bl.position = Vec3::new(-s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2);
next.leg_br.position = Vec3::new(s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2);
next.leg_bl.orientation = Quaternion::rotation_z(0.4);
next.leg_br.orientation = Quaternion::rotation_z(-0.4);
next.leg_bl.orientation = Quaternion::rotation_z(s_a.leg_ori.3);
next.leg_br.orientation = Quaternion::rotation_z(-s_a.leg_ori.3);
next
}

View File

@ -0,0 +1,75 @@
use super::{
super::{vek::*, Animation},
ArthropodSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
pub struct LeapMeleeAnimation;
impl Animation for LeapMeleeAnimation {
type Dependency<'a> = (f32, f32, Option<StageSection>, f32);
type Skeleton = ArthropodSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"arthropod_leapmelee\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "arthropod_leapmelee")]
fn update_skeleton_inner<'a>(
skeleton: &Self::Skeleton,
(_velocity, global_time, stage_section, timer): Self::Dependency<'a>,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
//let speed = (Vec2::<f32>::from(velocity).magnitude()).min(24.0);
let (movement1base, movement2base, movement3base, movement4) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0, 0.0),
Some(StageSection::Movement) => (1.0, anim_time, 0.0, 0.0),
Some(StageSection::Action) => (1.0, 1.0, anim_time, 0.0),
Some(StageSection::Recover) => (0.0, 1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0, 0.0),
};
let pullback = 1.0 - movement4;
let subtract = global_time - timer;
let check = subtract - subtract.trunc();
let mirror = (check - 0.5).signum();
let movement1abs = movement1base * pullback;
let movement2abs = movement2base * pullback;
let movement3abs = movement3base * pullback;
let twitch1 = (movement1base * 10.0).sin() * (1.0 - movement2base);
let twitch3 = (movement3base * 5.0).sin() * mirror;
let twitch1abs = twitch1 * mirror;
next.chest.scale = Vec3::one() / s_a.scaler;
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
next.mandible_l.position = Vec3::new(-s_a.mandible.0, s_a.mandible.1, s_a.mandible.2);
next.mandible_r.position = Vec3::new(s_a.mandible.0, s_a.mandible.1, s_a.mandible.2);
next.wing_fl.position = Vec3::new(-s_a.wing_f.0, s_a.wing_f.1, s_a.wing_f.2);
next.wing_fr.position = Vec3::new(s_a.wing_f.0, s_a.wing_f.1, s_a.wing_f.2);
next.wing_bl.position = Vec3::new(-s_a.wing_b.0, s_a.wing_b.1, s_a.wing_b.2);
next.wing_br.position = Vec3::new(s_a.wing_b.0, s_a.wing_b.1, s_a.wing_b.2);
next.leg_fl.position = Vec3::new(-s_a.leg_f.0, s_a.leg_f.1, s_a.leg_f.2);
next.leg_fr.position = Vec3::new(s_a.leg_f.0, s_a.leg_f.1, s_a.leg_f.2);
next.leg_fcl.position = Vec3::new(-s_a.leg_fc.0, s_a.leg_fc.1, s_a.leg_fc.2);
next.leg_fcr.position = Vec3::new(s_a.leg_fc.0, s_a.leg_fc.1, s_a.leg_fc.2);
next.leg_bcl.position = Vec3::new(-s_a.leg_bc.0, s_a.leg_bc.1, s_a.leg_bc.2);
next.leg_bcr.position = Vec3::new(s_a.leg_bc.0, s_a.leg_bc.1, s_a.leg_bc.2);
next.leg_bl.position = Vec3::new(-s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2);
next.leg_br.position = Vec3::new(s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2);
next
}
}

View File

@ -1,11 +1,14 @@
pub mod alpha;
pub mod idle;
pub mod jump;
pub mod leapmelee;
pub mod run;
pub mod stunned;
// Reexports
pub use self::{
alpha::AlphaAnimation, idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation,
alpha::AlphaAnimation, idle::IdleAnimation, jump::JumpAnimation, leapmelee::LeapMeleeAnimation,
run::RunAnimation, stunned::StunnedAnimation,
};
use super::{make_bone, vek::*, FigureBoneData, Offsets, Skeleton};
@ -87,7 +90,8 @@ impl Skeleton for ArthropodSkeleton {
make_bone(leg_br_mat),
];
use comp::arthropod::Species::*;
// TODO: mount points
//use comp::arthropod::Species::*;
let (mount_bone_mat, mount_bone_ori) = match (body.species, body.body_type) {
_ => (chest_mat, self.chest.orientation),
};
@ -122,6 +126,7 @@ pub struct SkeletonAttr {
leg_bc: (f32, f32, f32),
leg_b: (f32, f32, f32),
scaler: f32,
leg_ori: (f32, f32, f32, f32),
}
impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
@ -148,6 +153,7 @@ impl Default for SkeletonAttr {
leg_bc: (0.0, 0.0, 0.0),
leg_b: (0.0, 0.0, 0.0),
scaler: 0.0,
leg_ori: (0.0, 0.0, 0.0, 0.0),
}
}
}
@ -224,7 +230,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
leg_f: match (body.species, body.body_type) {
(Tarantula, _) => (4.0, 11.0, -1.5),
(Blackwidow, _) => (4.0, 13.5, -6.0),
(Antlion, _) => (1.5, 12.0, -4.0),
(Antlion, _) => (4.0, 11.5, -4.0),
(Hornbeetle, _) => (5.0, 6.0, -3.0),
(Leafbeetle, _) => (5.0, 6.0, -1.0),
(Stagbeetle, _) => (5.0, 6.0, -2.0),
@ -237,7 +243,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
leg_fc: match (body.species, body.body_type) {
(Tarantula, _) => (1.5, 13.5, -1.5),
(Blackwidow, _) => (2.5, 13.0, -5.5),
(Antlion, _) => (1.5, 8.0, -4.0),
(Antlion, _) => (1.5, 6.0, -4.0),
(Hornbeetle, _) => (1.5, 7.5, -3.0),
(Leafbeetle, _) => (1.5, 6.5, -1.5),
(Stagbeetle, _) => (1.5, 7.5, -2.0),
@ -250,7 +256,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
leg_bc: match (body.species, body.body_type) {
(Tarantula, _) => (1.5, 10.5, -1.5),
(Blackwidow, _) => (2.5, 10.0, -5.5),
(Antlion, _) => (7.0, 7.5, -4.0),
(Antlion, _) => (6.0, 7.5, -4.0),
(Hornbeetle, _) => (6.0, 6.0, -3.0),
(Leafbeetle, _) => (6.0, 5.0, -2.5),
(Stagbeetle, _) => (6.0, 6.0, -2.0),
@ -286,12 +292,18 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Mosscrawler, _) => (1.0),
(Sandcrawler, _) => (1.0),
},
// Z ori (front, front center, back center, center)
leg_ori: match (body.species, body.body_type) {
(Antlion, _) => (0.7, -0.3, -0.4, 0.4),
(_, _) => (0.1, -0.3, 0.0, 0.4),
},
}
}
}
fn mount_point(body: &Body) -> Vec3<f32> {
use comp::arthropod::{BodyType::*, Species::*};
// TODO: mount points
//use comp::arthropod::{BodyType::*, Species::*};
match (body.species, body.body_type) {
(_, _) => (0.0, -6.0, 6.0),
}

View File

@ -1,7 +1,7 @@
use super::{super::Animation, ArthropodSkeleton, SkeletonAttr};
//use std::{f32::consts::PI, ops::Mul};
use super::super::vek::*;
use std::f32::consts::{FRAC_PI_2, PI};
use std::f32::consts::PI;
pub struct RunAnimation;
@ -26,7 +26,7 @@ impl Animation for RunAnimation {
//let speednorm = speed / 13.0;
let speednorm = (speed / 13.0).powf(0.25);
let mixed_vel = (acc_vel + anim_time * 6.0) * 0.6; //sets run frequency using speed, with anim_time setting a floor
let mixed_vel = (acc_vel + anim_time * 6.0) * 0.8; //sets run frequency using speed, with anim_time setting a floor
let speedmult = 1.0;
let lab: f32 = 0.6; //6
@ -41,12 +41,6 @@ impl Animation for RunAnimation {
//
let shortalt = (mixed_vel * 1.0 * lab * speedmult + PI * 3.0 / 8.0 - 0.5).sin() * speednorm;
//FL
let foot1a = (mixed_vel * 1.0 * lab * speedmult + 0.0 + PI).sin() * speednorm; //1.5
let foot1b = (mixed_vel * 1.0 * lab * speedmult + FRAC_PI_2 + PI).sin() * speednorm; //1.9
//FR
let foot2a = (mixed_vel * 1.0 * lab * speedmult).sin() * speednorm; //1.2
let foot2b = (mixed_vel * 1.0 * lab * speedmult + FRAC_PI_2).sin() * speednorm; //1.6
let ori: Vec2<f32> = Vec2::from(orientation);
let last_ori = Vec2::from(last_ori);
let tilt = if ::vek::Vec2::new(ori, last_ori)
@ -63,11 +57,13 @@ impl Animation for RunAnimation {
let x_tilt = avg_vel.z.atan2(avg_vel.xy().magnitude()) * speednorm;
next.chest.scale = Vec3::one() / s_a.scaler;
next.wing_bl.scale = Vec3::one() * 0.98;
next.wing_br.scale = Vec3::one() * 0.98;
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_x((mixed_vel).sin() * 0.1)
* Quaternion::rotation_y((mixed_vel).sin().min(0.0) * 0.1)
* Quaternion::rotation_z((mixed_vel + PI * 1.5).sin() * 0.1);
* Quaternion::rotation_y((mixed_vel).sin().min(0.0) * 0.08)
* Quaternion::rotation_z((mixed_vel + PI * 1.5).sin() * 0.08);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
next.chest.orientation = Quaternion::rotation_x((mixed_vel).sin().max(0.0) * 0.06)
@ -85,36 +81,36 @@ impl Animation for RunAnimation {
next.leg_fl.position = Vec3::new(-s_a.leg_f.0, s_a.leg_f.1, s_a.leg_f.2);
next.leg_fr.position = Vec3::new(s_a.leg_f.0, s_a.leg_f.1, s_a.leg_f.2);
next.leg_fl.orientation = Quaternion::rotation_x((mixed_vel + PI).sin().max(0.0) * 0.7)
* Quaternion::rotation_z(0.1 + (mixed_vel - PI / 2.0).sin() * 0.4);
* Quaternion::rotation_z(s_a.leg_ori.0 + (mixed_vel - PI / 2.0).sin() * 0.4);
next.leg_fr.orientation = Quaternion::rotation_x((mixed_vel).sin().max(0.0) * 0.7)
* Quaternion::rotation_z(-0.1 - (mixed_vel + PI / 2.0).sin() * 0.4);
* Quaternion::rotation_z(-s_a.leg_ori.0 - (mixed_vel + PI / 2.0).sin() * 0.4);
next.leg_fcl.position = Vec3::new(-s_a.leg_fc.0, s_a.leg_fc.1, s_a.leg_fc.2);
next.leg_fcr.position = Vec3::new(s_a.leg_fc.0, s_a.leg_fc.1, s_a.leg_fc.2);
next.leg_fcl.orientation = Quaternion::rotation_x((mixed_vel + PI).sin() * 0.4)
next.leg_fcl.orientation = Quaternion::rotation_x((mixed_vel + PI).sin() * 0.2)
* Quaternion::rotation_y((mixed_vel).sin().max(0.0) * 0.7)
* Quaternion::rotation_z(-0.3 + (mixed_vel + PI / 2.0).sin() * 0.2);
next.leg_fcr.orientation = Quaternion::rotation_x((mixed_vel).sin() * 0.4)
* Quaternion::rotation_z(s_a.leg_ori.1 + (mixed_vel + PI / 2.0).sin() * 0.2);
next.leg_fcr.orientation = Quaternion::rotation_x((mixed_vel).sin() * 0.2)
* Quaternion::rotation_y((mixed_vel).sin().min(0.0) * 0.7)
* Quaternion::rotation_z(0.3 - (mixed_vel + PI * 1.5).sin() * 0.2);
* Quaternion::rotation_z(-s_a.leg_ori.1 - (mixed_vel + PI * 1.5).sin() * 0.2);
next.leg_bcl.position = Vec3::new(-s_a.leg_bc.0, s_a.leg_bc.1, s_a.leg_bc.2);
next.leg_bcr.position = Vec3::new(s_a.leg_bc.0, s_a.leg_bc.1, s_a.leg_bc.2);
next.leg_bcl.orientation = Quaternion::rotation_x((mixed_vel + PI).sin() * 0.4)
next.leg_bcl.orientation = Quaternion::rotation_x((mixed_vel + PI).sin() * 0.2)
* Quaternion::rotation_y((mixed_vel + PI).sin().max(0.0) * 0.7)
* Quaternion::rotation_z((mixed_vel + PI * 1.5).sin() * 0.3);
next.leg_bcr.orientation = Quaternion::rotation_x((mixed_vel).sin() * 0.4)
* Quaternion::rotation_z(s_a.leg_ori.2 + (mixed_vel + PI * 1.5).sin() * 0.3);
next.leg_bcr.orientation = Quaternion::rotation_x((mixed_vel).sin() * 0.2)
* Quaternion::rotation_y((mixed_vel + PI).sin().min(0.0) * 0.7)
* Quaternion::rotation_z(-(mixed_vel + PI / 2.0).sin() * 0.3);
* Quaternion::rotation_z(-s_a.leg_ori.2 - (mixed_vel + PI / 2.0).sin() * 0.3);
next.leg_bl.position = Vec3::new(-s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2);
next.leg_br.position = Vec3::new(s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2);
next.leg_bl.orientation = Quaternion::rotation_x((mixed_vel + PI).sin() * 0.4)
next.leg_bl.orientation = Quaternion::rotation_x((mixed_vel + PI).sin() * 0.2)
* Quaternion::rotation_y((mixed_vel).sin().max(0.0) * 0.7)
* Quaternion::rotation_z(0.4 + (mixed_vel + PI / 2.0).sin() * 0.2);
next.leg_br.orientation = Quaternion::rotation_x((mixed_vel).sin() * 0.4)
* Quaternion::rotation_z(s_a.leg_ori.3 + (mixed_vel + PI / 2.0).sin() * 0.2);
next.leg_br.orientation = Quaternion::rotation_x((mixed_vel).sin() * 0.2)
* Quaternion::rotation_y((mixed_vel).sin().min(0.0) * 0.7)
* Quaternion::rotation_z(-0.4 - (mixed_vel + PI * 1.5).sin() * 0.2);
* Quaternion::rotation_z(s_a.leg_ori.3 - (mixed_vel + PI * 1.5).sin() * 0.2);
next
}

View File

@ -0,0 +1,70 @@
use super::{
super::{vek::*, Animation},
ArthropodSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
//use std::ops::Rem;
pub struct StunnedAnimation;
impl Animation for StunnedAnimation {
type Dependency<'a> = (f32, f32, Option<StageSection>, f32);
type Skeleton = ArthropodSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"arthropod_stunned\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "arthropod_stunned")]
fn update_skeleton_inner<'a>(
skeleton: &Self::Skeleton,
(_velocity, global_time, stage_section, timer): Self::Dependency<'a>,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let (movement1base, movement2, twitch) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Recover) => {
(1.0, anim_time.powf(3.0), ((1.0 - anim_time) * 10.0).sin())
},
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - movement2;
let subtract = global_time - timer;
let check = subtract - subtract.trunc();
let mirror = (check - 0.5).signum();
let movement1 = mirror * movement1base * pullback;
let movement1abs = movement1base * pullback;
next.chest.scale = Vec3::one() / s_a.scaler;
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
next.mandible_l.position = Vec3::new(-s_a.mandible.0, s_a.mandible.1, s_a.mandible.2);
next.mandible_r.position = Vec3::new(s_a.mandible.0, s_a.mandible.1, s_a.mandible.2);
next.wing_fl.position = Vec3::new(-s_a.wing_f.0, s_a.wing_f.1, s_a.wing_f.2);
next.wing_fr.position = Vec3::new(s_a.wing_f.0, s_a.wing_f.1, s_a.wing_f.2);
next.wing_bl.position = Vec3::new(-s_a.wing_b.0, s_a.wing_b.1, s_a.wing_b.2);
next.wing_br.position = Vec3::new(s_a.wing_b.0, s_a.wing_b.1, s_a.wing_b.2);
next.leg_fl.position = Vec3::new(-s_a.leg_f.0, s_a.leg_f.1, s_a.leg_f.2);
next.leg_fr.position = Vec3::new(s_a.leg_f.0, s_a.leg_f.1, s_a.leg_f.2);
next.leg_fcl.position = Vec3::new(-s_a.leg_fc.0, s_a.leg_fc.1, s_a.leg_fc.2);
next.leg_fcr.position = Vec3::new(s_a.leg_fc.0, s_a.leg_fc.1, s_a.leg_fc.2);
next.leg_bcl.position = Vec3::new(-s_a.leg_bc.0, s_a.leg_bc.1, s_a.leg_bc.2);
next.leg_bcr.position = Vec3::new(s_a.leg_bc.0, s_a.leg_bc.1, s_a.leg_bc.2);
next.leg_bl.position = Vec3::new(-s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2);
next.leg_br.position = Vec3::new(s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2);
next
}
}

View File

@ -3574,6 +3574,68 @@ impl FigureMgr {
),
}
},
CharacterState::LeapMelee(s) => {
let stage_time = s.timer.as_secs_f32();
let stage_progress = match s.stage_section {
StageSection::Buildup => {
stage_time / s.static_data.buildup_duration.as_secs_f32()
},
StageSection::Movement => {
stage_time / s.static_data.movement_duration.as_secs_f32()
},
StageSection::Action => {
stage_time / s.static_data.swing_duration.as_secs_f32()
},
StageSection::Recover => {
stage_time / s.static_data.recover_duration.as_secs_f32()
},
_ => 0.0,
};
anim::arthropod::LeapMeleeAnimation::update_skeleton(
&target_base,
(
rel_vel.magnitude(),
time,
Some(s.stage_section),
state.state_time,
),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
)
},
CharacterState::Stunned(s) => {
let stage_time = s.timer.as_secs_f32();
let stage_progress = match s.stage_section {
StageSection::Buildup => {
stage_time / s.static_data.buildup_duration.as_secs_f32()
},
StageSection::Recover => {
stage_time / s.static_data.recover_duration.as_secs_f32()
},
_ => 0.0,
};
match s.static_data.poise_state {
PoiseState::Normal
| PoiseState::Interrupted
| PoiseState::Stunned
| PoiseState::Dazed
| PoiseState::KnockedDown => {
anim::arthropod::StunnedAnimation::update_skeleton(
&target_base,
(
rel_vel.magnitude(),
time,
Some(s.stage_section),
state.state_time,
),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
)
},
}
},
// TODO!
_ => target_base,
};