UNPKG

hytopia

Version:

The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.

221 lines (101 loc) 3.05 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [server](./server.md) &gt; [EntityManager](./server.entitymanager.md) ## EntityManager class Manages entities in a world. When to use: querying and filtering entities within a specific world. Do NOT use for: cross-world queries; access each world's manager separately. **Signature:** ```typescript export default class EntityManager ``` ## Remarks The EntityManager is created internally per `World` instance. The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `EntityManager` class. ## Example ```typescript // Get all entities in the world const entityManager = world.entityManager; const entities = entityManager.getAllEntities(); ``` \*\*Category:\*\* Entities ## Properties <table><thead><tr><th> Property </th><th> Modifiers </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td> [entityCount](./server.entitymanager.entitycount.md) </td><td> `readonly` </td><td> number </td><td> The number of spawned entities in the world. \*\*Category:\*\* Entities </td></tr> <tr><td> [world](./server.entitymanager.world.md) </td><td> `readonly` </td><td> [World](./server.world.md) </td><td> The world this manager is for. \*\*Category:\*\* Entities </td></tr> </tbody></table> ## Methods <table><thead><tr><th> Method </th><th> Modifiers </th><th> Description </th></tr></thead> <tbody><tr><td> [getAllEntities()](./server.entitymanager.getallentities.md) </td><td> </td><td> Gets all spawned entities in the world. </td></tr> <tr><td> [getAllPlayerEntities()](./server.entitymanager.getallplayerentities.md) </td><td> </td><td> Gets all spawned player entities in the world. </td></tr> <tr><td> [getEntitiesByTag(tag)](./server.entitymanager.getentitiesbytag.md) </td><td> </td><td> Gets all spawned entities in the world with a specific tag. </td></tr> <tr><td> [getEntitiesByTagSubstring(tagSubstring)](./server.entitymanager.getentitiesbytagsubstring.md) </td><td> </td><td> Gets all spawned entities in the world with a tag that includes a specific substring. </td></tr> <tr><td> [getEntity(id)](./server.entitymanager.getentity.md) </td><td> </td><td> Gets a spawned entity in the world by its ID. </td></tr> <tr><td> [getEntityChildren(entity)](./server.entitymanager.getentitychildren.md) </td><td> </td><td> Gets all child entities of an entity. </td></tr> <tr><td> [getPlayerEntitiesByPlayer(player)](./server.entitymanager.getplayerentitiesbyplayer.md) </td><td> </td><td> Gets all spawned player entities in the world assigned to the provided player. </td></tr> </tbody></table>