mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Cleaned up tweaks in ui and allowed sfx choosing to scale to amount of sfx variants provided.
This commit is contained in:
parent
2e24fcf165
commit
6848851dc3
@ -61,11 +61,11 @@ impl<'a> System<'a> for Sys {
|
||||
let mut server_emitter = read_data.server_bus.emitter();
|
||||
|
||||
// Attacks
|
||||
'projectile_loop: for (entity, pos, physics, ori, mut projectile) in (
|
||||
'projectile_loop: for (entity, pos, physics, vel, mut projectile) in (
|
||||
&read_data.entities,
|
||||
&read_data.positions,
|
||||
&read_data.physics_states,
|
||||
&mut orientations,
|
||||
&read_data.velocities,
|
||||
&mut projectiles,
|
||||
)
|
||||
.join()
|
||||
@ -111,7 +111,10 @@ impl<'a> System<'a> for Sys {
|
||||
.uid_allocator
|
||||
.retrieve_entity_internal(other.into())
|
||||
{
|
||||
if let Some(pos) = read_data.positions.get(target) {
|
||||
if let (Some(pos), Some(dir)) = (
|
||||
read_data.positions.get(target),
|
||||
Dir::from_unnormalized(vel.0),
|
||||
) {
|
||||
let owner_entity = projectile.owner.and_then(|u| {
|
||||
read_data.uid_allocator.retrieve_entity_internal(u.into())
|
||||
});
|
||||
@ -133,9 +136,7 @@ impl<'a> System<'a> for Sys {
|
||||
stats: read_data.stats.get(target),
|
||||
health: read_data.healths.get(target),
|
||||
pos: pos.0,
|
||||
// TODO: Let someone smarter figure this out
|
||||
// ori: orientations.get(target),
|
||||
ori: None,
|
||||
ori: orientations.get(target),
|
||||
char_state: read_data.character_states.get(target),
|
||||
};
|
||||
|
||||
@ -156,7 +157,7 @@ impl<'a> System<'a> for Sys {
|
||||
target_group,
|
||||
attacker_info,
|
||||
target_info,
|
||||
ori.look_dir(),
|
||||
dir,
|
||||
false,
|
||||
1.0,
|
||||
AttackSource::Projectile,
|
||||
@ -222,12 +223,10 @@ impl<'a> System<'a> for Sys {
|
||||
if projectile_vanished {
|
||||
continue 'projectile_loop;
|
||||
}
|
||||
} else if let Some(dir) = read_data
|
||||
.velocities
|
||||
.get(entity)
|
||||
.and_then(|vel| Dir::from_unnormalized(vel.0))
|
||||
{
|
||||
*ori = dir.into();
|
||||
} else if let Some(ori) = orientations.get_mut(entity) {
|
||||
if let Some(dir) = Dir::from_unnormalized(vel.0) {
|
||||
*ori = dir.into();
|
||||
}
|
||||
}
|
||||
|
||||
if projectile.time_left == Duration::default() {
|
||||
|
@ -417,20 +417,21 @@ impl SfxMgr {
|
||||
audio.play_sfx(file_ref, *pos, None);
|
||||
},
|
||||
Outcome::Block { pos, parry, .. } => {
|
||||
// TODO: Get audio for blocking and parrying
|
||||
let file_ref_block = vec![
|
||||
let block_sfx = vec![
|
||||
"voxygen.audio.sfx.character.block_1",
|
||||
"voxygen.audio.sfx.character.block_2",
|
||||
"voxygen.audio.sfx.character.block_3",
|
||||
][rand::thread_rng().gen_range(1..3)];
|
||||
let file_ref_parry = vec![
|
||||
];
|
||||
let parry_sfx = vec![
|
||||
"voxygen.audio.sfx.character.parry_1",
|
||||
"voxygen.audio.sfx.character.parry_2",
|
||||
][rand::thread_rng().gen_range(1..2)];
|
||||
];
|
||||
if *parry {
|
||||
audio.play_sfx(file_ref_parry, *pos, Some(2.0));
|
||||
let file_ref = parry_sfx[rand::thread_rng().gen_range(1..parry_sfx.len())];
|
||||
audio.play_sfx(file_ref, *pos, Some(2.0));
|
||||
} else {
|
||||
audio.play_sfx(file_ref_block, *pos, Some(2.0));
|
||||
let file_ref = block_sfx[rand::thread_rng().gen_range(1..block_sfx.len())];
|
||||
audio.play_sfx(file_ref, *pos, Some(2.0));
|
||||
}
|
||||
},
|
||||
Outcome::ExpChange { .. }
|
||||
|
@ -1348,7 +1348,6 @@ impl Hud {
|
||||
.for_each(|f| f.timer -= dt.as_secs_f32());
|
||||
self.floaters.block_floaters.retain(|f| f.timer > 0_f32);
|
||||
if let Some(uid) = uids.get(me) {
|
||||
use inline_tweak::tweak;
|
||||
for floater in self
|
||||
.floaters
|
||||
.block_floaters
|
||||
@ -1378,18 +1377,15 @@ impl Hud {
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.color(Color::Rgba(0.0, 0.0, 0.0, fade))
|
||||
.x_y(
|
||||
ui_widgets.win_w * (tweak!(0.0)),
|
||||
ui_widgets.win_h * (tweak!(-0.3)) + y - tweak!(3.0),
|
||||
ui_widgets.win_w * (0.0),
|
||||
ui_widgets.win_h * (-0.3) + y - 3.0,
|
||||
)
|
||||
.set(player_sct_bg_id, ui_widgets);
|
||||
Text::new(&i18n.get("hud.sct.block"))
|
||||
.font_size(font_size)
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.color(Color::Rgba(tweak!(0.69), tweak!(0.82), tweak!(0.88), fade))
|
||||
.x_y(
|
||||
ui_widgets.win_w * (tweak!(0.0)),
|
||||
ui_widgets.win_h * (tweak!(-0.3)) + y,
|
||||
)
|
||||
.color(Color::Rgba(0.69, 0.82, 0.88, fade))
|
||||
.x_y(ui_widgets.win_w * 0.0, ui_widgets.win_h * -0.3 + y)
|
||||
.set(player_sct_id, ui_widgets);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user