5 #include <common/util.qh>
6 #include <server/defs.qh>
11 void secrets_setstatus(entity this)
13 this.stat_secrets_total = secrets_total;
14 this.stat_secrets_found = secrets_found;
18 * A secret has been found (maybe :P)
20 void trigger_secret_touch(entity this, entity toucher)
22 // only a player can trigger this
23 if (!IS_PLAYER(toucher))
26 // update secrets found counter
28 //print("Secret found: ", ftos(secret_counter.cnt), "/");
29 //print(ftos(secret_counter.count), "\n");
31 // centerprint message (multi_touch() doesn't always call centerprint())
32 centerprint(toucher, this.message);
35 // handle normal trigger features
36 multi_touch(this, toucher);
40 /*QUAKED trigger_secret (.5 .5 .5) ?
41 Variable sized secret trigger. Can be targeted at one or more entities.
42 Basically, it's a trigger_once (with restrictions, see notes) that additionally updates the number of secrets found.
43 -------- KEYS --------
44 sounds: 1 to play misc/secret.wav, 2 to play misc/talk.wav, 3 to play misc/trigger1.wav (default: 1)
45 noise: path to sound file, if you want to play something else
46 target: trigger all entities with this targetname when triggered
47 message: print this message to the player who activated the trigger instead of the standard 'You found a secret!'
48 killtarget: remove all entities with this targetname when triggered
49 -------- NOTES --------
50 You should create a common/trigger textured brush covering the entrance to a secret room/area.
51 Trigger secret can only be trigger by a player's touch and can not be a target itself.
53 spawnfunc(trigger_secret)
55 // FIXME: should it be disabled in most modes?
57 // update secrets count
60 // add default message
61 if (this.message == "")
62 this.message = "You found a secret!";
67 this.sounds = 1; // misc/secret.wav
69 // this entity can't be a target itself!!!!
72 // you can't just shoot a room to find it, can you?
75 // a secret can not be delayed
78 // convert this trigger to trigger_once
79 this.classname = "trigger_once";
80 spawnfunc_trigger_once(this);
82 // take over the touch() function, so we can mark secret as found
83 settouch(this, trigger_secret_touch);