X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fweapons%2Fselection.qc;h=791d65915be989f9982b9d080024a860d13fab43;hb=926ed1b0236982412cf330acad1298e0581e4e6e;hp=f8ce9e750cd91091d8e3e54fae0f0857d6108afa;hpb=7779bdd488de14ec800782f2904d49a7f5aa33f8;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/weapons/selection.qc b/qcsrc/server/weapons/selection.qc index f8ce9e750..791d65915 100644 --- a/qcsrc/server/weapons/selection.qc +++ b/qcsrc/server/weapons/selection.qc @@ -3,11 +3,13 @@ #include "weaponsystem.qh" #include #include +#include #include #include #include #include #include +#include // 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; @@ -42,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 @@ -51,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) { @@ -59,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) @@ -73,7 +77,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 +252,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); @@ -286,7 +290,7 @@ void W_CycleWeapon(entity this, string weaponorder, float dir, .entity weaponent void W_NextWeaponOnImpulse(entity this, float imp, .entity weaponentity) { float w; - w = W_GetCycleWeapon(this, this.cvar_cl_weaponpriority, +1, imp, 1, (this.cvar_cl_weaponimpulsemode == 0), weaponentity); + w = W_GetCycleWeapon(this, this.cvar_cl_weaponpriority, +1, imp, 1, (CS(this).cvar_cl_weaponimpulsemode == 0), weaponentity); if(w > 0) W_SwitchWeapon(this, Weapons_from(w), weaponentity); }