Entity_FindClosest: Don't return any entity of class "player" if their health is equal or below 0.
This commit is contained in:
parent
e947e35cd6
commit
80099317cb
1 changed files with 5 additions and 1 deletions
|
@ -62,6 +62,10 @@ entity Entity_FindClosest(entity target, string cname) {
|
|||
bestdist = 9999999;
|
||||
|
||||
for (entity e = world; (e = find(e, classname, cname));) {
|
||||
/* hack: don't ever return dead players. they're invisible. */
|
||||
if (cname == "player" && e.health <= 0)
|
||||
continue;
|
||||
|
||||
dist = vlen(target.origin - e.origin);
|
||||
|
||||
if (dist < bestdist) {
|
||||
|
@ -110,4 +114,4 @@ entity Entity_SelectRandom(string cname)
|
|||
|
||||
/* we should have returned something valid now */
|
||||
return spot;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue