From: Freddy Date: Sun, 11 Mar 2018 16:45:33 +0000 (+0100) Subject: trigger_counter: replace magic number and document hidden feature X-Git-Tag: xonotic-v0.8.5~2176^2~19 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6ef92d6901ef4b029d5c6589cd8565b34451cf10;p=xonotic%2Fxonotic-data.pk3dir.git trigger_counter: replace magic number and document hidden feature --- diff --git a/qcsrc/common/triggers/spawnflags.qh b/qcsrc/common/triggers/spawnflags.qh index 6e213fa76..f91b037fb 100644 --- a/qcsrc/common/triggers/spawnflags.qh +++ b/qcsrc/common/triggers/spawnflags.qh @@ -100,6 +100,9 @@ const int TELEPORT_FLAG_FORCE_TDEATH = BIT(3); const int SPAWNFLAG_NOMESSAGE = BIT(0); const int SPAWNFLAG_NOTOUCH = BIT(0); // why are these the same? +// counter +const int COUNTER_FIRE_AT_COUNT = BIT(2); + //---------- // SENDFLAGS //---------- diff --git a/qcsrc/common/triggers/trigger/counter.qc b/qcsrc/common/triggers/trigger/counter.qc index 87c046b0d..4c89c4c27 100644 --- a/qcsrc/common/triggers/trigger/counter.qc +++ b/qcsrc/common/triggers/trigger/counter.qc @@ -8,7 +8,7 @@ void counter_use(entity this, entity actor, entity trigger) if (this.count < 0) return; - bool doactivate = (this.spawnflags & 4); + bool doactivate = (this.spawnflags & COUNTER_FIRE_AT_COUNT); if (this.count == 0) { @@ -45,14 +45,15 @@ void counter_reset(entity this) this.count = this.cnt; } -/*QUAKED spawnfunc_trigger_counter (.5 .5 .5) ? nomessage +/*QUAKED spawnfunc_trigger_counter (.5 .5 .5) ? nomessage COUNTER_FIRE_AT_COUNT Acts as an intermediary for an action that takes multiple inputs. If nomessage is not set, it will print "1 more.. " etc when triggered and "sequence complete" when finished. +If COUNTER_FIRE_AT_COUNT is set, it will also fire all of its targets at countdown, making it behave like trigger_mulitple with limited shots If respawntime is set, it will re-enable itself after the time once the sequence has been completed -After the counter has been triggered "count" times (default 2), it will fire all of it's targets and remove itself. +After the counter has been triggered "count" times (default 2), it will fire all of its targets. */ spawnfunc(trigger_counter) {