]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/target/voicescript.qc
Move an assault constant into the assault file
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / target / voicescript.qc
index 1d1816a7741e988f46f9ee70f6773efc5843fe6f..6dfb568a8b5bbddfbfc1d3c5f7e8f93e68de2a4b 100644 (file)
@@ -1,3 +1,4 @@
+#include "voicescript.qh"
 #ifdef SVQC
 .entity voicescript; // attached voice script
 .float voicescript_index; // index of next voice, or -1 to use the randomized ones
@@ -6,16 +7,16 @@
 
 void target_voicescript_clear(entity pl)
 {
-       pl.voicescript = world;
+       pl.voicescript = NULL;
 }
 
-void target_voicescript_use()
-{SELFPARAM();
-       if(activator.voicescript != self)
+void target_voicescript_use(entity this, entity actor, entity trigger)
+{
+       if(actor.voicescript != this)
        {
-               activator.voicescript = self;
-               activator.voicescript_index = 0;
-               activator.voicescript_nextthink = time + self.delay;
+               actor.voicescript = this;
+               actor.voicescript_index = 0;
+               actor.voicescript_nextthink = time + this.delay;
        }
 }
 
@@ -31,7 +32,7 @@ void target_voicescript_next(entity pl)
                return;
        if (!IS_PLAYER(pl))
                return;
-       if(gameover)
+       if(game_stopped)
                return;
 
        if(time >= pl.voicescript_voiceend)
@@ -67,7 +68,7 @@ void target_voicescript_next(entity pl)
                        }
                        else
                        {
-                               pl.voicescript = world; // stop trying then
+                               pl.voicescript = NULL; // stop trying then
                        }
                }
        }
@@ -84,18 +85,18 @@ spawnfunc(target_voicescript)
        // delay: initial delay before the first message
 
        float i, n;
-       self.use = target_voicescript_use;
+       this.use = target_voicescript_use;
 
-       n = tokenize_console(self.message);
-       self.cnt = n / 2;
+       n = tokenize_console(this.message);
+       this.cnt = n / 2;
        for(i = 0; i+1 < n; i += 2)
        {
                if(argv(i) == "*")
                {
-                       self.cnt = i / 2;
+                       this.cnt = i / 2;
                        ++i;
                }
-               precache_sound(strcat(self.netname, "/", argv(i), ".wav"));
+               precache_sound(strcat(this.netname, "/", argv(i), ".wav"));
        }
 }
 #endif