]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/weapons/throwing.qc
Don't recount votes if the client leaving is a bot
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / weapons / throwing.qc
index 1bd88e16f66417ab4dbe7c83ef178b9e9da30b70..14da0f14ec66388b7637910ca3cf36cfb0466145 100644 (file)
@@ -2,14 +2,14 @@
 
 #include "weaponsystem.qh"
 #include "../mutators/all.qh"
-#include "../t_items.qh"
+#include <common/t_items.qh>
 #include "../g_damage.qh"
-#include "../../common/items/item.qh"
-#include "../../common/mapinfo.qh"
-#include "../../common/notifications.qh"
-#include "../../common/triggers/subs.qh"
-#include "../../common/util.qh"
-#include "../../common/weapons/all.qh"
+#include <common/items/item.qh>
+#include <common/mapinfo.qh>
+#include <common/notifications.qh>
+#include <common/triggers/subs.qh>
+#include <common/util.qh>
+#include <common/weapons/all.qh>
 
 void thrown_wep_think()
 {SELFPARAM();
@@ -32,7 +32,7 @@ void thrown_wep_think()
 // returns amount of ammo used as string, or -1 for failure, or 0 for no ammo count
 string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo)
 {SELFPARAM();
-       float thisammo, i;
+       float thisammo;
        string s;
        Weapon info = Weapons_from(wpn);
        var .int ammotype = info.ammo_field;
@@ -55,12 +55,11 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
                }
                else
                {
-                       float superweapons = 1;
-                       for(i = WEP_FIRST; i <= WEP_LAST; ++i)
-                       {
-                               WepSet set = WepSet_FromWeapon(Weapons_from(i));
-                               if ((set & WEPSET_SUPERWEAPONS) && (own.weapons & set)) ++superweapons;
-                       }
+                       int superweapons = 1;
+                       FOREACH(Weapons, it != WEP_Null, LAMBDA(
+                               WepSet set = it.m_wepset;
+                               if((set & WEPSET_SUPERWEAPONS) && (own.weapons & set)) ++superweapons;
+                       ));
                        if(superweapons <= 1)
                        {
                                wep.superweapons_finished = own.superweapons_finished;
@@ -79,7 +78,7 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
        weapon_defaultspawnfunc(wep, info);
        if(startitem_failed)
                return string_null;
-       wep.glowmod = own.weaponentity_glowmod;
+       wep.glowmod = weaponentity_glowmod(info, own.clientcolors);
        wep.think = thrown_wep_think;
        wep.savenextthink = wep.nextthink;
        wep.nextthink = min(wep.nextthink, time + 0.5);
@@ -191,9 +190,9 @@ void W_ThrowWeapon(vector velo, vector delta, float doreduce)
        Send_Notification(NOTIF_ONE, self, MSG_MULTI, ITEM_WEAPON_DROP, a, w.m_id);
 }
 
-void SpawnThrownWeapon(vector org, float w)
-{SELFPARAM();
-       if(self.weapons & WepSet_FromWeapon(PS(self).m_weapon))
-               if(W_IsWeaponThrowable(PS(self).m_weapon.m_id))
-                       W_ThrowNewWeapon(self, PS(self).m_weapon.m_id, false, org, randomvec() * 125 + '0 0 200');
+void SpawnThrownWeapon(entity this, vector org, float w)
+{
+       if(this.weapons & WepSet_FromWeapon(PS(this).m_weapon))
+               if(W_IsWeaponThrowable(PS(this).m_weapon.m_id))
+                       W_ThrowNewWeapon(this, PS(this).m_weapon.m_id, false, org, randomvec() * 125 + '0 0 200');
 }