new command to list entities of a certain type

enumentities <entity type name>
  Returns a list of the numbers of all entities of that type. If no such
  entities exist or the entity type could not be recognised, the list is
  empty.

DOCREF enumentities
This commit is contained in:
ac-stef
2015-05-18 14:59:41 +02:00
parent ae82b6b22e
commit 47367c3e61
2 changed files with 11 additions and 0 deletions
+1
View File
@@ -95,6 +95,7 @@ looplist [
newent ents
clearents ents
closestenttype ents
enumentities ents
weapon weapons
burstshots weapons
team teamnames
+10
View File
@@ -418,6 +418,16 @@ void editentity(char **args, int numargs) // index x y z a1 a2 a3 a4 ...
}
COMMAND(editentity, "v");
void enumentities(char *type)
{
vector<char> res;
int t = getlistindex(type, entnames, false, -1);
loopv(ents) if(ents[i].type == t) cvecprintf(res, "%d ", i);
if(!res.length()) res.add('\0');
else res.last() = '\0';
result(res.getbuf());
}
COMMAND(enumentities, "s");
void scalecomp(uchar &c, int intens)
{