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
void button_fire()
-{
+{SELFPARAM();
self.health = self.max_health;
self.takedamage = DAMAGE_NO; // will be reset upon return
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
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)
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());
}
}
2) metallic click
3) in-out
*/
-void spawnfunc_func_button()
+spawnfunc(func_button)
{
- SetMovedir ();
+ SetMovedir(self);
if (!InitMovingBrushTrigger())
return;