2003-10-22 09:24:50 +00:00
|
|
|
#include "config.rh"
|
|
|
|
|
|
|
|
#include "paroxysm.rh"
|
|
|
|
|
|
|
|
// POX - v1.1 target identifier ala Quake3 - displays the name of players who cross your sight
|
|
|
|
// by Frank Condello (POX) - http://www.planetquake.com/paroxysm/ - pox@planetquake.com
|
|
|
|
/* POX - from original Quake ai.qc
|
|
|
|
=============
|
|
|
|
visible
|
2003-10-22 21:54:29 +00:00
|
|
|
returns 1 if the entity is visible to @self, even if not infront ()
|
2003-10-22 09:24:50 +00:00
|
|
|
=============
|
|
|
|
*/
|
|
|
|
float (entity targ) visible =
|
|
|
|
{
|
|
|
|
local vector spot1, spot2;
|
|
|
|
|
2003-10-22 21:54:29 +00:00
|
|
|
spot1 = @self.origin + @self.view_ofs;
|
2003-10-22 09:24:50 +00:00
|
|
|
spot2 = targ.origin + targ.view_ofs;
|
2003-10-22 21:54:29 +00:00
|
|
|
traceline (spot1, spot2, TRUE, @self); // see through other monsters
|
2003-10-22 09:24:50 +00:00
|
|
|
|
|
|
|
if (trace_inopen && trace_inwater)
|
|
|
|
return FALSE; // sight line crossed contents
|
|
|
|
if (trace_fraction == 1)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
};
|
|
|
|
// Short and sweet....
|
|
|
|
void() ID_CheckTarget =
|
|
|
|
{
|
|
|
|
local vector org;
|
|
|
|
local entity spot;
|
|
|
|
local string idfrags; //POX v1.12
|
|
|
|
|
|
|
|
//Lost target, or target died
|
2003-10-22 21:54:29 +00:00
|
|
|
if (@self.target_id_same < time || @self.last_target_id.health < 1 || !visible(@self.last_target_id))
|
|
|
|
@self.last_target_id = world;
|
2003-10-22 09:24:50 +00:00
|
|
|
|
2003-10-22 21:54:29 +00:00
|
|
|
traceline (@self.origin , (@self.origin+(v_forward * 800)) , FALSE , @self);
|
2003-10-22 09:24:50 +00:00
|
|
|
org = trace_endpos;
|
|
|
|
|
|
|
|
spot = findradius(org, 200);
|
|
|
|
while (spot)
|
|
|
|
{
|
|
|
|
if ((spot.classname == "player") && spot.takedamage)
|
|
|
|
{
|
|
|
|
//Same target as last time
|
2003-10-22 21:54:29 +00:00
|
|
|
if (@self.target_id_same > time && spot == @self.last_target_id)
|
2003-10-22 09:24:50 +00:00
|
|
|
{
|
2003-10-22 21:54:29 +00:00
|
|
|
@self.target_id_finished = time + 1.5;
|
|
|
|
@self.target_id_same = time + 3;
|
2003-10-22 09:24:50 +00:00
|
|
|
return;
|
|
|
|
}
|
2003-10-22 21:54:29 +00:00
|
|
|
else if (spot != @self && visible (spot) )//Found new Target
|
2003-10-22 09:24:50 +00:00
|
|
|
{
|
2003-10-22 21:54:29 +00:00
|
|
|
@self.last_target_id = spot;
|
|
|
|
@self.target_id_finished = time + 1.5;
|
|
|
|
@self.target_id_same = time + 3;
|
2003-10-22 09:24:50 +00:00
|
|
|
|
|
|
|
//POX v1.12 print the target's frags is observing
|
2003-10-22 21:54:29 +00:00
|
|
|
if (@self.classname == "LMSobserver")
|
2003-10-22 09:24:50 +00:00
|
|
|
{
|
2003-10-22 21:54:29 +00:00
|
|
|
idfrags = ftos (@self.last_target_id.frags);
|
|
|
|
centerprint4 (@self, @self.last_target_id.netname, "\n\n", idfrags, " frags remaining");
|
2003-10-22 09:24:50 +00:00
|
|
|
}
|
|
|
|
else
|
2003-10-22 21:54:29 +00:00
|
|
|
centerprint (@self, @self.last_target_id.netname);
|
2003-10-22 09:24:50 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
spot = spot.chain;
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|