Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!
Difference between revisions of "nextent"
From Quake Wiki
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
− | + | ''entity'' '''nextent'''(''entity'' start) | |
− | entity | + | == Usage == |
+ | Gets the next entity in the list of all entities. Passing '''world''' will get the very first entity. Can be used to iterate through all entities and update them if <code>find()</code> is not general enough. | ||
− | + | === Parameters === | |
− | + | *''start'' | |
− | + | :The entity to start from, exclusive. | |
− | entity | + | === Return === |
+ | The next entity in the list, or '''world''' if at the end. | ||
− | + | == Example == | |
− | + | // This goes through every entity and disables their collision | |
− | + | for (entity it = nextent(world); it; it = nextent(it)) | |
− | + | { | |
− | + | if (it.solid == SOLID_BBOX || it.solid == SOLID_SLIDEBOX) | |
− | + | { | |
− | + | it.solid = SOLID_NONE; | |
− | + | setorigin(it, it.origin); // Relink them | |
− | + | } | |
− | + | } | |
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 14:58, 1 August 2023
entity nextent(entity start)
Contents
Usage[edit]
Gets the next entity in the list of all entities. Passing world will get the very first entity. Can be used to iterate through all entities and update them if find()
is not general enough.
Parameters[edit]
- start
- The entity to start from, exclusive.
Return[edit]
The next entity in the list, or world if at the end.
Example[edit]
// This goes through every entity and disables their collision for (entity it = nextent(world); it; it = nextent(it)) { if (it.solid == SOLID_BBOX || it.solid == SOLID_SLIDEBOX) { it.solid = SOLID_NONE; setorigin(it, it.origin); // Relink them } }