Fix some updated weapon references and an incomplete match after rebasing.

This commit is contained in:
Shane Handley 2020-05-04 20:03:36 +10:00
parent 987a025d36
commit faf04bb4f3
5 changed files with 16 additions and 12 deletions

View File

@ -125,6 +125,7 @@ pub enum ToolCategory {
Staff,
Shield,
Debug,
Farming,
Empty,
}
@ -139,6 +140,7 @@ impl From<ToolKind> for ToolCategory {
ToolKind::Staff(_) => ToolCategory::Staff,
ToolKind::Shield(_) => ToolCategory::Shield,
ToolKind::Debug(_) => ToolCategory::Debug,
ToolKind::Farming(_) => ToolCategory::Farming,
ToolKind::Empty => ToolCategory::Empty,
}
}

View File

@ -1,6 +1,6 @@
/// event_mapper::combat watches the combat state of entities and emits
/// associated sfx events
use crate::audio::sfx::{SfxTriggerItem, SfxTriggers};
use crate::audio::sfx::{SfxTriggerItem, SfxTriggers, SFX_DIST_LIMIT_SQR};
use common::{
comp::{
@ -44,7 +44,6 @@ impl CombatEventMapper {
}
pub fn maintain(&mut self, state: &State, player_entity: EcsEntity, triggers: &SfxTriggers) {
const SFX_DIST_LIMIT_SQR: f32 = 20000.0;
let ecs = state.ecs();
let sfx_event_bus = ecs.read_resource::<EventBus<SfxEventItem>>();

View File

@ -1,10 +1,7 @@
use super::*;
use common::{
assets,
comp::{
item::tool::{AxeKind, BowKind, SwordKind, ToolCategory, ToolKind},
CharacterAbilityType, CharacterState, ItemConfig, Loadout,
},
comp::{item::tool::ToolCategory, CharacterAbilityType, CharacterState, ItemConfig, Loadout},
event::SfxEvent,
states,
};
@ -15,7 +12,7 @@ fn maps_wield_while_equipping() {
let mut loadout = Loadout::default();
loadout.active_item = Some(ItemConfig {
item: assets::load_expect_cloned("common.items.weapons.starter_axe"),
item: assets::load_expect_cloned("common.items.weapons.axe.starter_axe"),
ability1: None,
ability2: None,
ability3: None,
@ -43,7 +40,7 @@ fn maps_unwield() {
let mut loadout = Loadout::default();
loadout.active_item = Some(ItemConfig {
item: assets::load_expect_cloned("common.items.weapons.starter_bow"),
item: assets::load_expect_cloned("common.items.weapons.bow.starter_bow"),
ability1: None,
ability2: None,
ability3: None,
@ -69,7 +66,7 @@ fn maps_basic_melee() {
let mut loadout = Loadout::default();
loadout.active_item = Some(ItemConfig {
item: assets::load_expect_cloned("common.items.weapons.starter_axe"),
item: assets::load_expect_cloned("common.items.weapons.axe.starter_axe"),
ability1: None,
ability2: None,
ability3: None,
@ -105,7 +102,7 @@ fn maps_triple_strike() {
let mut loadout = Loadout::default();
loadout.active_item = Some(ItemConfig {
item: assets::load_expect_cloned("common.items.weapons.starter_sword"),
item: assets::load_expect_cloned("common.items.weapons.sword.starter_sword"),
ability1: None,
ability2: None,
ability3: None,

View File

@ -1,7 +1,7 @@
/// event_mapper::movement watches all local entities movements and determines
/// which sfx to emit, and the position at which the sound should be emitted
/// from
use crate::audio::sfx::{SfxTriggerItem, SfxTriggers};
use crate::audio::sfx::{SfxTriggerItem, SfxTriggers, SFX_DIST_LIMIT_SQR};
use common::{
comp::{Body, CharacterState, PhysicsState, Pos, Vel},
@ -42,7 +42,6 @@ impl MovementEventMapper {
}
pub fn maintain(&mut self, state: &State, player_entity: EcsEntity, triggers: &SfxTriggers) {
const SFX_DIST_LIMIT_SQR: f32 = 20000.0;
let ecs = state.ecs();
let sfx_event_bus = ecs.read_resource::<EventBus<SfxEventItem>>();

View File

@ -16,6 +16,13 @@ use serde::Deserialize;
use specs::WorldExt;
use vek::*;
/// We watch the states of nearby entities in order to emit SFX at their
/// position based on their state. This constant limits the radius that we
/// observe to prevent tracking distant entities. It approximates the distance
/// at which the volume of the sfx emitted is too quiet to be meaningful for the
/// player.
const SFX_DIST_LIMIT_SQR: f32 = 20000.0;
#[derive(Deserialize)]
pub struct SfxTriggerItem {
pub files: Vec<String>,