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:
@ -61,11 +61,11 @@ impl<'a> System<'a> for Sys {
|
|||||||
let mut server_emitter = read_data.server_bus.emitter();
|
let mut server_emitter = read_data.server_bus.emitter();
|
||||||
|
|
||||||
// Attacks
|
// 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.entities,
|
||||||
&read_data.positions,
|
&read_data.positions,
|
||||||
&read_data.physics_states,
|
&read_data.physics_states,
|
||||||
&mut orientations,
|
&read_data.velocities,
|
||||||
&mut projectiles,
|
&mut projectiles,
|
||||||
)
|
)
|
||||||
.join()
|
.join()
|
||||||
@ -111,7 +111,10 @@ impl<'a> System<'a> for Sys {
|
|||||||
.uid_allocator
|
.uid_allocator
|
||||||
.retrieve_entity_internal(other.into())
|
.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| {
|
let owner_entity = projectile.owner.and_then(|u| {
|
||||||
read_data.uid_allocator.retrieve_entity_internal(u.into())
|
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),
|
stats: read_data.stats.get(target),
|
||||||
health: read_data.healths.get(target),
|
health: read_data.healths.get(target),
|
||||||
pos: pos.0,
|
pos: pos.0,
|
||||||
// TODO: Let someone smarter figure this out
|
ori: orientations.get(target),
|
||||||
// ori: orientations.get(target),
|
|
||||||
ori: None,
|
|
||||||
char_state: read_data.character_states.get(target),
|
char_state: read_data.character_states.get(target),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -156,7 +157,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
target_group,
|
target_group,
|
||||||
attacker_info,
|
attacker_info,
|
||||||
target_info,
|
target_info,
|
||||||
ori.look_dir(),
|
dir,
|
||||||
false,
|
false,
|
||||||
1.0,
|
1.0,
|
||||||
AttackSource::Projectile,
|
AttackSource::Projectile,
|
||||||
@ -222,13 +223,11 @@ impl<'a> System<'a> for Sys {
|
|||||||
if projectile_vanished {
|
if projectile_vanished {
|
||||||
continue 'projectile_loop;
|
continue 'projectile_loop;
|
||||||
}
|
}
|
||||||
} else if let Some(dir) = read_data
|
} else if let Some(ori) = orientations.get_mut(entity) {
|
||||||
.velocities
|
if let Some(dir) = Dir::from_unnormalized(vel.0) {
|
||||||
.get(entity)
|
|
||||||
.and_then(|vel| Dir::from_unnormalized(vel.0))
|
|
||||||
{
|
|
||||||
*ori = dir.into();
|
*ori = dir.into();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if projectile.time_left == Duration::default() {
|
if projectile.time_left == Duration::default() {
|
||||||
server_emitter.emit(ServerEvent::Destroy {
|
server_emitter.emit(ServerEvent::Destroy {
|
||||||
|
@ -417,20 +417,21 @@ impl SfxMgr {
|
|||||||
audio.play_sfx(file_ref, *pos, None);
|
audio.play_sfx(file_ref, *pos, None);
|
||||||
},
|
},
|
||||||
Outcome::Block { pos, parry, .. } => {
|
Outcome::Block { pos, parry, .. } => {
|
||||||
// TODO: Get audio for blocking and parrying
|
let block_sfx = vec![
|
||||||
let file_ref_block = vec![
|
|
||||||
"voxygen.audio.sfx.character.block_1",
|
"voxygen.audio.sfx.character.block_1",
|
||||||
"voxygen.audio.sfx.character.block_2",
|
"voxygen.audio.sfx.character.block_2",
|
||||||
"voxygen.audio.sfx.character.block_3",
|
"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_1",
|
||||||
"voxygen.audio.sfx.character.parry_2",
|
"voxygen.audio.sfx.character.parry_2",
|
||||||
][rand::thread_rng().gen_range(1..2)];
|
];
|
||||||
if *parry {
|
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 {
|
} 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 { .. }
|
Outcome::ExpChange { .. }
|
||||||
|
@ -1348,7 +1348,6 @@ impl Hud {
|
|||||||
.for_each(|f| f.timer -= dt.as_secs_f32());
|
.for_each(|f| f.timer -= dt.as_secs_f32());
|
||||||
self.floaters.block_floaters.retain(|f| f.timer > 0_f32);
|
self.floaters.block_floaters.retain(|f| f.timer > 0_f32);
|
||||||
if let Some(uid) = uids.get(me) {
|
if let Some(uid) = uids.get(me) {
|
||||||
use inline_tweak::tweak;
|
|
||||||
for floater in self
|
for floater in self
|
||||||
.floaters
|
.floaters
|
||||||
.block_floaters
|
.block_floaters
|
||||||
@ -1378,18 +1377,15 @@ impl Hud {
|
|||||||
.font_id(self.fonts.cyri.conrod_id)
|
.font_id(self.fonts.cyri.conrod_id)
|
||||||
.color(Color::Rgba(0.0, 0.0, 0.0, fade))
|
.color(Color::Rgba(0.0, 0.0, 0.0, fade))
|
||||||
.x_y(
|
.x_y(
|
||||||
ui_widgets.win_w * (tweak!(0.0)),
|
ui_widgets.win_w * (0.0),
|
||||||
ui_widgets.win_h * (tweak!(-0.3)) + y - tweak!(3.0),
|
ui_widgets.win_h * (-0.3) + y - 3.0,
|
||||||
)
|
)
|
||||||
.set(player_sct_bg_id, ui_widgets);
|
.set(player_sct_bg_id, ui_widgets);
|
||||||
Text::new(&i18n.get("hud.sct.block"))
|
Text::new(&i18n.get("hud.sct.block"))
|
||||||
.font_size(font_size)
|
.font_size(font_size)
|
||||||
.font_id(self.fonts.cyri.conrod_id)
|
.font_id(self.fonts.cyri.conrod_id)
|
||||||
.color(Color::Rgba(tweak!(0.69), tweak!(0.82), tweak!(0.88), fade))
|
.color(Color::Rgba(0.69, 0.82, 0.88, fade))
|
||||||
.x_y(
|
.x_y(ui_widgets.win_w * 0.0, ui_widgets.win_h * -0.3 + y)
|
||||||
ui_widgets.win_w * (tweak!(0.0)),
|
|
||||||
ui_widgets.win_h * (tweak!(-0.3)) + y,
|
|
||||||
)
|
|
||||||
.set(player_sct_id, ui_widgets);
|
.set(player_sct_id, ui_widgets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user