return; // only players
}
- // TODO: restructure this so that trigger_secret is more independent
- if (this.classname == "trigger_secret")
- {
- if (!IS_PLAYER(this.enemy))
- return;
- found_secrets = found_secrets + 1;
- WriteByte (MSG_ALL, SVC_FOUNDSECRET);
- }
-
- if (this.noise)
+ if (this.noise && this.noise != "")
{
_sound (this.enemy, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM);
}
else if (this.sounds == 3)
this.noise = "misc/trigger1.wav";
- if(this.noise)
+ if(this.noise && this.noise != "")
precache_sound(this.noise);
if (!this.wait)
#include "relay_activators.qh"
+
#ifdef SVQC
void relay_activators_use(entity this, entity actor, entity trigger)
{
+ if(this.active != ACTIVE_ACTIVE)
+ return;
+
for(entity trg = NULL; (trg = find(trg, targetname, this.target)); )
{
if (trg.setactive)
}
}
+void relay_activators_init(entity this)
+{
+ this.reset = relay_activators_init; // doubles as a reset function
+ this.active = ACTIVE_ACTIVE;
+ this.use = relay_activators_use;
+}
+
spawnfunc(relay_activate)
{
this.cnt = ACTIVE_ACTIVE;
- this.use = relay_activators_use;
+ relay_activators_init(this);
}
spawnfunc(relay_deactivate)
{
this.cnt = ACTIVE_NOT;
- this.use = relay_activators_use;
+ relay_activators_init(this);
}
spawnfunc(relay_activatetoggle)
{
this.cnt = ACTIVE_TOGGLE;
- this.use = relay_activators_use;
+ relay_activators_init(this);
}
#endif
#include "relay_if.qh"
+
#ifdef SVQC
void trigger_relay_if_use(entity this, entity actor, entity trigger)
{
#include "relay_teamcheck.qh"
+
#ifdef SVQC
void trigger_relay_teamcheck_use(entity this, entity actor, entity trigger)
{
#ifdef SVQC
-void secrets_setstatus(entity this)
-{
- // TODO: use global stats!
- STAT(SECRETS_TOTAL, this) = secrets_total;
- STAT(SECRETS_FOUND, this) = secrets_found;
-}
-
/**
* A secret has been found (maybe :P)
*/
if (!IS_PLAYER(toucher))
return;
+ EXACTTRIGGER_TOUCH(this, toucher);
+
// update secrets found counter
secrets_found += 1;
- //print("Secret found: ", ftos(secret_counter.cnt), "/");
- //print(ftos(secret_counter.count), "\n");
- // centerprint message (multi_touch() doesn't always call centerprint())
- centerprint(toucher, this.message);
- this.message = "";
+ // message and noise handled by SUB_UseTargets
+ SUB_UseTargets(this, toucher, toucher);
- // handle normal trigger features
- multi_touch(this, toucher);
// we can't just delete(this) here, because this is a touch function
// called while C code is looping through area links...
- //delete(this);
+ settouch(this, func_null);
+}
+
+#if 0
+void trigger_secret_reset(entity this)
+{
+ secrets_found = 0;
+ settouch(this, trigger_secret_touch);
}
+#endif
/*QUAKED trigger_secret (.5 .5 .5) ?
Variable sized secret trigger. Can be targeted at one or more entities.
secrets_total += 1;
// add default message
- if (this.message == "")
+ if (!this.message || this.message == "")
this.message = "You found a secret!";
// set default sound
- if (this.noise == "")
- if (!this.sounds)
+ if ((!this.noise || this.noise == "") && !this.sounds)
this.sounds = 1; // misc/secret.wav
- // this entity can't be a target itself!!!!
- this.targetname = "";
+ switch(this.sounds)
+ {
+ case 1: this.noise = "misc/secret.wav"; break;
+ case 2: this.noise = strzone(SND(TALK)); break;
+ case 3: this.noise = "misc/trigger1.wav"; break;
+ }
- // you can't just shoot a room to find it, can you?
- SetResourceExplicit(this, RES_HEALTH, 0);
+ if(this.noise && this.noise != "")
+ precache_sound(this.noise);
- // a secret can not be delayed
+ // a secret cannot be delayed
this.delay = 0;
- // convert this trigger to trigger_once
- //this.classname = "trigger_once";
- spawnfunc_trigger_once(this);
+ EXACTTRIGGER_INIT;
- // take over the touch() function, so we can mark secret as found
settouch(this, trigger_secret_touch);
- // ignore triggering;
- this.use = func_null;
+// NOTE: old maps don't expect secrets to reset, so enabling resetting can cause issues!
+#if 0
+ this.reset = trigger_secret_reset;
+#endif
}
#endif
#pragma once
-#ifdef SVQC
-
-/**
- * Total number of secrets on the map.
- */
-float secrets_total;
-
-/**
- * Total numbe of secrets found on the map.
- */
-float secrets_found;
+#ifdef SVQC
+// Total number of secrets on the map.
+int secrets_total;
-/**
- * update secrets status.
- */
-void secrets_setstatus(entity this);
+// Total numbe of secrets found on the map.
+int secrets_found;
#endif
#ifdef SVQC
#include <server/autocvars.qh>
#include <server/client.qh>
+#include <common/mapobjects/trigger/secret.qh>
#endif
// Full list of all stat constants, included in a single location for easy reference
REGISTER_STAT(VEHICLESTAT_RELOAD2, int)
REGISTER_STAT(VEHICLESTAT_W2MODE, int)
REGISTER_STAT(NADE_TIMER, float)
-REGISTER_STAT(SECRETS_TOTAL, float)
-REGISTER_STAT(SECRETS_FOUND, float)
+REGISTER_STAT(SECRETS_TOTAL, int, secrets_total)
+REGISTER_STAT(SECRETS_FOUND, int, secrets_found)
REGISTER_STAT(RESPAWN_TIME, float)
REGISTER_STAT(ROUNDSTARTTIME, float, round_starttime)
REGISTER_STAT(MONSTERS_TOTAL, int)
this.dmg_team = max(0, this.dmg_team - autocvar_g_teamdamage_resetspeed * frametime);
}
- secrets_setstatus(this);
monsters_setstatus(this);
return true;