From 14f45231bfeae7747a7bd2b2629164b41985ce71 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 2 Jan 2017 08:50:56 +1000 Subject: [PATCH] Preliminary support for triggering items (default action is to give the item to the activator), requires spawnflags 16 --- qcsrc/common/t_items.qc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 9d89679e3b..cacc1e4f51 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -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? -- 2.39.2