]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/t_items.qc
Merge remote-tracking branch 'origin/master' into Mario/mutators
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / t_items.qc
index 45698f1b2b978eeec8a7ceab1ea11b9edde10dea..61e2a09bf8af6927a78273a74005ac1e26e67287 100644 (file)
@@ -277,12 +277,6 @@ float have_pickup_item(void)
                        return TRUE;
                if(autocvar_g_powerups == 0)
                        return FALSE;
-               if(g_lms)
-                       return FALSE;
-               if(g_ca)
-                       return FALSE;
-               if(g_arena)
-                       return FALSE;
        }
        else
        {
@@ -290,10 +284,6 @@ float have_pickup_item(void)
                        return TRUE;
                if(autocvar_g_pickup_items == 0)
                        return FALSE;
-               if(g_lms)
-                       return FALSE;
-               if(g_ca)
-                       return FALSE;
                if(g_weaponarena)
                        if(!WEPSET_EMPTY_E(self) || (self.items & IT_AMMO))
                                return FALSE;
@@ -624,12 +614,12 @@ float Item_GiveTo(entity item, entity player)
                WEPSET_COPY_AE(it, item);
                WEPSET_ANDNOT_AE(it, player);
 
-               if (!WEPSET_EMPTY_A(it) || (item.spawnshieldtime && self.pickup_anyway))
+               if (!WEPSET_EMPTY_A(it) || (item.spawnshieldtime && item.pickup_anyway))
                {
-               pickedup = TRUE;
-               for(i = WEP_FIRST; i <= WEP_LAST; ++i)
+                       pickedup = TRUE;
+                       for(i = WEP_FIRST; i <= WEP_LAST; ++i)
                        if(WEPSET_CONTAINS_AW(it, i))
-                       W_GiveWeapon(player, i);
+                               W_GiveWeapon(player, i);
                }
        }
 
@@ -657,14 +647,6 @@ float Item_GiveTo(entity item, entity player)
        }
 
 :skip
-
-       other = player;
-       giveitem = item;
-       player_wswitch = _switchweapon;
-       player_pickedup = pickedup;
-       MUTATOR_CALLHOOK(Item_GiveTo);
-       _switchweapon = player_wswitch;
-       pickedup = player_pickedup;
        
        // always eat teamed entities
        if(item.team)
@@ -694,7 +676,7 @@ void Item_Touch (void)
                }
        }
 
-       if (other.classname != "player")
+       if not(IS_PLAYER(other))
                return;
        if (other.deadflag)
                return;
@@ -702,8 +684,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")
        {
@@ -724,6 +710,8 @@ void Item_Touch (void)
                return;
        }
 
+       :pickup
+
        other.last_pickup = time;
 
        pointparticles(particleeffectnum("item_pickup"), self.origin, '0 0 0', 1);
@@ -1171,12 +1159,9 @@ void weapon_defaultspawnfunc(float wpn)
 
                if(e.spawnflags & WEP_FLAG_MUTATORBLOCKED)
                {
-                       print("Attempted to spawn a mutator-blocked weapon; these guns will in the future require a mutator\n");
-                       /*
                        objerror("Attempted to spawn a mutator-blocked weapon rejected");
                        startitem_failed = TRUE;
                        return;
-                       */
                }
 
                s = W_Apply_Weaponreplace(e.netname);
@@ -1497,7 +1482,7 @@ void target_items_use (void)
                return;
        }
 
-       if(activator.classname != "player")
+       if not(IS_PLAYER(activator))
                return;
        if(activator.deadflag != DEAD_NO)
                return;