3 void counter_reset(entity this);
5 void counter_use(entity this, entity actor, entity trigger)
8 if(this.spawnflags & COUNTER_PER_PLAYER)
12 entity mycounter = NULL;
13 IL_EACH(g_counters, it.realowner == actor && it.owner == this,
20 mycounter = new_pure(counter);
21 IL_PUSH(g_counters, mycounter);
22 mycounter.owner = this;
23 mycounter.realowner = actor;
24 mycounter.reset = counter_reset; // NOTE: this may be useless as the player deletes their counters upon respawning
25 mycounter.counter_cnt = 0;
30 store.counter_cnt += 1;
31 if (store.counter_cnt > this.count)
34 bool doactivate = (this.spawnflags & COUNTER_FIRE_AT_COUNT);
36 if (store.counter_cnt == this.count)
38 if(IS_PLAYER(actor) && !(this.spawnflags & SPAWNFLAG_NOMESSAGE))
39 Send_Notification(NOTIF_ONE, actor, MSG_CENTER, CENTER_SEQUENCE_COMPLETED);
45 setthink(store, counter_reset);
46 store.nextthink = time + this.respawntime;
51 if(IS_PLAYER(actor) && !(this.spawnflags & SPAWNFLAG_NOMESSAGE))
53 if((this.count - store.counter_cnt) >= 4)
54 Send_Notification(NOTIF_ONE, actor, MSG_CENTER, CENTER_SEQUENCE_COUNTER);
56 Send_Notification(NOTIF_ONE, actor, MSG_CENTER, CENTER_SEQUENCE_COUNTER_FEWMORE, this.count - store.counter_cnt);
61 SUB_UseTargets(this, actor, trigger);
64 void counter_reset(entity this)
66 setthink(this, func_null);
71 /*QUAKED spawnfunc_trigger_counter (.5 .5 .5) ? nomessage COUNTER_FIRE_AT_COUNT
72 Acts as an intermediary for an action that takes multiple inputs.
74 If nomessage is not set, it will print "1 more.. " etc when triggered and "sequence complete" when finished.
75 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
77 If respawntime is set, it will re-enable itself after the time once the sequence has been completed
79 After the counter has been triggered "count" times (default 2), it will fire all of its targets.
81 spawnfunc(trigger_counter)
87 this.use = counter_use;
88 this.reset = counter_reset;