]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/cl_physics.qc
Earthquake for falling, obviously stronger than that of footsteps
[voretournament/voretournament.git] / data / qcsrc / server / cl_physics.qc
index 3dd65f7c8f0e958138e5a145e4cdacf0075395e1..73de99315478b195d454d0136e0737b166cd733f 100644 (file)
@@ -879,6 +879,31 @@ void SV_PlayerPhysics()
                                                pointparticles(particleeffectnum("ground_dirt"), self.origin, '0 0 0', self.scale);\r
                                        }\r
                                        sound(self, CHAN_AUTO, "misc/macro_hitground.wav", bound(0, VOL_BASE * playersize_macro(self), 1), ATTN_NORM);\r
+\r
+                                       // earthquake effect for nearby players when a macro falls\r
+                                       if(cvar("g_healthsize_quake_fall"))\r
+                                       {\r
+                                               entity head;\r
+                                               for(head = findradius(self.origin, cvar("g_healthsize_quake_fall_radius")); head; head = head.chain)\r
+                                               {\r
+                                                       if not(head.classname == "player" || head.classname == "spectator")\r
+                                                               continue;\r
+                                                       if(head == self || head.spectatee_status == num_for_edict(self))\r
+                                                               continue; // not for self\r
+                                                       if not(head.flags & FL_ONGROUND)\r
+                                                               continue; // we only feel the ground shaking if we are sitting on it\r
+\r
+                                                       float shake;\r
+                                                       shake = vlen(head.origin - self.origin);\r
+                                                       if(shake)\r
+                                                               shake = 1 - bound(0, shake / cvar("g_healthsize_quake_fall_radius"), 1);\r
+                                                       shake *= cvar("g_healthsize_quake_fall");\r
+\r
+                                                       head.punchvector_x += crandom() * shake;\r
+                                                       head.punchvector_y += crandom() * shake;\r
+                                                       head.punchvector_z += crandom() * shake;\r
+                                               }\r
+                                       }\r
                                }\r
                                else\r
                                {\r