X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Ftriggers%2Ftrigger%2Fmultivibrator.qc;h=a50f62b7abd699f207746792a1693f7a07dd9c26;hp=02a258e87f13a92a942f70f5c2427129f4457928;hb=42e255d014f2c6a1871177ea511f630624cdfb57;hpb=ff442844108257ce535eae6dc08eaf659ff5efd7 diff --git a/qcsrc/common/triggers/trigger/multivibrator.qc b/qcsrc/common/triggers/trigger/multivibrator.qc index 02a258e87..a50f62b7a 100644 --- a/qcsrc/common/triggers/trigger/multivibrator.qc +++ b/qcsrc/common/triggers/trigger/multivibrator.qc @@ -1,6 +1,6 @@ #ifdef SVQC void multivibrator_send() -{ +{SELFPARAM(); float newstate; float cyclestart; @@ -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,25 +18,25 @@ void multivibrator_send() self.nextthink = cyclestart + self.wait + self.respawntime + 0.01; } -void multivibrator_toggle() +void multivibrator_toggle(entity this, entity actor, entity trigger) { - if(self.nextthink == 0) + 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; } } void multivibrator_reset() -{ +{SELFPARAM(); if(!(self.spawnflags & 1)) self.nextthink = 0; // wait for a trigger event else @@ -55,7 +54,7 @@ respawntime: "off" cycle time (default: same as wait) -------- SPAWNFLAGS -------- START_ON: assume it is already turned on (when targeted) */ -void spawnfunc_trigger_multivibrator() +spawnfunc(trigger_multivibrator) { if(!self.wait) self.wait = 1;