Merge branch 'DaforLynx/poise-sfx' into 'master'

Poise (stun) SFX and fix for town music

See merge request veloren/veloren!2212
This commit is contained in:
Samuel Keiffer 2021-04-29 23:36:22 +00:00
commit be8f25052f
26 changed files with 159 additions and 86 deletions

View File

@ -2,7 +2,7 @@
tracks: [
(
path: "voxygen.audio.ambient.wind",
length: 14.203,
length: 14.2,
tag: Wind,
),
]

View File

@ -716,81 +716,113 @@
],
threshold: 0.2,
),
ArrowShot: (
ArrowShot: (
files: [
"voxygen.audio.sfx.abilities.arrow_shot_1",
"voxygen.audio.sfx.abilities.arrow_shot_2",
"voxygen.audio.sfx.abilities.arrow_shot_3",
"voxygen.audio.sfx.abilities.arrow_shot_4",
],
threshold: 0.2,
),
FireShot: (
files: [
"voxygen.audio.sfx.abilities.fire_shot_1",
"voxygen.audio.sfx.abilities.fire_shot_2",
],
threshold: 0.2,
),
ArrowMiss: (
files: [
"voxygen.audio.sfx.abilities.arrow_shot_1",
"voxygen.audio.sfx.abilities.arrow_shot_2",
"voxygen.audio.sfx.abilities.arrow_shot_3",
"voxygen.audio.sfx.abilities.arrow_shot_4",
"voxygen.audio.sfx.character.arrow_miss",
],
threshold: 0.2,
),
FireShot: (
),
ArrowHit: (
files: [
"voxygen.audio.sfx.abilities.fire_shot_1",
"voxygen.audio.sfx.abilities.fire_shot_2",
"voxygen.audio.sfx.character.arrow_hit",
],
threshold: 0.2,
),
ArrowMiss: (
files: [
"voxygen.audio.sfx.character.arrow_miss",
],
threshold: 0.2,
),
ArrowHit: (
files: [
"voxygen.audio.sfx.character.arrow_hit",
],
threshold: 0.2,
),
SkillPointGain: (
files: [
"voxygen.audio.sfx.character.level_up_sound_-_shorter_wind_up",
),
SkillPointGain: (
files: [
"voxygen.audio.sfx.character.level_up_sound_-_shorter_wind_up",
],
threshold: 0.2,
),
HealingBeam: (
files: [
"voxygen.audio.sfx.abilities.sceptre_channeling",
],
threshold: 0.2,
),
FlameThrower: (
files: [
"voxygen.audio.sfx.abilities.flame_thrower",
],
threshold: 0.2,
),
BreakBlock: (
files: [
"voxygen.audio.sfx.footsteps.stone_step_1",
],
threshold: 0.2,
),
Damage: (
files: [
"voxygen.audio.sfx.character.hit_1",
"voxygen.audio.sfx.character.hit_2",
"voxygen.audio.sfx.character.hit_3",
"voxygen.audio.sfx.character.hit_4",
],
threshold: 0.2,
),
Block: (
files: [
"voxygen.audio.sfx.character.block_1",
"voxygen.audio.sfx.character.block_2",
"voxygen.audio.sfx.character.block_3",
],
threshold: 0.2,
),
Parry: (
files: [
"voxygen.audio.sfx.character.parry_1",
"voxygen.audio.sfx.character.parry_2",
],
threshold: 0.2,
),
PoiseChange(Interrupted): (
files: [
"voxygen.audio.sfx.character.interrupted_1",
"voxygen.audio.sfx.character.interrupted_2",
"voxygen.audio.sfx.character.interrupted_3",
"voxygen.audio.sfx.character.interrupted_4",
],
threshold: 0.2,
),
HealingBeam: (
files: [
"voxygen.audio.sfx.abilities.sceptre_channeling",
threshold: 0.25,
),
PoiseChange(Stunned): (
files: [
"voxygen.audio.sfx.character.stunned_1",
"voxygen.audio.sfx.character.stunned_2",
"voxygen.audio.sfx.character.stunned_3",
],
threshold: 0.2,
),
FlameThrower: (
files: [
"voxygen.audio.sfx.abilities.flame_thrower",
threshold: 0.6,
),
PoiseChange(Dazed): (
files: [
"voxygen.audio.sfx.character.dazed_1",
"voxygen.audio.sfx.character.dazed_2",
"voxygen.audio.sfx.character.dazed_3",
],
threshold: 0.2,
),
BreakBlock: (
files: [
"voxygen.audio.sfx.footsteps.stone_step_1",
threshold: 0.85,
),
PoiseChange(KnockedDown): (
files: [
"voxygen.audio.sfx.character.knockeddown_1",
"voxygen.audio.sfx.character.knockeddown_2",
],
threshold: 0.2,
),
Damage: (
files: [
"voxygen.audio.sfx.character.hit_1",
"voxygen.audio.sfx.character.hit_2",
"voxygen.audio.sfx.character.hit_3",
"voxygen.audio.sfx.character.hit_4",
],
threshold: 0.2,
),
Block: (
files: [
"voxygen.audio.sfx.character.block_1",
"voxygen.audio.sfx.character.block_2",
"voxygen.audio.sfx.character.block_3",
],
threshold: 0.2,
),
Parry: (
files: [
"voxygen.audio.sfx.character.parry_1",
"voxygen.audio.sfx.character.parry_2",
],
threshold: 0.2,
),
threshold: 1.25,
),
}
)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -17,16 +17,6 @@
music_state: Activity(Explore),
artist: "badbbad",
)),
Individual((
title: "Library Theme",
path: "voxygen.audio.soundtrack.town.library_theme",
length: 65.0,
timing: Some(Day),
biomes: [],
site: Some(Settlement),
music_state: Activity(Explore),
artist: "Aeronic",
)),
Individual((
title: "Onwards!",
path: "voxygen.audio.soundtrack.town.onwards",

View File

@ -90,7 +90,7 @@ impl Default for Poise {
}
/// States to define effects of a poise change
#[derive(Clone, Copy, PartialEq, Debug, Serialize, Deserialize)]
#[derive(Clone, Copy, PartialEq, Debug, Serialize, Deserialize, Eq, Hash)]
pub enum PoiseState {
/// No effect applied
Normal,

View File

@ -1,5 +1,5 @@
use crate::{comp, uid::Uid};
use comp::{beam, item::Reagent};
use comp::{beam, item::Reagent, poise::PoiseState};
use serde::{Deserialize, Serialize};
use vek::*;
@ -64,6 +64,10 @@ pub enum Outcome {
parry: bool,
uid: Uid,
},
PoiseChange {
pos: Vec3<f32>,
state: PoiseState,
},
}
impl Outcome {
@ -76,7 +80,8 @@ impl Outcome {
| Outcome::SkillPointGain { pos, .. }
| Outcome::SummonedCreature { pos, .. }
| Outcome::Damage { pos, .. }
| Outcome::Block { pos, .. } => Some(*pos),
| Outcome::Block { pos, .. }
| Outcome::PoiseChange { pos, .. } => Some(*pos),
Outcome::BreakBlock { pos, .. } => Some(pos.map(|e| e as f32 + 0.5)),
Outcome::ExpChange { .. } | Outcome::ComboChange { .. } => None,
}

View File

@ -1,5 +1,5 @@
use specs::{
shred::ResourceId, Entities, Join, LazyUpdate, Read, ReadStorage, SystemData, World,
shred::ResourceId, Entities, Join, LazyUpdate, Read, ReadStorage, SystemData, World, Write,
WriteStorage,
};
@ -15,6 +15,7 @@ use common::{
Vel,
},
event::{EventBus, LocalEvent, ServerEvent},
outcome::Outcome,
resources::DeltaTime,
states::{
self,
@ -101,6 +102,7 @@ impl<'a> System<'a> for Sys {
WriteStorage<'a, Inventory>,
WriteStorage<'a, Controller>,
WriteStorage<'a, Poise>,
Write<'a, Vec<Outcome>>,
);
const NAME: &'static str = "character_behavior";
@ -121,6 +123,7 @@ impl<'a> System<'a> for Sys {
mut inventories,
mut controllers,
mut poises,
mut outcomes,
): Self::SystemData,
) {
let mut server_emitter = read_data.server_bus.emitter();
@ -173,6 +176,7 @@ impl<'a> System<'a> for Sys {
if let Some(mut poise) = poises.get_mut(entity) {
let was_wielded = char_state.get_unchecked().is_wield();
let poise_state = poise.poise_state();
let pos = pos.0;
match poise_state {
PoiseState::Normal => {},
PoiseState::Interrupted => {
@ -189,6 +193,10 @@ impl<'a> System<'a> for Sys {
stage_section: common::states::utils::StageSection::Buildup,
was_wielded,
});
outcomes.push(Outcome::PoiseChange {
pos,
state: PoiseState::Interrupted,
});
},
PoiseState::Stunned => {
poise.reset();
@ -204,6 +212,10 @@ impl<'a> System<'a> for Sys {
stage_section: common::states::utils::StageSection::Buildup,
was_wielded,
});
outcomes.push(Outcome::PoiseChange {
pos,
state: PoiseState::Stunned,
});
server_emitter.emit(ServerEvent::Knockback {
entity,
impulse: 5.0 * poise.knockback(),
@ -223,6 +235,10 @@ impl<'a> System<'a> for Sys {
stage_section: common::states::utils::StageSection::Buildup,
was_wielded,
});
outcomes.push(Outcome::PoiseChange {
pos,
state: PoiseState::Dazed,
});
server_emitter.emit(ServerEvent::Knockback {
entity,
impulse: 10.0 * poise.knockback(),
@ -242,6 +258,10 @@ impl<'a> System<'a> for Sys {
stage_section: common::states::utils::StageSection::Buildup,
was_wielded,
});
outcomes.push(Outcome::PoiseChange {
pos,
state: PoiseState::KnockedDown,
});
server_emitter.emit(ServerEvent::Knockback {
entity,
impulse: 10.0 * poise.knockback(),

View File

@ -139,7 +139,7 @@ impl assets::Asset for AmbientCollection {
fn default_value(_: &str, error: assets::Error) -> Result<Self, assets::Error> {
warn!(
"Error reading music config file, music will not be available: {:#?}",
"Error reading ambience config file, ambience will not be available: {:#?}",
error
);

View File

@ -93,7 +93,9 @@ use common::{
comp::{
beam,
item::{ItemKind, ToolKind},
object, Body, CharacterAbilityType, InventoryUpdateEvent,
object,
poise::PoiseState,
Body, CharacterAbilityType, InventoryUpdateEvent,
},
outcome::Outcome,
terrain::{BlockKind, TerrainChunk},
@ -178,7 +180,7 @@ pub enum SfxEvent {
ArrowShot,
FireShot,
FlameThrower,
// Poise(StunState),
PoiseChange(PoiseState),
}
#[derive(Clone, Debug, PartialEq, Deserialize, Hash, Eq)]
@ -418,6 +420,29 @@ impl SfxMgr {
audio.emit_sfx(sfx_trigger_item, *pos, Some(2.0), false);
}
},
Outcome::PoiseChange { pos, state, .. } => match state {
PoiseState::Normal => {},
PoiseState::Interrupted => {
let sfx_trigger_item =
triggers.get_key_value(&SfxEvent::PoiseChange(PoiseState::Interrupted));
audio.emit_sfx(sfx_trigger_item, *pos, None, false);
},
PoiseState::Stunned => {
let sfx_trigger_item =
triggers.get_key_value(&SfxEvent::PoiseChange(PoiseState::Stunned));
audio.emit_sfx(sfx_trigger_item, *pos, None, false);
},
PoiseState::Dazed => {
let sfx_trigger_item =
triggers.get_key_value(&SfxEvent::PoiseChange(PoiseState::Dazed));
audio.emit_sfx(sfx_trigger_item, *pos, None, false);
},
PoiseState::KnockedDown => {
let sfx_trigger_item =
triggers.get_key_value(&SfxEvent::PoiseChange(PoiseState::KnockedDown));
audio.emit_sfx(sfx_trigger_item, *pos, None, false);
},
},
Outcome::ExpChange { .. }
| Outcome::ComboChange { .. }
| Outcome::SummonedCreature { .. } => {},

View File

@ -219,8 +219,9 @@ impl ParticleMgr {
| Outcome::Beam { .. }
| Outcome::ExpChange { .. }
| Outcome::SkillPointGain { .. }
| Outcome::ComboChange { .. } => {},
Outcome::Damage { .. } => {},
| Outcome::ComboChange { .. }
| Outcome::Damage { .. }
| Outcome::PoiseChange { .. } => {},
}
}