From: Mario Date: Sun, 1 Jan 2017 22:50:56 +0000 (+1000) Subject: Preliminary support for triggering items (default action is to give the item to the... X-Git-Tag: xonotic-v0.8.2~334 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=14f45231bfeae7747a7bd2b2629164b41985ce71;p=xonotic%2Fxonotic-data.pk3dir.git Preliminary support for triggering items (default action is to give the item to the activator), requires spawnflags 16 --- diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 9d89679e3..cacc1e4f5 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?