]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/func/button.qc
Merge branch 'master' into Mirio/balance
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / func / button.qc
index bb8875b4221ace9b5bd83c25fac38d3fc3be7b27..a1cabdc6c0326d2fa82bb766bfc1f5cd8c87abef 100644 (file)
@@ -5,22 +5,21 @@ void() button_wait;
 void() button_return;
 
 void button_wait()
-{
+{SELFPARAM();
        self.state = STATE_TOP;
        self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait;
        self.SUB_THINK = button_return;
-       activator = self.enemy;
-       SUB_UseTargets();
+       SUB_UseTargets(self, self.enemy, NULL);
        self.frame = 1;                 // use alternate textures
 }
 
 void button_done()
-{
+{SELFPARAM();
        self.state = STATE_BOTTOM;
 }
 
 void button_return()
-{
+{SELFPARAM();
        self.state = STATE_DOWN;
        SUB_CalcMove (self.pos1, TSPEED_LINEAR, self.speed, button_done);
        self.frame = 0;                 // use normal textures
@@ -36,7 +35,7 @@ void button_blocked()
 
 
 void button_fire()
-{
+{SELFPARAM();
        self.health = self.max_health;
        self.takedamage = DAMAGE_NO;    // will be reset upon return
 
@@ -44,14 +43,14 @@ void button_fire()
                return;
 
        if (self.noise != "")
-               sound (self, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM);
+               _sound (self, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM);
 
        self.state = STATE_UP;
        SUB_CalcMove (self.pos2, TSPEED_LINEAR, self.speed, button_wait);
 }
 
 void button_reset()
-{
+{SELFPARAM();
        self.health = self.max_health;
        setorigin(self, self.pos1);
        self.frame = 0;                 // use normal textures
@@ -60,17 +59,17 @@ void button_reset()
                self.takedamage = DAMAGE_YES;   // can be shot again
 }
 
-void button_use()
+void button_use(entity this, entity actor, entity trigger)
 {
-       if(self.active != ACTIVE_ACTIVE)
+       if(this.active != ACTIVE_ACTIVE)
                return;
 
-       self.enemy = activator;
-       button_fire ();
+       this.enemy = actor;
+       WITHSELF(this, button_fire());
 }
 
 void button_touch()
-{
+{SELFPARAM();
        if (!other)
                return;
        if (!other.iscreature)
@@ -83,16 +82,16 @@ void button_touch()
        button_fire ();
 }
 
-void button_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+void button_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
 {
-       if(self.spawnflags & DOOR_NOSPLASH)
+       if(this.spawnflags & DOOR_NOSPLASH)
                if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH))
                        return;
-       self.health = self.health - damage;
-       if (self.health <= 0)
+       this.health = this.health - damage;
+       if (this.health <= 0)
        {
-               self.enemy = damage_attacker;
-               button_fire ();
+               this.enemy = damage_attacker;
+               WITHSELF(this, button_fire());
        }
 }
 
@@ -112,9 +111,9 @@ When a button is touched, it moves some distance in the direction of it's angle,
 2) metallic click
 3) in-out
 */
-void spawnfunc_func_button()
+spawnfunc(func_button)
 {
-       SetMovedir ();
+       SetMovedir(self);
 
        if (!InitMovingBrushTrigger())
                return;