]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/t_items.qc
Fix ItemTouch mutator hook usage (fixes #1572)
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / t_items.qc
index 3471ce1b046fd54dc00a8b12dad110e22115360c..926a4ab9df36a6faeec3214cab01510f72d7f274 100644 (file)
@@ -682,7 +682,7 @@ void Item_Touch (void)
                }
        }
 
-       if (other.classname != "player")
+       if not(IS_PLAYER(other))
                return;
        if (other.deadflag)
                return;
@@ -690,8 +690,12 @@ void Item_Touch (void)
                return;
        if (self.owner == other)
                return;
-       if(MUTATOR_CALLHOOK(ItemTouch))
-               return;
+
+       switch(MUTATOR_CALLHOOK(ItemTouch))
+       {
+               case MUT_ITEMTOUCH_RETURN: { return; }
+               case MUT_ITEMTOUCH_PICKUP: { goto pickup; }
+       }
 
        if (self.classname == "droppedweapon")
        {
@@ -712,6 +716,8 @@ void Item_Touch (void)
                return;
        }
 
+       :pickup
+
        other.last_pickup = time;
 
        pointparticles(particleeffectnum("item_pickup"), self.origin, '0 0 0', 1);
@@ -1485,7 +1491,7 @@ void target_items_use (void)
                return;
        }
 
-       if(activator.classname != "player")
+       if not(IS_PLAYER(activator))
                return;
        if(activator.deadflag != DEAD_NO)
                return;