From: Mario Date: Mon, 27 Feb 2017 14:06:02 +0000 (+1000) Subject: Don't force the switching if the weapon is the same in GiveItems (fixes lastwep bind... X-Git-Tag: xonotic-v0.8.2~170 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=14fbb3eada4048ab76b1181cb460a0e9b26285a3;p=xonotic%2Fxonotic-data.pk3dir.git Don't force the switching if the weapon is the same in GiveItems (fixes lastwep bind if player's best weapon is the one they're holding) --- diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 00b0dcf12..c8e08bbcc 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -1916,7 +1916,11 @@ float GiveItems(entity e, float beginarg, float endarg) { .entity weaponentity = weaponentities[slot]; if(_switchweapon & BIT(slot)) - W_SwitchWeapon_Force(e, w_getbestweapon(e, weaponentity), weaponentity); + { + Weapon wep = w_getbestweapon(e, weaponentity); + if(wep != e.(weaponentity).m_switchweapon) + W_SwitchWeapon_Force(e, wep, weaponentity); + } } }