Makes basic beam Y offset depend on body scale

This commit is contained in:
Snowram 2020-11-15 21:06:07 +01:00 committed by Robin Gilh
parent 7af561263d
commit 83b2640e02
4 changed files with 19 additions and 15 deletions

View File

@ -944,7 +944,7 @@ impl From<(&CharacterAbility, AbilityKey)> for CharacterState {
timer: Duration::default(),
stage_section: StageSection::Buildup,
particle_ori: None::<Vec3<f32>>,
offset: 0.0,
offset: Vec3::zero(),
}),
}
}

View File

@ -546,7 +546,11 @@ impl Body {
(humanoid::Species::Danari, humanoid::BodyType::Male) => 0.696,
(humanoid::Species::Danari, humanoid::BodyType::Female) => 0.696,
},
Body::BipedLarge(_) => 2.5,
Body::BipedLarge(biped_large) => match (biped_large.species, biped_large.body_type) {
(biped_large::Species::Occultsaurok, _) => 2.0,
(biped_large::Species::Slysaurok, _) => 2.0,
_ => 2.2,
},
Body::BirdMedium(_) => 0.7,
Body::Dragon(_) => 16.0,
Body::Golem(_) => 2.0,

View File

@ -54,7 +54,7 @@ pub struct Data {
/// Used for particle stuffs
pub particle_ori: Option<Vec3<f32>>,
/// Used to offset beam and particles
pub offset: f32,
pub offset: Vec3<f32>,
}
impl CharacterBehavior for Data {
@ -88,15 +88,16 @@ impl CharacterBehavior for Data {
tick_dur: Duration::from_secs_f32(1.0 / self.static_data.tick_rate),
timer: Duration::default(),
});
// Gets offset
let eye_height = data.body.eye_height();
// Gets offsets
let body_offsets =
Vec3::new(data.body.radius() * 3.0, 0.0, data.body.eye_height());
// Build up
update.character = CharacterState::BasicBeam(Data {
timer: Duration::default(),
stage_section: StageSection::Cast,
particle_ori: Some(*data.inputs.look_dir),
offset: eye_height * 0.55,
offset: body_offsets * 0.55,
..*self
});
}
@ -132,7 +133,10 @@ impl CharacterBehavior for Data {
duration: self.static_data.beam_duration,
owner: Some(*data.uid),
};
let pos = Pos(data.pos.0 + Vec3::new(0.0, 0.0, self.offset));
// Gets offsets
let body_offsets =
Vec3::new(data.body.radius() * 3.0, 0.0, data.body.eye_height());
let pos = Pos(data.pos.0 + body_offsets);
// Create beam segment
update.server_events.push_front(ServerEvent::BeamSegment {
properties,

View File

@ -375,10 +375,8 @@ impl ParticleMgr {
b.static_data.beam_duration,
time + i as f64 / 1000.0,
ParticleMode::HealingBeam,
pos.0 + particle_ori * 0.5 + Vec3::new(0.0, 0.0, b.offset),
pos.0
+ particle_ori * b.static_data.range
+ Vec3::new(0.0, 0.0, b.offset),
pos.0 + particle_ori * 0.5 + b.offset,
pos.0 + particle_ori * b.static_data.range + b.offset,
));
}
} else {
@ -404,10 +402,8 @@ impl ParticleMgr {
b.static_data.beam_duration,
time,
ParticleMode::FlameThrower,
pos.0 + random_ori * 0.5 + Vec3::new(0.0, 0.0, b.offset),
pos.0
+ random_ori * b.static_data.range
+ Vec3::new(0.0, 0.0, b.offset),
pos.0 + random_ori * 0.5 + b.offset,
pos.0 + random_ori * b.static_data.range + b.offset,
)
},
);