From: terencehill Date: Sun, 31 Jul 2022 21:11:37 +0000 (+0200) Subject: Fix #2728 "Spectating a bot displays a "no ammo for shotgun slap but primary can... X-Git-Tag: xonotic-v0.8.6~357^2~3 X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=41a636d8ffe56475c0aad21d40cadd7f9a60a133 Fix #2728 "Spectating a bot displays a "no ammo for shotgun slap but primary can fire" when they begin to slap but their target moves out of their reach" Fixed by removing an ugly hack that reported insufficient ammo for melee attack and changing shotgun behaviour to no longer automatically turn attack1 into attack2 (melee) if bots are out of ammo --- diff --git a/qcsrc/common/weapons/weapon/shotgun.qc b/qcsrc/common/weapons/weapon/shotgun.qc index bc1ce89479..523de5d71b 100644 --- a/qcsrc/common/weapons/weapon/shotgun.qc +++ b/qcsrc/common/weapons/weapon/shotgun.qc @@ -253,7 +253,7 @@ METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentit } if(actor.(weaponentity).clip_load >= 0) // we are not currently reloading if(WEP_CVAR(shotgun, secondary) == 1) - if(((fire & 1) && GetResource(actor, thiswep.ammo_type) <= 0 && !(actor.items & IT_UNLIMITED_AMMO)) || (fire & 2)) + if(((fire & 1) && !IS_BOT_CLIENT(actor) && GetResource(actor, thiswep.ammo_type) <= 0 && !(actor.items & IT_UNLIMITED_AMMO)) || (fire & 2)) if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(shotgun, refire))) { // attempt forcing playback of the anim by switching to another anim (that we never play) here... @@ -268,9 +268,6 @@ METHOD(Shotgun, wr_checkammo1, bool(entity thiswep, entity actor, .entity weapon } METHOD(Shotgun, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity)) { - if(IS_BOT_CLIENT(actor)) - if(vdist(actor.origin - actor.enemy.origin, >, WEP_CVAR_SEC(shotgun, melee_range))) - return false; // bots cannot use secondary out of range (fixes constant melee when out of ammo) switch(WEP_CVAR(shotgun, secondary)) { case 1: return true; // melee does not use ammo