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/pr_server/trigger_generic.c

61 lines
1011 B
C

/*
+===================+
|TRIGGER_GENERIC|
+===================+
*/
void() trigger_generic_think =
{
pev->touched = FALSE;
if(pev->message)
centerprint(pev->triggerer , pev->message);
if(pev->target)
IEM_usetarget();
if(pev->spawnflags & TRIGGER_ONCE)
remove(pev);
};
void() trigger_generic_touch =
{
if(!(other.flags & FL_CLIENT))
return;
if(pev->touched == FALSE)
{
pev->triggerer = other;
pev->touched = TRUE;
pev->think = trigger_generic_think;
pev->nextthink = time + pev->delay;
}
};
void() trigger_generic_use =
{
if(pev->touched == TRUE)
return;
pev->touched = TRUE;
if(pev->message)
centerprint(pev->triggerer, pev->message);
pev->think = trigger_generic_think;
pev->nextthink = time + pev->delay;
};
void() trigger_generic =
{
trigger_setup();
pev->touch = trigger_generic_touch;
pev->use = trigger_generic_use;
pev->classname = "generic";
if(!pev->delay)
pev->delay = 2;
};