From: TimePath Date: Tue, 6 Oct 2015 01:06:29 +0000 (+1100) Subject: Nades: check if player has hook for priming with weapon throw bind X-Git-Tag: xonotic-v0.8.2~1874^2~3 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d9c1e0e502298ba7005909c3d09be8eece5306fd;p=xonotic%2Fxonotic-data.pk3dir.git Nades: check if player has hook for priming with weapon throw bind --- diff --git a/qcsrc/server/mutators/mutator_nades.qc b/qcsrc/server/mutators/mutator_nades.qc index fd2ce00a2..8eea2a5fb 100644 --- a/qcsrc/server/mutators/mutator_nades.qc +++ b/qcsrc/server/mutators/mutator_nades.qc @@ -905,15 +905,6 @@ void nades_Clear(entity player) player.nade_timer = 0; } -MUTATOR_HOOKFUNCTION(nades_CheckThrow) -{ - if (self.offhand) { - nades_CheckThrow(); - return true; - } - return false; -} - MUTATOR_HOOKFUNCTION(nades_VehicleEnter) { if(vh_player.nade) @@ -959,6 +950,15 @@ CLASS(NadeOffhand, OffhandWeapon) ENDCLASS(NadeOffhand) NadeOffhand OFFHAND_NADE; STATIC_INIT(OFFHAND_NADE) { OFFHAND_NADE = NEW(NadeOffhand); } +MUTATOR_HOOKFUNCTION(nades_CheckThrow) +{ + if (self.offhand != OFFHAND_NADE || (self.weapons & WEPSET(HOOK))) { + nades_CheckThrow(); + return true; + } + return false; +} + MUTATOR_HOOKFUNCTION(nades_PlayerPreThink) {SELFPARAM(); if (!IS_PLAYER(self)) { return false; } diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 0929d8bc6..ae76b36b6 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -781,7 +781,7 @@ void W_WeaponFrame(entity actor) { bool key_pressed = actor.BUTTON_HOOK && !actor.vehicle; Weapon off = actor.offhand; - if (off) { + if (off && !(actor.weapons & WEPSET(HOOK))) { if (off.offhand_think) off.offhand_think(off, actor, key_pressed); } else { if (key_pressed && actor.switchweapon != WEP_HOOK.m_id && !actor.hook_switchweapon) {