From 80597698a385521b39bfa063c7c01f7528f1f406 Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Sat, 3 Mar 2012 21:22:36 +0200 Subject: [PATCH] Earthquake for falling, obviously stronger than that of footsteps --- data/defaultVT.cfg | 5 +++-- data/qcsrc/server/cl_physics.qc | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/data/defaultVT.cfg b/data/defaultVT.cfg index 8bdfc193..dbfe893c 100644 --- a/data/defaultVT.cfg +++ b/data/defaultVT.cfg @@ -1663,9 +1663,10 @@ set g_healthsize_soundfactor 0.5 "The sounds players make are amplified or reduc set g_healthsize_exteriorweapon_scalefactor 1 "Amount by which player size resizes the exterior weapon model" set g_healthsize_weapon_scalefactor 1 "Amount by which player size resizes the view weapon model" set g_healthsize_weapon_scalefactor_pos 6 "Amount by which the view model is moved vertically based on player size" - set g_healthsize_quake_step 10 "The view of nearby players is shaken by this amount when a macro walks near them (requires g_footsteps)" -set g_healthsize_quake_step_radius 500 "Radius in which a player must be to shake the view" +set g_healthsize_quake_step_radius 500 "Radius in which a player must be located to shake the view" +set g_healthsize_quake_fall 20 "The view of nearby players is shaken by this amount when a macro falls near them" +set g_healthsize_quake_fall_radius 750 "Radius in which a player must be located to shake the view" set g_power 5 "when armor is below this level, the HUD, crosshair and helper will not work" set g_power_reboot 2 "amount of time it takes to boot a player's subsystems once he has enough armor" diff --git a/data/qcsrc/server/cl_physics.qc b/data/qcsrc/server/cl_physics.qc index 3dd65f7c..73de9931 100644 --- a/data/qcsrc/server/cl_physics.qc +++ b/data/qcsrc/server/cl_physics.qc @@ -879,6 +879,31 @@ void SV_PlayerPhysics() pointparticles(particleeffectnum("ground_dirt"), self.origin, '0 0 0', self.scale); } sound(self, CHAN_AUTO, "misc/macro_hitground.wav", bound(0, VOL_BASE * playersize_macro(self), 1), ATTN_NORM); + + // earthquake effect for nearby players when a macro falls + if(cvar("g_healthsize_quake_fall")) + { + entity head; + for(head = findradius(self.origin, cvar("g_healthsize_quake_fall_radius")); head; head = head.chain) + { + if not(head.classname == "player" || head.classname == "spectator") + continue; + if(head == self || head.spectatee_status == num_for_edict(self)) + continue; // not for self + if not(head.flags & FL_ONGROUND) + continue; // we only feel the ground shaking if we are sitting on it + + float shake; + shake = vlen(head.origin - self.origin); + if(shake) + shake = 1 - bound(0, shake / cvar("g_healthsize_quake_fall_radius"), 1); + shake *= cvar("g_healthsize_quake_fall"); + + head.punchvector_x += crandom() * shake; + head.punchvector_y += crandom() * shake; + head.punchvector_z += crandom() * shake; + } + } } else { -- 2.39.2