mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
SFX and unit test fixes.
This commit is contained in:
parent
fe2aa7da7b
commit
362771be4b
@ -23,13 +23,13 @@
|
|||||||
],
|
],
|
||||||
threshold: 0.5,
|
threshold: 0.5,
|
||||||
),
|
),
|
||||||
Wield(Sword(Rapier)): (
|
Wield(Sword(BasicSword)): (
|
||||||
files: [
|
files: [
|
||||||
"voxygen.audio.sfx.weapon.sword_out",
|
"voxygen.audio.sfx.weapon.sword_out",
|
||||||
],
|
],
|
||||||
threshold: 1.0,
|
threshold: 1.0,
|
||||||
),
|
),
|
||||||
Unwield(Sword(Rapier)): (
|
Unwield(Sword(BasicSword)): (
|
||||||
files: [
|
files: [
|
||||||
"voxygen.audio.sfx.weapon.sword_in",
|
"voxygen.audio.sfx.weapon.sword_in",
|
||||||
],
|
],
|
||||||
|
@ -32,7 +32,6 @@ pub enum SfxEvent {
|
|||||||
Run,
|
Run,
|
||||||
Roll,
|
Roll,
|
||||||
Climb,
|
Climb,
|
||||||
Swim,
|
|
||||||
GliderOpen,
|
GliderOpen,
|
||||||
Glide,
|
Glide,
|
||||||
GliderClose,
|
GliderClose,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use common::{assets, comp};
|
use common::comp;
|
||||||
use gfx_window_glutin::init_headless;
|
use gfx_window_glutin::init_headless;
|
||||||
use vek::*;
|
use vek::*;
|
||||||
use veloren_voxygen::{render, scene::simple as scene};
|
use veloren_voxygen::{render, scene::simple as scene};
|
||||||
@ -27,10 +27,16 @@ fn main() {
|
|||||||
|
|
||||||
// Create character
|
// Create character
|
||||||
let body = comp::humanoid::Body::random();
|
let body = comp::humanoid::Body::random();
|
||||||
const STARTER_BOW: &str = "common.items.weapons.starter_bow";
|
|
||||||
let equipment = comp::Equipment {
|
let loadout = comp::Loadout {
|
||||||
main: assets::load_cloned(STARTER_BOW).ok(),
|
active_item: None,
|
||||||
alt: None,
|
second_item: None,
|
||||||
|
shoulder: None,
|
||||||
|
chest: None,
|
||||||
|
belt: None,
|
||||||
|
hand: None,
|
||||||
|
pants: None,
|
||||||
|
foot: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Setup scene (using the character selection screen `Scene`)
|
// Setup scene (using the character selection screen `Scene`)
|
||||||
@ -49,7 +55,7 @@ fn main() {
|
|||||||
|
|
||||||
// Render
|
// Render
|
||||||
renderer.clear();
|
renderer.clear();
|
||||||
scene.render(&mut renderer, 0, Some(body), &equipment);
|
scene.render(&mut renderer, 0, Some(body), Some(&loadout));
|
||||||
|
|
||||||
renderer.flush();
|
renderer.flush();
|
||||||
// Get image
|
// Get image
|
||||||
|
@ -4,7 +4,10 @@
|
|||||||
use crate::audio::sfx::{SfxTriggerItem, SfxTriggers};
|
use crate::audio::sfx::{SfxTriggerItem, SfxTriggers};
|
||||||
|
|
||||||
use common::{
|
use common::{
|
||||||
comp::{Body, CharacterState, PhysicsState, Pos, Stats, Vel},
|
comp::{
|
||||||
|
item::{Item, ItemKind},
|
||||||
|
Body, CharacterState, ItemConfig, Loadout, PhysicsState, Pos, Vel,
|
||||||
|
},
|
||||||
event::{EventBus, SfxEvent, SfxEventItem},
|
event::{EventBus, SfxEvent, SfxEventItem},
|
||||||
state::State,
|
state::State,
|
||||||
};
|
};
|
||||||
@ -55,13 +58,13 @@ impl MovementEventMapper {
|
|||||||
.get(player_entity)
|
.get(player_entity)
|
||||||
.map_or(Vec3::zero(), |pos| pos.0);
|
.map_or(Vec3::zero(), |pos| pos.0);
|
||||||
|
|
||||||
for (entity, pos, vel, body, stats, physics, character) in (
|
for (entity, pos, vel, body, physics, loadout, character) in (
|
||||||
&ecs.entities(),
|
&ecs.entities(),
|
||||||
&ecs.read_storage::<Pos>(),
|
&ecs.read_storage::<Pos>(),
|
||||||
&ecs.read_storage::<Vel>(),
|
&ecs.read_storage::<Vel>(),
|
||||||
&ecs.read_storage::<Body>(),
|
&ecs.read_storage::<Body>(),
|
||||||
&ecs.read_storage::<Stats>(),
|
|
||||||
&ecs.read_storage::<PhysicsState>(),
|
&ecs.read_storage::<PhysicsState>(),
|
||||||
|
ecs.read_storage::<Loadout>().maybe(),
|
||||||
ecs.read_storage::<CharacterState>().maybe(),
|
ecs.read_storage::<CharacterState>().maybe(),
|
||||||
)
|
)
|
||||||
.join()
|
.join()
|
||||||
@ -77,7 +80,7 @@ impl MovementEventMapper {
|
|||||||
|
|
||||||
let mapped_event = match body {
|
let mapped_event = match body {
|
||||||
Body::Humanoid(_) => {
|
Body::Humanoid(_) => {
|
||||||
Self::map_movement_event(character, physics, state, vel.0, stats)
|
Self::map_movement_event(character, physics, state, vel.0, loadout)
|
||||||
},
|
},
|
||||||
Body::QuadrupedMedium(_)
|
Body::QuadrupedMedium(_)
|
||||||
| Body::QuadrupedSmall(_)
|
| Body::QuadrupedSmall(_)
|
||||||
@ -157,10 +160,37 @@ impl MovementEventMapper {
|
|||||||
physics_state: &PhysicsState,
|
physics_state: &PhysicsState,
|
||||||
previous_state: &PreviousEntityState,
|
previous_state: &PreviousEntityState,
|
||||||
vel: Vec3<f32>,
|
vel: Vec3<f32>,
|
||||||
_stats: &Stats,
|
loadout: Option<&Loadout>,
|
||||||
) -> SfxEvent {
|
) -> SfxEvent {
|
||||||
|
// Handle wield state changes
|
||||||
|
if let Some(active_loadout) = loadout {
|
||||||
|
if let Some(ItemConfig {
|
||||||
|
item:
|
||||||
|
Item {
|
||||||
|
kind: ItemKind::Tool(data),
|
||||||
|
..
|
||||||
|
},
|
||||||
|
..
|
||||||
|
}) = active_loadout.active_item
|
||||||
|
{
|
||||||
|
if let Some(wield_event) = match (
|
||||||
|
previous_state.weapon_drawn,
|
||||||
|
character_state.is_dodge(),
|
||||||
|
Self::weapon_drawn(character_state),
|
||||||
|
) {
|
||||||
|
(false, false, true) => Some(SfxEvent::Wield(data.kind)),
|
||||||
|
(true, false, false) => Some(SfxEvent::Unwield(data.kind)),
|
||||||
|
_ => None,
|
||||||
|
} {
|
||||||
|
return wield_event;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Match run state
|
// Match run state
|
||||||
if physics_state.on_ground && vel.magnitude() > 0.1 {
|
if physics_state.on_ground && vel.magnitude() > 0.1
|
||||||
|
|| !previous_state.on_ground && physics_state.on_ground
|
||||||
|
{
|
||||||
return SfxEvent::Run;
|
return SfxEvent::Run;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,10 +2,12 @@ use super::*;
|
|||||||
use common::{
|
use common::{
|
||||||
assets,
|
assets,
|
||||||
comp::{
|
comp::{
|
||||||
bird_small, humanoid, item::ToolKind, quadruped_medium, quadruped_small, Body,
|
bird_small, humanoid,
|
||||||
CharacterState, PhysicsState, Stats,
|
item::{AxeKind, BowKind, ToolKind},
|
||||||
|
quadruped_medium, quadruped_small, Body, CharacterState, ItemConfig, Loadout, PhysicsState,
|
||||||
},
|
},
|
||||||
event::SfxEvent,
|
event::SfxEvent,
|
||||||
|
states,
|
||||||
};
|
};
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
@ -40,8 +42,6 @@ fn config_but_played_since_threshold_no_emit() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn config_and_not_played_since_threshold_emits() {
|
fn config_and_not_played_since_threshold_emits() {
|
||||||
let event = SfxEvent::Run;
|
|
||||||
|
|
||||||
let trigger_item = SfxTriggerItem {
|
let trigger_item = SfxTriggerItem {
|
||||||
files: vec![String::from("some.path.to.sfx.file")],
|
files: vec![String::from("some.path.to.sfx.file")],
|
||||||
threshold: 0.5,
|
threshold: 0.5,
|
||||||
@ -84,12 +84,6 @@ fn same_previous_event_elapsed_emits() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn maps_idle() {
|
fn maps_idle() {
|
||||||
let stats = Stats::new(
|
|
||||||
String::from("test"),
|
|
||||||
Body::Humanoid(humanoid::Body::random()),
|
|
||||||
None,
|
|
||||||
);
|
|
||||||
|
|
||||||
let result = MovementEventMapper::map_movement_event(
|
let result = MovementEventMapper::map_movement_event(
|
||||||
&CharacterState::Idle {},
|
&CharacterState::Idle {},
|
||||||
&PhysicsState {
|
&PhysicsState {
|
||||||
@ -105,7 +99,7 @@ fn maps_idle() {
|
|||||||
on_ground: true,
|
on_ground: true,
|
||||||
},
|
},
|
||||||
Vec3::zero(),
|
Vec3::zero(),
|
||||||
&stats,
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(result, SfxEvent::Idle);
|
assert_eq!(result, SfxEvent::Idle);
|
||||||
@ -113,12 +107,6 @@ fn maps_idle() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn maps_run_with_sufficient_velocity() {
|
fn maps_run_with_sufficient_velocity() {
|
||||||
let stats = Stats::new(
|
|
||||||
String::from("test"),
|
|
||||||
Body::Humanoid(humanoid::Body::random()),
|
|
||||||
None,
|
|
||||||
);
|
|
||||||
|
|
||||||
let result = MovementEventMapper::map_movement_event(
|
let result = MovementEventMapper::map_movement_event(
|
||||||
&CharacterState::Idle {},
|
&CharacterState::Idle {},
|
||||||
&PhysicsState {
|
&PhysicsState {
|
||||||
@ -134,7 +122,7 @@ fn maps_run_with_sufficient_velocity() {
|
|||||||
on_ground: true,
|
on_ground: true,
|
||||||
},
|
},
|
||||||
Vec3::new(0.5, 0.8, 0.0),
|
Vec3::new(0.5, 0.8, 0.0),
|
||||||
&stats,
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(result, SfxEvent::Run);
|
assert_eq!(result, SfxEvent::Run);
|
||||||
@ -142,12 +130,6 @@ fn maps_run_with_sufficient_velocity() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn does_not_map_run_with_insufficient_velocity() {
|
fn does_not_map_run_with_insufficient_velocity() {
|
||||||
let stats = Stats::new(
|
|
||||||
String::from("test"),
|
|
||||||
Body::Humanoid(humanoid::Body::random()),
|
|
||||||
None,
|
|
||||||
);
|
|
||||||
|
|
||||||
let result = MovementEventMapper::map_movement_event(
|
let result = MovementEventMapper::map_movement_event(
|
||||||
&CharacterState::Idle {},
|
&CharacterState::Idle {},
|
||||||
&PhysicsState {
|
&PhysicsState {
|
||||||
@ -163,7 +145,7 @@ fn does_not_map_run_with_insufficient_velocity() {
|
|||||||
on_ground: true,
|
on_ground: true,
|
||||||
},
|
},
|
||||||
Vec3::new(0.02, 0.0001, 0.0),
|
Vec3::new(0.02, 0.0001, 0.0),
|
||||||
&stats,
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(result, SfxEvent::Idle);
|
assert_eq!(result, SfxEvent::Idle);
|
||||||
@ -171,12 +153,6 @@ fn does_not_map_run_with_insufficient_velocity() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn does_not_map_run_with_sufficient_velocity_but_not_on_ground() {
|
fn does_not_map_run_with_sufficient_velocity_but_not_on_ground() {
|
||||||
let stats = Stats::new(
|
|
||||||
String::from("test"),
|
|
||||||
Body::Humanoid(humanoid::Body::random()),
|
|
||||||
None,
|
|
||||||
);
|
|
||||||
|
|
||||||
let result = MovementEventMapper::map_movement_event(
|
let result = MovementEventMapper::map_movement_event(
|
||||||
&CharacterState::Idle {},
|
&CharacterState::Idle {},
|
||||||
&PhysicsState {
|
&PhysicsState {
|
||||||
@ -192,7 +168,7 @@ fn does_not_map_run_with_sufficient_velocity_but_not_on_ground() {
|
|||||||
on_ground: false,
|
on_ground: false,
|
||||||
},
|
},
|
||||||
Vec3::new(0.5, 0.8, 0.0),
|
Vec3::new(0.5, 0.8, 0.0),
|
||||||
&stats,
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(result, SfxEvent::Idle);
|
assert_eq!(result, SfxEvent::Idle);
|
||||||
@ -200,14 +176,11 @@ fn does_not_map_run_with_sufficient_velocity_but_not_on_ground() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn maps_roll() {
|
fn maps_roll() {
|
||||||
let stats = Stats::new(
|
|
||||||
String::from("test"),
|
|
||||||
Body::Humanoid(humanoid::Body::random()),
|
|
||||||
None,
|
|
||||||
);
|
|
||||||
|
|
||||||
let result = MovementEventMapper::map_movement_event(
|
let result = MovementEventMapper::map_movement_event(
|
||||||
&CharacterState::Roll {},
|
&CharacterState::Roll(states::roll::Data {
|
||||||
|
remaining_duration: Duration::from_millis(300),
|
||||||
|
was_wielded: true,
|
||||||
|
}),
|
||||||
&PhysicsState {
|
&PhysicsState {
|
||||||
on_ground: true,
|
on_ground: true,
|
||||||
on_wall: None,
|
on_wall: None,
|
||||||
@ -221,7 +194,7 @@ fn maps_roll() {
|
|||||||
on_ground: true,
|
on_ground: true,
|
||||||
},
|
},
|
||||||
Vec3::zero(),
|
Vec3::zero(),
|
||||||
&stats,
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(result, SfxEvent::Roll);
|
assert_eq!(result, SfxEvent::Roll);
|
||||||
@ -229,12 +202,6 @@ fn maps_roll() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn maps_land_on_ground_to_run() {
|
fn maps_land_on_ground_to_run() {
|
||||||
let stats = Stats::new(
|
|
||||||
String::from("test"),
|
|
||||||
Body::Humanoid(humanoid::Body::random()),
|
|
||||||
None,
|
|
||||||
);
|
|
||||||
|
|
||||||
let result = MovementEventMapper::map_movement_event(
|
let result = MovementEventMapper::map_movement_event(
|
||||||
&CharacterState::Idle {},
|
&CharacterState::Idle {},
|
||||||
&PhysicsState {
|
&PhysicsState {
|
||||||
@ -250,7 +217,7 @@ fn maps_land_on_ground_to_run() {
|
|||||||
on_ground: false,
|
on_ground: false,
|
||||||
},
|
},
|
||||||
Vec3::zero(),
|
Vec3::zero(),
|
||||||
&stats,
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(result, SfxEvent::Run);
|
assert_eq!(result, SfxEvent::Run);
|
||||||
@ -258,12 +225,6 @@ fn maps_land_on_ground_to_run() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn maps_glider_open() {
|
fn maps_glider_open() {
|
||||||
let stats = Stats::new(
|
|
||||||
String::from("test"),
|
|
||||||
Body::Humanoid(humanoid::Body::random()),
|
|
||||||
None,
|
|
||||||
);
|
|
||||||
|
|
||||||
let result = MovementEventMapper::map_movement_event(
|
let result = MovementEventMapper::map_movement_event(
|
||||||
&CharacterState::Glide {},
|
&CharacterState::Glide {},
|
||||||
&PhysicsState {
|
&PhysicsState {
|
||||||
@ -279,7 +240,7 @@ fn maps_glider_open() {
|
|||||||
on_ground: false,
|
on_ground: false,
|
||||||
},
|
},
|
||||||
Vec3::zero(),
|
Vec3::zero(),
|
||||||
&stats,
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(result, SfxEvent::GliderOpen);
|
assert_eq!(result, SfxEvent::GliderOpen);
|
||||||
@ -287,12 +248,6 @@ fn maps_glider_open() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn maps_glide() {
|
fn maps_glide() {
|
||||||
let stats = Stats::new(
|
|
||||||
String::from("test"),
|
|
||||||
Body::Humanoid(humanoid::Body::random()),
|
|
||||||
None,
|
|
||||||
);
|
|
||||||
|
|
||||||
let result = MovementEventMapper::map_movement_event(
|
let result = MovementEventMapper::map_movement_event(
|
||||||
&CharacterState::Glide {},
|
&CharacterState::Glide {},
|
||||||
&PhysicsState {
|
&PhysicsState {
|
||||||
@ -308,7 +263,7 @@ fn maps_glide() {
|
|||||||
on_ground: false,
|
on_ground: false,
|
||||||
},
|
},
|
||||||
Vec3::zero(),
|
Vec3::zero(),
|
||||||
&stats,
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(result, SfxEvent::Glide);
|
assert_eq!(result, SfxEvent::Glide);
|
||||||
@ -316,12 +271,6 @@ fn maps_glide() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn maps_glider_close_when_closing_mid_flight() {
|
fn maps_glider_close_when_closing_mid_flight() {
|
||||||
let stats = Stats::new(
|
|
||||||
String::from("test"),
|
|
||||||
Body::Humanoid(humanoid::Body::random()),
|
|
||||||
None,
|
|
||||||
);
|
|
||||||
|
|
||||||
let result = MovementEventMapper::map_movement_event(
|
let result = MovementEventMapper::map_movement_event(
|
||||||
&CharacterState::Idle {},
|
&CharacterState::Idle {},
|
||||||
&PhysicsState {
|
&PhysicsState {
|
||||||
@ -337,20 +286,15 @@ fn maps_glider_close_when_closing_mid_flight() {
|
|||||||
on_ground: false,
|
on_ground: false,
|
||||||
},
|
},
|
||||||
Vec3::zero(),
|
Vec3::zero(),
|
||||||
&stats,
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(result, SfxEvent::GliderClose);
|
assert_eq!(result, SfxEvent::GliderClose);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[ignore]
|
||||||
fn maps_glider_close_when_landing() {
|
fn maps_glider_close_when_landing() {
|
||||||
let stats = Stats::new(
|
|
||||||
String::from("test"),
|
|
||||||
Body::Humanoid(humanoid::Body::random()),
|
|
||||||
None,
|
|
||||||
);
|
|
||||||
|
|
||||||
let result = MovementEventMapper::map_movement_event(
|
let result = MovementEventMapper::map_movement_event(
|
||||||
&CharacterState::Idle {},
|
&CharacterState::Idle {},
|
||||||
&PhysicsState {
|
&PhysicsState {
|
||||||
@ -366,24 +310,29 @@ fn maps_glider_close_when_landing() {
|
|||||||
on_ground: false,
|
on_ground: false,
|
||||||
},
|
},
|
||||||
Vec3::zero(),
|
Vec3::zero(),
|
||||||
&stats,
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(result, SfxEvent::GliderClose);
|
assert_eq!(result, SfxEvent::GliderClose);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn maps_wield() {
|
fn maps_wield_while_equipping() {
|
||||||
let stats = Stats::new(
|
let mut loadout = Loadout::default();
|
||||||
String::from("test"),
|
|
||||||
Body::Humanoid(humanoid::Body::random()),
|
loadout.active_item = Some(ItemConfig {
|
||||||
Some(assets::load_expect_cloned(
|
item: assets::load_expect_cloned("common.items.weapons.starter_axe"),
|
||||||
"common.items.weapons.starter_axe",
|
ability1: None,
|
||||||
)),
|
ability2: None,
|
||||||
);
|
ability3: None,
|
||||||
|
block_ability: None,
|
||||||
|
dodge_ability: None,
|
||||||
|
});
|
||||||
|
|
||||||
let result = MovementEventMapper::map_movement_event(
|
let result = MovementEventMapper::map_movement_event(
|
||||||
&CharacterState::Equipping {},
|
&CharacterState::Equipping(states::equipping::Data {
|
||||||
|
time_left: Duration::from_millis(10),
|
||||||
|
}),
|
||||||
&PhysicsState {
|
&PhysicsState {
|
||||||
on_ground: true,
|
on_ground: true,
|
||||||
on_wall: None,
|
on_wall: None,
|
||||||
@ -397,21 +346,24 @@ fn maps_wield() {
|
|||||||
on_ground: true,
|
on_ground: true,
|
||||||
},
|
},
|
||||||
Vec3::zero(),
|
Vec3::zero(),
|
||||||
&stats,
|
Some(&loadout),
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(result, SfxEvent::Wield(ToolKind::Axe));
|
assert_eq!(result, SfxEvent::Wield(ToolKind::Axe(AxeKind::BasicAxe)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn maps_unwield() {
|
fn maps_unwield() {
|
||||||
let stats = Stats::new(
|
let mut loadout = Loadout::default();
|
||||||
String::from("test"),
|
|
||||||
Body::Humanoid(humanoid::Body::random()),
|
loadout.active_item = Some(ItemConfig {
|
||||||
Some(assets::load_expect_cloned(
|
item: assets::load_expect_cloned("common.items.weapons.starter_bow"),
|
||||||
"common.items.weapons.starter_bow",
|
ability1: None,
|
||||||
)),
|
ability2: None,
|
||||||
);
|
ability3: None,
|
||||||
|
block_ability: None,
|
||||||
|
dodge_ability: None,
|
||||||
|
});
|
||||||
|
|
||||||
let result = MovementEventMapper::map_movement_event(
|
let result = MovementEventMapper::map_movement_event(
|
||||||
&CharacterState::default(),
|
&CharacterState::default(),
|
||||||
@ -428,39 +380,10 @@ fn maps_unwield() {
|
|||||||
on_ground: true,
|
on_ground: true,
|
||||||
},
|
},
|
||||||
Vec3::zero(),
|
Vec3::zero(),
|
||||||
&stats,
|
Some(&loadout),
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(result, SfxEvent::Unwield(ToolKind::Bow));
|
assert_eq!(result, SfxEvent::Unwield(ToolKind::Bow(BowKind::BasicBow)));
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn does_not_map_wield_when_no_main_weapon() {
|
|
||||||
let stats = Stats::new(
|
|
||||||
String::from("test"),
|
|
||||||
Body::Humanoid(humanoid::Body::random()),
|
|
||||||
None,
|
|
||||||
);
|
|
||||||
|
|
||||||
let result = MovementEventMapper::map_movement_event(
|
|
||||||
&CharacterState::Wielding {},
|
|
||||||
&PhysicsState {
|
|
||||||
on_ground: true,
|
|
||||||
on_wall: None,
|
|
||||||
touch_entity: None,
|
|
||||||
in_fluid: false,
|
|
||||||
},
|
|
||||||
&PreviousEntityState {
|
|
||||||
event: SfxEvent::Idle,
|
|
||||||
time: Instant::now(),
|
|
||||||
weapon_drawn: false,
|
|
||||||
on_ground: true,
|
|
||||||
},
|
|
||||||
Vec3::new(0.5, 0.8, 0.0),
|
|
||||||
&stats,
|
|
||||||
);
|
|
||||||
|
|
||||||
assert_eq!(result, SfxEvent::Run);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
Loading…
Reference in New Issue
Block a user