used second sfx for teleport event

This commit is contained in:
Maxicarlos08 2023-08-19 11:44:58 +02:00
parent dc1756b2df
commit 14f433b6cd
No known key found for this signature in database
6 changed files with 38 additions and 2 deletions

View File

@ -1505,6 +1505,13 @@
threshold: 0.8,
subtitle: "subtitle-portal-activated",
),
TeleportedByPortal: (
files: [
"voxygen.audio.sfx.ambient.portal_1",
],
threshold: 0.8,
subtitle: "subtitle-portal-teleported",
),
// Utterances (NPCs)

View File

@ -5,6 +5,7 @@ subtitle-owl = Owl hooting
subtitle-running_water = Water bubbling
subtitle-lightning = Thunder
subtitle-portal-activated = Portal Activated
subtitle-portal-teleported = Teleported via portal
subtitle-footsteps_grass = Walking on grass
subtitle-footsteps_earth = Walking on dirt

View File

@ -143,6 +143,9 @@ pub enum Outcome {
PortalActivated {
pos: Vec3<f32>,
},
TeleportedByPortal {
pos: Vec3<f32>,
},
}
impl Outcome {
@ -174,6 +177,7 @@ impl Outcome {
| Outcome::LaserBeam { pos }
| Outcome::GroundDig { pos }
| Outcome::PortalActivated { pos }
| Outcome::TeleportedByPortal { pos}
| Outcome::Glider { pos, .. } => Some(*pos),
Outcome::BreakBlock { pos, .. }
| Outcome::SpriteUnlocked { pos }

View File

@ -2,6 +2,7 @@ use common::{
comp::{Agent, Alignment, CharacterState, Object, Pos, Teleporting},
consts::TELEPORTER_RADIUS,
event::{EventBus, ServerEvent},
outcome::Outcome,
resources::Time,
uid::Uid,
CachedSpatialGrid,
@ -33,6 +34,7 @@ impl<'a> System<'a> for Sys {
Read<'a, CachedSpatialGrid>,
Read<'a, Time>,
Read<'a, EventBus<ServerEvent>>,
Read<'a, EventBus<Outcome>>,
);
const NAME: &'static str = "teleporter";
@ -52,7 +54,8 @@ impl<'a> System<'a> for Sys {
character_states,
spatial_grid,
time,
event_bus,
server_bus,
outcome_bus,
): Self::SystemData,
) {
let check_aggro = |entity, pos: Vec3<f32>| {
@ -115,10 +118,11 @@ impl<'a> System<'a> for Sys {
for entity in nearby {
cancel_teleporting.push(entity);
event_bus.emit_now(ServerEvent::TeleportToPosition {
server_bus.emit_now(ServerEvent::TeleportToPosition {
entity,
position: *target,
});
outcome_bus.emit_now(Outcome::TeleportedByPortal { pos: *target });
}
}
}

View File

@ -184,6 +184,7 @@ pub enum SfxEvent {
Swoosh,
GroundDig,
PortalActivated,
TeleportedByPortal,
}
#[derive(Copy, Clone, Debug, PartialEq, Deserialize, Hash, Eq)]
@ -498,6 +499,10 @@ impl SfxMgr {
let sfx_trigger_item = triggers.get_key_value(&SfxEvent::PortalActivated);
audio.emit_sfx(sfx_trigger_item, *pos, Some(2.0), underwater);
},
Outcome::TeleportedByPortal { pos, .. } => {
let sfx_trigger_item = triggers.get_key_value(&SfxEvent::TeleportedByPortal);
audio.emit_sfx(sfx_trigger_item, *pos, Some(2.0), underwater);
},
Outcome::IceSpikes { pos, .. } => {
let sfx_trigger_item = triggers.get_key_value(&SfxEvent::IceSpikes);
audio.emit_sfx(sfx_trigger_item, *pos, Some(2.0), underwater);

View File

@ -396,6 +396,21 @@ impl ParticleMgr {
)
});
},
Outcome::TeleportedByPortal { pos, .. } => {
self.particles.resize_with(self.particles.len() + 80, || {
Particle::new_directed(
Duration::from_millis(500),
time,
ParticleMode::CultistFlame,
*pos,
pos + Vec3::unit_z()
+ Vec3::zero()
.map(|_: f32| rng.gen_range(-0.1..0.1))
.normalized()
* 2.0,
)
});
},
Outcome::ProjectileShot { .. }
| Outcome::Beam { .. }
| Outcome::ExpChange { .. }