From 348fa0d2e5bb9039dcd96e94e4ad594edf91bb23 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 31 Jul 2024 15:27:46 +1000 Subject: [PATCH] Add basic relay activation support to standard items --- qcsrc/server/items/items.qc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/qcsrc/server/items/items.qc b/qcsrc/server/items/items.qc index f43fa3b3d..8506926e9 100644 --- a/qcsrc/server/items/items.qc +++ b/qcsrc/server/items/items.qc @@ -980,6 +980,18 @@ void item_use(entity this, entity actor, entity trigger) gettouch(this)(this, actor); } +void item_setactive(entity this, int act) +{ + int old_status = this.active; + if(act == ACTIVE_TOGGLE) + this.active = (this.active == ACTIVE_ACTIVE) ? ACTIVE_NOT : ACTIVE_ACTIVE; + else + this.active = act; + + if(this.active != old_status) + Item_Show(this, ((this.active == ACTIVE_ACTIVE) ? 1 : -1)); +} + void StartItem(entity this, entity def) { if (def.m_spawnfunc_hookreplace) @@ -1146,6 +1158,9 @@ void StartItem(entity this, entity def) if(this.targetname != "" && (this.spawnflags & 16)) this.use = item_use; + this.setactive = item_setactive; + this.active = ACTIVE_ACTIVE; + if(autocvar_spawn_debug >= 2) { // why not flags & fl_item? -- 2.39.2