Fix swim sfx, fix glider sfx, add glide sfx

This commit is contained in:
DaforLynx 2022-03-13 05:44:07 +00:00 committed by Samuel Keiffer
parent c5365c850a
commit 123fee2707
23 changed files with 95 additions and 95 deletions

View File

@ -259,19 +259,26 @@
files: [
"voxygen.audio.sfx.character.glider_open",
],
threshold: 0.5,
threshold: 0.1,
),
//Glide: (
// files: [
// // Event Missing or not implemented?
// ],
// threshold: 0.5,
//),
GliderClose: (
files: [
"voxygen.audio.sfx.character.glider_close",
],
threshold: 0.5,
threshold: 0.1,
),
Glide: (
files: [
"voxygen.audio.sfx.character.catch_air_1",
"voxygen.audio.sfx.character.catch_air_2",
"voxygen.audio.sfx.character.catch_air_3",
"voxygen.audio.sfx.character.catch_air_4",
"voxygen.audio.sfx.character.catch_air_5",
"voxygen.audio.sfx.character.catch_air_6",
"voxygen.audio.sfx.character.catch_air_7",
"voxygen.audio.sfx.character.catch_air_8",
],
threshold: 0.85,
),
//

BIN
assets/voxygen/audio/sfx/character/catch_air_1.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/character/catch_air_2.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/character/catch_air_3.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/character/catch_air_4.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/character/catch_air_5.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/character/catch_air_6.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/character/catch_air_7.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/character/catch_air_8.ogg (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -81,6 +81,10 @@ pub enum Outcome {
body: comp::Body,
kind: UtteranceKind,
},
Glider {
pos: Vec3<f32>,
wielded: bool,
},
}
impl Outcome {
@ -97,7 +101,8 @@ impl Outcome {
| Outcome::Block { pos, .. }
| Outcome::PoiseChange { pos, .. }
| Outcome::GroundSlam { pos }
| Outcome::Utterance { pos, .. } => Some(*pos),
| Outcome::Utterance { pos, .. }
| Outcome::Glider { pos, .. } => Some(*pos),
Outcome::BreakBlock { pos, .. } => Some(pos.map(|e| e as f32 + 0.5)),
Outcome::ExpChange { .. } | Outcome::ComboChange { .. } => None,
}

View File

@ -4,6 +4,8 @@ use crate::{
character_state::OutputEvents, fluid_dynamics::angle_of_attack, inventory::slot::EquipSlot,
CharacterState, Ori, StateUpdate, Vel,
},
event::LocalEvent,
outcome::Outcome,
states::{
behavior::{CharacterBehavior, JoinData},
glide_wield, idle,
@ -199,8 +201,12 @@ impl CharacterBehavior for Data {
update
}
fn unwield(&self, data: &JoinData, _: &mut OutputEvents) -> StateUpdate {
fn unwield(&self, data: &JoinData, output_events: &mut OutputEvents) -> StateUpdate {
let mut update = StateUpdate::from(data);
output_events.emit_local(LocalEvent::CreateOutcome(Outcome::Glider {
pos: data.pos.0,
wielded: false,
}));
update.character = CharacterState::Idle(idle::Data { is_sneaking: false });
update
}

View File

@ -4,6 +4,8 @@ use crate::{
character_state::OutputEvents, slot::EquipSlot, CharacterState, InventoryAction, Ori,
StateUpdate,
},
event::LocalEvent,
outcome::Outcome,
states::{
behavior::{CharacterBehavior, JoinData},
glide, idle,
@ -90,8 +92,12 @@ impl CharacterBehavior for Data {
update
}
fn unwield(&self, data: &JoinData, _: &mut OutputEvents) -> StateUpdate {
fn unwield(&self, data: &JoinData, output_events: &mut OutputEvents) -> StateUpdate {
let mut update = StateUpdate::from(data);
output_events.emit_local(LocalEvent::CreateOutcome(Outcome::Glider {
pos: data.pos.0,
wielded: false,
}));
update.character = CharacterState::Idle(idle::Data { is_sneaking: false });
update
}

View File

@ -55,9 +55,9 @@ impl CharacterBehavior for Data {
update
}
fn glide_wield(&self, data: &JoinData, _: &mut OutputEvents) -> StateUpdate {
fn glide_wield(&self, data: &JoinData, output_events: &mut OutputEvents) -> StateUpdate {
let mut update = StateUpdate::from(data);
attempt_glide_wield(data, &mut update);
attempt_glide_wield(data, &mut update, output_events);
update
}

View File

@ -13,6 +13,7 @@ use crate::{
},
consts::{FRIC_GROUND, GRAVITY, MAX_PICKUP_RANGE},
event::{LocalEvent, ServerEvent},
outcome::Outcome,
states::{behavior::JoinData, *},
util::Dir,
vol::ReadVol,
@ -837,7 +838,11 @@ pub fn handle_manipulate_loadout(
}
/// Checks that player can wield the glider and updates `CharacterState` if so
pub fn attempt_glide_wield(data: &JoinData<'_>, update: &mut StateUpdate) {
pub fn attempt_glide_wield(
data: &JoinData<'_>,
update: &mut StateUpdate,
output_events: &mut OutputEvents,
) {
if data
.inventory
.and_then(|inv| inv.equipped(EquipSlot::Glider))
@ -849,6 +854,10 @@ pub fn attempt_glide_wield(data: &JoinData<'_>, update: &mut StateUpdate) {
.unwrap_or(false)
&& data.body.is_humanoid()
{
output_events.emit_local(LocalEvent::CreateOutcome(Outcome::Glider {
pos: data.pos.0,
wielded: true,
}));
update.character = CharacterState::GlideWield(glide_wield::Data::from(data));
}
}

View File

@ -66,9 +66,9 @@ impl CharacterBehavior for Data {
update
}
fn glide_wield(&self, data: &JoinData, _: &mut OutputEvents) -> StateUpdate {
fn glide_wield(&self, data: &JoinData, output_events: &mut OutputEvents) -> StateUpdate {
let mut update = StateUpdate::from(data);
attempt_glide_wield(data, &mut update);
attempt_glide_wield(data, &mut update, output_events);
update
}

View File

@ -179,7 +179,7 @@ impl MovementEventMapper {
}
}
/// Voxygen has an existing list of character states however that list does
/// Voxygen has an existing list of character states; however that list does
/// not provide enough resolution to target specific entity events, such
/// as opening or closing the glider. These methods translate those
/// entity states with some additional data into more specific
@ -220,14 +220,7 @@ impl MovementEventMapper {
// Match all other Movemement and Action states
match (previous_state.event.clone(), character_state) {
(_, CharacterState::Climb { .. }) => SfxEvent::Climb,
(SfxEvent::Glide, CharacterState::Idle { .. }) => SfxEvent::GliderClose,
(previous_event, CharacterState::Glide { .. }) => {
if previous_event != SfxEvent::GliderOpen && previous_event != SfxEvent::Glide {
SfxEvent::GliderOpen
} else {
SfxEvent::Glide
}
},
(_, CharacterState::Glide { .. }) => SfxEvent::Glide,
_ => SfxEvent::Idle,
}
}

View File

@ -233,25 +233,6 @@ fn maps_land_on_ground_to_run() {
assert_eq!(result, SfxEvent::Run(BlockKind::Grass));
}
#[test]
fn maps_glider_open() {
let result = MovementEventMapper::map_movement_event(
&CharacterState::Glide(states::glide::Data::new(10.0, 1.0, Ori::default())),
&Default::default(),
&PreviousEntityState {
event: SfxEvent::Jump,
time: Instant::now(),
on_ground: false,
in_water: false,
distance_travelled: 0.0,
},
Vec3::zero(),
BlockKind::Grass,
);
assert_eq!(result, SfxEvent::GliderOpen);
}
#[test]
fn maps_glide() {
let result = MovementEventMapper::map_movement_event(
@ -271,48 +252,6 @@ fn maps_glide() {
assert_eq!(result, SfxEvent::Glide);
}
#[test]
fn maps_glider_close_when_closing_mid_flight() {
let result = MovementEventMapper::map_movement_event(
&CharacterState::Idle(common::states::idle::Data { is_sneaking: false }),
&Default::default(),
&PreviousEntityState {
event: SfxEvent::Glide,
time: Instant::now(),
on_ground: false,
in_water: false,
distance_travelled: 0.0,
},
Vec3::zero(),
BlockKind::Grass,
);
assert_eq!(result, SfxEvent::GliderClose);
}
#[test]
#[ignore]
fn maps_glider_close_when_landing() {
let result = MovementEventMapper::map_movement_event(
&CharacterState::Idle(common::states::idle::Data { is_sneaking: false }),
&PhysicsState {
on_ground: Some(Block::empty()),
..Default::default()
},
&PreviousEntityState {
event: SfxEvent::Glide,
time: Instant::now(),
on_ground: false,
in_water: false,
distance_travelled: 0.0,
},
Vec3::zero(),
BlockKind::Grass,
);
assert_eq!(result, SfxEvent::GliderClose);
}
#[test]
fn maps_quadrupeds_running() {
let result = MovementEventMapper::map_non_humanoid_movement_event(

View File

@ -161,6 +161,7 @@ pub enum SfxEvent {
GliderOpen,
Glide,
GliderClose,
CatchAir,
Jump,
Fall,
ExperienceGained,
@ -569,6 +570,15 @@ impl SfxMgr {
Outcome::ExpChange { .. }
| Outcome::ComboChange { .. }
| Outcome::SummonedCreature { .. } => {},
Outcome::Glider { pos, wielded } => {
if *wielded {
let sfx_trigger_item = triggers.get_key_value(&SfxEvent::GliderOpen);
audio.emit_sfx(sfx_trigger_item, *pos, Some(1.0), false);
} else {
let sfx_trigger_item = triggers.get_key_value(&SfxEvent::GliderClose);
audio.emit_sfx(sfx_trigger_item, *pos, Some(1.0), false);
}
},
}
}

View File

@ -265,7 +265,8 @@ impl ParticleMgr {
| Outcome::ComboChange { .. }
| Outcome::Damage { .. }
| Outcome::PoiseChange { .. }
| Outcome::Utterance { .. } => {},
| Outcome::Utterance { .. }
| Outcome::Glider { .. } => {},
}
}