]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/triggers.qc
Merge branch 'terencehill/quickmenu_file_example' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / triggers.qc
index 09c9fcd1081fc49e41c4f62d4254c6d511bc44de..41180dd2cc806b020a441b50f03cb2ff08f9f160 100644 (file)
@@ -138,7 +138,7 @@ match (string)self.target and call their .use function
 */
 void SUB_UseTargets()
 {SELFPARAM();
-       entity t, stemp, otemp, act;
+       entity t, otemp, act;
        string s;
        float i;
 
@@ -148,8 +148,7 @@ void SUB_UseTargets()
        if (self.delay)
        {
        // create a temp object to fire at a later time
-               t = spawn();
-               t.classname = "DelayedUse";
+               t = new(DelayedUse);
                t.nextthink = time + self.delay;
                t.think = DelayThink;
                t.enemy = activator;
@@ -173,7 +172,7 @@ void SUB_UseTargets()
        {
                centerprint(activator, self.message);
                if (self.noise == "")
-                       play2(activator, "misc/talk.wav");
+                       play2(activator, SND(TALK));
        }
 
 //
@@ -191,10 +190,9 @@ void SUB_UseTargets()
 // fire targets
 //
        act = activator;
-       stemp = self;
        otemp = other;
 
-       if(stemp.target_random)
+       if(this.target_random)
                RandomSelection_Init();
 
        for(i = 0; i < 4; ++i)
@@ -202,10 +200,10 @@ void SUB_UseTargets()
                switch(i)
                {
                        default:
-                       case 0: s = stemp.target; break;
-                       case 1: s = stemp.target2; break;
-                       case 2: s = stemp.target3; break;
-                       case 3: s = stemp.target4; break;
+                       case 0: s = this.target; break;
+                       case 1: s = this.target2; break;
+                       case 2: s = this.target3; break;
+                       case 3: s = this.target4; break;
                }
                if (s != "")
                {
@@ -215,7 +213,7 @@ void SUB_UseTargets()
                        for(t = world; (t = find(t, targetname, s)); )
                        if(t.use)
                        {
-                               if(stemp.target_random)
+                               if(this.target_random)
                                {
                                        RandomSelection_Add(t, 0, string_null, 1, 0);
                                }
@@ -223,8 +221,8 @@ void SUB_UseTargets()
                                {
                                        if (t.classname == "func_clientwall" || t.classname == "func_clientillusionary")
                                                t.antiwall_flag = aw_flag;
-                                       self = t;
-                                       other = stemp;
+                                       setself(t);
+                                       other = this;
                                        activator = act;
                                        self.use();
                                }
@@ -232,16 +230,16 @@ void SUB_UseTargets()
                }
        }
 
-       if(stemp.target_random && RandomSelection_chosen_ent)
+       if(this.target_random && RandomSelection_chosen_ent)
        {
-               self = RandomSelection_chosen_ent;
-               other = stemp;
+               setself(RandomSelection_chosen_ent);
+               other = this;
                activator = act;
                self.use();
        }
 
        activator = act;
-       self = stemp;
+       setself(this);
        other = otemp;
 }
 
@@ -266,8 +264,8 @@ void trigger_touch_generic(void() touchfunc)
                }
        }
 }
-void trigger_draw_generic()
-{SELFPARAM();
+void trigger_draw_generic(entity this)
+{
        float dt = time - self.move_time;
        self.move_time = time;
        if(dt <= 0) { return; }