This repository has been archived on 2022-06-27. You can view files and clone it, but cannot push or open issues or pull requests.
Xash3DArchive/vprogs/ents/triggers/trigger_push.c

48 lines
766 B
C
Raw Normal View History

2007-09-04 22:00:00 +02:00
/*
+============+
|TRIGGER_PUSH|
+============+==============+
|Description; |
2007-09-16 22:00:00 +02:00
|Push player for pev speed.|
2007-09-04 22:00:00 +02:00
+===========================+
*/
void() trigger_push_think =
{
2007-09-16 22:00:00 +02:00
pev->touched = FALSE;
2007-09-04 22:00:00 +02:00
};
void() trigger_push_touch =
{
if(other.flags & FL_CLIENT)
2007-09-16 22:00:00 +02:00
other.velocity = pev->speed * pev->movedir * 10;
2007-09-04 22:00:00 +02:00
2007-09-16 22:00:00 +02:00
if (pev->spawnflags & TRIGGER_ONCE)
remove(pev);
2007-09-04 22:00:00 +02:00
2007-09-16 22:00:00 +02:00
if(pev->dmg)
2007-09-04 22:00:00 +02:00
{
2007-09-16 22:00:00 +02:00
if(pev->touched == FALSE)
2007-09-04 22:00:00 +02:00
{
2007-09-16 22:00:00 +02:00
T_Damage (other, pev, pev, pev->dmg);
pev->touched = TRUE;
2007-09-04 22:00:00 +02:00
2007-09-16 22:00:00 +02:00
pev->think = trigger_push_think;
pev->nextthink = time + 0.1;
2007-09-04 22:00:00 +02:00
}
}
};
void() trigger_push =
{
trigger_setup();
2007-09-16 22:00:00 +02:00
pev->touch = trigger_push_touch;
2007-09-04 22:00:00 +02:00
2007-09-16 22:00:00 +02:00
if (!pev->speed)
pev->speed = 1000;
2007-09-04 22:00:00 +02:00
2007-09-16 22:00:00 +02:00
pev->classname = "t_push";
2007-09-04 22:00:00 +02:00
};