From: Mario Date: Mon, 18 May 2020 09:38:41 +0000 (+1000) Subject: Allow deactivating trigger_relay_if, trigger_relay_teamcheck and trigger_disablerelay... X-Git-Tag: xonotic-v0.8.5~1069 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=d611f37d63254ae205c5e125e90f93e86de3e524;hp=-c Allow deactivating trigger_relay_if, trigger_relay_teamcheck and trigger_disablerelay, also fix trigger_disablerelay functionality --- d611f37d63254ae205c5e125e90f93e86de3e524 diff --git a/qcsrc/common/mapobjects/trigger/disablerelay.qc b/qcsrc/common/mapobjects/trigger/disablerelay.qc index eee61c9935..dde1a77c73 100644 --- a/qcsrc/common/mapobjects/trigger/disablerelay.qc +++ b/qcsrc/common/mapobjects/trigger/disablerelay.qc @@ -2,18 +2,21 @@ #ifdef SVQC void trigger_disablerelay_use(entity this, entity actor, entity trigger) { + if(this.active != ACTIVE_ACTIVE) + return; + int a = 0, b = 0; for(entity e = NULL; (e = find(e, targetname, this.target)); ) { - if(e.use == SUB_UseTargets) + if(e.active == ACTIVE_ACTIVE) { - e.use = SUB_DontUseTargets; + e.active = ACTIVE_NOT; ++a; } - else if(e.use == SUB_DontUseTargets) + else if(e.active == ACTIVE_NOT) { - e.use = SUB_UseTargets; + e.active = ACTIVE_ACTIVE; ++b; } } @@ -24,6 +27,8 @@ void trigger_disablerelay_use(entity this, entity actor, entity trigger) spawnfunc(trigger_disablerelay) { + this.reset = spawnfunc_trigger_disablerelay; // this spawnfunc resets fully + this.active = ACTIVE_ACTIVE; this.use = trigger_disablerelay_use; } #endif diff --git a/qcsrc/common/mapobjects/trigger/relay_if.qc b/qcsrc/common/mapobjects/trigger/relay_if.qc index 9adcd666ec..7586bd3384 100644 --- a/qcsrc/common/mapobjects/trigger/relay_if.qc +++ b/qcsrc/common/mapobjects/trigger/relay_if.qc @@ -2,6 +2,9 @@ #ifdef SVQC void trigger_relay_if_use(entity this, entity actor, entity trigger) { + if(this.active != ACTIVE_ACTIVE) + return; + int n = this.count; // TODO make this generic AND faster than nextent()ing through all, if somehow possible @@ -15,6 +18,8 @@ void trigger_relay_if_use(entity this, entity actor, entity trigger) spawnfunc(trigger_relay_if) { + this.reset = spawnfunc_trigger_relay_if; // this spawnfunc resets fully + this.active = ACTIVE_ACTIVE; this.use = trigger_relay_if_use; } #endif diff --git a/qcsrc/common/mapobjects/trigger/relay_teamcheck.qc b/qcsrc/common/mapobjects/trigger/relay_teamcheck.qc index bf03b1542f..5291f52906 100644 --- a/qcsrc/common/mapobjects/trigger/relay_teamcheck.qc +++ b/qcsrc/common/mapobjects/trigger/relay_teamcheck.qc @@ -2,6 +2,9 @@ #ifdef SVQC void trigger_relay_teamcheck_use(entity this, entity actor, entity trigger) { + if(this.active != ACTIVE_ACTIVE) + return; + if(actor.team) { if(this.spawnflags & RELAYTEAMCHECK_INVERT) @@ -24,11 +27,13 @@ void trigger_relay_teamcheck_use(entity this, entity actor, entity trigger) void trigger_relay_teamcheck_reset(entity this) { + this.active = ACTIVE_ACTIVE; this.team = this.team_saved; } spawnfunc(trigger_relay_teamcheck) { + this.active = ACTIVE_ACTIVE; this.team_saved = this.team; IL_PUSH(g_saved_team, this); this.use = trigger_relay_teamcheck_use;