]> 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 ab1cff538ef2e1bbbd6c020208578ce326ae7a03..a1cabdc6c0326d2fa82bb766bfc1f5cd8c87abef 100644 (file)
@@ -9,8 +9,7 @@ void button_wait()
        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
 }
 
@@ -60,13 +59,13 @@ void button_reset()
                self.takedamage = DAMAGE_YES;   // can be shot again
 }
 
-void button_use()
-{SELFPARAM();
-       if(self.active != ACTIVE_ACTIVE)
+void button_use(entity this, entity actor, entity trigger)
+{
+       if(this.active != ACTIVE_ACTIVE)
                return;
 
-       self.enemy = activator;
-       button_fire ();
+       this.enemy = actor;
+       WITHSELF(this, button_fire());
 }
 
 void button_touch()
@@ -83,16 +82,16 @@ void button_touch()
        button_fire ();
 }
 
-void button_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
-       if(self.spawnflags & DOOR_NOSPLASH)
+void button_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       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());
        }
 }
 
@@ -114,7 +113,7 @@ When a button is touched, it moves some distance in the direction of it's angle,
 */
 spawnfunc(func_button)
 {
-       SetMovedir ();
+       SetMovedir(self);
 
        if (!InitMovingBrushTrigger())
                return;