From 81e700ef6691ffd60f07ea4b95bbd82b80ba29d1 Mon Sep 17 00:00:00 2001 From: hut Date: Sun, 12 May 2024 22:30:53 +0200 Subject: [PATCH] add death type: GForce --- src/actor.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/actor.rs b/src/actor.rs index 0fd7a52..e183ea1 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -19,7 +19,7 @@ use bevy_xpbd_3d::prelude::*; use bevy::scene::SceneInstance; use bevy::math::DVec3; use crate::prelude::*; -use crate::{actor, audio, camera, chat, commands, hud, menu, nature, visual, world}; +use crate::{actor, audio, camera, chat, hud, menu, nature, visual, world}; use std::collections::HashMap; pub const ENGINE_SPEED_FACTOR: f32 = 30.0; @@ -62,6 +62,7 @@ pub enum DamageType { Unknown, Mental, Trauma, + GForce, Asphyxiation, //Poison, //Radiation, @@ -547,6 +548,13 @@ fn handle_player_death( duration: 1.0, }); } + DamageType::GForce => { + settings.death_cause = "Trauma from excessive g forces".to_string(); + ew_effect.send(visual::SpawnEffectEvent { + class: visual::Effects::FadeIn(Color::MAROON), + duration: 1.0, + }); + } _ => { settings.death_cause = "Unknown".to_string(); ew_effect.send(visual::SpawnEffectEvent { @@ -597,7 +605,7 @@ fn handle_gforce( } if gforce.gforce > gforce.damage_threshold { hp.damage += (gforce.gforce - gforce.damage_threshold).powf(2.0) / 3000.0; - hp.damagetype = DamageType::Trauma; + hp.damagetype = DamageType::GForce; } if gforce.visual_effect > 0.0001 {