Nades: check if player has hook for priming with weapon throw bind
authorTimePath <andrew.hardaker1995@gmail.com>
Tue, 6 Oct 2015 01:06:29 +0000 (12:06 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Tue, 6 Oct 2015 01:06:29 +0000 (12:06 +1100)
qcsrc/server/mutators/mutator_nades.qc
qcsrc/server/weapons/weaponsystem.qc

index fd2ce00..8eea2a5 100644 (file)
@@ -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; }
index 0929d8b..ae76b36 100644 (file)
@@ -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) {