From 8d8d0f277e6b766da05c166049588fa3f4d11915 Mon Sep 17 00:00:00 2001 From: terencehill Date: Sat, 6 Mar 2021 19:57:35 +0100 Subject: [PATCH] Add an optional parameter to the 'findat' command to find all entities within a certain distance from --- qcsrc/common/debug.qh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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; } -- 2.39.2