X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Ftriggers%2Ffunc%2Fbutton.qc;h=a1cabdc6c0326d2fa82bb766bfc1f5cd8c87abef;hb=bf28c62f9ad2f130024109354c2503457195898d;hp=228b3f810aa5c3b62b91a8508cbd9a545ddcfcf4;hpb=5b22584122d4354ab7819853d0fa5219d14d832e;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/triggers/func/button.qc b/qcsrc/common/triggers/func/button.qc index 228b3f810..a1cabdc6c 100644 --- a/qcsrc/common/triggers/func/button.qc +++ b/qcsrc/common/triggers/func/button.qc @@ -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 } @@ -44,7 +43,7 @@ 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); @@ -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()); } } @@ -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() -{SELFPARAM(); - SetMovedir (); +spawnfunc(func_button) +{ + SetMovedir(self); if (!InitMovingBrushTrigger()) return;