]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/weapons/weaponsystem.qc
Merge branch 'master' into Mario/vehicles
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / weapons / weaponsystem.qc
index ab85389c5c9dc675e84f4917e21a6c08cf47eb03..d3b11cf184e7a66fcdc2a97668d7db1fd7437d68 100644 (file)
@@ -1,23 +1,19 @@
-#if defined(CSQC)
-#elif defined(MENUQC)
-#elif defined(SVQC)
-       #include "../../dpdefs/progsdefs.qh"
-    #include "../../dpdefs/dpextensions.qh"
-    #include "../../common/constants.qh"
-    #include "../../common/util.qh"
-    #include "../../common/animdecide.qh"
-    #include "../../common/monsters/monsters.qh"
-    #include "../../common/weapons/weapons.qh"
-    #include "weaponsystem.qh"
-    #include "../t_items.qh"
-    #include "../autocvars.qh"
-    #include "../defs.qh"
-    #include "../../common/notifications.qh"
-    #include "../mutators/mutators_include.qh"
-    #include "../command/common.qh"
-    #include "../../csqcmodellib/sv_model.qh"
-    #include "../round_handler.qh"
-#endif
+#include "weaponsystem.qh"
+#include "../_all.qh"
+
+#include "selection.qh"
+
+#include "../command/common.qh"
+#include "../mutators/mutators_include.qh"
+#include "../round_handler.qh"
+#include "../t_items.qh"
+#include "../../common/animdecide.qh"
+#include "../../common/constants.qh"
+#include "../../common/monsters/all.qh"
+#include "../../common/notifications.qh"
+#include "../../common/util.qh"
+#include "../../common/weapons/all.qh"
+#include "../../csqcmodellib/sv_model.qh"
 
 /*
 ===========================================================================
 
 float W_WeaponRateFactor()
 {
-       float t;
-       t = 1.0 / g_weaponratefactor;
+       float t = 1.0 / g_weaponratefactor;
 
-       weapon_rate = t;
-       MUTATOR_CALLHOOK(WeaponRateFactor);
+       MUTATOR_CALLHOOK(WeaponRateFactor, t);
        t = weapon_rate;
 
        return t;
 }
 
+float W_WeaponSpeedFactor()
+{
+       float t = 1.0 * g_weaponspeedfactor;
+
+       MUTATOR_CALLHOOK(WeaponSpeedFactor, t);
+       t = ret_float;
+
+       return t;
+}
+
 
 void(float fr, float t, void() func) weapon_thinkf;
 
@@ -468,11 +472,11 @@ float weapon_prepareattack_checkammo(float secondary)
        {
                // always keep the Mine Layer if we placed mines, so that we can detonate them
                entity mine;
-               if(self.weapon == WEP_MINE_LAYER)
+               if(self.weapon == WEP_MINE_LAYER.m_id)
                for(mine = world; (mine = find(mine, classname, "mine")); ) if(mine.owner == self)
                        return false;
 
-               if(self.weapon == WEP_SHOTGUN)
+               if(self.weapon == WEP_SHOTGUN.m_id)
                if(!secondary && WEP_CVAR(shotgun, secondary) == 1)
                        return false; // no clicking, just allow
 
@@ -633,7 +637,7 @@ void weapon_thinkf(float fr, float t, void() func)
 
        if((fr == WFRAME_FIRE1 || fr == WFRAME_FIRE2) && t)
        {
-               if((self.weapon == WEP_SHOCKWAVE || self.weapon == WEP_SHOTGUN) && fr == WFRAME_FIRE2)
+               if((self.weapon == WEP_SHOCKWAVE.m_id || self.weapon == WEP_SHOTGUN.m_id) && fr == WFRAME_FIRE2)
                        animdecide_setaction(self, ANIMACTION_MELEE, restartanim);
                else
                        animdecide_setaction(self, ANIMACTION_SHOOT, restartanim);
@@ -645,17 +649,17 @@ void weapon_thinkf(float fr, float t, void() func)
        }
 }
 
-float forbidWeaponUse()
+float forbidWeaponUse(entity player)
 {
        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)
+       if(player.player_blocked)
                return 1;
-       if(self.frozen)
+       if(player.frozen)
                return 1;
-       if(self.weapon_blocked)
+       if(player.weapon_blocked)
                return 1;
        return 0;
 }
@@ -670,7 +674,7 @@ void W_WeaponFrame()
        if (!self.weaponentity || self.health < 1)
                return; // Dead player can't use weapons and injure impulse commands
 
-       if(forbidWeaponUse())
+       if(forbidWeaponUse(self))
        if(self.weaponentity.state != WS_CLEAR)
        {
                w_ready();