]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/weapons/selection.qc
Merge branch 'master' into Mario/wepent_experimental
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / weapons / selection.qc
index f8ce9e750cd91091d8e3e54fae0f0857d6108afa..06d5f30851711c5a952ce3935513d870da97d12a 100644 (file)
@@ -3,11 +3,13 @@
 #include "weaponsystem.qh"
 #include <common/t_items.qh>
 #include <common/constants.qh>
+#include <common/net_linked.qh>
 #include <common/util.qh>
 #include <common/items/item.qh>
 #include <common/weapons/_all.qh>
 #include <common/state.qh>
 #include <common/mutators/mutator/waypoints/waypointsprites.qh>
+#include <common/wepent.qh>
 
 // switch between weapons
 void Send_WeaponComplain(entity e, float wpn, float type)
@@ -21,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,
+       IL_EACH(g_items, it.weapon == this.m_id && (!it.team || (it.ItemStatus & ITS_AVAILABLE)),
        {
                if (it.classname == "droppedweapon" && autocvar_g_showweaponspawns < 2)
                        continue;
@@ -73,7 +75,7 @@ bool client_hasweapon(entity this, Weapon wpn, .entity weaponentity, float andam
 
                                // always allow selecting the Mine Layer if we placed mines, so that we can detonate them
                                if(wpn == WEP_MINE_LAYER)
-                                       IL_EACH(g_mines, it.owner == this,
+                                       IL_EACH(g_mines, it.owner == this && it.weaponentity_fld == weaponentity,
                                        {
                                                f = 1;
                                                break; // no need to continue
@@ -248,12 +250,12 @@ void W_SwitchToOtherWeapon(entity this, .entity weaponentity)
        if (this.weapons & set)
        {
                this.weapons &= ~set;
-               ww = w_getbestweapon(this);
+               ww = w_getbestweapon(this, weaponentity);
                this.weapons |= set;
        }
        else
        {
-               ww = w_getbestweapon(this);
+               ww = w_getbestweapon(this, weaponentity);
        }
        if (ww == WEP_Null) return;
        W_SwitchWeapon_Force(this, ww, weaponentity);