]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/t_items.qc
Preliminary support for triggering items (default action is to give the item to the...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / t_items.qc
index 9d89679e3be9f88817ea8abd9883774c36eca22a..cacc1e4f511e87ba71f3e91dd83889c0194866af 100644 (file)
@@ -1058,6 +1058,12 @@ void Item_Damage(entity this, entity inflictor, entity attacker, float damage, i
                RemoveItem(this);
 }
 
+void item_use(entity this, entity actor, entity trigger)
+{
+       // use the touch function to handle collection
+       gettouch(this)(this, actor);
+}
+
 void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter)
 {
        string itemname = def.m_name;
@@ -1179,6 +1185,9 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
                }
                */
 
+               if(this.targetname != "" && (this.spawnflags & 16))
+                       this.use = item_use;
+
                if(autocvar_spawn_debug >= 2)
                {
             // why not flags & fl_item?