X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Ftriggers%2Ftrigger%2Fsecret.qc;h=c3c2c7474e6983b071464d04cc59ea45bbb47c1f;hb=0071121b663dc3d841a2c28d27c1015899f0f402;hp=b93ab03d0a4ded5fcb90f76e2cef41c1963bb195;hpb=ff442844108257ce535eae6dc08eaf659ff5efd7;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/triggers/trigger/secret.qc b/qcsrc/common/triggers/trigger/secret.qc index b93ab03d0..c3c2c7474 100644 --- a/qcsrc/common/triggers/trigger/secret.qc +++ b/qcsrc/common/triggers/trigger/secret.qc @@ -1,25 +1,26 @@ +#include "secret.qh" #if defined(CSQC) #elif defined(MENUQC) #elif defined(SVQC) - #include "../../../server/_all.qh" - #include "../../util.qh" - #include "../../../server/defs.qh" - #include "secret.qh" + #include + #include #endif #ifdef SVQC -void secrets_setstatus() { - self.stat_secrets_total = secrets_total; - self.stat_secrets_found = secrets_found; +void secrets_setstatus(entity this) +{ + this.stat_secrets_total = secrets_total; + this.stat_secrets_found = secrets_found; } /** * A secret has been found (maybe :P) */ -void trigger_secret_touch() { +void trigger_secret_touch(entity this, entity toucher) +{ // only a player can trigger this - if (!IS_PLAYER(other)) + if (!IS_PLAYER(toucher)) return; // update secrets found counter @@ -28,12 +29,14 @@ void trigger_secret_touch() { //print(ftos(secret_counter.count), "\n"); // centerprint message (multi_touch() doesn't always call centerprint()) - centerprint(other, self.message); - self.message = ""; + centerprint(toucher, this.message); + this.message = ""; // handle normal trigger features - multi_touch(); - remove(self); + 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); } /*QUAKED trigger_secret (.5 .5 .5) ? @@ -49,37 +52,38 @@ killtarget: remove all entities with this targetname when triggered You should create a common/trigger textured brush covering the entrance to a secret room/area. Trigger secret can only be trigger by a player's touch and can not be a target itself. */ -void spawnfunc_trigger_secret() { +spawnfunc(trigger_secret) +{ // FIXME: should it be disabled in most modes? // update secrets count secrets_total += 1; // add default message - if (self.message == "") - self.message = "You found a secret!"; + if (this.message == "") + this.message = "You found a secret!"; // set default sound - if (self.noise == "") - if (!self.sounds) - self.sounds = 1; // misc/secret.wav + if (this.noise == "") + if (!this.sounds) + this.sounds = 1; // misc/secret.wav // this entity can't be a target itself!!!! - self.targetname = ""; + this.targetname = ""; // you can't just shoot a room to find it, can you? - self.health = 0; + this.health = 0; // a secret can not be delayed - self.delay = 0; + this.delay = 0; // convert this trigger to trigger_once - self.classname = "trigger_once"; - spawnfunc_trigger_once(); + //this.classname = "trigger_once"; + spawnfunc_trigger_once(this); // take over the touch() function, so we can mark secret as found - self.touch = trigger_secret_touch; + settouch(this, trigger_secret_touch); // ignore triggering; - self.use = func_null; + this.use = func_null; } #endif