]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
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 fd2ce00a2b38ec60a55bcdc132acdadb70555519..8eea2a5fbfdc57d1b446d4d68c4408b3abf9f25e 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 0929d8bc687796a35dc8b4fb66fcac69e69c8c11..ae76b36b662901661a8cdb172126bfd4c21f015d 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) {