]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/trigger/secret.qc
Move an assault constant into the assault file
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / trigger / secret.qc
index bf4178beae33396b3742a6bedabe5f950cc0d21d..9377332e2fb138299e1f3af53b653d57e55163d6 100644 (file)
@@ -1,26 +1,27 @@
+#include "secret.qh"
 #if defined(CSQC)
 #elif defined(MENUQC)
 #elif defined(SVQC)
     #include <common/util.qh>
     #include <server/defs.qh>
-    #include "secret.qh"
 #endif
 
 #ifdef SVQC
 
 void secrets_setstatus(entity this)
 {
-       this.stat_secrets_total = secrets_total;
-       this.stat_secrets_found = secrets_found;
+       // TODO: use global stats!
+       STAT(SECRETS_TOTAL, this) = secrets_total;
+       STAT(SECRETS_FOUND, this) = secrets_found;
 }
 
 /**
  * A secret has been found (maybe :P)
  */
-void trigger_secret_touch(entity this)
+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
@@ -29,12 +30,14 @@ void trigger_secret_touch(entity this)
        //print(ftos(secret_counter.count), "\n");
 
        // centerprint message (multi_touch() doesn't always call centerprint())
-       centerprint(other, this.message);
+       centerprint(toucher, this.message);
        this.message = "";
 
        // handle normal trigger features
-       multi_touch(this);
-       remove(this);
+       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) ?
@@ -76,7 +79,7 @@ spawnfunc(trigger_secret)
        this.delay = 0;
 
        // convert this trigger to trigger_once
-       this.classname = "trigger_once";
+       //this.classname = "trigger_once";
        spawnfunc_trigger_once(this);
 
        // take over the touch() function, so we can mark secret as found