tWithEntities
MMO\core\classes · 1 symbol · generated 30 Sep 2026
tWithEntities
tWithEntities.php:18Gives a class its own local collection of iEntity instances, indexed by iEntity::getId when available (falling back to a plain numeric index for entities without an id, or when two different entity instances collide on the same id).
- Namespace
MMO\core\classes
Index
| entities | ||
| addEntity($entity) | Add an entity, indexed under its own iEntity::getId(). | |
| getEntities() | ||
| getEntitiesWithFlags($flags) | ||
| getEntity($id) | ||
| hasEntity($entity) | ||
| removeEntity($entity) | Remove entity by instance or uid |
Properties1
entities
Methods6
addEntity($entity)
tWithEntities.php:70Add an entity, indexed under its own iEntity::getId(). An entity with no id (getId() === '' once cast to string), or whose id already maps to a DIFFERENT entity instance, is appended under a plain numeric index instead -- re-adding the SAME instance under an id it already occupies simply overwrites it in place (no duplicate is created).
getEntities()
tWithEntities.php:25getEntitiesWithFlags($flags)
tWithEntities.php:34| $flags | int | a bitmask of iEntity::FLAG_* constants |
| returns | array | only the entities whose getFlags() has EVERY bit of $flags set |
getEntity($id)
tWithEntities.php:57hasEntity($entity)
tWithEntities.php:48| $entity | iEntity | string | int | either an entity instance (checked by identity) or an id (checked by key) |
| returns | bool |
removeEntity($entity)
tWithEntities.php:87Remove entity by instance or uid
| $entity | iEntity | string | int | the entity to remove or its id |
| returns | null | iEntity | null if it was not found in the collection |