mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'snowram/death-outcome' into 'master'
Adds an outcome to death with SFX and VFX See merge request veloren/veloren!2519
This commit is contained in:
commit
aaf5f89076
@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Made strafing slightly slower
|
||||
- Food now has limited regeneration strength but longer duration.
|
||||
- Harvester boss now has new abilities and AI
|
||||
- Death particles and SFX
|
||||
|
||||
### Removed
|
||||
|
||||
|
@ -777,6 +777,14 @@
|
||||
],
|
||||
threshold: 0.2,
|
||||
),
|
||||
Death: (
|
||||
files: [
|
||||
"voxygen.audio.sfx.character.death_1",
|
||||
"voxygen.audio.sfx.character.death_2",
|
||||
"voxygen.audio.sfx.character.death_3",
|
||||
],
|
||||
threshold: 0.2,
|
||||
),
|
||||
Block: (
|
||||
files: [
|
||||
"voxygen.audio.sfx.character.block_1",
|
||||
|
BIN
assets/voxygen/audio/sfx/character/death_1.ogg
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/audio/sfx/character/death_1.ogg
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/audio/sfx/character/death_2.ogg
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/audio/sfx/character/death_2.ogg
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/audio/sfx/character/death_3.ogg
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/audio/sfx/character/death_3.ogg
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -72,6 +72,7 @@ const int WATER = 30;
|
||||
const int ICE_SPIKES = 31;
|
||||
const int DRIP = 32;
|
||||
const int TORNADO = 33;
|
||||
const int DEATH = 34;
|
||||
|
||||
// meters per second squared (acceleration)
|
||||
const float earth_gravity = 9.807;
|
||||
@ -553,13 +554,25 @@ void main() {
|
||||
spin_in_axis(vec3(rand6, rand7, rand8), percent() * 10 + 3 * rand9)
|
||||
);
|
||||
break;
|
||||
case DEATH:
|
||||
f_reflect = 0.0;
|
||||
attr = Attr(
|
||||
linear_motion(
|
||||
vec3(0),
|
||||
vec3(rand2 * 0.02, rand3 * 0.02, 2.0 + rand4 * 0.6)
|
||||
),
|
||||
vec3((1.2 * (1 - slow_start(.1)))),
|
||||
vec4(vec3(1.2 + 0.5 * percent()), 1),
|
||||
spin_in_axis(vec3(rand6, rand7, rand8), percent() * 10 + 3 * rand9)
|
||||
);
|
||||
break;
|
||||
default:
|
||||
attr = Attr(
|
||||
linear_motion(
|
||||
vec3(rand0 * 0.25, rand1 * 0.25, 1.7 + rand5),
|
||||
vec3(rand2 * 0.1, rand3 * 0.1, 1.0 + rand4 * 0.5)
|
||||
),
|
||||
vec3(exp_scale(-0.2)),
|
||||
vec3(exp_scale(-0.2)) * rand0,
|
||||
vec4(1),
|
||||
spin_in_axis(vec3(1,0,0),0)
|
||||
);
|
||||
|
@ -61,6 +61,9 @@ pub enum Outcome {
|
||||
Damage {
|
||||
pos: Vec3<f32>,
|
||||
},
|
||||
Death {
|
||||
pos: Vec3<f32>,
|
||||
},
|
||||
Block {
|
||||
pos: Vec3<f32>,
|
||||
parry: bool,
|
||||
@ -90,6 +93,7 @@ impl Outcome {
|
||||
| Outcome::SkillPointGain { pos, .. }
|
||||
| Outcome::SummonedCreature { pos, .. }
|
||||
| Outcome::Damage { pos, .. }
|
||||
| Outcome::Death { pos, .. }
|
||||
| Outcome::Block { pos, .. }
|
||||
| Outcome::PoiseChange { pos, .. }
|
||||
| Outcome::GroundSlam { pos }
|
||||
|
@ -138,6 +138,21 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, cause: HealthSourc
|
||||
}
|
||||
};
|
||||
|
||||
// Push an outcome
|
||||
if state
|
||||
.ecs()
|
||||
.read_storage::<comp::Projectile>()
|
||||
.get(entity)
|
||||
.is_none()
|
||||
{
|
||||
if let Some(pos) = state.ecs().read_storage::<Pos>().get(entity) {
|
||||
state
|
||||
.ecs()
|
||||
.write_resource::<Vec<Outcome>>()
|
||||
.push(Outcome::Death { pos: pos.0 });
|
||||
}
|
||||
}
|
||||
|
||||
// Chat message
|
||||
// If it was a player that died
|
||||
if let Some(_player) = state.ecs().read_storage::<Player>().get(entity) {
|
||||
|
@ -171,6 +171,7 @@ pub enum SfxEvent {
|
||||
Inventory(SfxInventoryEvent),
|
||||
Explosion,
|
||||
Damage,
|
||||
Death,
|
||||
Parry,
|
||||
Block,
|
||||
BreakBlock,
|
||||
@ -505,6 +506,10 @@ impl SfxMgr {
|
||||
let sfx_trigger_item = triggers.get_key_value(&SfxEvent::Damage);
|
||||
audio.emit_sfx(sfx_trigger_item, *pos, Some(1.5), false);
|
||||
},
|
||||
Outcome::Death { pos, .. } => {
|
||||
let sfx_trigger_item = triggers.get_key_value(&SfxEvent::Death);
|
||||
audio.emit_sfx(sfx_trigger_item, *pos, Some(1.5), false);
|
||||
},
|
||||
Outcome::Block { pos, parry, .. } => {
|
||||
if *parry {
|
||||
let sfx_trigger_item = triggers.get_key_value(&SfxEvent::Parry);
|
||||
|
@ -84,6 +84,7 @@ pub enum ParticleMode {
|
||||
IceSpikes = 31,
|
||||
Drip = 32,
|
||||
Tornado = 33,
|
||||
Death = 34,
|
||||
}
|
||||
|
||||
impl ParticleMode {
|
||||
|
@ -242,6 +242,19 @@ impl ParticleMgr {
|
||||
)
|
||||
});
|
||||
},
|
||||
Outcome::Death { pos, .. } => {
|
||||
self.particles.resize_with(self.particles.len() + 40, || {
|
||||
Particle::new(
|
||||
Duration::from_millis(400 + rng.gen_range(0..100)),
|
||||
time,
|
||||
ParticleMode::Death,
|
||||
*pos + Vec3::unit_z()
|
||||
+ Vec3::<f32>::zero()
|
||||
.map(|_| rng.gen_range(-0.1..0.1))
|
||||
.normalized(),
|
||||
)
|
||||
});
|
||||
},
|
||||
Outcome::ProjectileShot { .. }
|
||||
| Outcome::Beam { .. }
|
||||
| Outcome::ExpChange { .. }
|
||||
|
Loading…
Reference in New Issue
Block a user