]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cl_physics.qc
Merge branch 'master' into Mario/notifications
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_physics.qc
index 50518040b7ce07649d804af7504f15b1a2c87787..08f9dee9562f5c9d91c382236f3f0ea56e84e0bf 100644 (file)
@@ -19,6 +19,9 @@ When you press the jump key
 */
 void PlayerJump (void)
 {
+       if(self.frozen)
+               return; // no jumping in freezetag when frozen
+
        if(self.player_blocked)
                return; // no jumping while blocked
 
@@ -792,6 +795,28 @@ void SV_PlayerPhysics()
                self.stat_sv_airspeedlimit_nonqw *= 0.5;
        }
 
+       if(self.frozen)
+       {
+               if(autocvar_sv_dodging_frozen && IS_REAL_CLIENT(self))
+               {
+                       self.movement_x = bound(-5, self.movement_x, 5);
+                       self.movement_y = bound(-5, self.movement_y, 5);
+                       self.movement_z = bound(-5, self.movement_z, 5);
+               }
+               else
+                       self.movement = '0 0 0';
+               self.disableclientprediction = 1;
+
+               vector midpoint = ((self.absmin + self.absmax) * 0.5);
+               if(pointcontents(midpoint) == CONTENT_WATER)
+               {
+                       self.velocity = self.velocity * 0.5;
+
+                       if(pointcontents(midpoint + '0 0 16') == CONTENT_WATER)
+                               { self.velocity_z = 200; }
+               }
+       }
+
        MUTATOR_CALLHOOK(PlayerPhysics);
 
        if(self.player_blocked)
@@ -993,7 +1018,7 @@ void SV_PlayerPhysics()
                        PM_Accelerate(wishdir, wishspeed, wishspeed, autocvar_sv_accelerate*maxspd_mod, 1, 0, 0, 0);
                }
        }
-       else if ((self.items & IT_JETPACK) && self.BUTTON_HOOK && (!autocvar_g_jetpack_fuel || self.ammo_fuel >= 0.01 || self.items & IT_UNLIMITED_WEAPON_AMMO) && !self.freezetag_frozen)
+       else if ((self.items & IT_JETPACK) && self.BUTTON_HOOK && (!autocvar_g_jetpack_fuel || self.ammo_fuel >= 0.01 || self.items & IT_UNLIMITED_WEAPON_AMMO) && !self.frozen)
        {
                //makevectors(self.v_angle_y * '0 1 0');
                makevectors(self.v_angle);
@@ -1066,12 +1091,11 @@ void SV_PlayerPhysics()
                else
                        fz = bound(0, 1 + self.velocity_z / autocvar_g_jetpack_maxspeed_up, 1);
 
-               float fvel;
-               fvel = vlen(wishvel);
                wishvel_x *= fxy;
                wishvel_y *= fxy;
                wishvel_z = (wishvel_z - autocvar_sv_gravity) * fz + autocvar_sv_gravity;
 
+               float fvel;
                fvel = min(1, vlen(wishvel) / best);
                if(autocvar_g_jetpack_fuel && !(self.items & IT_UNLIMITED_WEAPON_AMMO))
                        f = min(1, self.ammo_fuel / (autocvar_g_jetpack_fuel * frametime * fvel));
@@ -1096,7 +1120,7 @@ void SV_PlayerPhysics()
        {
                // we get here if we ran out of ammo
                if((self.items & IT_JETPACK) && self.BUTTON_HOOK && !(buttons_prev & 32) && self.ammo_fuel < 0.01)
-                       sprint(self, "You don't have any fuel for the ^2Jetpack\n");
+                       Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_JETPACK_NOFUEL);
 
                // walking
                makevectors(self.v_angle_y * '0 1 0');
@@ -1113,20 +1137,6 @@ void SV_PlayerPhysics()
                        self.jumppadcount = 0;
                }
 
-#ifdef LETS_TEST_FTEQCC
-               if(self.velocity_x || self.velocity_y)
-               {
-                       // good
-               }
-               else
-               {
-                       if(self.velocity_x)
-                               checkclient();
-                       if(self.velocity_y)
-                               checkclient();
-               }
-#endif
-
                v = self.velocity;
                v_z = 0;
                f = vlen(v);
@@ -1179,7 +1189,7 @@ void SV_PlayerPhysics()
                float wishspeed0;
                // we get here if we ran out of ammo
                if((self.items & IT_JETPACK) && self.BUTTON_HOOK && !(buttons_prev & 32) && self.ammo_fuel < 0.01)
-                       sprint(self, "You don't have any fuel for the ^2Jetpack\n");
+                       Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_JETPACK_NOFUEL);
 
                if(maxspd_mod < 1)
                {
@@ -1276,15 +1286,16 @@ void SV_PlayerPhysics()
                }
        }
 
+       // WEAPONTODO
        float xyspeed;
        xyspeed = vlen('1 0 0' * self.velocity_x + '0 1 0' * self.velocity_y);
-       if(self.weapon == WEP_NEX && autocvar_g_balance_nex_charge && autocvar_g_balance_nex_charge_velocity_rate && xyspeed > autocvar_g_balance_nex_charge_minspeed)
+       if(self.weapon == WEP_VORTEX && WEP_CVAR(vortex, charge) && WEP_CVAR(vortex, charge_velocity_rate) && xyspeed > WEP_CVAR(vortex, charge_minspeed))
        {
                // add a maximum of charge_velocity_rate when going fast (f = 1), gradually increasing from minspeed (f = 0) to maxspeed
-               xyspeed = min(xyspeed, autocvar_g_balance_nex_charge_maxspeed);
-               f = (xyspeed - autocvar_g_balance_nex_charge_minspeed) / (autocvar_g_balance_nex_charge_maxspeed - autocvar_g_balance_nex_charge_minspeed);
+               xyspeed = min(xyspeed, WEP_CVAR(vortex, charge_maxspeed));
+               f = (xyspeed - WEP_CVAR(vortex, charge_minspeed)) / (WEP_CVAR(vortex, charge_maxspeed) - WEP_CVAR(vortex, charge_minspeed));
                // add the extra charge
-               self.nex_charge = min(1, self.nex_charge + autocvar_g_balance_nex_charge_velocity_rate * f * frametime);
+               self.vortex_charge = min(1, self.vortex_charge + WEP_CVAR(vortex, charge_velocity_rate) * f * frametime);
        }
 :end
        if(self.flags & FL_ONGROUND)