Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!

findradius

From Quake Wiki

Revision as of 15:43, 31 July 2023 by Boondorl (talk | contribs)

entity findradius(vector pos, float range)

Usage

Grabs all entities within range of the passed position. This compares against the center of the entities and not their origins. Entities with the solid type SOLID_NONE are ignored.

Warning: This function uses the chain field to create a linked list of entities that it found. Nested calls should be avoided as only one linked list can be guaranteed active at a time and the base working list can become corrupted.

Parameters

  • pos
The position in the map to test from.
  • range
The max distance the center of an entity can be from the position.

Return

The head of the linked list of found entities. Their chain field will point to the next entity in the list.

Example

// Find all entities within 256 map units of the caller's origin
entity it = findradius(self.origin, 256);
while (it)
{
    PerformTask(it);
    it = it.chain;
}