diff --git a/CHANGELOG.md b/CHANGELOG.md index f428e5e2aa..b27a9adc90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Admin designated build areas - Indicator text to collectable terrain sprites - You can now autorequest exact change by ctrl-clicking in a trade, and can quick-add individual items with shift-click. +<<<<<<< HEAD - Buy and sell prices in tooltips when trading with a merchant now have colors. +======= +- Attacks now emit sound effects from the target on hit. +>>>>>>> e2f8d1d27 (Changelog) ### Changed @@ -31,8 +35,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Overhauled clouds for more verticality and performance - New tooltip for items with stats comparison - Improved bow feedback, added arrow particles +<<<<<<< HEAD - Retiered most sceptres and staves - Loot tables can now recursively reference loot tables +======= +- "max_sfx_channels" default now set to 30 +>>>>>>> e2f8d1d27 (Changelog) ### Removed diff --git a/assets/voxygen/audio/sfx.ron b/assets/voxygen/audio/sfx.ron index 9a03cd9ea3..324d416f7f 100644 --- a/assets/voxygen/audio/sfx.ron +++ b/assets/voxygen/audio/sfx.ron @@ -194,7 +194,7 @@ //), GliderOpen: ( files: [ - "voxygen.audio.sfx.glider_open", + "voxygen.audio.sfx.character.glider_open", ], threshold: 0.5, ), @@ -206,7 +206,7 @@ //), GliderClose: ( files: [ - "voxygen.audio.sfx.glider_close", + "voxygen.audio.sfx.character.glider_close", ], threshold: 0.5, ), diff --git a/assets/voxygen/audio/sfx/abilities/explosion.wav b/assets/voxygen/audio/sfx/abilities/explosion.wav new file mode 100644 index 0000000000..ea6ceb7f49 --- /dev/null +++ b/assets/voxygen/audio/sfx/abilities/explosion.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:71db7f53bd69d4e0723b8c6dff06edcdcbe0c043c5b1b5e87817cbb2be49b38e +size 453210 diff --git a/assets/voxygen/audio/sfx/abilities/fire_shot_2.wav b/assets/voxygen/audio/sfx/abilities/fire_shot_2.wav index 35d1ac36c6..0208712ca9 100644 --- a/assets/voxygen/audio/sfx/abilities/fire_shot_2.wav +++ b/assets/voxygen/audio/sfx/abilities/fire_shot_2.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f7917950b69e5a31c1fc82604ec2f75e61b45c9171496d1a462add6af8f58004 -size 240050 +oid sha256:bc317702a6d3450861009fdd73d2bb478cfe930e52a8a04f476ffaf9b491cdc7 +size 121182 diff --git a/assets/voxygen/audio/sfx/abilities/sceptre_aura.wav b/assets/voxygen/audio/sfx/abilities/sceptre_aura.wav index 9b6745459f..9dd330327f 100644 --- a/assets/voxygen/audio/sfx/abilities/sceptre_aura.wav +++ b/assets/voxygen/audio/sfx/abilities/sceptre_aura.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d0cf92874c40cf0e4ce7b23a89f838744204fc2147db4eac1f888b649eedede5 -size 441112 +oid sha256:028af8c927b70ece23f33b8e9705020755e516f2d7d9b93c900059a1a7d45675 +size 651354 diff --git a/assets/voxygen/audio/sfx/abilities/staff_channeling.wav b/assets/voxygen/audio/sfx/abilities/sceptre_channeling.wav similarity index 100% rename from assets/voxygen/audio/sfx/abilities/staff_channeling.wav rename to assets/voxygen/audio/sfx/abilities/sceptre_channeling.wav diff --git a/assets/voxygen/audio/sfx/ambient/bees_1.wav b/assets/voxygen/audio/sfx/ambient/bees_1.wav index 54643ce225..04e7a81197 100644 --- a/assets/voxygen/audio/sfx/ambient/bees_1.wav +++ b/assets/voxygen/audio/sfx/ambient/bees_1.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:79cba70909371875bb6199355397096c2345d6e12512a83cdcf0d33b34928b78 -size 2642668 +oid sha256:548e72163d7fc09947562bafd1a54717386f4cdf644a21be2fc8d1f244aa6820 +size 3961434 diff --git a/assets/voxygen/audio/sfx/ambient/birdcall_1.wav b/assets/voxygen/audio/sfx/ambient/birdcall_1.wav index 175f7e8fa9..3ff6765036 100644 --- a/assets/voxygen/audio/sfx/ambient/birdcall_1.wav +++ b/assets/voxygen/audio/sfx/ambient/birdcall_1.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:eff53828813ed459df17f76cfe24057c601c839a99936ce64f1728e1e82728bb -size 1306004 +oid sha256:48beac38a18f009deddf7ef64dd2ceed3e6e645b56b62e5ddab99626d0b89dc2 +size 1870938 diff --git a/assets/voxygen/audio/sfx/ambient/birdcall_2.wav b/assets/voxygen/audio/sfx/ambient/birdcall_2.wav index c6249782b0..84b1a71e47 100644 --- a/assets/voxygen/audio/sfx/ambient/birdcall_2.wav +++ b/assets/voxygen/audio/sfx/ambient/birdcall_2.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0359f1387f257c04ba0e01d1f94ecc68bd9606fccb996555629bea782f58ab2b -size 2038924 +oid sha256:654d036baaa259367c38a343cf3ed006aa18b88a509bce6ddfc555606ad74e96 +size 3061338 diff --git a/assets/voxygen/audio/sfx/ambient/fire.wav b/assets/voxygen/audio/sfx/ambient/fire.wav index bf72a7bdc5..ef2baa281f 100644 --- a/assets/voxygen/audio/sfx/ambient/fire.wav +++ b/assets/voxygen/audio/sfx/ambient/fire.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:937d4e08697d52a801b85fec37bb249eca17cb77d27f43575a941a38ff02b91d -size 324368 +oid sha256:039903c62106c994ef422a9b5220000f93706b57bb43605390d38aa4dc8e9f57 +size 162342 diff --git a/assets/voxygen/audio/sfx/ambient/owl_1.wav b/assets/voxygen/audio/sfx/ambient/owl_1.wav index a6d59653ef..58d2c2d9db 100644 --- a/assets/voxygen/audio/sfx/ambient/owl_1.wav +++ b/assets/voxygen/audio/sfx/ambient/owl_1.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7309844c204faf31bce19d4faf6657018b87fa5b1729f4f2fc4276fa139c6bc2 -size 775048 +oid sha256:a5ed42b21d86d81bdb7b1bca9c1af4af3a9adecd3aed3e3a1a7f64d9ace7cd23 +size 388260 diff --git a/assets/voxygen/audio/sfx/ambient/running_water_1.wav b/assets/voxygen/audio/sfx/ambient/running_water_1.wav index 5c34a5eaa5..55fa89b1e1 100644 --- a/assets/voxygen/audio/sfx/ambient/running_water_1.wav +++ b/assets/voxygen/audio/sfx/ambient/running_water_1.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e8d639dd1ba7308c053495f166836a9786ffbd31e08039763f8f641e6322422f -size 1406680 +oid sha256:7392c18ce33853b3a717fb291b4a6173102cc2a6996ae933e5d5879aa9a41eb6 +size 644772 diff --git a/assets/voxygen/audio/sfx/arrow_hit.wav b/assets/voxygen/audio/sfx/character/arrow_hit.wav similarity index 100% rename from assets/voxygen/audio/sfx/arrow_hit.wav rename to assets/voxygen/audio/sfx/character/arrow_hit.wav diff --git a/assets/voxygen/audio/sfx/arrow_miss.wav b/assets/voxygen/audio/sfx/character/arrow_miss.wav similarity index 100% rename from assets/voxygen/audio/sfx/arrow_miss.wav rename to assets/voxygen/audio/sfx/character/arrow_miss.wav diff --git a/assets/voxygen/audio/sfx/glider_close.wav b/assets/voxygen/audio/sfx/character/glider_close.wav similarity index 100% rename from assets/voxygen/audio/sfx/glider_close.wav rename to assets/voxygen/audio/sfx/character/glider_close.wav diff --git a/assets/voxygen/audio/sfx/character/glider_open.wav b/assets/voxygen/audio/sfx/character/glider_open.wav new file mode 100644 index 0000000000..ef932c331b --- /dev/null +++ b/assets/voxygen/audio/sfx/character/glider_open.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3bcc0d2e51d68332e6e1845e06556cf3e311bf45f857491c23666118511d0f90 +size 146010 diff --git a/assets/voxygen/audio/sfx/character/hit_1.wav b/assets/voxygen/audio/sfx/character/hit_1.wav new file mode 100644 index 0000000000..fbd3563d13 --- /dev/null +++ b/assets/voxygen/audio/sfx/character/hit_1.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:afa3a9c622bcb61b2364d83816995fc1e704f87500a04509e066cd8ac05fab23 +size 33904 diff --git a/assets/voxygen/audio/sfx/character/hit_2.wav b/assets/voxygen/audio/sfx/character/hit_2.wav new file mode 100644 index 0000000000..dab62f63e3 --- /dev/null +++ b/assets/voxygen/audio/sfx/character/hit_2.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dba2ff50929687cc7e06b23b178ee2d574deb1889f348f2021f52ff1ef600368 +size 33904 diff --git a/assets/voxygen/audio/sfx/character/hit_3.wav b/assets/voxygen/audio/sfx/character/hit_3.wav new file mode 100644 index 0000000000..fc1846ed9f --- /dev/null +++ b/assets/voxygen/audio/sfx/character/hit_3.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d6120ce34ae17286338fe29bcdd8c697a4964c8fa21bd8fe7ebec73a89188e1b +size 33904 diff --git a/assets/voxygen/audio/sfx/character/hit_4.wav b/assets/voxygen/audio/sfx/character/hit_4.wav new file mode 100644 index 0000000000..b1b5957d93 --- /dev/null +++ b/assets/voxygen/audio/sfx/character/hit_4.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb7906a8f7c63ed3466f9b2e9490342e641d9a619a9bb64b9547229076e0e78b +size 33904 diff --git a/assets/voxygen/audio/sfx/character/interrupted_1.wav b/assets/voxygen/audio/sfx/character/interrupted_1.wav new file mode 100644 index 0000000000..2f87bfb0fb --- /dev/null +++ b/assets/voxygen/audio/sfx/character/interrupted_1.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5be02d146694a09e38aa155975ab206809d6aa45b3282aa63781b67637ab6b0f +size 300084 diff --git a/assets/voxygen/audio/sfx/character/stunned_1.wav b/assets/voxygen/audio/sfx/character/stunned_1.wav new file mode 100644 index 0000000000..d3daf4cf8d --- /dev/null +++ b/assets/voxygen/audio/sfx/character/stunned_1.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e839db11f05beab373587cb2f69db8c0ef3c9368c5e4a3c6cfef5266c46968ae +size 396948 diff --git a/assets/voxygen/audio/sfx/character/stunned_2.wav b/assets/voxygen/audio/sfx/character/stunned_2.wav new file mode 100644 index 0000000000..eef5e9ffaf --- /dev/null +++ b/assets/voxygen/audio/sfx/character/stunned_2.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aaa53994f26b3f257ddb9cb7cfda6b5b8dd3f3c956532e798db7bd8fa1f6b6c1 +size 396948 diff --git a/assets/voxygen/audio/sfx/explosion.wav b/assets/voxygen/audio/sfx/explosion.wav deleted file mode 100644 index f7269ac71c..0000000000 --- a/assets/voxygen/audio/sfx/explosion.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8d7f0bb0a0865d45e98d107c1d24a448aaeeced9c37db9f9e472ab3e1bd2eb03 -size 604946 diff --git a/assets/voxygen/audio/sfx/footsteps/stone_step_1.wav b/assets/voxygen/audio/sfx/footsteps/stone_step_1.wav index a2b0c7e47e..f96ddbff59 100644 --- a/assets/voxygen/audio/sfx/footsteps/stone_step_1.wav +++ b/assets/voxygen/audio/sfx/footsteps/stone_step_1.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bb83d6421e0100a777a6a081f777663129418554e4db0c323a5c8e3895beee63 -size 35640 +oid sha256:daded2798326020b0c969f74e58f379f9da4d12faa57c30225b6b450abebaefc +size 2856 diff --git a/assets/voxygen/audio/sfx/footsteps/stone_step_2.wav b/assets/voxygen/audio/sfx/footsteps/stone_step_2.wav index a7e02c21cb..ff7c8a0fa9 100644 --- a/assets/voxygen/audio/sfx/footsteps/stone_step_2.wav +++ b/assets/voxygen/audio/sfx/footsteps/stone_step_2.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ff7ab14fa6cdce34ba4cd3161af704f5020438ab73ecb1371a66789378b84b5c -size 26464 +oid sha256:e5604231ea46089ba92b042406d4f4d89dfd213b49c67528c5a653b93074bae6 +size 3440 diff --git a/assets/voxygen/audio/sfx/footsteps/stone_step_3.wav b/assets/voxygen/audio/sfx/footsteps/stone_step_3.wav index 8d982f1c42..d5c002c39b 100644 --- a/assets/voxygen/audio/sfx/footsteps/stone_step_3.wav +++ b/assets/voxygen/audio/sfx/footsteps/stone_step_3.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6e1779e8ba831cf58d61b7fc7809a91860fbb83a3f57c08a6cbffe347f6f0502 -size 36600 +oid sha256:4b67b401888485eb2a4df575918f6a993854b432d76c69ce6a2e58d4ed8bf955 +size 2048 diff --git a/assets/voxygen/audio/sfx/footsteps/stone_step_4.wav b/assets/voxygen/audio/sfx/footsteps/stone_step_4.wav index f27621a500..ba316386b4 100644 --- a/assets/voxygen/audio/sfx/footsteps/stone_step_4.wav +++ b/assets/voxygen/audio/sfx/footsteps/stone_step_4.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9cc3d086bced41f99fc77981a6b066a06bb8ebc4cd82cdbe180a03bdc7d65b38 -size 35576 +oid sha256:9139b26cd633588a3acd606311f3813191bae313260aada9cf65fef0ba8acbf3 +size 3192 diff --git a/assets/voxygen/audio/sfx/footsteps/wood_step_1.wav b/assets/voxygen/audio/sfx/footsteps/wood_step_1.wav index dd93ea5476..9db053954d 100644 --- a/assets/voxygen/audio/sfx/footsteps/wood_step_1.wav +++ b/assets/voxygen/audio/sfx/footsteps/wood_step_1.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7519bbdea2c5e2713ec884cf08a7c4b03d1bef30eb264091ae8c22623449a259 -size 31090 +oid sha256:fe0b447a9c967592d5d6da56d159d5dfa52caa25d3be1d2ab69891796940adaa +size 40026 diff --git a/assets/voxygen/audio/sfx/footsteps/wood_step_2.wav b/assets/voxygen/audio/sfx/footsteps/wood_step_2.wav index d918f7fd9f..05a236cc8f 100644 --- a/assets/voxygen/audio/sfx/footsteps/wood_step_2.wav +++ b/assets/voxygen/audio/sfx/footsteps/wood_step_2.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e4a3a3025be119a89064e0f48adde1f2494d9df217040626b514b047254f3742 -size 27654 +oid sha256:e40450a677232da26e15dfc04c4ac5612b04d90551219c531b5117322987fdbd +size 40026 diff --git a/assets/voxygen/audio/sfx/footsteps/wood_step_3.wav b/assets/voxygen/audio/sfx/footsteps/wood_step_3.wav index b288c2bf48..5f3795040f 100644 --- a/assets/voxygen/audio/sfx/footsteps/wood_step_3.wav +++ b/assets/voxygen/audio/sfx/footsteps/wood_step_3.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:57fb2f3a6219020b9f4834eb255720b86ca49976a53867f49b74f863982c11e9 -size 25582 +oid sha256:d9164000a715d383cbc2672a72b197c21d39fbada1eaa72f6310f159d8a5f7c0 +size 40026 diff --git a/assets/voxygen/audio/sfx/footsteps/wood_step_4.wav b/assets/voxygen/audio/sfx/footsteps/wood_step_4.wav index afaf29fe54..510ff99854 100644 --- a/assets/voxygen/audio/sfx/footsteps/wood_step_4.wav +++ b/assets/voxygen/audio/sfx/footsteps/wood_step_4.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:50a3ab5b659a5a4d054eaf82b3e1af45cf07b54f051627c91424166d7e3cc6f3 -size 32258 +oid sha256:ae9d031dc88a342a66b7b9aad1abf3b829b6ed6cbbe6c922c286bca3c0a45239 +size 44634 diff --git a/assets/voxygen/audio/sfx/glider_open.wav b/assets/voxygen/audio/sfx/glider_open.wav deleted file mode 100644 index bbcb8c6874..0000000000 --- a/assets/voxygen/audio/sfx/glider_open.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ddd1e09f0a874e96a73ec340a030b9306de4c0a5677886fdf3fd7609b49a24c8 -size 94976 diff --git a/assets/voxygen/audio/sfx/inventory/add_failed.wav b/assets/voxygen/audio/sfx/inventory/add_failed.wav index 6e5d3abe97..462c33f6a9 100644 --- a/assets/voxygen/audio/sfx/inventory/add_failed.wav +++ b/assets/voxygen/audio/sfx/inventory/add_failed.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b7cf98460ef3c627df1603e34b9b2b4443f54dc9bfafccaccaba6719f4214085 -size 51216 +oid sha256:98815deb61f0e5098121915937fdf32a065122b24e6b20b388ee42e2b40fe575 +size 70746 diff --git a/assets/voxygen/audio/sfx/inventory/consumable/apple.wav b/assets/voxygen/audio/sfx/inventory/consumable/apple.wav index 286d8aade0..f379852fac 100644 --- a/assets/voxygen/audio/sfx/inventory/consumable/apple.wav +++ b/assets/voxygen/audio/sfx/inventory/consumable/apple.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4c4d2931431c26b95a4d41b2e137b3db74456b8b9db54d7c48defb9d7bb67689 -size 70152 +oid sha256:ccb489b8661cf0c8b2fc28211053d8412c2bda6c45eca49f1acb04066931a214 +size 103002 diff --git a/common/src/combat.rs b/common/src/combat.rs index f001bbd6b6..b04c482923 100644 --- a/common/src/combat.rs +++ b/common/src/combat.rs @@ -1,8 +1,7 @@ -use crate::comp::buff::BuffKind; #[cfg(not(target_arch = "wasm32"))] use crate::{ comp::{ - buff::{Buff, BuffChange, BuffData, BuffSource}, + buff::{Buff, BuffChange, BuffData, BuffKind, BuffSource}, inventory::{ item::{ armor::Protection, @@ -17,6 +16,7 @@ use crate::{ Inventory, Stats, }, event::ServerEvent, + outcome::Outcome, uid::Uid, util::Dir, }; @@ -54,6 +54,7 @@ pub struct TargetInfo<'a> { pub inventory: Option<&'a Inventory>, pub stats: Option<&'a Stats>, pub health: Option<&'a Health>, + pub pos: Vec3, } #[cfg(not(target_arch = "wasm32"))] @@ -115,6 +116,7 @@ impl Attack { // Currently just modifies damage, maybe look into modifying strength of other effects? strength_modifier: f32, mut emit: impl FnMut(ServerEvent), + mut emit_outcome: impl FnMut(Outcome), ) { let is_crit = thread_rng().gen::() < self.crit_chance; let mut accumulated_damage = 0.0; @@ -134,6 +136,7 @@ impl Attack { ); let applied_damage = -change.amount as f32; accumulated_damage += applied_damage; + emit_outcome(Outcome::Damage { pos: target.pos }); if change.amount != 0 { emit(ServerEvent::Damage { entity: target.entity, diff --git a/common/src/outcome.rs b/common/src/outcome.rs index 6e620c3ee0..ecc1e08b05 100644 --- a/common/src/outcome.rs +++ b/common/src/outcome.rs @@ -56,6 +56,9 @@ pub enum Outcome { pos: Vec3, body: comp::Body, }, + Damage { + pos: Vec3, + }, } impl Outcome { @@ -66,7 +69,8 @@ impl Outcome { | Outcome::ProjectileHit { pos, .. } | Outcome::Beam { pos, .. } | Outcome::SkillPointGain { pos, .. } - | Outcome::SummonedCreature { pos, .. } => Some(*pos), + | Outcome::SummonedCreature { pos, .. } + | Outcome::Damage { pos, .. } => Some(*pos), Outcome::BreakBlock { pos, .. } => Some(pos.map(|e| e as f32 + 0.5)), Outcome::ExpChange { .. } | Outcome::ComboChange { .. } => None, } diff --git a/common/sys/src/beam.rs b/common/sys/src/beam.rs index b1bdc0d504..b91ca2c94d 100644 --- a/common/sys/src/beam.rs +++ b/common/sys/src/beam.rs @@ -5,6 +5,7 @@ use common::{ Scale, Stats, }, event::{EventBus, ServerEvent}, + outcome::Outcome, resources::{DeltaTime, Time}, terrain::TerrainGrid, uid::{Uid, UidAllocator}, @@ -15,7 +16,7 @@ use common_ecs::{Job, Origin, ParMode, Phase, System}; use rayon::iter::ParallelIterator; use specs::{ saveload::MarkerAllocator, shred::ResourceId, Entities, Join, ParJoin, Read, ReadExpect, - ReadStorage, SystemData, World, WriteStorage, + ReadStorage, SystemData, World, Write, WriteStorage, }; use std::time::Duration; use vek::*; @@ -49,13 +50,17 @@ impl<'a> System<'a> for Sys { ReadData<'a>, WriteStorage<'a, BeamSegment>, WriteStorage<'a, Beam>, + Write<'a, Vec>, ); const NAME: &'static str = "beam"; const ORIGIN: Origin = Origin::Common; const PHASE: Phase = Phase::Create; - fn run(job: &mut Job, (read_data, mut beam_segments, mut beams): Self::SystemData) { + fn run( + job: &mut Job, + (read_data, mut beam_segments, mut beams, mut outcomes): Self::SystemData, + ) { let mut server_emitter = read_data.server_bus.emitter(); let time = read_data.time.0; @@ -64,24 +69,25 @@ impl<'a> System<'a> for Sys { job.cpu_stats.measure(ParMode::Rayon); // Beams - let (server_events, add_hit_entities) = ( + let (server_events, add_hit_entities, mut new_outcomes) = ( &read_data.entities, &read_data.positions, &read_data.orientations, &beam_segments, ) .par_join() - .fold(|| (Vec::new(), Vec::new()), |(mut server_events, mut add_hit_entities), (entity, pos, ori, beam_segment)| + .fold(|| (Vec::new(), Vec::new(), Vec::new()), + |(mut server_events, mut add_hit_entities, mut outcomes), + (entity, pos, ori, beam_segment)| { let creation_time = match beam_segment.creation { Some(time) => time, // Skip newly created beam segments - None => return (server_events, add_hit_entities), + None => return (server_events, add_hit_entities, outcomes), }; let end_time = creation_time + beam_segment.duration.as_secs_f64(); - // If beam segment is out of time emit destroy event but still continue since it - // may have traveled and produced effects a bit before reaching it's + // may have traveled and produced effects a bit before reaching its // end point if end_time < time { server_events.push(ServerEvent::Destroy { @@ -93,7 +99,7 @@ impl<'a> System<'a> for Sys { // Determine area that was covered by the beam in the last tick let frame_time = dt.min((end_time - time) as f32); if frame_time <= 0.0 { - return (server_events, add_hit_entities); + return (server_events, add_hit_entities, outcomes); } // Note: min() probably uneeded let time_since_creation = (time - creation_time) as f32; @@ -112,7 +118,7 @@ impl<'a> System<'a> for Sys { let hit_entities = if let Some(beam) = beam_owner.and_then(|e| beams.get(e)) { &beam.hit_entities } else { - return (server_events, add_hit_entities); + return (server_events, add_hit_entities, outcomes); }; // Go through all other effectable entities @@ -181,6 +187,7 @@ impl<'a> System<'a> for Sys { inventory: read_data.inventories.get(target), stats: read_data.stats.get(target), health: read_data.healths.get(target), + pos: pos.0, }; beam_segment.properties.attack.apply_attack( @@ -191,19 +198,23 @@ impl<'a> System<'a> for Sys { false, 1.0, |e| server_events.push(e), + |o| outcomes.push(o), ); add_hit_entities.push((beam_owner, *uid_b)); } } - (server_events, add_hit_entities) - }).reduce(|| (Vec::new(), Vec::new()), |(mut events_a, mut hit_entities_a), (mut events_b, mut hit_entities_b)| { - events_a.append(&mut events_b); - hit_entities_a.append(&mut hit_entities_b); - (events_a, hit_entities_a) - }); - + (server_events, add_hit_entities, outcomes) + }).reduce(|| (Vec::new(), Vec::new(), Vec::new()), + |(mut events_a, mut hit_entities_a, mut outcomes_a), + (mut events_b, mut hit_entities_b, mut outcomes_b)| { + events_a.append(&mut events_b); + hit_entities_a.append(&mut hit_entities_b); + outcomes_a.append(&mut outcomes_b); + (events_a, hit_entities_a, outcomes_a) + }); job.cpu_stats.measure(ParMode::Single); + outcomes.append(&mut new_outcomes); for event in server_events { server_emitter.emit(event); diff --git a/common/sys/src/lib.rs b/common/sys/src/lib.rs index f8348b3b43..7f5e329c11 100644 --- a/common/sys/src/lib.rs +++ b/common/sys/src/lib.rs @@ -11,7 +11,7 @@ pub mod melee; mod mount; pub mod phys; #[cfg(feature = "plugins")] pub mod plugin; -mod projectile; +pub mod projectile; mod shockwave; pub mod state; mod stats; @@ -34,6 +34,5 @@ pub fn add_local_systems(dispatch_builder: &mut DispatcherBuilder) { dispatch::(dispatch_builder, &[&phys::Sys::sys_name()]); dispatch::(dispatch_builder, &[&phys::Sys::sys_name()]); dispatch::(dispatch_builder, &[&phys::Sys::sys_name()]); - dispatch::(dispatch_builder, &[&projectile::Sys::sys_name()]); dispatch::(dispatch_builder, &[]); } diff --git a/common/sys/src/melee.rs b/common/sys/src/melee.rs index f919c378a7..0809f0d965 100644 --- a/common/sys/src/melee.rs +++ b/common/sys/src/melee.rs @@ -5,13 +5,14 @@ use common::{ Stats, }, event::{EventBus, ServerEvent}, + outcome::Outcome, uid::Uid, util::Dir, GroupTarget, }; use common_ecs::{Job, Origin, Phase, System}; use specs::{ - shred::ResourceId, Entities, Join, Read, ReadStorage, SystemData, World, WriteStorage, + shred::ResourceId, Entities, Join, Read, ReadStorage, SystemData, World, Write, WriteStorage, }; use vek::*; @@ -39,13 +40,17 @@ pub struct ReadData<'a> { pub struct Sys; impl<'a> System<'a> for Sys { - type SystemData = (ReadData<'a>, WriteStorage<'a, Melee>); + type SystemData = ( + ReadData<'a>, + WriteStorage<'a, Melee>, + Write<'a, Vec>, + ); const NAME: &'static str = "melee"; const ORIGIN: Origin = Origin::Common; const PHASE: Phase = Phase::Create; - fn run(_job: &mut Job, (read_data, mut melee_attacks): Self::SystemData) { + fn run(_job: &mut Job, (read_data, mut melee_attacks, mut outcomes): Self::SystemData) { let mut server_emitter = read_data.server_bus.emitter(); // Attacks for (attacker, uid, pos, ori, melee_attack, body) in ( @@ -141,6 +146,7 @@ impl<'a> System<'a> for Sys { inventory: read_data.inventories.get(target), stats: read_data.stats.get(target), health: read_data.healths.get(target), + pos: pos.0, }; melee_attack.attack.apply_attack( @@ -151,6 +157,7 @@ impl<'a> System<'a> for Sys { is_dodge, 1.0, |e| server_emitter.emit(e), + |o| outcomes.push(o), ); melee_attack.hit_count += 1; diff --git a/common/sys/src/projectile.rs b/common/sys/src/projectile.rs index 603729587f..f780f7f967 100644 --- a/common/sys/src/projectile.rs +++ b/common/sys/src/projectile.rs @@ -129,6 +129,7 @@ impl<'a> System<'a> for Sys { inventory: read_data.inventories.get(target), stats: read_data.stats.get(target), health: read_data.healths.get(target), + pos: pos.0, }; if let Some(&body) = read_data.bodies.get(entity) { @@ -152,6 +153,7 @@ impl<'a> System<'a> for Sys { false, 1.0, |e| server_emitter.emit(e), + |o| outcomes.push(o), ); } }, diff --git a/common/sys/src/shockwave.rs b/common/sys/src/shockwave.rs index e00b591e78..cc1d2fa46e 100644 --- a/common/sys/src/shockwave.rs +++ b/common/sys/src/shockwave.rs @@ -5,6 +5,7 @@ use common::{ Shockwave, ShockwaveHitEntities, Stats, }, event::{EventBus, ServerEvent}, + outcome::Outcome, resources::{DeltaTime, Time}, uid::{Uid, UidAllocator}, util::Dir, @@ -13,7 +14,7 @@ use common::{ use common_ecs::{Job, Origin, Phase, System}; use specs::{ saveload::MarkerAllocator, shred::ResourceId, Entities, Join, Read, ReadStorage, SystemData, - World, WriteStorage, + World, Write, WriteStorage, }; use vek::*; @@ -47,6 +48,7 @@ impl<'a> System<'a> for Sys { ReadData<'a>, WriteStorage<'a, Shockwave>, WriteStorage<'a, ShockwaveHitEntities>, + Write<'a, Vec>, ); const NAME: &'static str = "shockwave"; @@ -55,7 +57,7 @@ impl<'a> System<'a> for Sys { fn run( _job: &mut Job, - (read_data, mut shockwaves, mut shockwave_hit_lists): Self::SystemData, + (read_data, mut shockwaves, mut shockwave_hit_lists, mut outcomes): Self::SystemData, ) { let mut server_emitter = read_data.server_bus.emitter(); @@ -189,6 +191,7 @@ impl<'a> System<'a> for Sys { inventory: read_data.inventories.get(target), stats: read_data.stats.get(target), health: read_data.healths.get(target), + pos: pos.0, }; shockwave.properties.attack.apply_attack( @@ -199,6 +202,7 @@ impl<'a> System<'a> for Sys { false, 1.0, |e| server_emitter.emit(e), + |o| outcomes.push(o), ); shockwave_hit_list.hit_entities.push(*uid_b); diff --git a/server/src/events/entity_manipulation.rs b/server/src/events/entity_manipulation.rs index 4269a6f08a..b1a1cdac74 100644 --- a/server/src/events/entity_manipulation.rs +++ b/server/src/events/entity_manipulation.rs @@ -544,17 +544,17 @@ pub fn handle_explosion(server: &Server, pos: Vec3, explosion: Explosion, o // Add an outcome // Uses radius as outcome power for now let outcome_power = explosion.radius; - ecs.write_resource::>() - .push(Outcome::Explosion { - pos, - power: outcome_power, - radius: explosion.radius, - is_attack: explosion - .effects - .iter() - .any(|e| matches!(e, RadiusEffect::Attack(_))), - reagent: explosion.reagent, - }); + let mut outcomes = ecs.write_resource::>(); + outcomes.push(Outcome::Explosion { + pos, + power: outcome_power, + radius: explosion.radius, + is_attack: explosion + .effects + .iter() + .any(|e| matches!(e, RadiusEffect::Attack(_))), + reagent: explosion.reagent, + }); let owner_entity = owner.and_then(|uid| { ecs.read_resource::() .retrieve_entity_internal(uid.into()) @@ -711,6 +711,7 @@ pub fn handle_explosion(server: &Server, pos: Vec3, explosion: Explosion, o inventory: inventory_b_maybe, stats: stats_b_maybe, health: Some(health_b), + pos, }; let server_eventbus = ecs.read_resource::>(); @@ -723,6 +724,7 @@ pub fn handle_explosion(server: &Server, pos: Vec3, explosion: Explosion, o false, strength, |e| server_eventbus.emit_now(e), + |o| outcomes.push(o), ); } } diff --git a/server/src/sys/mod.rs b/server/src/sys/mod.rs index 4457f5b741..8542ecabef 100644 --- a/server/src/sys/mod.rs +++ b/server/src/sys/mod.rs @@ -11,7 +11,8 @@ pub mod terrain; pub mod terrain_sync; pub mod waypoint; -use common_ecs::{dispatch, run_now}; +use common_ecs::{dispatch, run_now, System}; +use common_sys::{melee, projectile}; use specs::DispatcherBuilder; use std::{ marker::PhantomData, @@ -21,6 +22,7 @@ use std::{ pub type PersistenceScheduler = SysScheduler; pub fn add_server_systems(dispatch_builder: &mut DispatcherBuilder) { + dispatch::(dispatch_builder, &[&projectile::Sys::sys_name()]); dispatch::(dispatch_builder, &[]); dispatch::(dispatch_builder, &[]); dispatch::(dispatch_builder, &[]); diff --git a/voxygen/src/audio/sfx/event_mapper/block/mod.rs b/voxygen/src/audio/sfx/event_mapper/block/mod.rs index 7e3a9db51b..ea939febaf 100644 --- a/voxygen/src/audio/sfx/event_mapper/block/mod.rs +++ b/voxygen/src/audio/sfx/event_mapper/block/mod.rs @@ -97,13 +97,13 @@ impl EventMapper for BlockEventMapper { volume: 1.0, cond: |st| st.get_day_period().is_dark(), }, - BlockSounds { - blocks: |boi| &boi.river, - range: 1, - sfx: SfxEvent::RunningWater, - volume: 1.0, - cond: |_| true, - }, + // BlockSounds { + // blocks: |boi| &boi.river, + // range: 1, + // sfx: SfxEvent::RunningWater, + // volume: 1.0, + // cond: |_| true, + // }, //BlockSounds { // blocks: |boi| &boi.embers, // range: 1, diff --git a/voxygen/src/audio/sfx/event_mapper/campfire/mod.rs b/voxygen/src/audio/sfx/event_mapper/campfire/mod.rs index ee0230f487..0941712204 100644 --- a/voxygen/src/audio/sfx/event_mapper/campfire/mod.rs +++ b/voxygen/src/audio/sfx/event_mapper/campfire/mod.rs @@ -72,7 +72,7 @@ impl EventMapper for CampfireEventMapper { .map(|b| b.is_liquid()) .unwrap_or(false); let sfx_trigger_item = triggers.get_key_value(&mapped_event); - const CAMPFIRE_VOLUME: f32 = 0.1; + const CAMPFIRE_VOLUME: f32 = 0.9; audio.emit_sfx(sfx_trigger_item, pos.0, Some(CAMPFIRE_VOLUME), underwater); internal_state.time = Instant::now(); } diff --git a/voxygen/src/audio/sfx/mod.rs b/voxygen/src/audio/sfx/mod.rs index 5697f763fc..195614cd59 100644 --- a/voxygen/src/audio/sfx/mod.rs +++ b/voxygen/src/audio/sfx/mod.rs @@ -168,6 +168,8 @@ pub enum SfxEvent { Inventory(SfxInventoryEvent), Explosion, ProjectileShot, + Damage, + // Poise(StunState), } #[derive(Clone, Debug, PartialEq, Deserialize, Hash, Eq)] @@ -311,7 +313,7 @@ impl SfxMgr { let file_ref = if *is_attack && matches!(reagent, Some(Reagent::Green)) { "voxygen.audio.sfx.abilities.heal_bomb" } else { - "voxygen.audio.sfx.explosion" + "voxygen.audio.sfx.abilities.explosion" }; audio.play_sfx( @@ -370,10 +372,10 @@ impl SfxMgr { | object::Body::ArrowTurret, ) => { if target.is_none() { - audio.play_sfx("voxygen.audio.sfx.arrow_miss", *pos, Some(2.0)); + audio.play_sfx("voxygen.audio.sfx.character.arrow_miss", *pos, Some(2.0)); } else if *source == client.uid() { audio.play_sfx( - "voxygen.audio.sfx.arrow_hit", + "voxygen.audio.sfx.character.arrow_hit", client.position().unwrap_or(*pos), Some(2.0), ); @@ -389,12 +391,16 @@ impl SfxMgr { }, Outcome::Beam { pos, specifier } => match specifier { beam::FrontendSpecifier::LifestealBeam | beam::FrontendSpecifier::HealingBeam => { - let file_ref = "voxygen.audio.sfx.abilities.staff_channeling"; - audio.play_sfx(file_ref, *pos, None); + let file_ref = "voxygen.audio.sfx.abilities.sceptre_channeling"; + if thread_rng().gen_bool(0.5) { + audio.play_sfx(file_ref, *pos, None); + }; }, beam::FrontendSpecifier::Flamethrower | beam::FrontendSpecifier::Cultist => { let file_ref = "voxygen.audio.sfx.abilities.flame_thrower"; - audio.play_sfx(file_ref, *pos, None); + if thread_rng().gen_bool(0.5) { + audio.play_sfx(file_ref, *pos, None); + } }, }, Outcome::BreakBlock { pos, .. } => { @@ -404,6 +410,15 @@ impl SfxMgr { Outcome::ExpChange { .. } | Outcome::ComboChange { .. } | Outcome::SummonedCreature { .. } => {}, + Outcome::Damage { pos, .. } => { + let file_ref = vec![ + "voxygen.audio.sfx.character.hit_1", + "voxygen.audio.sfx.character.hit_2", + "voxygen.audio.sfx.character.hit_3", + "voxygen.audio.sfx.character.hit_4", + ][rand::thread_rng().gen_range(1..4)]; + audio.play_sfx(file_ref, *pos, None); + }, } } diff --git a/voxygen/src/scene/particle.rs b/voxygen/src/scene/particle.rs index fa0a78becd..9f2f6a4606 100644 --- a/voxygen/src/scene/particle.rs +++ b/voxygen/src/scene/particle.rs @@ -208,6 +208,7 @@ impl ParticleMgr { | Outcome::ExpChange { .. } | Outcome::SkillPointGain { .. } | Outcome::ComboChange { .. } => {}, + Outcome::Damage { .. } => {}, } } diff --git a/voxygen/src/settings.rs b/voxygen/src/settings.rs index f55ca48a3d..66244a2e07 100644 --- a/voxygen/src/settings.rs +++ b/voxygen/src/settings.rs @@ -677,7 +677,7 @@ impl Default for AudioSettings { master_volume: 1.0, music_volume: 0.4, sfx_volume: 0.6, - max_sfx_channels: 10, + max_sfx_channels: 30, output: AudioOutput::Automatic, } }