]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/gamemode_nexball.qc
Weapons: remove useless weapon return values and implementations
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / gamemode_nexball.qc
index 10690001d49dd2dfa2aa20c63fef302ea931ec2b..5d034870e67a0418c9814d3d18ca3158f07b2d85 100644 (file)
@@ -170,7 +170,8 @@ void GiveBall(entity plyr, entity ball)
        plyr.weaponentity.switchweapon = plyr.weapon;
        plyr.weapons = WEPSET_NEXBALL;
        setself(plyr);
-       WEP_ACTION(WEP_NEXBALL, WR_RESETPLAYER);
+       Weapon w = WEP_NEXBALL;
+       w.wr_resetplayer(w);
        plyr.switchweapon = WEP_NEXBALL.m_id;
        W_SwitchWeapon(WEP_NEXBALL.m_id);
        setself(this);
@@ -841,17 +842,10 @@ float ball_customize()
        return true;
 }
 
-float w_nexball_weapon(float req);
-METHOD(BallStealer, weapon_func, bool(entity this, int req)) {
-       return w_nexball_weapon(req);
-}
-
-float w_nexball_weapon(float req)
-{SELFPARAM();
-       if(req == WR_THINK)
+       METHOD(BallStealer, wr_think, void(BallStealer thiswep, bool fire1, bool fire2))
        {
-               if(self.BUTTON_ATCK)
-                       if(weapon_prepareattack(0, autocvar_g_balance_nexball_primary_refire))
+               if(fire1)
+                       if(weapon_prepareattack(false, autocvar_g_balance_nexball_primary_refire))
                                if(autocvar_g_nexball_basketball_meter)
                                {
                                        if(self.ballcarried && !self.metertime)
@@ -864,30 +858,32 @@ float w_nexball_weapon(float req)
                                        W_Nexball_Attack(-1);
                                        weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
                                }
-               if(self.BUTTON_ATCK2)
-                       if(weapon_prepareattack(1, autocvar_g_balance_nexball_secondary_refire))
+               if(fire2)
+                       if(weapon_prepareattack(true, autocvar_g_balance_nexball_secondary_refire))
                        {
                                W_Nexball_Attack2();
                                weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_nexball_secondary_animtime, w_ready);
                        }
 
-               if(!self.BUTTON_ATCK && self.metertime && self.ballcarried)
+               if(!fire1 && self.metertime && self.ballcarried)
                {
                        W_Nexball_Attack(time - self.metertime);
                        // DropBall or stealing will set metertime back to 0
                        weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
                }
        }
-       else if(req == WR_INIT)
+       METHOD(BallStealer, wr_setup, void(BallStealer thiswep))
        {
+               //weapon_setup(WEP_PORTO.m_id);
        }
-       else if(req == WR_SETUP)
+       METHOD(BallStealer, wr_checkammo1, bool(BallStealer thiswep))
        {
-               //weapon_setup(WEP_PORTO.m_id);
+               return true;
+       }
+       METHOD(BallStealer, wr_checkammo2, bool(BallStealer thiswep))
+       {
+               return true;
        }
-       // No need to check WR_CHECKAMMO* or WR_AIM, it should always return true
-       return true;
-}
 
 MUTATOR_HOOKFUNCTION(nexball_BallDrop)
 {SELFPARAM();
@@ -946,7 +942,8 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerPreThink)
                        if(self.weaponentity.weapons)
                        {
                                self.weapons = self.weaponentity.weapons;
-                               WEP_ACTION(WEP_NEXBALL, WR_RESETPLAYER);
+                               Weapon w = WEP_NEXBALL;
+                               w.wr_resetplayer(w);
                                self.switchweapon = self.weaponentity.switchweapon;
                                W_SwitchWeapon(self.switchweapon);