]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Correctly block weapon functionalities in the other situations too
authorterencehill <piuntn@gmail.com>
Fri, 15 Feb 2013 19:37:40 +0000 (20:37 +0100)
committerterencehill <piuntn@gmail.com>
Fri, 15 Feb 2013 19:37:40 +0000 (20:37 +0100)
qcsrc/server/cl_weapons.qc

index 7e9da5b212c90f9bc35e3daa25d49a18a159847d..2715d475c8f6b3fa44425d93ac0af5a289b5ad4a 100644 (file)
@@ -365,7 +365,19 @@ void W_ThrowWeapon(vector velo, vector delta, float doreduce)
                sprint(self, strcat("You dropped the ^2", W_Name(w), " with ", a, "\n"));
 }
 
-// Bringed back weapon frame
+float forbidWeaponUse()
+{
+       if(time < game_starttime && !autocvar_sv_ready_restart_after_countdown)
+               return 1;
+       if(round_handler_IsActive() && !round_handler_IsRoundStarted())
+               return 1;
+       if(self.player_blocked)
+               return 1;
+       if(self.freezetag_frozen)
+               return 1;
+       return 0;
+}
+
 void W_WeaponFrame()
 {
        vector fo, ri, up;
@@ -376,22 +388,13 @@ void W_WeaponFrame()
        if (!self.weaponentity || self.health < 1)
                return; // Dead player can't use weapons and injure impulse commands
 
-       if(time < game_starttime && !autocvar_sv_ready_restart_after_countdown)
-               return;
-
-       if(round_handler_IsActive() && !round_handler_IsRoundStarted())
+       if(forbidWeaponUse())
        if(self.weaponentity.state != WS_CLEAR)
        {
                w_ready();
                return;
        }
 
-       if(self.player_blocked)
-               return;
-
-       if(self.freezetag_frozen == 1)
-               return;
-
        if(!self.switchweapon)
        {
                self.weapon = 0;