Updated Resources: spread functions (markdown)

Azgaar 2021-05-09 02:49:05 +03:00
parent 43b20e936b
commit db0be3ce64

@ -4,10 +4,14 @@ Resource **spread models** are bits of JavaScript code applied for cell to check
Technically spread models are functional expressions evaluated for each cell to return a Boolean: `true` indicates that resource can be placed in cells and `false` indicates the opposite. The expressions are vanilla JS function, you can use any logical operators (`!` for not, `||` for OR, `&&` for and etc.) and other features. Technically spread models are functional expressions evaluated for each cell to return a Boolean: `true` indicates that resource can be placed in cells and `false` indicates the opposite. The expressions are vanilla JS function, you can use any logical operators (`!` for not, `||` for OR, `&&` for and etc.) and other features.
Build-in functions make models syntax easier to read: Build-in functions make models syntax easier to read:
* `nth(number)`: return true for each nth cell only, e.g. `nth(2)` will skip 50% of cells * `nth(number)`: true for each nth cell only, e.g. `nth(2)` will skip 50% of cells
* `biome(biomeId, biomeId, ...)`: check against biome id, see below to get id reference * `biome(biomeId, biomeId, ...)`: check against biome id, see below to get id reference
* `minHeight(number)`: true if number cell height >= number. Number is in range [0-100], where 0 is deep ocean and 20 is minimal land elevation * `minHeight(number)`: true if cell height >= number. Number is in range `[0-100]`, where `0` is deep ocean and `20` is minimal land elevation
* `maxHeight(number)`: true if number cell height <= number * `maxHeight(number)`: true if cell height <= number
* `minTemp(number)`: true if cell temperature (in Celsius) >= number
* `maxTemp(number)`: true if cell temperature <= number
* `shore(number)`: check against cell distance to shore, where `1` is land next to water (coastline cells), `2` - next land ring, `-1` - water cells next to land (shallow water), `-2, -3, ...` - next water rings, `0` - value not assigned, usually values are assigned only for first 2 land rings, so other land cells have zero value
Default biome ids: Default biome ids:
* 0: Marine * 0: Marine