]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/trigger/multivibrator.qc
Fix the use of self, activator and other globals in .use
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / trigger / multivibrator.qc
index 78b3383fc0422f787fa68c075bd6bdd9c5514dd9..886bed55cfb519e244461ab381c99ba89f665597 100644 (file)
@@ -8,9 +8,8 @@ void multivibrator_send()
 
        newstate = (time < cyclestart + self.wait);
 
-       activator = self;
        if(self.state != newstate)
-               SUB_UseTargets();
+               SUB_UseTargets(self, self, NULL);
        self.state = newstate;
 
        if(self.state)
@@ -19,20 +18,20 @@ void multivibrator_send()
                self.nextthink = cyclestart + self.wait + self.respawntime + 0.01;
 }
 
-void multivibrator_toggle()
-{SELFPARAM();
-       if(self.nextthink == 0)
+void multivibrator_toggle(entity this, entity actor, entity trigger)
+{
+       if(this.nextthink == 0)
        {
-               multivibrator_send();
+               WITHSELF(this, multivibrator_send());
        }
        else
        {
-               if(self.state)
+               if(this.state)
                {
-                       SUB_UseTargets();
-                       self.state = 0;
+                       SUB_UseTargets(this, actor, trigger);
+                       this.state = 0;
                }
-               self.nextthink = 0;
+               this.nextthink = 0;
        }
 }
 
@@ -63,7 +62,7 @@ spawnfunc(trigger_multivibrator)
                self.respawntime = self.wait;
 
        self.state = 0;
-       self.use = multivibrator_toggle;
+       self.use1 = multivibrator_toggle;
        self.think = multivibrator_send;
        self.nextthink = max(1, time);