From: MirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Date: Sat, 3 Mar 2012 19:22:36 +0000 (+0200)
Subject: Earthquake for falling, obviously stronger than that of footsteps
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=80597698a385521b39bfa063c7c01f7528f1f406;p=voretournament%2Fvoretournament.git

Earthquake for falling, obviously stronger than that of footsteps
---

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
 				{