]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/cl_physics.qc
Properly calculate falling damage based on player scale. Don't just offset the damage...
[voretournament/voretournament.git] / data / qcsrc / server / cl_physics.qc
index df1c3a458a88cf48de4c1fa80d17ab1530758b7e..a201643540316726cb25a6a18020336e1986256d 100644 (file)
@@ -507,14 +507,19 @@ void PM_Accelerate(vector wishdir, float wishspeed, float wishspeed0, float acce
        if(speedclamp)\r
                accelqw = -accelqw;\r
 \r
-       if(cvar("g_balance_vore_load_pred_weight") > 0) // apply stomach weight\r
-               wishspeed /= 1 + (self.stomach_load / self.stomach_maxload) * cvar("g_balance_vore_load_pred_speed");\r
-       if(cvar("g_healthsize")) // if we are smaller or larger, we run slower or faster\r
-               wishspeed *= (1 - cvar("g_healthsize_movementfactor")) + cvar("g_healthsize_movementfactor") * self.scale; \r
-       if(self.swallow_progress_prey) // cut speed based on swallow progress for prey\r
-               wishspeed *= 1 - (self.swallow_progress_prey * cvar("g_balance_vore_swallow_speed_cutspd_prey"));\r
-       if(self.swallow_progress_pred) // cut speed based on swallow progress for preds\r
-               wishspeed *= 1 - (self.swallow_progress_pred * cvar("g_balance_vore_swallow_speed_cutspd_pred"));\r
+       if(self.classname == "player")\r
+       {\r
+               if(cvar("g_balance_vore_load_pred_weight") > 0) // apply stomach weight\r
+                       wishspeed /= 1 + (self.stomach_load / self.stomach_maxload) * cvar("g_balance_vore_load_pred_speed");\r
+               if(cvar("g_healthsize")) // if we are smaller or larger, we run slower or faster\r
+                       wishspeed *= (1 - cvar("g_healthsize_movementfactor")) + cvar("g_healthsize_movementfactor") * self.scale; \r
+               if(self.swallow_progress_prey) // cut speed based on swallow progress for prey\r
+                       wishspeed *= 1 - (self.swallow_progress_prey * cvar("g_balance_vore_swallow_speed_cutspd_prey"));\r
+               if(self.swallow_progress_pred) // cut speed based on swallow progress for preds\r
+                       wishspeed *= 1 - (self.swallow_progress_pred * cvar("g_balance_vore_swallow_speed_cutspd_pred"));\r
+               if(self.grabber_stunned > time && random() <= cvar("g_balance_grabber_secondary_stun_rate")) // randomly cut speed while the player is stunned\r
+                       return;\r
+       }\r
 \r
        if(cvar("sv_gameplayfix_q2airaccelerate"))\r
                wishspeed0 = wishspeed;\r
@@ -733,7 +738,7 @@ void SV_PlayerPhysics()
 \r
        if (self.punchangle != '0 0 0')\r
        {\r
-               f = vlen(self.punchangle) - 15 * frametime;\r
+               f = vlen(self.punchangle) - cvar("sv_punchangle_speed") * frametime;\r
                if (f > 0)\r
                        self.punchangle = normalize(self.punchangle) * f;\r
                else\r
@@ -742,7 +747,7 @@ void SV_PlayerPhysics()
 \r
        if (self.punchvector != '0 0 0')\r
        {\r
-               f = vlen(self.punchvector) - 30 * frametime;\r
+               f = vlen(self.punchvector) - cvar("sv_punchvector_speed") * frametime;\r
                if (f > 0)\r
                        self.punchvector = normalize(self.punchvector) * f;\r
                else\r
@@ -851,6 +856,7 @@ void SV_PlayerPhysics()
        {\r
                self.wasFlying = 0;\r
 \r
+               if(self.classname == "player")\r
                if(self.waterlevel < WATERLEVEL_SWIMMING)\r
                if(time >= self.ladder_time)\r
                if not(self.grabber)\r
@@ -860,10 +866,60 @@ void SV_PlayerPhysics()
                        tracebox(self.origin, self.mins, self.maxs, self.origin - '0 0 1', MOVE_NOMONSTERS, self);\r
                        if not(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS)\r
                        {\r
-                               if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS)\r
-                                       GlobalSound(globalsound_metalfall, CHAN_PLAYER, VOICETYPE_PLAYERSOUND);\r
+                               if(cvar("g_healthsize"))\r
+                               {\r
+                                       if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS)\r
+                                       {\r
+                                               GlobalSound(globalsound_metalfall, CHAN_PLAYER, VOICETYPE_PLAYERSOUND, bound(0, VOL_BASE * (1 - playersize_micro(self)), 1));\r
+                                               pointparticles(particleeffectnum("ground_metal"), self.origin, '0 0 0', floor(self.scale * PARTICLE_MULTIPLIER));\r
+                                       }\r
+                                       else\r
+                                       {\r
+                                               GlobalSound(globalsound_fall, CHAN_PLAYER, VOICETYPE_PLAYERSOUND, bound(0, VOL_BASE * (1 - playersize_micro(self)), 1));\r
+                                               pointparticles(particleeffectnum("ground_dirt"), self.origin, '0 0 0', floor(self.scale * PARTICLE_MULTIPLIER));\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
+                                                       if(head.stat_eaten)\r
+                                                               continue; // not for prey\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 *= playersize_macro(self) * 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
-                                       GlobalSound(globalsound_fall, CHAN_PLAYER, VOICETYPE_PLAYERSOUND);\r
+                               {\r
+                                       if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS)\r
+                                       {\r
+                                               GlobalSound(globalsound_metalfall, CHAN_PLAYER, VOICETYPE_PLAYERSOUND, VOL_BASE);\r
+                                               pointparticles(particleeffectnum("ground_metal"), self.origin, '0 0 0', PARTICLE_MULTIPLIER);\r
+                                       }\r
+                                       else\r
+                                       {\r
+                                               GlobalSound(globalsound_fall, CHAN_PLAYER, VOICETYPE_PLAYERSOUND, VOL_BASE);\r
+                                               pointparticles(particleeffectnum("ground_dirt"), self.origin, '0 0 0', PARTICLE_MULTIPLIER);\r
+                                       }\r
+                               }\r
                        }\r
                }\r
        }\r
@@ -905,7 +961,7 @@ void SV_PlayerPhysics()
        {\r
                RaceCarPhysics();\r
        }\r
-       else if (self.movetype == MOVETYPE_NOCLIP || self.movetype == MOVETYPE_FLY)\r
+       else if (self.movetype == MOVETYPE_NOCLIP || self.movetype == MOVETYPE_FLY || self.movetype == MOVETYPE_FLY_WORLDONLY)\r
        {\r
                // noclipping or flying\r
                self.flags &~= FL_ONGROUND;\r
@@ -1144,7 +1200,7 @@ void SV_PlayerPhysics()
                if (wishspeed > sv_maxspeed*maxspd_mod)\r
                        wishspeed = sv_maxspeed*maxspd_mod;\r
                if (self.crouch)\r
-                       wishspeed = wishspeed * 0.5;\r
+                       wishspeed = wishspeed * cvar("sv_crouchvelocity");\r
                if (time >= self.teleport_time)\r
                        PM_Accelerate(wishdir, wishspeed, wishspeed, sv_accelerate*maxspd_mod, 1, 0);\r
        }\r
@@ -1176,7 +1232,7 @@ void SV_PlayerPhysics()
                if (wishspeed > maxairspd)\r
                        wishspeed = maxairspd;\r
                if (self.crouch)\r
-                       wishspeed = wishspeed * 0.5;\r
+                       wishspeed = wishspeed * cvar("sv_crouchvelocity");\r
                if (time >= self.teleport_time)\r
                {\r
                        float accelerating;\r