From: terencehill Date: Sat, 6 Mar 2021 18:57:35 +0000 (+0100) Subject: Add an optional parameter to the 'findat' command to find all entities within... X-Git-Tag: xonotic-v0.8.5~524 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8d8d0f277e6b766da05c166049588fa3f4d11915;p=xonotic%2Fxonotic-data.pk3dir.git Add an optional parameter to the 'findat' command to find all entities within a certain distance from --- diff --git a/qcsrc/common/debug.qh b/qcsrc/common/debug.qh index f59038bb1..649894874 100644 --- a/qcsrc/common/debug.qh +++ b/qcsrc/common/debug.qh @@ -372,8 +372,12 @@ GENERIC_COMMAND(findat, "Search through entities for matching origin", false) { case CMD_REQUEST_COMMAND: { - vector match = stov(argv(1)); - FOREACH_ENTITY_ORDERED(it.origin == match, LOG_INFOF("%i (%s)", it, it.classname)); + vector org = stov(argv(1)); + float dist = stof(argv(2)); + if (dist > 0) + FOREACH_ENTITY_ORDERED(vdist(it.origin - org, <, dist), LOG_HELPF("%i (%s)", it, it.classname)); + else + FOREACH_ENTITY_ORDERED(it.origin == org, LOG_HELPF("%i (%s)", it, it.classname)); return; } @@ -381,7 +385,7 @@ GENERIC_COMMAND(findat, "Search through entities for matching origin", false) LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0)); case CMD_REQUEST_USAGE: { - LOG_HELP("Usage:^3 " GetProgramCommandPrefix() " findat "); + LOG_HELP("Usage:^3 " GetProgramCommandPrefix() " findat []"); LOG_HELP(" Where is a vector \"x y z\""); return; }