Fixed beam offsets, told healing beam to use beam animation.

This commit is contained in:
Sam 2021-03-03 00:18:01 -05:00
parent c6a222340e
commit b6f4543a14
3 changed files with 38 additions and 26 deletions

View File

@ -3,7 +3,7 @@ use crate::{
Attack, AttackDamage, AttackEffect, CombatEffect, CombatRequirement, Damage, DamageSource,
GroupTarget,
},
comp::{beam, Body, CharacterState, EnergyChange, EnergySource, Ori, Pos, StateUpdate},
comp::{beam, CharacterState, EnergyChange, EnergySource, Ori, Pos, StateUpdate},
event::ServerEvent,
states::{
behavior::{CharacterBehavior, JoinData},
@ -146,18 +146,11 @@ impl CharacterBehavior for Data {
specifier: self.static_data.specifier,
};
// Gets offsets
let body_offsets = match data.body {
Body::Humanoid(_) => Vec3::new(
(data.body.radius() + 2.0) * data.inputs.look_dir.x,
(data.body.radius() + 2.0) * data.inputs.look_dir.y,
data.body.eye_height() * 0.55,
),
_ => Vec3::new(
(data.body.radius() + 3.0) * data.inputs.look_dir.x,
(data.body.radius() + 3.0) * data.inputs.look_dir.y,
data.body.eye_height() * 0.55,
),
};
let body_offsets = Vec3::new(
(data.body.radius() + 1.0) * data.inputs.look_dir.x,
(data.body.radius() + 1.0) * data.inputs.look_dir.y,
data.body.eye_height() * 0.6,
);
let pos = Pos(data.pos.0 + body_offsets);
// Create beam segment
update.server_events.push_front(ServerEvent::BeamSegment {

View File

@ -1,6 +1,6 @@
use crate::{
combat::{Attack, AttackEffect, CombatEffect, CombatRequirement, GroupTarget},
comp::{beam, Body, CharacterState, Ori, Pos, StateUpdate},
comp::{beam, CharacterState, Ori, Pos, StateUpdate},
event::ServerEvent,
states::{
behavior::{CharacterBehavior, JoinData},
@ -111,18 +111,11 @@ impl CharacterBehavior for Data {
specifier: self.static_data.specifier,
};
// Gets offsets
let body_offsets = match data.body {
Body::Humanoid(_) => Vec3::new(
(data.body.radius() + 2.0) * data.inputs.look_dir.x,
(data.body.radius() + 2.0) * data.inputs.look_dir.y,
data.body.eye_height() * 0.55,
),
_ => Vec3::new(
(data.body.radius() + 3.0) * data.inputs.look_dir.x,
(data.body.radius() + 3.0) * data.inputs.look_dir.y,
data.body.eye_height() * 0.55,
),
};
let body_offsets = Vec3::new(
(data.body.radius() + 1.0) * data.inputs.look_dir.x,
(data.body.radius() + 1.0) * data.inputs.look_dir.y,
data.body.eye_height() * 0.6,
);
let pos = Pos(data.pos.0 + body_offsets);
// Create beam segment
update.server_events.push_front(ServerEvent::BeamSegment {

View File

@ -1252,6 +1252,32 @@ impl FigureMgr {
skeleton_attr,
)
},
CharacterState::HealingBeam(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::Cast => s.timer.as_secs_f32(),
StageSection::Recover => {
stage_time / s.static_data.recover_duration.as_secs_f32()
},
_ => 0.0,
};
anim::character::BeamAnimation::update_skeleton(
&target_base,
(
active_tool_kind,
second_tool_kind,
time,
vel.0.magnitude(),
Some(s.stage_section),
),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
)
},
CharacterState::ComboMelee(s) => {
let stage_index = (s.stage - 1) as usize;
let stage_time = s.timer.as_secs_f32();