]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Actually, create a weapon independent function that forbids the player to change...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 12 Apr 2011 23:17:13 +0000 (02:17 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 12 Apr 2011 23:17:13 +0000 (02:17 +0300)
qcsrc/server/cl_client.qc
qcsrc/server/cl_weapons.qc
qcsrc/server/cl_weaponsystem.qc
qcsrc/server/defs.qh
qcsrc/server/w_hagar.qc

index 93dfc1c5f8c00045a8d856146ec0aac2090511ae..a59ef51e6ed426f9aa30c15ea885791b140ab966 100644 (file)
@@ -1064,6 +1064,7 @@ void PutClientInServer (void)
                        if(e.spawnflags & WEP_FLAG_RELOADABLE) // prevent accessing undefined cvars
                                self.weapon_load[j] = cvar(strcat("g_balance_", e.netname, "_reload_ammo"));
                }
+               self.weapon_forbidchange = FALSE;
 
                oldself = self;
                self = spot;
index 6deb23c4209574fbec662e34bc025fc1911abd51..4df6655b7caae298981acf13ea09ed8b14b9b215 100644 (file)
@@ -284,6 +284,8 @@ void W_ThrowWeapon(vector velo, vector delta, float doreduce)
        w = self.weapon;
        if (w == 0)
                return; // just in case
+       if(self.weapon_forbidchange)
+               return;
        if(MUTATOR_CALLHOOK(ForbidThrowCurrentWeapon))
                return;
        if(!autocvar_g_weapon_throwable)
@@ -295,10 +297,6 @@ void W_ThrowWeapon(vector velo, vector delta, float doreduce)
        if(!W_IsWeaponThrowable(w))
                return;
 
-       // don't allow throwing the hager if we're loading rockets into it
-       if(self.weapon == WEP_HAGAR && self.hagar_load)
-               return;
-
        wb = W_WeaponBit(w);
        if(self.weapons & wb != wb)
                return;
index 0c9409bc77c6b1c2a8ecc8799ebff304cdd98c97..ee4b703523a2239593a46772f0976bd0c8b6dcc2 100644 (file)
@@ -34,9 +34,8 @@ float W_WeaponRateFactor()
 
 void W_SwitchWeapon_Force(entity e, float w)
 {
-       // don't allow switching to another weapon if we're loading rockets into the hagar
-       if(e.weapon == WEP_HAGAR && e.hagar_load)
-       if(e.weapons & WEPBIT_HAGAR) // only if we still have the hagar, prevents a bug with dropping
+       // don't switch to another weapon if we're not allowed to
+       if(e.weapon_forbidchange)
                return;
 
        e.cnt = e.switchweapon;
index 34d77350456e926e19c749a8695e57625f954ad3..79579f0e1883e964640377f407182394447d6ed7 100644 (file)
@@ -209,6 +209,7 @@ void w_ready();
 // VorteX: standalone think for weapons, so normal think on weaponentity can be reserved by weaponflashes (which needs update even player dies)
 .float weapon_nextthink;
 .void() weapon_think;
+.float weapon_forbidchange;
 
 //float        PLAYER_WEAPONSELECTION_DELAY = );
 float  PLAYER_WEAPONSELECTION_SPEED = 18;
index 3ab7836369e86fad12edb76686243343db17ee94..43216cd4ceba793dcda77aa921818a72b940327c 100644 (file)
@@ -231,8 +231,14 @@ void W_Hagar_Attack2_Load (void)
        }
 
        if(self.hagar_load)
-       if(!self.BUTTON_ATCK2 || ((loaded || !weapon_action(self.weapon, WR_CHECKAMMO2)) && self.hagar_loadstep < time && !autocvar_g_balance_hagar_secondary_load_hold))
-               W_Hagar_Attack2_Load_Release();
+       {
+               self.weapon_forbidchange = TRUE;
+
+               if(!self.BUTTON_ATCK2 || ((loaded || !weapon_action(self.weapon, WR_CHECKAMMO2)) && self.hagar_loadstep < time && !autocvar_g_balance_hagar_secondary_load_hold))
+                       W_Hagar_Attack2_Load_Release();
+       }
+       else
+               self.weapon_forbidchange = FALSE;
 
        // we aren't checking ammo during an attack, so we must do it here
        if not(weapon_action(self.weapon, WR_CHECKAMMO2))