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