]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/weapons/selection.qc
Port hasweapon_complain_spam to ClientState
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / weapons / selection.qc
index 7abe976ae2bc0d6c19f4732e2f05859e8cac96eb..6f3fd85a8d21795cc6acd8345cfed5ed7964f2e5 100644 (file)
@@ -23,7 +23,7 @@ void Send_WeaponComplain(entity e, float wpn, float type)
 void Weapon_whereis(Weapon this, entity cl)
 {
        if (!autocvar_g_showweaponspawns) return;
-       IL_EACH(g_items, it.weapon == this.m_id && (it.ItemStatus & ITS_AVAILABLE),
+       IL_EACH(g_items, it.weapon == this.m_id && (!it.team || (it.ItemStatus & ITS_AVAILABLE)),
        {
                if (it.classname == "droppedweapon" && autocvar_g_showweaponspawns < 2)
                        continue;
@@ -44,7 +44,7 @@ bool client_hasweapon(entity this, Weapon wpn, .entity weaponentity, float andam
 {
        float f = 0;
 
-       if (time < this.hasweapon_complain_spam)
+       if (time < CS(this).hasweapon_complain_spam)
                complain = 0;
 
        // ignore hook button when using other offhand equipment
@@ -53,7 +53,7 @@ bool client_hasweapon(entity this, Weapon wpn, .entity weaponentity, float andam
            complain = 0;
 
        if (complain)
-               this.hasweapon_complain_spam = time + 0.2;
+               CS(this).hasweapon_complain_spam = time + 0.2;
 
        if (wpn == WEP_Null)
        {
@@ -61,6 +61,8 @@ bool client_hasweapon(entity this, Weapon wpn, .entity weaponentity, float andam
                        sprint(this, "Invalid weapon\n");
                return false;
        }
+       if (autocvar_g_weaponswitch_debug == 2 && weaponslot(weaponentity) > 0 && !(wpn.spawnflags & WEP_FLAG_DUALWIELD) && !(PS(this).dual_weapons & wpn.m_wepset))
+               return false; // no complaints needed
        if (this.weapons & WepSet_FromWeapon(wpn))
        {
                if (andammo)