]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add an optional <dist> parameter to the 'findat' command to find all entities within...
authorterencehill <piuntn@gmail.com>
Sat, 6 Mar 2021 18:57:35 +0000 (19:57 +0100)
committerterencehill <piuntn@gmail.com>
Sat, 6 Mar 2021 18:57:35 +0000 (19:57 +0100)
qcsrc/common/debug.qh

index f59038bb10fa5e461ec72bd23bf8b9f693b271b2..6498948749f9baa6f0203515dd199a7b32d3c271 100644 (file)
@@ -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 <position>");
+                       LOG_HELP("Usage:^3 " GetProgramCommandPrefix() " findat <position> [<dist>]");
                        LOG_HELP("  Where <position> is a vector \"x y z\"");
                        return;
                }