hytopia
Version:
The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.
64 lines (31 loc) • 1.19 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [server](./server.md) > [World](./server.world.md) > [loadMap](./server.world.loadmap.md)
## World.loadMap() method
Loads a map into the world, replacing any prior map contents.
Use for: initializing or fully resetting a world from serialized map data. Do NOT use for: incremental edits while players are actively interacting with the world.
**Signature:**
```typescript
loadMap(map: WorldMap): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
map
</td><td>
[WorldMap](./server.worldmap.md)
</td><td>
The map to load.
\*\*Side effects:\*\* Clears the chunk lattice, registers block types, and spawns entities.
\*\*Category:\*\* Core
</td></tr>
</tbody></table>
**Returns:**
void
## Remarks
- Clears existing blocks and colliders via `ChunkLattice.clear`<!-- -->. - Registers block types from the map into `World.blockTypeRegistry`<!-- -->. - Spawns map entities as `isEnvironmental: true` by default.