]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/t_items.qc
Purge most cases of self from the client folder
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / t_items.qc
index da360c80d51eb2e73e703d19855faee3d22bcedc..ce3bf352a8e03fdcbded71f3bd255968b425330b 100644 (file)
@@ -7,26 +7,26 @@
     #include "../server/bot/bot.qh"
     #include "../server/bot/waypoints.qh"
 
-    #include "../server/mutators/all.qh"
+    #include <server/mutators/all.qh>
 
     #include "../server/weapons/common.qh"
     #include "../server/weapons/selection.qh"
     #include "../server/weapons/weaponsystem.qh"
 
     #include "constants.qh"
-    #include "deathtypes/all.qh"
-    #include "notifications.qh"
+    #include <common/deathtypes/all.qh>
+    #include <common/notifications.qh>
        #include "triggers/subs.qh"
     #include "util.qh"
 
-    #include "monsters/all.qh"
+    #include <common/monsters/all.qh>
 
-    #include "weapons/all.qh"
+    #include <common/weapons/all.qh>
 
     #include "../lib/warpzone/util_server.qh"
 #elif defined(CSQC)
        #include "physics/movetypes/movetypes.qh"
-       #include "weapons/all.qh"
+       #include <common/weapons/all.qh>
        #include "../lib/csqcmodel/cl_model.qh"
        #include "../lib/csqcmodel/common.qh"
 #endif
@@ -110,6 +110,8 @@ void ItemDrawSimple(entity this)
         if(this.move_flags & FL_ONGROUND)
             this.gravity = 0;
     }
+
+    Item_SetAlpha(this);
 }
 
 void Item_PreDraw()
@@ -117,7 +119,7 @@ void Item_PreDraw()
        if(warpzone_warpzones_exist)
        {
                // just incase warpzones were initialized last, reset these
-               self.alpha = 1;
+               //self.alpha = 1; // alpha is already set by the draw function
                self.drawmask = MASK_NORMAL;
                return;
        }
@@ -138,10 +140,10 @@ void Item_PreDraw()
                self.drawmask = MASK_NORMAL;
 }
 
-void ItemRemove()
-{SELFPARAM();
-       if (self.mdl)
-               strunzone(self.mdl);
+void ItemRemove(entity this)
+{
+       if(this.mdl)
+               strunzone(this.mdl);
 }
 
 NET_HANDLE(ENT_CLIENT_ITEM, bool isnew)
@@ -767,8 +769,8 @@ void Item_Touch()
        }
 
        if(!(other.flags & FL_PICKUPITEMS)
-       || other.frozen
-       || other.deadflag
+       || STAT(FROZEN, other)
+       || IS_DEAD(other)
        || (this.solid != SOLID_TRIGGER)
        || (this.owner == other)
        || (time < this.item_spawnshieldtime)
@@ -1012,10 +1014,10 @@ float commodity_pickupevalfunc(entity player, entity item)
        return item.bot_pickupbasevalue * c;
 }
 
-void Item_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+void Item_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
 {
        if(ITEM_DAMAGE_NEEDKILL(deathtype))
-               RemoveItem();
+               WITH(entity, self, this, RemoveItem());
 }
 
 void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter)
@@ -1421,14 +1423,15 @@ void target_items_use()
 
        if (!IS_PLAYER(activator))
                return;
-       if(activator.deadflag != DEAD_NO)
+       if(IS_DEAD(activator))
                return;
        EXACTTRIGGER_TOUCH;
 
-       entity e;
-       for(e = world; (e = find(e, classname, "droppedweapon")); )
-               if(e.enemy == activator)
-                       remove(e);
+       FOREACH_ENTITY_ENT(enemy, activator,
+       {
+               if(it.classname == "droppedweapon")
+                       remove(it);
+       });
 
        if(GiveItems(activator, 0, tokenize_console(self.netname)))
                centerprint(activator, self.message);