The resource types currently in use.
The metadata channel key resources are stored under.
Whether the icons are currently drawn.
Swap the resource set at runtime (a loaded pack, edited icons). Cell data is untouched — deposits whose type is not in the new set simply stop drawing until a matching descriptor comes back.
Optionalicons: ResourceIconRegistryThe resource type id on a cell, or null if it has none.
The remaining quantity on a cell, or null when the cell has no resource
or stores no amount (an undepletable deposit).
Place a resource on a cell. Pass an amount for deposits that deplete;
omit it for permanent ones. Out-of-bounds cells are skipped.
Optionalamount: numberChange a cell's remaining quantity, removing the deposit when it runs out.
No-op on cells with no resource. Returns the new amount, or null if the
deposit was removed or the cell had nothing to deplete.
Remove the resource from a cell.
Every placed resource on the map, optionally filtered to one type.
Optionaltype: stringDeposit counts per resource type id.
Remove every resource from the map, optionally limited to one type.
Optionaltype: stringAttach or detach fog of war. Icons then hide on unexplored cells and dim on explored-but-unseen ones, exactly as the terrain and scatter beneath them do.
Match ChunkManager.setHideUnexplored so icons and ground agree.
Match ChunkManager.setDimExplored so icons and ground agree.
Show or hide the whole layer without discarding resource data.
Rebuild only if something changed since the last build. Cheap to call every frame.
Rebuild the icon meshes from the map's metadata channel.
Remove the icon meshes and free their GPU resources. Resource data on the map, and any icon textures you supplied, are left alone.
Per-cell resources — ore, fish, forest yield — stored in the map's metadata channel and drawn as instanced camera-facing icons, one draw call per resource type.
Like TerritoryLayer, the layer holds no cell state of its own: the data lives in
HexMap.cellData, so it serializes with the map throughserializeMap/serializeMapJSON/.hexpackwith no companion file. The types themselves are descriptor-driven, so a pack can carry resources this library has never heard of.Rebuilds walk the sparse metadata store rather than the map, so cost scales with the number of deposits, not the size of the world. Mutations mark the layer dirty; call update once per frame or refresh straight after a batch.
Example