]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/secret.qc
Updates to secrets
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / secret.qc
1 /*
2 A secret has been found!
3 */
4 void trigger_secret_touch() {
5         // only a player can trigger this
6         if (other.classname != "player")
7                 return;
8         
9         // update secrets found counter
10         secrets_found += 1;
11         //print("Secret found: ", ftos(secret_counter.cnt), "/");
12         //print(ftos(secret_counter.count), "\n");
13         
14         // handle normal trigger features
15         multi_touch();
16         remove(self);
17 }
18
19 /*QUAKED trigger_secret (.5 .5 .5) ?
20 Variable sized secret trigger. Can be targeted at one or more entities.
21 Basically, it's a trigger_once (with restrictions, see notes) that additionally updates the number of secrets found.
22 -------- KEYS --------
23 sounds: 1 to play misc/secret.wav, 2 to play misc/talk.wav, 3 to play misc/trigger1.wav (default: 1)
24 noise: path to sound file, if you want to play something else
25 target: trigger all entities with this targetname when triggered
26 message: print this message to the player who activated the trigger instead of the standard 'You found a secret!'
27 killtarget: remove all entities with this targetname when triggered
28 -------- NOTES --------
29 You should create a common/trigger textured brush covering the entrance to a secret room/area.
30 Trigger secret can only be trigger by a player's touch and can not be a target itself.
31 */
32 void spawnfunc_trigger_secret() {
33         // FIXME: should it be disabled in most modes?
34         
35         // update secrets count
36         secrets_total += 1;
37         
38         // add default message
39         if (self.message == "")
40                 self.message = "You found a secret!";
41         
42         // set default sound
43         if (self.noise == "")
44         if not(self.sounds)
45                 self.sounds = 1; // misc/secret.wav
46         
47         // this entity can't be a target itself!!!!
48         self.targetname = "";
49         
50         // you can't just shoot a room to find it, can you?
51         self.health = 0;
52         
53         // a secret can not be delayed
54         self.delay = 0;
55         
56         // convert this trigger to trigger_once
57         self.classname = "trigger_once";
58         spawnfunc_trigger_once();
59         
60         // take over the touch() function, so we can mark secret as found
61         self.touch = trigger_secret_touch;
62         // ignore triggering;
63         self.use = SUB_Null;
64 }
65