hex-world
    Preparing search index...

    Function generateResources

    • Scatters resources across a map according to each descriptor's placement rules — terrain, elevation, rivers, coastline, scatter density, and (when the climate fields are supplied) temperature and moisture windows.

      Deterministic for a given seed: each resource type draws from its own sub-stream, so adding or removing a type leaves the others' placements unchanged. Types are considered in descriptor order and one cell holds at most one resource, so earlier descriptors win contested cells — put the rare, highly-constrained resources first.

      Writes through the map's metadata channel, which means the result serializes with the map and needs no companion file. Call ResourceLayer.refresh() (or let its update() pick it up) to draw the result.

      Parameters

      Returns PlacedResource[]

      Every deposit placed, in the order they were written.

      const placed = generateResources(map, DEFAULT_RESOURCE_DESCRIPTORS, seed, {
      isWater: world.isWater,
      temperature, moisture, // from ClimateSimulator, optional
      });