]> 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 cb6700a2cfb60a3a5e2e289ff82761976dada93a..926a4ab9df36a6faeec3214cab01510f72d7f274 100644 (file)
@@ -651,11 +651,6 @@ float Item_GiveTo(entity item, entity player)
                pickedup = TRUE;
                player.superweapons_finished = max(player.superweapons_finished, time) + item.superweapons_finished;
        }
-       if (item.max_health)
-       {
-               pickedup = TRUE;
-               // extra life powerup handled by mutators
-       }
 
 :skip
        
@@ -695,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")
        {
@@ -717,6 +716,8 @@ void Item_Touch (void)
                return;
        }
 
+       :pickup
+
        other.last_pickup = time;
 
        pointparticles(particleeffectnum("item_pickup"), self.origin, '0 0 0', 1);