Compare commits
67 Commits
30015d26ea
...
tahrion_te
| Author | SHA1 | Date | |
|---|---|---|---|
| cfa75bd8f3 | |||
| b08f808167 | |||
| eb69779b0d | |||
| b0fc925750 | |||
| e12b0d64e5 | |||
| efcee33a02 | |||
| ce778673c7 | |||
| 5ec4bdd933 | |||
| 6332f23bf3 | |||
| 966af2328a | |||
| d08ee33400 | |||
| ba97a8f36f | |||
| ef6c0d9fe6 | |||
| c3bdb29852 | |||
| 6904090d19 | |||
| f3c5beb341 | |||
| fc90ae54c0 | |||
| 0952e96452 | |||
| 19d6637a29 | |||
| 6fb06b7109 | |||
| d392414cb7 | |||
| 8c7aaefe09 | |||
| 1d1591accc | |||
| ec614e6080 | |||
| c32d324bfb | |||
| 37d759e48a | |||
| 4b9afcf97d | |||
| c9ce8e5f60 | |||
| b7124419e7 | |||
| 8742b86a44 | |||
| 79111b3cbd | |||
| 087a8eee86 | |||
| cb853778fe | |||
| bdd35af484 | |||
| 882165c9e7 | |||
| e294c34801 | |||
| b6e07d04e3 | |||
| 3d03477467 | |||
| c75e06d274 | |||
| 6d3e9af2f8 | |||
| cabe562dc4 | |||
| 43bee3dae0 | |||
| 4f4b268d3c | |||
| c2b0c54236 | |||
| 907230e67d | |||
| 03ce7983eb | |||
| e81e2141a6 | |||
| 3d0a906a59 | |||
| 18dbce95c0 | |||
| b646a8e3e3 | |||
| 7ec4f906c8 | |||
| 39dbf29ff6 | |||
| a4b1ff2ee5 | |||
| 0c5f508152 | |||
| 50dd702e6e | |||
| 426fea3691 | |||
| 299dad5e11 | |||
| 0e8edc4f05 | |||
| f13a0b1273 | |||
| 57de1f4b42 | |||
| d0eba35e8d | |||
| 8640e55415 | |||
| 84295c56c4 | |||
| eaf350e9ce | |||
| dfd8021808 | |||
| d9f9bd7a6c | |||
|
|
0ff45e4da1 |
@@ -24,6 +24,7 @@
|
||||
"enables": [],
|
||||
"globals": [
|
||||
"core",
|
||||
"Smc",
|
||||
"table",
|
||||
"Events",
|
||||
"VoxelArea",
|
||||
|
||||
52
.gitea/issue_template/bug.yaml
Normal file
52
.gitea/issue_template/bug.yaml
Normal file
@@ -0,0 +1,52 @@
|
||||
name: Сообщение об ошибке
|
||||
about: Сообщить о недоработке игры, которую необходимо исправить.
|
||||
title: "[Bug]: "
|
||||
labels:
|
||||
- bug/need confirmed
|
||||
body:
|
||||
- type: textarea
|
||||
id: bug-desc
|
||||
attributes:
|
||||
label: Описание ошибки
|
||||
description: Опишите, что произошло, в чем по вашему мнению заключается ошибка и какое поведение игры вы ожидали.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: playback-order
|
||||
attributes:
|
||||
label: Как воспроизвести баг?
|
||||
description: Опишите порядок действий, как воспроизвести описываемую ошибку.
|
||||
validations:
|
||||
required: false
|
||||
- type: dropdown
|
||||
id: game-version
|
||||
attributes:
|
||||
label: Версия игры
|
||||
description: Сообщите на каких версиях клиента игры была замечена ошибка.
|
||||
multiple: true
|
||||
options:
|
||||
- "5.15"
|
||||
- "5.14"
|
||||
- "5.13"
|
||||
- "5.12"
|
||||
- "5.11"
|
||||
- "5.10"
|
||||
- "< 5.10"
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: bug-server
|
||||
attributes:
|
||||
label: Где была замечена ошибка?
|
||||
description: Сообщите, где была замечена ошибка.
|
||||
multiple: true
|
||||
options:
|
||||
- Игровой сервер
|
||||
- Локальный мир
|
||||
- Тестовый сервер
|
||||
validations:
|
||||
required: true
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Спасибо, что уделили время и заполнили этот отчет об ошибке!
|
||||
19
.gitea/issue_template/idea.yaml
Normal file
19
.gitea/issue_template/idea.yaml
Normal file
@@ -0,0 +1,19 @@
|
||||
name: Предложение
|
||||
about: Описать предложение для рассмотрения мейнтейнерами проекта.
|
||||
labels:
|
||||
- idea/need a maintainer
|
||||
body:
|
||||
- type: textarea
|
||||
id: task-desc
|
||||
attributes:
|
||||
label: Описание
|
||||
description: Подробно опишите в чем заключается ваша идея, а так же объясните необходимость её реализации.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: task-additions
|
||||
attributes:
|
||||
label: Дополнения
|
||||
description: Приложите дополнительные сведенья, файлы или изображения.
|
||||
validations:
|
||||
required: false
|
||||
19
.gitea/issue_template/task.yaml
Normal file
19
.gitea/issue_template/task.yaml
Normal file
@@ -0,0 +1,19 @@
|
||||
name: Задача
|
||||
about: Сформировать и описать задачу, которую должен будет выполнить разработчик. Этот шаблон предназначен для мейнтейнеров проекта.
|
||||
labels:
|
||||
- task/need developer
|
||||
body:
|
||||
- type: textarea
|
||||
id: task-desc
|
||||
attributes:
|
||||
label: Описание задачи
|
||||
description: Подробно опишите в чем заключается задача для разработчика.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: task-additions
|
||||
attributes:
|
||||
label: Дополнения
|
||||
description: Приложите дополнительные сведенья, файлы или изображения необходимые для выполнения задачи.
|
||||
validations:
|
||||
required: false
|
||||
35
.gitea/pull_request_template.yml
Normal file
35
.gitea/pull_request_template.yml
Normal file
@@ -0,0 +1,35 @@
|
||||
name: Сообщение об ошибке
|
||||
about: Сообщить о недоработке игры, которую необходимо исправить.
|
||||
labels:
|
||||
- pr/wait review
|
||||
- review/need a maintainer
|
||||
body:
|
||||
- type: textarea
|
||||
id: pr-desc
|
||||
attributes:
|
||||
label: Описание изменений
|
||||
description: Опишите, что было изменено в запросе на слияние и по какой причине.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: testing
|
||||
attributes:
|
||||
label: Тестирование
|
||||
description: Опишите, в наличии каких объектов или в работоспособности каких систем необходимо убедиться.
|
||||
validations:
|
||||
required: false
|
||||
- type: checkboxes
|
||||
id: terms
|
||||
attributes:
|
||||
label: Требования
|
||||
options:
|
||||
- label: Я запускал игру и убедился в том, что она работает.
|
||||
required: true
|
||||
- label: Я ознакомлен с соглашением по разработке и мои изменения следуют принятым стандартам.
|
||||
required: true
|
||||
- label: Я указал в описании запроса метки (label) с префиксом `Edit:` в соответствии с теми изменениями, которые сделал.
|
||||
required: true
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Спасибо, что прислали это запрос на слияние и помогли нам в разработке игры!
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
IGNORE
|
||||
/mods/IGNORE
|
||||
7
.gitmodules
vendored
7
.gitmodules
vendored
@@ -1,7 +1,6 @@
|
||||
[submodule "mods/API/Utf8"]
|
||||
path = mods/API/Utf8
|
||||
url = https://github.com/ApancoreStudio/utf8_api.git
|
||||
branch = main
|
||||
[submodule "util/ide-helper"]
|
||||
path = util/ide-helper
|
||||
url = https://github.com/Voxrame/luanti-ide-helper.git
|
||||
[submodule "mods/SYSTEM/Utf8"]
|
||||
path = mods/SYSTEM/Utf8
|
||||
url = https://git.apancore.ru/Apancore.Studio/utf8_api.git
|
||||
|
||||
218
docs/MapGen_docs.txt
Normal file
218
docs/MapGen_docs.txt
Normal file
@@ -0,0 +1,218 @@
|
||||
MapGen.PastCalcNoiseValue *MapGen.PastCalcNoiseValue*
|
||||
|
||||
Type: ~
|
||||
|
||||
|
||||
|
||||
MapGen *MapGen*
|
||||
|
||||
Fields: ~
|
||||
{layersByName} (table<string,MapGen.Layer>)
|
||||
{layersList} (MapGen.Layer[])
|
||||
{staticsByName} (table<string,MapGen.StaticLayer>)
|
||||
{staticsList} (MapGen.StaticLayer[])
|
||||
{layersNoisesInitialized} (boolean) Is the fractal noise of the layer initialized? This is necessary for a one-time noise initialization.
|
||||
{cavernsNoiseInitialized} (boolean) Is the fractal noise of the caverns initialized? This is necessary for a one-time noise initialization.
|
||||
{isRunning} (boolean) A static field that guarantees that only one instance of the `MapGen` class will work.
|
||||
{nodeIDs} (table<string,number>)
|
||||
|
||||
|
||||
MapGenDef *MapGenDef*
|
||||
Definition table for the `MapGen`.
|
||||
|
||||
**Only for EmmyLua.**
|
||||
|
||||
Fields: ~
|
||||
{nodes} (table<string,string>)
|
||||
|
||||
|
||||
MapGen:new({def}) *MapGen:new*
|
||||
|
||||
Parameters: ~
|
||||
{def} (MapGenDef)
|
||||
|
||||
Returns: ~
|
||||
(MapGen)
|
||||
|
||||
|
||||
MapGen:getLayerByHeight({yPos}) *MapGen:getLayerByHeight*
|
||||
Determines which layer a node belongs to based on its height coordinate.
|
||||
|
||||
Parameters: ~
|
||||
{yPos} (number) @return MapGen.Layer?
|
||||
|
||||
|
||||
MapGen:getStaticByHeight({yPos}) *MapGen:getStaticByHeight*
|
||||
Determines which statics layer a node belongs to based on its height coordinate.
|
||||
|
||||
Parameters: ~
|
||||
{yPos} (number) @return MapGen.StaticLayer?
|
||||
|
||||
|
||||
MapGen:registerLayer({name}, {def}) *MapGen:registerLayer*
|
||||
Mark the world area between two heights as a `MapGen.Layer`.
|
||||
|
||||
Note: layers must not overlap.
|
||||
|
||||
Parameters: ~
|
||||
{name} (string) The name that will be assigned to the layer. The name must be unique for each layer.
|
||||
{def} (MapGen.LayerDef) Layer description table, see details `MapGen.LayerDef`.
|
||||
|
||||
|
||||
*MapGen:registerLayerNoiseColor*
|
||||
MapGen:registerLayerNoiseColor({layerName}, {category}, {color}, {noiseParams})
|
||||
Register the color and the noise parameters that correspond to it.
|
||||
|
||||
Parameters: ~
|
||||
{layerName} (string) The name of the layer for which the color will be registered.
|
||||
{category} (MapGen.Layer.Category) Category indicating what will be generated by noise.
|
||||
{color} (ColorString) Noise color. Must be unique.
|
||||
{noiseParams} (NoiseParams) Fractal noise parameters.
|
||||
|
||||
|
||||
*MapGen:registerStaticLayer*
|
||||
MapGen:registerStaticLayer({name}, {def})
|
||||
Mark the world area between two heights as a `MapGen.StaticLayer`.
|
||||
|
||||
Note: layers must not overlap.
|
||||
|
||||
Parameters: ~
|
||||
{name} (string) The name that will be assigned to the static layer. The name must be unique for each layer.
|
||||
{def} (MapGen.StaticLayerDef) Static layer description table, see details `MapGen.StaticLayerDef`.
|
||||
|
||||
|
||||
*MapGen:registerPeak*
|
||||
MapGen:registerPeak({layerName}, {category}, {def})
|
||||
Mark a world point as `MapGen.Peak` and assign it a specific color that will affect the generation.
|
||||
|
||||
Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
||||
|
||||
Parameters: ~
|
||||
{layerName} (string) The name of the layer in which the new peak will be included.
|
||||
{category} (MapGen.Layer.Category) Category indicating what will be generated by peak.
|
||||
{def} (MapGen.PeakDef) Peak description table, see details `MapGen.PeakDef`.
|
||||
|
||||
|
||||
*MapGen:register2DPeak*
|
||||
MapGen:register2DPeak({layerName}, {category}, {def})
|
||||
Mark a world point as `MapGen.Peak` and assign it a specific color that will affect the generation.
|
||||
The Y coordinate will be forced to zero, and the `is2d` group will be added to the groups field.
|
||||
|
||||
Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
||||
|
||||
Parameters: ~
|
||||
{layerName} (string) The name of the layer in which the new peak will be included.
|
||||
{category} (MapGen.Layer.Category) Category indicating what will be generated by peak.
|
||||
{def} (MapGen.PeakDef) Peak description table, see details `MapGen.PeakDef`.
|
||||
|
||||
|
||||
*MapGen:register2DPeaks*
|
||||
MapGen:register2DPeaks({layerName}, {category}, {defs})
|
||||
Mark the world points as `MapGen.Peak` and assign them all a specific noise that will affect generation.
|
||||
The Y coordinate will be forced to zero, and the `is2d` group will be added to the groups field.
|
||||
|
||||
Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
||||
|
||||
Parameters: ~
|
||||
{layerName} (string) The name of the layer in which the new peaks will be included.
|
||||
{category} (MapGen.Layer.Category) Category indicating what will be generated by peaks.
|
||||
{defs} (MapGen.PeakDef[]) Peaks description table, see details `MapGen.PeakDef`.
|
||||
|
||||
|
||||
*MapGen:register2DPeaksFromFile*
|
||||
MapGen:register2DPeaksFromFile({layerName}, {map}, {scale}, {zeroPos}, {category}, {groups?})
|
||||
Extract the `MapGen.Peak` from the image and assign them all a specific color that will affect the generation.
|
||||
|
||||
Parameters: ~
|
||||
{layerName} (string) The name of the layer in which the new peaks will be included.
|
||||
{map} (string) The name of the image from which the peaks will be extracted. It should be located in the `<mod_name>/textures/maps` folder and have the following format `<image_name>.ff`
|
||||
{scale} (number) Multiplier of how many blocks (nodes) will be between image pixels. It is not recommended to set the value below 50 for performance reasons.
|
||||
{zeroPos} (Position2d) The position in pixels where the zero world coordinate will be in the image.
|
||||
{category} (MapGen.Layer.Category) Category indicating what will be generated by peaks.
|
||||
{groups?} (table<string,number>) Groups that will be added to all peaks.
|
||||
|
||||
|
||||
*MapGen:registerBiome*
|
||||
MapGen:registerBiome({layerName}, {biomeName}, {def})
|
||||
Mark a point on the biomes diagram and constrain the world area by height to mark it as `MapGen.Biome`.
|
||||
|
||||
Parameters: ~
|
||||
{layerName} (string) The name of the layer in which the new biome will be included.
|
||||
{biomeName} (string) The name to be assigned to the biome. The name must be unique for each biome.
|
||||
{def} (MapGen.BiomeDef) Biome description table, see details `MapGen.BiomeDef`
|
||||
|
||||
|
||||
*MapGen:registerCavern*
|
||||
MapGen:registerCavern({layerName}, {cavernName}, {def})
|
||||
Mark the world area between two heights as a `MapGen.Cavern` and assign the noise that the cave will be generated from.
|
||||
|
||||
Parameters: ~
|
||||
{layerName} (string) The name of the layer in which the new cavern will be included.
|
||||
{cavernName} (string) The name to be assigned to the cavern. The name must be unique for each cavern.
|
||||
{def} (MapGen.CavernDef) Cavern description table, see details `MapGen.CavernDef`
|
||||
|
||||
|
||||
MapGen:initLayersTriangultaion() *MapGen:initLayersTriangultaion*
|
||||
Divide all layers into triangles whose vertices are the `Mapgen.Peak` belonging to these layers.
|
||||
|
||||
|
||||
MapGen:initLayersNoises() *MapGen:initLayersNoises*
|
||||
Initialize all layer noises. This should be called after the map object is loaded.
|
||||
|
||||
|
||||
MapGen:initBiomesDiagram() *MapGen:initBiomesDiagram*
|
||||
Initialization of the biome diagram using the Voronoi method.
|
||||
|
||||
|
||||
MapGen:initCavernsNoise() *MapGen:initCavernsNoise*
|
||||
Initialize caverns's noises. This should be called after the map object is loaded.
|
||||
|
||||
|
||||
*MapGen:getNoises2dValue*
|
||||
MapGen:getNoises2dValue({category}, {layer}, {x}, {y}, {z})
|
||||
Calculates a smoothed 2D noise value based on a preliminary space partitioning.
|
||||
|
||||
Returns `nil` if the point is not included in any triangle.
|
||||
|
||||
Parameters: ~
|
||||
{category} (MapGen.Layer.Category)
|
||||
{layer} (MapGen.Layer)
|
||||
{x} (integer)
|
||||
{y} (integer)
|
||||
{z} (integer) @return number?
|
||||
|
||||
|
||||
*MapGen:getNoises3dValues*
|
||||
MapGen:getNoises3dValues({layer}, {x}, {y}, {z})
|
||||
Calculates a smoothed 3D noise value based on a preliminary space partitioning.
|
||||
|
||||
Returns `nil` if the point is not included in any tetrahedron.
|
||||
|
||||
|
||||
Parameters: ~
|
||||
{layer} (MapGen.Layer)
|
||||
{x} (number)
|
||||
{y} (number)
|
||||
{z} (number) @return number?
|
||||
|
||||
|
||||
*MapGen:onMapGenerated*
|
||||
MapGen:onMapGenerated({voxelManip}, {minPos}, {maxPos}, {blockseed})
|
||||
Chunk generation handler.
|
||||
|
||||
Parameters: ~
|
||||
{voxelManip} (VoxelManip)
|
||||
{minPos} (Position)
|
||||
{maxPos} (Position)
|
||||
{blockseed} (number)
|
||||
|
||||
|
||||
MapGen:run() *MapGen:run*
|
||||
Run world generation through this mapgen object
|
||||
|
||||
Note: only one instance of a `MapGen` class can be running.
|
||||
|
||||
**FOR MAPGEN ENVIRONMENT ONLY**
|
||||
|
||||
|
||||
vim:tw=78:ts=8:noet:ft=help:norl:
|
||||
54
docs/docs/index.md
Normal file
54
docs/docs/index.md
Normal file
@@ -0,0 +1,54 @@
|
||||
# index
|
||||
|
||||
|
||||
## Types
|
||||
|
||||
- [alias Category](types/MapGen.Layer.Category.md)
|
||||
- [alias CircumCircleEnum](types/MapGen.Triangle.CircumCircleEnum.md)
|
||||
- [alias ColoredDotsTable](types/ColoredDotsTable.md)
|
||||
- [alias Neighbours](types/MapGen.Triangle.Neighbours.md)
|
||||
- [alias PastCalcNoiseValue](types/MapGen.PastCalcNoiseValue.md)
|
||||
- [alias generateFunc](types/generateFunc.md)
|
||||
- [class Biome](types/MapGen.Biome.md)
|
||||
- [class BiomeDef](types/MapGen.BiomeDef.md)
|
||||
- [class Cavern](types/MapGen.Cavern.md)
|
||||
- [class CavernDef](types/MapGen.CavernDef.md)
|
||||
- [class Decoration](types/MapGen.Decoration.md)
|
||||
- [class Edge](types/MapGen.Triangulation.Edge.md)
|
||||
- [class FakePeak](types/MapGen.Triangulation.FakePeak.md)
|
||||
- [class GroundNodes](types/MapGen.Biome.GroundNodes.md)
|
||||
- [class GroundNodesIDs](types/MapGen.Biome.GroundNodesIDs.md)
|
||||
- [class Layer](types/MapGen.Layer.md)
|
||||
- [class LayerDef](types/MapGen.LayerDef.md)
|
||||
- [class MapGen](types/MapGen.md)
|
||||
- [class MapGenDef](types/MapGenDef.md)
|
||||
- [class Peak](types/MapGen.Peak.md)
|
||||
- [class PeakDef](types/MapGen.PeakDef.md)
|
||||
- [class StaticLayer](types/MapGen.StaticLayer.md)
|
||||
- [class StaticLayerDef](types/MapGen.StaticLayerDef.md)
|
||||
- [class Tetrahedron](types/MapGen.Tetrahedron.md)
|
||||
- [class Triangle](types/MapGen.Triangle.md)
|
||||
- [class Triangulation](types/MapGen.Triangulation.md)
|
||||
|
||||
|
||||
|
||||
## Modules
|
||||
- [MapGen](modules/MapGen.md)
|
||||
- [MapGen.Biome](modules/MapGen.Biome.md)
|
||||
- [MapGen.Biome.GroundNodes](modules/MapGen.Biome.GroundNodes.md)
|
||||
- [MapGen.Biome.GroundNodesIds](modules/MapGen.Biome.GroundNodesIds.md)
|
||||
- [MapGen.Cavern](modules/MapGen.Cavern.md)
|
||||
- [MapGen.Decoration](modules/MapGen.Decoration.md)
|
||||
- [MapGen.Layer](modules/MapGen.Layer.md)
|
||||
- [MapGen.Peak](modules/MapGen.Peak.md)
|
||||
- [MapGen.StaticLayer](modules/MapGen.StaticLayer.md)
|
||||
- [MapGen.Tetrahedron](modules/MapGen.Tetrahedron.md)
|
||||
- [MapGen.Triangle](modules/MapGen.Triangle.md)
|
||||
- [MapGen.Triangulation](modules/MapGen.Triangulation.md)
|
||||
- [MapGen.Triangulation.Edge](modules/MapGen.Triangulation.Edge.md)
|
||||
- [MapGen.Triangulation.FakePeak](modules/MapGen.Triangulation.FakePeak.md)
|
||||
- [MapGen.ff2luat](modules/MapGen.ff2luat.md)
|
||||
|
||||
|
||||
|
||||
|
||||
85
docs/docs/modules/MapGen.Biome.GroundNodes.md
Normal file
85
docs/docs/modules/MapGen.Biome.GroundNodes.md
Normal file
@@ -0,0 +1,85 @@
|
||||
# global MapGen.Biome.GroundNodes
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### GroundNodes.turf
|
||||
---
|
||||
```lua
|
||||
GroundNodes.turf : string
|
||||
```
|
||||
|
||||
|
||||
|
||||
The soil covering the surface of the biome
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### GroundNodes.soil
|
||||
---
|
||||
```lua
|
||||
GroundNodes.soil : string
|
||||
```
|
||||
|
||||
|
||||
|
||||
The soil beneath the turf. The height of this layer depends on `Biome.soilHeight`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### GroundNodes.rock
|
||||
---
|
||||
```lua
|
||||
GroundNodes.rock : string
|
||||
```
|
||||
|
||||
|
||||
|
||||
The rock found beneath the soil of a biome.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### GroundNodes.bottom
|
||||
---
|
||||
```lua
|
||||
GroundNodes.bottom : string
|
||||
```
|
||||
|
||||
|
||||
|
||||
Covering the bottom of reservoirs.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
85
docs/docs/modules/MapGen.Biome.GroundNodesIds.md
Normal file
85
docs/docs/modules/MapGen.Biome.GroundNodesIds.md
Normal file
@@ -0,0 +1,85 @@
|
||||
# global MapGen.Biome.GroundNodesIds
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### GroundNodesIDs.turf
|
||||
---
|
||||
```lua
|
||||
GroundNodesIDs.turf : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
The soil covering the surface of the biome
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### GroundNodesIDs.soil
|
||||
---
|
||||
```lua
|
||||
GroundNodesIDs.soil : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
The soil beneath the turf. The height of this layer depends on `Biome.soilHeight`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### GroundNodesIDs.rock
|
||||
---
|
||||
```lua
|
||||
GroundNodesIDs.rock : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
The rock found beneath the soil of a biome.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### GroundNodesIDs.bottom
|
||||
---
|
||||
```lua
|
||||
GroundNodesIDs.bottom : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
Covering the bottom of reservoirs.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
307
docs/docs/modules/MapGen.Biome.md
Normal file
307
docs/docs/modules/MapGen.Biome.md
Normal file
@@ -0,0 +1,307 @@
|
||||
# global MapGen.Biome
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## methods
|
||||
---
|
||||
|
||||
### Biome.new
|
||||
---
|
||||
```lua
|
||||
function Biome.new(
|
||||
name: string,
|
||||
def: MapGen.BiomeDef {
|
||||
tempPoint = number,
|
||||
humidityPoint = number,
|
||||
minY = number,
|
||||
maxY = number,
|
||||
groundNodes = MapGen.Biome.GroundNodes,
|
||||
soilHeight = number,
|
||||
generateAir = generateFunc?,
|
||||
generateCavernAir = generateFunc?,
|
||||
generateWater = generateFunc?,
|
||||
generateRock = generateFunc?,
|
||||
generateTurf = generateFunc?,
|
||||
generateSoil = generateFunc?,
|
||||
generateBottom = generateFunc?,
|
||||
}
|
||||
) -> MapGen.Biome {
|
||||
name = string,
|
||||
tempPoint = number,
|
||||
humidityPoint = number,
|
||||
minY = number,
|
||||
maxY = number,
|
||||
groundNodes = MapGen.Biome.GroundNodes,
|
||||
groundNodesIDs = MapGen.Biome.GroundNodesIDs,
|
||||
soilHeight = number,
|
||||
generateAir = generateFunc,
|
||||
generateCavernAir = generateFunc,
|
||||
generateWater = generateFunc,
|
||||
generateRock = generateFunc,
|
||||
generateTurf = generateFunc,
|
||||
generateSoil = generateFunc,
|
||||
generateBottom = generateFunc,
|
||||
new = function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### Biome.name
|
||||
---
|
||||
```lua
|
||||
Biome.name : string
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.tempPoint
|
||||
---
|
||||
```lua
|
||||
Biome.tempPoint : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.humidityPoint
|
||||
---
|
||||
```lua
|
||||
Biome.humidityPoint : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.minY
|
||||
---
|
||||
```lua
|
||||
Biome.minY : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.maxY
|
||||
---
|
||||
```lua
|
||||
Biome.maxY : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.groundNodes
|
||||
---
|
||||
```lua
|
||||
Biome.groundNodes : MapGen.Biome.GroundNodes {
|
||||
turf: string,
|
||||
soil: string,
|
||||
rock: string,
|
||||
bottom: string,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.groundNodesIDs
|
||||
---
|
||||
```lua
|
||||
Biome.groundNodesIDs : MapGen.Biome.GroundNodesIDs {
|
||||
turf: number,
|
||||
soil: number,
|
||||
rock: number,
|
||||
bottom: number,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.soilHeight
|
||||
---
|
||||
```lua
|
||||
Biome.soilHeight : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.generateAir
|
||||
---
|
||||
```lua
|
||||
Biome.generateAir : generateFunc
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.generateCavernAir
|
||||
---
|
||||
```lua
|
||||
Biome.generateCavernAir : generateFunc
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.generateWater
|
||||
---
|
||||
```lua
|
||||
Biome.generateWater : generateFunc
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.generateRock
|
||||
---
|
||||
```lua
|
||||
Biome.generateRock : generateFunc
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.generateTurf
|
||||
---
|
||||
```lua
|
||||
Biome.generateTurf : generateFunc
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.generateSoil
|
||||
---
|
||||
```lua
|
||||
Biome.generateSoil : generateFunc
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.generateBottom
|
||||
---
|
||||
```lua
|
||||
Biome.generateBottom : generateFunc
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
203
docs/docs/modules/MapGen.Cavern.md
Normal file
203
docs/docs/modules/MapGen.Cavern.md
Normal file
@@ -0,0 +1,203 @@
|
||||
# global MapGen.Cavern
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## methods
|
||||
---
|
||||
|
||||
### Cavern.getNoise
|
||||
---
|
||||
```lua
|
||||
function Cavern.getNoise()-> ValueNoise
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Cavern.initNoise
|
||||
---
|
||||
```lua
|
||||
function Cavern.initNoise()-> nil
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Cavern.getGroups
|
||||
---
|
||||
```lua
|
||||
function Cavern.getGroups()
|
||||
-> table<string,number>
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Cavern.new
|
||||
---
|
||||
```lua
|
||||
function Cavern.new(
|
||||
name: string,
|
||||
def: MapGen.CavernDef {
|
||||
minY = number,
|
||||
maxY = number,
|
||||
noiseParams = NoiseParams,
|
||||
smoothDistance = number,
|
||||
threshold = number?,
|
||||
groups = table<string,number>?,
|
||||
}
|
||||
) -> MapGen.Cavern {
|
||||
name = string,
|
||||
minY = number,
|
||||
maxY = number,
|
||||
smoothDistance = number,
|
||||
threshold = number,
|
||||
getNoise = function,
|
||||
initNoise = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
isCavern = function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Cavern.isCavern
|
||||
---
|
||||
```lua
|
||||
function Cavern.isCavern(
|
||||
x: integer,
|
||||
y: integer,
|
||||
z: integer
|
||||
) -> boolean
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns `true` if there is a cavern at the specified coordinates.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### Cavern.name
|
||||
---
|
||||
```lua
|
||||
Cavern.name : string
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Cavern.minY
|
||||
---
|
||||
```lua
|
||||
Cavern.minY : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Cavern.maxY
|
||||
---
|
||||
```lua
|
||||
Cavern.maxY : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Cavern.smoothDistance
|
||||
---
|
||||
```lua
|
||||
Cavern.smoothDistance : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Cavern.threshold
|
||||
---
|
||||
```lua
|
||||
Cavern.threshold : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
36
docs/docs/modules/MapGen.Decoration.md
Normal file
36
docs/docs/modules/MapGen.Decoration.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# global MapGen.Decoration
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## methods
|
||||
---
|
||||
|
||||
### Decoration.new
|
||||
---
|
||||
```lua
|
||||
function Decoration.new() -> MapGen.Decoration {
|
||||
new = function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
673
docs/docs/modules/MapGen.Layer.md
Normal file
673
docs/docs/modules/MapGen.Layer.md
Normal file
@@ -0,0 +1,673 @@
|
||||
# global MapGen.Layer
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## methods
|
||||
---
|
||||
|
||||
### Layer.calcTemp
|
||||
---
|
||||
```lua
|
||||
function Layer.calcTemp(
|
||||
self: MapGen.Layer {
|
||||
name = string,
|
||||
minY = integer,
|
||||
maxY = integer,
|
||||
minTemp = integer,
|
||||
maxTemp = integer,
|
||||
minHumidity = integer,
|
||||
maxHumidity = integer,
|
||||
waterLevel = integer,
|
||||
peaksList = { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] },
|
||||
noisesByColor = { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> },
|
||||
noisesParamsByColor = { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> },
|
||||
biomesByName = table<string,MapGen.Biome>,
|
||||
biomesList = MapGen.Biome[],
|
||||
biomesDiagram = table,
|
||||
biomesGorizontalScattering = integer,
|
||||
biomesVerticalScattering = integer,
|
||||
cavernsByName = table<string,MapGen.Cavern>,
|
||||
cavernsList = MapGen.Cavern[],
|
||||
trianglesList = { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] },
|
||||
tetrahedronsList = MapGen.Tetrahedron[],
|
||||
calcTemp = function,
|
||||
calcHumidity = function,
|
||||
new = function,
|
||||
addPeak = function,
|
||||
addNoiseParamsColor = function,
|
||||
getNoiseByColor = function,
|
||||
addBiome = function,
|
||||
addCavern = function,
|
||||
initNoises = function,
|
||||
initBiomesDiagram = function,
|
||||
},
|
||||
value: number,
|
||||
height: number
|
||||
)-> number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.calcHumidity
|
||||
---
|
||||
```lua
|
||||
function Layer.calcHumidity(
|
||||
self: MapGen.Layer {
|
||||
name = string,
|
||||
minY = integer,
|
||||
maxY = integer,
|
||||
minTemp = integer,
|
||||
maxTemp = integer,
|
||||
minHumidity = integer,
|
||||
maxHumidity = integer,
|
||||
waterLevel = integer,
|
||||
peaksList = { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] },
|
||||
noisesByColor = { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> },
|
||||
noisesParamsByColor = { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> },
|
||||
biomesByName = table<string,MapGen.Biome>,
|
||||
biomesList = MapGen.Biome[],
|
||||
biomesDiagram = table,
|
||||
biomesGorizontalScattering = integer,
|
||||
biomesVerticalScattering = integer,
|
||||
cavernsByName = table<string,MapGen.Cavern>,
|
||||
cavernsList = MapGen.Cavern[],
|
||||
trianglesList = { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] },
|
||||
tetrahedronsList = MapGen.Tetrahedron[],
|
||||
calcTemp = function,
|
||||
calcHumidity = function,
|
||||
new = function,
|
||||
addPeak = function,
|
||||
addNoiseParamsColor = function,
|
||||
getNoiseByColor = function,
|
||||
addBiome = function,
|
||||
addCavern = function,
|
||||
initNoises = function,
|
||||
initBiomesDiagram = function,
|
||||
},
|
||||
value: number,
|
||||
height: number
|
||||
)-> number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.new
|
||||
---
|
||||
```lua
|
||||
function Layer.new(
|
||||
name: string,
|
||||
def: MapGen.LayerDef {
|
||||
minY = number,
|
||||
maxY = number,
|
||||
minTemp = number,
|
||||
maxTemp = number,
|
||||
minHumidity = number,
|
||||
maxHumidity = number,
|
||||
waterLevel = number?,
|
||||
calcTemp = (fun(self: MapGen.Layer, value: number, height: number) -> number)?,
|
||||
calcHumidity = (fun(self: MapGen.Layer, value: number, height: number) -> number)?,
|
||||
biomesGorizontalScattering = number?,
|
||||
biomesVerticalScattering = number?,
|
||||
}
|
||||
) -> MapGen.Layer {
|
||||
name = string,
|
||||
minY = integer,
|
||||
maxY = integer,
|
||||
minTemp = integer,
|
||||
maxTemp = integer,
|
||||
minHumidity = integer,
|
||||
maxHumidity = integer,
|
||||
waterLevel = integer,
|
||||
peaksList = { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] },
|
||||
noisesByColor = { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> },
|
||||
noisesParamsByColor = { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> },
|
||||
biomesByName = table<string,MapGen.Biome>,
|
||||
biomesList = MapGen.Biome[],
|
||||
biomesDiagram = table,
|
||||
biomesGorizontalScattering = integer,
|
||||
biomesVerticalScattering = integer,
|
||||
cavernsByName = table<string,MapGen.Cavern>,
|
||||
cavernsList = MapGen.Cavern[],
|
||||
trianglesList = { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] },
|
||||
tetrahedronsList = MapGen.Tetrahedron[],
|
||||
calcTemp = function,
|
||||
calcHumidity = function,
|
||||
new = function,
|
||||
addPeak = function,
|
||||
addNoiseParamsColor = function,
|
||||
getNoiseByColor = function,
|
||||
addBiome = function,
|
||||
addCavern = function,
|
||||
initNoises = function,
|
||||
initBiomesDiagram = function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.addPeak
|
||||
---
|
||||
```lua
|
||||
function Layer.addPeak(
|
||||
category: MapGen.Layer.Category,
|
||||
peak: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
}
|
||||
) -> nil
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Adds a peak to the `Layer.peaksList`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.addNoiseParamsColor
|
||||
---
|
||||
```lua
|
||||
function Layer.addNoiseParamsColor(
|
||||
category: MapGen.Layer.Category,
|
||||
color: ColorString,
|
||||
noiseParams: NoiseParams
|
||||
) -> nil
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Adds a NoiseParams color to the `Layer.noisesParamsByColor`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.getNoiseByColor
|
||||
---
|
||||
```lua
|
||||
function Layer.getNoiseByColor(
|
||||
category: MapGen.Layer.Category,
|
||||
color: ColorString
|
||||
) -> ValueNoise
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns noise corresponding to a color.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.addBiome
|
||||
---
|
||||
```lua
|
||||
function Layer.addBiome(
|
||||
biomeName: string,
|
||||
biome: MapGen.Biome {
|
||||
name = string,
|
||||
tempPoint = number,
|
||||
humidityPoint = number,
|
||||
minY = number,
|
||||
maxY = number,
|
||||
groundNodes = MapGen.Biome.GroundNodes,
|
||||
groundNodesIDs = MapGen.Biome.GroundNodesIDs,
|
||||
soilHeight = number,
|
||||
generateAir = generateFunc,
|
||||
generateCavernAir = generateFunc,
|
||||
generateWater = generateFunc,
|
||||
generateRock = generateFunc,
|
||||
generateTurf = generateFunc,
|
||||
generateSoil = generateFunc,
|
||||
generateBottom = generateFunc,
|
||||
new = function,
|
||||
}
|
||||
) -> nil
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Adds a biome to the `Layer.biomesByName` & `Layer.biomesList`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.addCavern
|
||||
---
|
||||
```lua
|
||||
function Layer.addCavern(
|
||||
cavernName: string,
|
||||
cavern: MapGen.Cavern {
|
||||
name = string,
|
||||
minY = number,
|
||||
maxY = number,
|
||||
smoothDistance = number,
|
||||
threshold = number,
|
||||
getNoise = function,
|
||||
initNoise = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
isCavern = function,
|
||||
}
|
||||
) -> nil
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Adds a cavern to the `Layer.cavernsByName` & `Layer.cavernsList`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.initNoises
|
||||
---
|
||||
```lua
|
||||
function Layer.initNoises() -> nil
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Initializes noise for generation.
|
||||
|
||||
Should only be called after the mapgen object has been loaded.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.initBiomesDiagram
|
||||
---
|
||||
```lua
|
||||
function Layer.initBiomesDiagram() -> nil
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Initialization of the biome diagram using the Voronoi method.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### Layer.name
|
||||
---
|
||||
```lua
|
||||
Layer.name : string
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.minY
|
||||
---
|
||||
```lua
|
||||
Layer.minY : integer
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.maxY
|
||||
---
|
||||
```lua
|
||||
Layer.maxY : integer
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.minTemp
|
||||
---
|
||||
```lua
|
||||
Layer.minTemp : integer
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.maxTemp
|
||||
---
|
||||
```lua
|
||||
Layer.maxTemp : integer
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.minHumidity
|
||||
---
|
||||
```lua
|
||||
Layer.minHumidity : integer
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.maxHumidity
|
||||
---
|
||||
```lua
|
||||
Layer.maxHumidity : integer
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.waterLevel
|
||||
---
|
||||
```lua
|
||||
Layer.waterLevel : integer
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.peaksList
|
||||
---
|
||||
```lua
|
||||
Layer.peaksList : { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] }
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.noisesByColor
|
||||
---
|
||||
```lua
|
||||
Layer.noisesByColor : { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> }
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.noisesParamsByColor
|
||||
---
|
||||
```lua
|
||||
Layer.noisesParamsByColor : { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> }
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.biomesByName
|
||||
---
|
||||
```lua
|
||||
Layer.biomesByName : table<string,MapGen.Biome>
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.biomesList
|
||||
---
|
||||
```lua
|
||||
Layer.biomesList : MapGen.Biome[]
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.biomesDiagram
|
||||
---
|
||||
```lua
|
||||
Layer.biomesDiagram : table
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.biomesGorizontalScattering
|
||||
---
|
||||
```lua
|
||||
Layer.biomesGorizontalScattering : integer
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.biomesVerticalScattering
|
||||
---
|
||||
```lua
|
||||
Layer.biomesVerticalScattering : integer
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.cavernsByName
|
||||
---
|
||||
```lua
|
||||
Layer.cavernsByName : table<string,MapGen.Cavern>
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.cavernsList
|
||||
---
|
||||
```lua
|
||||
Layer.cavernsList : MapGen.Cavern[]
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.trianglesList
|
||||
---
|
||||
```lua
|
||||
Layer.trianglesList : { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] }
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.tetrahedronsList
|
||||
---
|
||||
```lua
|
||||
Layer.tetrahedronsList : MapGen.Tetrahedron[]
|
||||
```
|
||||
|
||||
|
||||
|
||||
**Not supported**
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
157
docs/docs/modules/MapGen.Peak.md
Normal file
157
docs/docs/modules/MapGen.Peak.md
Normal file
@@ -0,0 +1,157 @@
|
||||
# global MapGen.Peak
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## methods
|
||||
---
|
||||
|
||||
### Peak.getPeakPos
|
||||
---
|
||||
```lua
|
||||
function Peak.getPeakPos(self)-> vector
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Peak.getColor
|
||||
---
|
||||
```lua
|
||||
function Peak.getColor(self)-> ColorString
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Peak.getGroups
|
||||
---
|
||||
```lua
|
||||
function Peak.getGroups(self)
|
||||
-> table<string,number>
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Peak.new
|
||||
---
|
||||
```lua
|
||||
function Peak.new(def: MapGen.PeakDef {
|
||||
pos = vector,
|
||||
color = ColorString,
|
||||
groups = table<string,number>?,
|
||||
}) -> MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Peak.toString
|
||||
---
|
||||
```lua
|
||||
function Peak.toString() -> string
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns a string describing the object in a readable form.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Peak.eq
|
||||
---
|
||||
```lua
|
||||
function Peak.eq(other: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
}) -> boolean
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns true if the peaks are equivalent.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### Peak.id
|
||||
---
|
||||
```lua
|
||||
Peak.id : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
144
docs/docs/modules/MapGen.StaticLayer.md
Normal file
144
docs/docs/modules/MapGen.StaticLayer.md
Normal file
@@ -0,0 +1,144 @@
|
||||
# global MapGen.StaticLayer
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## methods
|
||||
---
|
||||
|
||||
### StaticLayer.new
|
||||
---
|
||||
```lua
|
||||
function StaticLayer.new(
|
||||
name: string,
|
||||
def: MapGen.StaticLayerDef {
|
||||
minY = number,
|
||||
maxY = number,
|
||||
staticNode = string,
|
||||
generateStaticNode = generateFunc,
|
||||
}
|
||||
) -> MapGen.StaticLayer {
|
||||
name = string,
|
||||
minY = number,
|
||||
maxY = number,
|
||||
staticNode = string,
|
||||
staticNodeID = number,
|
||||
generateStaticNode = generateFunc,
|
||||
new = function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### StaticLayer.name
|
||||
---
|
||||
```lua
|
||||
StaticLayer.name : string
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### StaticLayer.minY
|
||||
---
|
||||
```lua
|
||||
StaticLayer.minY : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### StaticLayer.maxY
|
||||
---
|
||||
```lua
|
||||
StaticLayer.maxY : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### StaticLayer.staticNode
|
||||
---
|
||||
```lua
|
||||
StaticLayer.staticNode : string
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### StaticLayer.staticNodeID
|
||||
---
|
||||
```lua
|
||||
StaticLayer.staticNodeID : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### StaticLayer.generateStaticNode
|
||||
---
|
||||
```lua
|
||||
StaticLayer.generateStaticNode : generateFunc
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
536
docs/docs/modules/MapGen.Tetrahedron.md
Normal file
536
docs/docs/modules/MapGen.Tetrahedron.md
Normal file
@@ -0,0 +1,536 @@
|
||||
# global MapGen.Tetrahedron
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## methods
|
||||
---
|
||||
|
||||
### Tetrahedron.new
|
||||
---
|
||||
```lua
|
||||
function Tetrahedron.new(
|
||||
p1: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
},
|
||||
p2: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
},
|
||||
p3: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
},
|
||||
p4: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
}
|
||||
) -> MapGen.Tetrahedron {
|
||||
p1 = MapGen.Peak,
|
||||
p2 = MapGen.Peak,
|
||||
p3 = MapGen.Peak,
|
||||
p4 = MapGen.Peak,
|
||||
h1 = MapGen.Triangulation.Edge,
|
||||
h2 = MapGen.Triangulation.Edge,
|
||||
h3 = MapGen.Triangulation.Edge,
|
||||
h4 = MapGen.Triangulation.Edge,
|
||||
f1 = MapGen.Triangle,
|
||||
f2 = MapGen.Triangle,
|
||||
f3 = MapGen.Triangle,
|
||||
f4 = MapGen.Triangle,
|
||||
new = function,
|
||||
toString = function,
|
||||
getHeight = function,
|
||||
getCircumSphereCenter = function,
|
||||
getCircumSphereRadius = function,
|
||||
inCircumSphere = function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.toString
|
||||
---
|
||||
```lua
|
||||
function Tetrahedron.toString() -> string
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns a string describing the object in a readable form.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.getHeight
|
||||
---
|
||||
```lua
|
||||
function Tetrahedron.getHeight(
|
||||
p1: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
},
|
||||
p2: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
},
|
||||
p3: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
},
|
||||
p4: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
}
|
||||
) -> MapGen.Triangulation.Edge?
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.getCircumSphereCenter
|
||||
---
|
||||
```lua
|
||||
function Tetrahedron.getCircumSphereCenter() -> vector
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns the center of the circumscribed sphere.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.getCircumSphereRadius
|
||||
---
|
||||
```lua
|
||||
function Tetrahedron.getCircumSphereRadius() -> number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns the radius of the circumscribed sphere.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.inCircumSphere
|
||||
---
|
||||
```lua
|
||||
function Tetrahedron.inCircumSphere(p: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
}) -> boolean
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Checks whether a given point lies within the circumscribed sphere of a tetrahedron.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### Tetrahedron.p1
|
||||
---
|
||||
```lua
|
||||
Tetrahedron.p1 : MapGen.Peak {
|
||||
id: number,
|
||||
getPeakPos: function,
|
||||
getColor: function,
|
||||
getGroups: function,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.p2
|
||||
---
|
||||
```lua
|
||||
Tetrahedron.p2 : MapGen.Peak {
|
||||
id: number,
|
||||
getPeakPos: function,
|
||||
getColor: function,
|
||||
getGroups: function,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.p3
|
||||
---
|
||||
```lua
|
||||
Tetrahedron.p3 : MapGen.Peak {
|
||||
id: number,
|
||||
getPeakPos: function,
|
||||
getColor: function,
|
||||
getGroups: function,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.p4
|
||||
---
|
||||
```lua
|
||||
Tetrahedron.p4 : MapGen.Peak {
|
||||
id: number,
|
||||
getPeakPos: function,
|
||||
getColor: function,
|
||||
getGroups: function,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.h1
|
||||
---
|
||||
```lua
|
||||
Tetrahedron.h1 : MapGen.Triangulation.Edge {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
same: function,
|
||||
length: function,
|
||||
getMidPoint: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.h2
|
||||
---
|
||||
```lua
|
||||
Tetrahedron.h2 : MapGen.Triangulation.Edge {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
same: function,
|
||||
length: function,
|
||||
getMidPoint: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.h3
|
||||
---
|
||||
```lua
|
||||
Tetrahedron.h3 : MapGen.Triangulation.Edge {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
same: function,
|
||||
length: function,
|
||||
getMidPoint: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.h4
|
||||
---
|
||||
```lua
|
||||
Tetrahedron.h4 : MapGen.Triangulation.Edge {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
same: function,
|
||||
length: function,
|
||||
getMidPoint: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.f1
|
||||
---
|
||||
```lua
|
||||
Tetrahedron.f1 : MapGen.Triangle {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
p3: MapGen.Peak,
|
||||
e1: MapGen.Triangulation.Edge,
|
||||
e2: MapGen.Triangulation.Edge,
|
||||
e3: MapGen.Triangulation.Edge,
|
||||
h1: MapGen.Triangulation.Edge,
|
||||
h2: MapGen.Triangulation.Edge,
|
||||
h3: MapGen.Triangulation.Edge,
|
||||
neighbours: MapGen.Triangle.Neighbours,
|
||||
color: ColorString?,
|
||||
new: function,
|
||||
...(+13)
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.f2
|
||||
---
|
||||
```lua
|
||||
Tetrahedron.f2 : MapGen.Triangle {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
p3: MapGen.Peak,
|
||||
e1: MapGen.Triangulation.Edge,
|
||||
e2: MapGen.Triangulation.Edge,
|
||||
e3: MapGen.Triangulation.Edge,
|
||||
h1: MapGen.Triangulation.Edge,
|
||||
h2: MapGen.Triangulation.Edge,
|
||||
h3: MapGen.Triangulation.Edge,
|
||||
neighbours: MapGen.Triangle.Neighbours,
|
||||
color: ColorString?,
|
||||
new: function,
|
||||
...(+13)
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.f3
|
||||
---
|
||||
```lua
|
||||
Tetrahedron.f3 : MapGen.Triangle {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
p3: MapGen.Peak,
|
||||
e1: MapGen.Triangulation.Edge,
|
||||
e2: MapGen.Triangulation.Edge,
|
||||
e3: MapGen.Triangulation.Edge,
|
||||
h1: MapGen.Triangulation.Edge,
|
||||
h2: MapGen.Triangulation.Edge,
|
||||
h3: MapGen.Triangulation.Edge,
|
||||
neighbours: MapGen.Triangle.Neighbours,
|
||||
color: ColorString?,
|
||||
new: function,
|
||||
...(+13)
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.f4
|
||||
---
|
||||
```lua
|
||||
Tetrahedron.f4 : MapGen.Triangle {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
p3: MapGen.Peak,
|
||||
e1: MapGen.Triangulation.Edge,
|
||||
e2: MapGen.Triangulation.Edge,
|
||||
e3: MapGen.Triangulation.Edge,
|
||||
h1: MapGen.Triangulation.Edge,
|
||||
h2: MapGen.Triangulation.Edge,
|
||||
h3: MapGen.Triangulation.Edge,
|
||||
neighbours: MapGen.Triangle.Neighbours,
|
||||
color: ColorString?,
|
||||
new: function,
|
||||
...(+13)
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
745
docs/docs/modules/MapGen.Triangle.md
Normal file
745
docs/docs/modules/MapGen.Triangle.md
Normal file
@@ -0,0 +1,745 @@
|
||||
# global MapGen.Triangle
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## methods
|
||||
---
|
||||
|
||||
### Triangle.new
|
||||
---
|
||||
```lua
|
||||
function Triangle.new(
|
||||
p1: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
},
|
||||
p2: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
},
|
||||
p3: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
}
|
||||
) -> MapGen.Triangle {
|
||||
p1 = MapGen.Peak,
|
||||
p2 = MapGen.Peak,
|
||||
p3 = MapGen.Peak,
|
||||
e1 = MapGen.Triangulation.Edge,
|
||||
e2 = MapGen.Triangulation.Edge,
|
||||
e3 = MapGen.Triangulation.Edge,
|
||||
h1 = MapGen.Triangulation.Edge,
|
||||
h2 = MapGen.Triangulation.Edge,
|
||||
h3 = MapGen.Triangulation.Edge,
|
||||
neighbours = MapGen.Triangle.Neighbours,
|
||||
color = ColorString?,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
same = function,
|
||||
getCenter = function,
|
||||
getArea = function,
|
||||
getHeight = function,
|
||||
getHeight2D = function,
|
||||
getSidesLength = function,
|
||||
getSidesLength2D = function,
|
||||
getCircumCenter2D = function,
|
||||
getCircumRadius2D = function,
|
||||
getCircumCircle2D = function,
|
||||
inCircumCircle2D = function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.toString
|
||||
---
|
||||
```lua
|
||||
function Triangle.toString() -> string
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns a string describing the object in a readable form.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.eq
|
||||
---
|
||||
```lua
|
||||
function Triangle.eq(other: MapGen.Triangle {
|
||||
p1 = MapGen.Peak,
|
||||
p2 = MapGen.Peak,
|
||||
p3 = MapGen.Peak,
|
||||
e1 = MapGen.Triangulation.Edge,
|
||||
e2 = MapGen.Triangulation.Edge,
|
||||
e3 = MapGen.Triangulation.Edge,
|
||||
h1 = MapGen.Triangulation.Edge,
|
||||
h2 = MapGen.Triangulation.Edge,
|
||||
h3 = MapGen.Triangulation.Edge,
|
||||
neighbours = MapGen.Triangle.Neighbours,
|
||||
color = ColorString?,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
same = function,
|
||||
getCenter = function,
|
||||
getArea = function,
|
||||
getHeight = function,
|
||||
getHeight2D = function,
|
||||
getSidesLength = function,
|
||||
getSidesLength2D = function,
|
||||
getCircumCenter2D = function,
|
||||
getCircumRadius2D = function,
|
||||
getCircumCircle2D = function,
|
||||
inCircumCircle2D = function,
|
||||
}) -> boolean
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns true if the triangles are equivalent.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.same
|
||||
---
|
||||
```lua
|
||||
function Triangle.same(other: MapGen.Triangle {
|
||||
p1 = MapGen.Peak,
|
||||
p2 = MapGen.Peak,
|
||||
p3 = MapGen.Peak,
|
||||
e1 = MapGen.Triangulation.Edge,
|
||||
e2 = MapGen.Triangulation.Edge,
|
||||
e3 = MapGen.Triangulation.Edge,
|
||||
h1 = MapGen.Triangulation.Edge,
|
||||
h2 = MapGen.Triangulation.Edge,
|
||||
h3 = MapGen.Triangulation.Edge,
|
||||
neighbours = MapGen.Triangle.Neighbours,
|
||||
color = ColorString?,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
same = function,
|
||||
getCenter = function,
|
||||
getArea = function,
|
||||
getHeight = function,
|
||||
getHeight2D = function,
|
||||
getSidesLength = function,
|
||||
getSidesLength2D = function,
|
||||
getCircumCenter2D = function,
|
||||
getCircumRadius2D = function,
|
||||
getCircumCircle2D = function,
|
||||
inCircumCircle2D = function,
|
||||
}) -> boolean
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns true if the triangles are similar.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.getCenter
|
||||
---
|
||||
```lua
|
||||
function Triangle.getCenter() -> vector
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns the coordinates of the triangle's center.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.getArea
|
||||
---
|
||||
```lua
|
||||
function Triangle.getArea() -> number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns the area of a triangle.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.getHeight
|
||||
---
|
||||
```lua
|
||||
function Triangle.getHeight(
|
||||
p1: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
},
|
||||
p2: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
},
|
||||
p3: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
}
|
||||
) -> MapGen.Triangulation.Edge {
|
||||
p1 = MapGen.Peak,
|
||||
p2 = MapGen.Peak,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
same = function,
|
||||
length = function,
|
||||
getMidPoint = function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns the perpendicular from the vertex Peak1 to the line Peak2-Peak3.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.getHeight2D
|
||||
---
|
||||
```lua
|
||||
function Triangle.getHeight2D(
|
||||
p1: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
},
|
||||
p2: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
},
|
||||
p3: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
}
|
||||
) -> MapGen.Triangulation.Edge {
|
||||
p1 = MapGen.Peak,
|
||||
p2 = MapGen.Peak,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
same = function,
|
||||
length = function,
|
||||
getMidPoint = function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns the perpendicular from the vertex Peak1 to the line Peak2-Peak3.
|
||||
|
||||
Note: This function does not take into account the Y-coordinate,
|
||||
that is, the calculation is performed on the projection of the triangle XZ.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.getSidesLength
|
||||
---
|
||||
```lua
|
||||
function Triangle.getSidesLength()
|
||||
-> number
|
||||
-> number
|
||||
-> number
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns the length of the edges
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.getSidesLength2D
|
||||
---
|
||||
```lua
|
||||
function Triangle.getSidesLength2D()
|
||||
-> number
|
||||
-> number
|
||||
-> number
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns the length of the edges.
|
||||
|
||||
Note: This function does not take into account the Y-coordinate,
|
||||
that is, the calculation is performed on the projection of the triangle XZ.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.getCircumCenter2D
|
||||
---
|
||||
```lua
|
||||
function Triangle.getCircumCenter2D() -> vector
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns the coordinates of the circumcircle center.
|
||||
|
||||
Note: This function does not take into account the Y-coordinate,
|
||||
that is, the calculation is performed on the projection of the triangle XZ.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.getCircumRadius2D
|
||||
---
|
||||
```lua
|
||||
function Triangle.getCircumRadius2D() -> number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns the radius of the circumcircle.
|
||||
|
||||
Note: This function does not take into account the Y-coordinate,
|
||||
that is, the calculation is performed on the projection of the triangle XZ.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.getCircumCircle2D
|
||||
---
|
||||
```lua
|
||||
function Triangle.getCircumCircle2D()
|
||||
-> vector
|
||||
-> number
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns the coordinates of the circumcircle center and its radius.
|
||||
|
||||
Note: This function does not take into account the Y-coordinate,
|
||||
that is, the calculation is performed on the projection of the triangle XZ.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.inCircumCircle2D
|
||||
---
|
||||
```lua
|
||||
function Triangle.inCircumCircle2D(p: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
}) -> boolean
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Checks if a given point lies into the triangle circumcircle.
|
||||
|
||||
Note: This function does not take into account the Y-coordinate,
|
||||
that is, the calculation is performed on the projection of the triangle XZ.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### Triangle.p1
|
||||
---
|
||||
```lua
|
||||
Triangle.p1 : MapGen.Peak {
|
||||
id: number,
|
||||
getPeakPos: function,
|
||||
getColor: function,
|
||||
getGroups: function,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.p2
|
||||
---
|
||||
```lua
|
||||
Triangle.p2 : MapGen.Peak {
|
||||
id: number,
|
||||
getPeakPos: function,
|
||||
getColor: function,
|
||||
getGroups: function,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.p3
|
||||
---
|
||||
```lua
|
||||
Triangle.p3 : MapGen.Peak {
|
||||
id: number,
|
||||
getPeakPos: function,
|
||||
getColor: function,
|
||||
getGroups: function,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.e1
|
||||
---
|
||||
```lua
|
||||
Triangle.e1 : MapGen.Triangulation.Edge {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
same: function,
|
||||
length: function,
|
||||
getMidPoint: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.e2
|
||||
---
|
||||
```lua
|
||||
Triangle.e2 : MapGen.Triangulation.Edge {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
same: function,
|
||||
length: function,
|
||||
getMidPoint: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.e3
|
||||
---
|
||||
```lua
|
||||
Triangle.e3 : MapGen.Triangulation.Edge {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
same: function,
|
||||
length: function,
|
||||
getMidPoint: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.h1
|
||||
---
|
||||
```lua
|
||||
Triangle.h1 : MapGen.Triangulation.Edge {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
same: function,
|
||||
length: function,
|
||||
getMidPoint: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.h2
|
||||
---
|
||||
```lua
|
||||
Triangle.h2 : MapGen.Triangulation.Edge {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
same: function,
|
||||
length: function,
|
||||
getMidPoint: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.h3
|
||||
---
|
||||
```lua
|
||||
Triangle.h3 : MapGen.Triangulation.Edge {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
same: function,
|
||||
length: function,
|
||||
getMidPoint: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.neighbours
|
||||
---
|
||||
```lua
|
||||
Triangle.neighbours : MapGen.Triangle.Neighbours
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.color
|
||||
---
|
||||
```lua
|
||||
Triangle.color : ColorString?
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
225
docs/docs/modules/MapGen.Triangulation.Edge.md
Normal file
225
docs/docs/modules/MapGen.Triangulation.Edge.md
Normal file
@@ -0,0 +1,225 @@
|
||||
# global MapGen.Triangulation.Edge
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## methods
|
||||
---
|
||||
|
||||
### Edge.new
|
||||
---
|
||||
```lua
|
||||
function Edge.new(
|
||||
p1: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
},
|
||||
p2: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
}
|
||||
) -> MapGen.Triangulation.Edge {
|
||||
p1 = MapGen.Peak,
|
||||
p2 = MapGen.Peak,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
same = function,
|
||||
length = function,
|
||||
getMidPoint = function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Edge.toString
|
||||
---
|
||||
```lua
|
||||
function Edge.toString() -> string
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns a string describing the object in a readable form.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Edge.eq
|
||||
---
|
||||
```lua
|
||||
function Edge.eq(other: MapGen.Triangulation.Edge {
|
||||
p1 = MapGen.Peak,
|
||||
p2 = MapGen.Peak,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
same = function,
|
||||
length = function,
|
||||
getMidPoint = function,
|
||||
}) -> boolean
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns true if the edges are equivalent.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Edge.same
|
||||
---
|
||||
```lua
|
||||
function Edge.same(other: MapGen.Triangulation.Edge {
|
||||
p1 = MapGen.Peak,
|
||||
p2 = MapGen.Peak,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
same = function,
|
||||
length = function,
|
||||
getMidPoint = function,
|
||||
}) -> boolean
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns true if the edges are similar.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Edge.length
|
||||
---
|
||||
```lua
|
||||
function Edge.length() -> number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns the length of an edge.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Edge.getMidPoint
|
||||
---
|
||||
```lua
|
||||
function Edge.getMidPoint() -> vector
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns the vector of the point located in the middle of the edge.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### Edge.p1
|
||||
---
|
||||
```lua
|
||||
Edge.p1 : MapGen.Peak {
|
||||
id: number,
|
||||
getPeakPos: function,
|
||||
getColor: function,
|
||||
getGroups: function,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Edge.p2
|
||||
---
|
||||
```lua
|
||||
Edge.p2 : MapGen.Peak {
|
||||
id: number,
|
||||
getPeakPos: function,
|
||||
getColor: function,
|
||||
getGroups: function,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
79
docs/docs/modules/MapGen.Triangulation.FakePeak.md
Normal file
79
docs/docs/modules/MapGen.Triangulation.FakePeak.md
Normal file
@@ -0,0 +1,79 @@
|
||||
# global MapGen.Triangulation.FakePeak
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## methods
|
||||
---
|
||||
|
||||
### FakePeak.getPeakPos
|
||||
---
|
||||
```lua
|
||||
function FakePeak.getPeakPos()-> vector
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### FakePeak.new
|
||||
---
|
||||
```lua
|
||||
function FakePeak.new(peakPos: vector) -> MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns a fake `MapGen.Peak` that has no noise parameters.
|
||||
Note that the initialized peak should not be used in generation.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### FakePeak.id
|
||||
---
|
||||
```lua
|
||||
FakePeak.id : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
81
docs/docs/modules/MapGen.Triangulation.md
Normal file
81
docs/docs/modules/MapGen.Triangulation.md
Normal file
@@ -0,0 +1,81 @@
|
||||
# global MapGen.Triangulation
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## methods
|
||||
---
|
||||
|
||||
### Triangulation.triangulate
|
||||
---
|
||||
```lua
|
||||
function Triangulation.triangulate(vertices: table<integer,MapGen.Peak>) -> ((MapGen.Triangle)|MapGen.Triangle[])
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
The Delaunay method divides a plane into triangles based on a list of their vertices.
|
||||
|
||||
Doesn't take into account the Y coordinate of the vertices.
|
||||
That is, all triangles that don't lie in the XZ plane will be projected onto it.
|
||||
|
||||
Vertices that do not have a `is2d` group will not participate in the triangulation.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangulation.tetrahedralize
|
||||
---
|
||||
```lua
|
||||
function Triangulation.tetrahedralize(vertices: table<integer,MapGen.Peak>) -> ((MapGen.Tetrahedron)|MapGen.Tetrahedron[])
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
The Delaunay method divides space into tetrahedra based on a list of their vertices.
|
||||
|
||||
Vertices that do not have a `is3d` group will not participate in the triangulation.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### Triangulation.convexMultiplier
|
||||
---
|
||||
```lua
|
||||
Triangulation.convexMultiplier : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
30
docs/docs/modules/MapGen.ff2luat.md
Normal file
30
docs/docs/modules/MapGen.ff2luat.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# global MapGen.ff2luat
|
||||
|
||||
|
||||
Converts given farbfeld image to ColoredDotsTable.
|
||||
Farbfeld format:
|
||||
```
|
||||
╔════════╤═════════════════════════════════════════════════════════╗
|
||||
║ Bytes │ Description ║
|
||||
╠════════╪═════════════════════════════════════════════════════════╣
|
||||
║ 8 │ 'farbfeld' magic value ║
|
||||
╟────────┼─────────────────────────────────────────────────────────╢
|
||||
║ 4 │ 32-Bit BE unsigned integer (width) ║
|
||||
╟────────┼─────────────────────────────────────────────────────────╢
|
||||
║ 4 │ 32-Bit BE unsigned integer (height) ║
|
||||
╟────────┼─────────────────────────────────────────────────────────╢
|
||||
║ [2222] │ 4x16-Bit BE unsigned integers [RGBA] / pixel, row-major ║
|
||||
╚════════╧═════════════════════════════════════════════════════════╝
|
||||
```
|
||||
[tools/farbfeld | suckless.org software that sucks less](https://tools.suckless.org/farbfeld/)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
738
docs/docs/modules/MapGen.md
Normal file
738
docs/docs/modules/MapGen.md
Normal file
@@ -0,0 +1,738 @@
|
||||
# global MapGen
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## methods
|
||||
---
|
||||
|
||||
### MapGen.new
|
||||
---
|
||||
```lua
|
||||
function MapGen.new(def: MapGenDef {
|
||||
nodes = table<string,string>,
|
||||
}) -> MapGen {
|
||||
layersByName = table<string,MapGen.Layer>,
|
||||
layersList = MapGen.Layer[],
|
||||
staticsByName = table<string,MapGen.StaticLayer>,
|
||||
staticsList = MapGen.StaticLayer[],
|
||||
layersNoisesInitialized = boolean,
|
||||
cavernsNoiseInitialized = boolean,
|
||||
isRunning = boolean,
|
||||
nodeIDs = table<string,number>,
|
||||
new = function,
|
||||
getLayerByHeight = function,
|
||||
getStaticByHeight = function,
|
||||
registerLayer = function,
|
||||
registerLayerNoiseColor = function,
|
||||
registerStaticLayer = function,
|
||||
registerPeak = function,
|
||||
register2DPeak = function,
|
||||
register2DPeaks = function,
|
||||
register2DPeaksFromFile = function,
|
||||
registerBiome = function,
|
||||
registerCavern = function,
|
||||
initLayersTriangultaion = function,
|
||||
initLayersNoises = function,
|
||||
initBiomesDiagram = function,
|
||||
initCavernsNoise = function,
|
||||
getNoises2dValue = function,
|
||||
onMapGenerated = function,
|
||||
run = function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.getLayerByHeight
|
||||
---
|
||||
```lua
|
||||
function MapGen.getLayerByHeight(yPos: number) -> MapGen.Layer?
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Determines which layer a node belongs to based on its height coordinate.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.getStaticByHeight
|
||||
---
|
||||
```lua
|
||||
function MapGen.getStaticByHeight(yPos: number) -> MapGen.StaticLayer?
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Determines which statics layer a node belongs to based on its height coordinate.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.registerLayer
|
||||
---
|
||||
```lua
|
||||
function MapGen.registerLayer(
|
||||
name: string,
|
||||
def: MapGen.LayerDef {
|
||||
minY = number,
|
||||
maxY = number,
|
||||
minTemp = number,
|
||||
maxTemp = number,
|
||||
minHumidity = number,
|
||||
maxHumidity = number,
|
||||
waterLevel = number?,
|
||||
calcTemp = (fun(self: MapGen.Layer, value: number, height: number) -> number)?,
|
||||
calcHumidity = (fun(self: MapGen.Layer, value: number, height: number) -> number)?,
|
||||
biomesGorizontalScattering = number?,
|
||||
biomesVerticalScattering = number?,
|
||||
}
|
||||
) -> nil
|
||||
```
|
||||
@param `name` - The name that will be assigned to the layer. The name must be unique for each layer.
|
||||
|
||||
@param `def` - Layer description table, see details `MapGen.LayerDef`.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Mark the world area between two heights as a `MapGen.Layer`.
|
||||
|
||||
Note: layers must not overlap.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.registerLayerNoiseColor
|
||||
---
|
||||
```lua
|
||||
function MapGen.registerLayerNoiseColor(
|
||||
layerName: string,
|
||||
category: MapGen.Layer.Category,
|
||||
color: ColorString,
|
||||
noiseParams: NoiseParams
|
||||
) -> nil
|
||||
```
|
||||
@param `layerName` - The name of the layer for which the color will be registered.
|
||||
|
||||
@param `category` - Category indicating what will be generated by noise.
|
||||
|
||||
@param `color` - Noise color. Must be unique.
|
||||
|
||||
@param `noiseParams` - Fractal noise parameters.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Register the color and the noise parameters that correspond to it.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.registerStaticLayer
|
||||
---
|
||||
```lua
|
||||
function MapGen.registerStaticLayer(
|
||||
name: string,
|
||||
def: MapGen.StaticLayerDef {
|
||||
minY = number,
|
||||
maxY = number,
|
||||
staticNode = string,
|
||||
generateStaticNode = generateFunc,
|
||||
}
|
||||
) -> nil
|
||||
```
|
||||
@param `name` - The name that will be assigned to the static layer. The name must be unique for each layer.
|
||||
|
||||
@param `def` - Static layer description table, see details `MapGen.StaticLayerDef`.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Mark the world area between two heights as a `MapGen.StaticLayer`.
|
||||
|
||||
Note: layers must not overlap.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.registerPeak
|
||||
---
|
||||
```lua
|
||||
function MapGen.registerPeak(
|
||||
layerName: string,
|
||||
category: MapGen.Layer.Category,
|
||||
def: MapGen.PeakDef {
|
||||
pos = vector,
|
||||
color = ColorString,
|
||||
groups = table<string,number>?,
|
||||
}
|
||||
) -> nil
|
||||
```
|
||||
@param `layerName` - The name of the layer in which the new peak will be included.
|
||||
|
||||
@param `category` - Category indicating what will be generated by peak.
|
||||
|
||||
@param `def` - Peak description table, see details `MapGen.PeakDef`.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Mark a world point as `MapGen.Peak` and assign it a specific color that will affect the generation.
|
||||
|
||||
Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.register2DPeak
|
||||
---
|
||||
```lua
|
||||
function MapGen.register2DPeak(
|
||||
layerName: string,
|
||||
category: MapGen.Layer.Category,
|
||||
def: MapGen.PeakDef {
|
||||
pos = vector,
|
||||
color = ColorString,
|
||||
groups = table<string,number>?,
|
||||
}
|
||||
) -> nil
|
||||
```
|
||||
@param `layerName` - The name of the layer in which the new peak will be included.
|
||||
|
||||
@param `category` - Category indicating what will be generated by peak.
|
||||
|
||||
@param `def` - Peak description table, see details `MapGen.PeakDef`.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Mark a world point as `MapGen.Peak` and assign it a specific color that will affect the generation.
|
||||
The Y coordinate will be forced to zero, and the `is2d` group will be added to the groups field.
|
||||
|
||||
Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.register2DPeaks
|
||||
---
|
||||
```lua
|
||||
function MapGen.register2DPeaks(
|
||||
layerName: string,
|
||||
category: MapGen.Layer.Category,
|
||||
defs: MapGen.PeakDef[]
|
||||
) -> nil
|
||||
```
|
||||
@param `layerName` - The name of the layer in which the new peaks will be included.
|
||||
|
||||
@param `category` - Category indicating what will be generated by peaks.
|
||||
|
||||
@param `defs` - Peaks description table, see details `MapGen.PeakDef`.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Mark the world points as `MapGen.Peak` and assign them all a specific noise that will affect generation.
|
||||
The Y coordinate will be forced to zero, and the `is2d` group will be added to the groups field.
|
||||
|
||||
Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.register2DPeaksFromFile
|
||||
---
|
||||
```lua
|
||||
function MapGen.register2DPeaksFromFile(
|
||||
layerName: string,
|
||||
map: string,
|
||||
scale: number,
|
||||
zeroPos: Position2d,
|
||||
category: MapGen.Layer.Category,
|
||||
groups: table<string,number>?
|
||||
) -> nil
|
||||
```
|
||||
@param `layerName` - The name of the layer in which the new peaks will be included.
|
||||
|
||||
@param `map` - The name of the image from which the peaks will be extracted. It should be located in the `<mod_name>/textures/maps` folder and have the following format `<image_name>.ff`
|
||||
|
||||
@param `scale` - Multiplier of how many blocks (nodes) will be between image pixels. It is not recommended to set the value below 50 for performance reasons.
|
||||
|
||||
@param `zeroPos` - The position in pixels where the zero world coordinate will be in the image.
|
||||
|
||||
@param `category` - Category indicating what will be generated by peaks.
|
||||
|
||||
@param `groups` - Groups that will be added to all peaks.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Extract the `MapGen.Peak` from the image and assign them all a specific color that will affect the generation.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.registerBiome
|
||||
---
|
||||
```lua
|
||||
function MapGen.registerBiome(
|
||||
layerName: string,
|
||||
biomeName: string,
|
||||
def: MapGen.BiomeDef {
|
||||
tempPoint = number,
|
||||
humidityPoint = number,
|
||||
minY = number,
|
||||
maxY = number,
|
||||
groundNodes = MapGen.Biome.GroundNodes,
|
||||
soilHeight = number,
|
||||
generateAir = generateFunc?,
|
||||
generateCavernAir = generateFunc?,
|
||||
generateWater = generateFunc?,
|
||||
generateRock = generateFunc?,
|
||||
generateTurf = generateFunc?,
|
||||
generateSoil = generateFunc?,
|
||||
generateBottom = generateFunc?,
|
||||
}
|
||||
) -> nil
|
||||
```
|
||||
@param `layerName` - The name of the layer in which the new biome will be included.
|
||||
|
||||
@param `biomeName` - The name to be assigned to the biome. The name must be unique for each biome.
|
||||
|
||||
@param `def` - Biome description table, see details `MapGen.BiomeDef`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Mark a point on the biomes diagram and constrain the world area by height to mark it as `MapGen.Biome`.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.registerCavern
|
||||
---
|
||||
```lua
|
||||
function MapGen.registerCavern(
|
||||
layerName: string,
|
||||
cavernName: string,
|
||||
def: MapGen.CavernDef {
|
||||
minY = number,
|
||||
maxY = number,
|
||||
noiseParams = NoiseParams,
|
||||
smoothDistance = number,
|
||||
threshold = number?,
|
||||
groups = table<string,number>?,
|
||||
}
|
||||
) -> nil
|
||||
```
|
||||
@param `layerName` - The name of the layer in which the new cavern will be included.
|
||||
|
||||
@param `cavernName` - The name to be assigned to the cavern. The name must be unique for each cavern.
|
||||
|
||||
@param `def` - Cavern description table, see details `MapGen.CavernDef`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Mark the world area between two heights as a `MapGen.Cavern` and assign the noise that the cave will be generated from.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.initLayersTriangultaion
|
||||
---
|
||||
```lua
|
||||
function MapGen.initLayersTriangultaion() -> nil
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Divide all layers into triangles whose vertices are the `Mapgen.Peak` belonging to these layers.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.initLayersNoises
|
||||
---
|
||||
```lua
|
||||
function MapGen.initLayersNoises() -> nil
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Initialize all layer noises. This should be called after the map object is loaded.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.initBiomesDiagram
|
||||
---
|
||||
```lua
|
||||
function MapGen.initBiomesDiagram() -> nil
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Initialization of the biome diagram using the Voronoi method.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.initCavernsNoise
|
||||
---
|
||||
```lua
|
||||
function MapGen.initCavernsNoise() -> nil
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Initialize caverns's noises. This should be called after the map object is loaded.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.getNoises2dValue
|
||||
---
|
||||
```lua
|
||||
function MapGen.getNoises2dValue(
|
||||
category: MapGen.Layer.Category,
|
||||
layer: MapGen.Layer {
|
||||
name = string,
|
||||
minY = integer,
|
||||
maxY = integer,
|
||||
minTemp = integer,
|
||||
maxTemp = integer,
|
||||
minHumidity = integer,
|
||||
maxHumidity = integer,
|
||||
waterLevel = integer,
|
||||
peaksList = { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] },
|
||||
noisesByColor = { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> },
|
||||
noisesParamsByColor = { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> },
|
||||
biomesByName = table<string,MapGen.Biome>,
|
||||
biomesList = MapGen.Biome[],
|
||||
biomesDiagram = table,
|
||||
biomesGorizontalScattering = integer,
|
||||
biomesVerticalScattering = integer,
|
||||
cavernsByName = table<string,MapGen.Cavern>,
|
||||
cavernsList = MapGen.Cavern[],
|
||||
trianglesList = { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] },
|
||||
tetrahedronsList = MapGen.Tetrahedron[],
|
||||
calcTemp = function,
|
||||
calcHumidity = function,
|
||||
new = function,
|
||||
addPeak = function,
|
||||
addNoiseParamsColor = function,
|
||||
getNoiseByColor = function,
|
||||
addBiome = function,
|
||||
addCavern = function,
|
||||
initNoises = function,
|
||||
initBiomesDiagram = function,
|
||||
},
|
||||
x: integer,
|
||||
y: integer,
|
||||
z: integer
|
||||
) -> number?
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Calculates a smoothed 2D noise value based on a preliminary space partitioning.
|
||||
|
||||
Returns `nil` if the point is not included in any triangle.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.onMapGenerated
|
||||
---
|
||||
```lua
|
||||
function MapGen.onMapGenerated(
|
||||
voxelManip: VoxelManip,
|
||||
minPos: Position,
|
||||
maxPos: Position,
|
||||
blockseed: number
|
||||
) -> nil
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Chunk generation handler.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.run
|
||||
---
|
||||
```lua
|
||||
function MapGen.run() -> nil
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Run world generation through this mapgen object
|
||||
|
||||
Note: only one instance of a `MapGen` class can be running.
|
||||
|
||||
**FOR MAPGEN ENVIRONMENT ONLY**
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### MapGen.layersByName
|
||||
---
|
||||
```lua
|
||||
MapGen.layersByName : table<string,MapGen.Layer>
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.layersList
|
||||
---
|
||||
```lua
|
||||
MapGen.layersList : MapGen.Layer[]
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.staticsByName
|
||||
---
|
||||
```lua
|
||||
MapGen.staticsByName : table<string,MapGen.StaticLayer>
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.staticsList
|
||||
---
|
||||
```lua
|
||||
MapGen.staticsList : MapGen.StaticLayer[]
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.layersNoisesInitialized
|
||||
---
|
||||
```lua
|
||||
MapGen.layersNoisesInitialized : boolean
|
||||
```
|
||||
|
||||
|
||||
|
||||
Is the fractal noise of the layer initialized? This is necessary for a one-time noise initialization.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.cavernsNoiseInitialized
|
||||
---
|
||||
```lua
|
||||
MapGen.cavernsNoiseInitialized : boolean
|
||||
```
|
||||
|
||||
|
||||
|
||||
Is the fractal noise of the caverns initialized? This is necessary for a one-time noise initialization.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.isRunning
|
||||
---
|
||||
```lua
|
||||
MapGen.isRunning : boolean
|
||||
```
|
||||
|
||||
|
||||
|
||||
A static field that guarantees that only one instance of the `MapGen` class will work.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.nodeIDs
|
||||
---
|
||||
```lua
|
||||
MapGen.nodeIDs : table<string,number>
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
23
docs/docs/types/ColoredDotsTable.md
Normal file
23
docs/docs/types/ColoredDotsTable.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# alias ColoredDotsTable
|
||||
---
|
||||
|
||||
|
||||
|
||||
```lua
|
||||
(alias) ColoredDotsTable = table<string,table>
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
Table with color as key and value is table with coordinates of dots. Note: coords begin from 1,1 (not 0,0).
|
||||
Example of table:
|
||||
```lua
|
||||
{
|
||||
'size': { h=256, w=256 },
|
||||
'#fff': { {x=1,y=1}, {x=2,y=2}, ... },
|
||||
'#ff0': { {x=3,y=3}, {x=4,y=4}, ... },
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
92
docs/docs/types/MapGen.Biome.GroundNodes.md
Normal file
92
docs/docs/types/MapGen.Biome.GroundNodes.md
Normal file
@@ -0,0 +1,92 @@
|
||||
# class GroundNodes
|
||||
|
||||
|
||||
|
||||
- namespace: MapGen.Biome
|
||||
|
||||
|
||||
|
||||
**Only for EmmyLua.**
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### GroundNodes.turf
|
||||
---
|
||||
```lua
|
||||
GroundNodes.turf : string
|
||||
```
|
||||
|
||||
|
||||
|
||||
The soil covering the surface of the biome
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### GroundNodes.soil
|
||||
---
|
||||
```lua
|
||||
GroundNodes.soil : string
|
||||
```
|
||||
|
||||
|
||||
|
||||
The soil beneath the turf. The height of this layer depends on `Biome.soilHeight`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### GroundNodes.rock
|
||||
---
|
||||
```lua
|
||||
GroundNodes.rock : string
|
||||
```
|
||||
|
||||
|
||||
|
||||
The rock found beneath the soil of a biome.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### GroundNodes.bottom
|
||||
---
|
||||
```lua
|
||||
GroundNodes.bottom : string
|
||||
```
|
||||
|
||||
|
||||
|
||||
Covering the bottom of reservoirs.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
92
docs/docs/types/MapGen.Biome.GroundNodesIDs.md
Normal file
92
docs/docs/types/MapGen.Biome.GroundNodesIDs.md
Normal file
@@ -0,0 +1,92 @@
|
||||
# class GroundNodesIDs
|
||||
|
||||
|
||||
|
||||
- namespace: MapGen.Biome
|
||||
|
||||
|
||||
|
||||
**Only for EmmyLua.**
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### GroundNodesIDs.turf
|
||||
---
|
||||
```lua
|
||||
GroundNodesIDs.turf : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
The soil covering the surface of the biome
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### GroundNodesIDs.soil
|
||||
---
|
||||
```lua
|
||||
GroundNodesIDs.soil : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
The soil beneath the turf. The height of this layer depends on `Biome.soilHeight`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### GroundNodesIDs.rock
|
||||
---
|
||||
```lua
|
||||
GroundNodesIDs.rock : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
The rock found beneath the soil of a biome.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### GroundNodesIDs.bottom
|
||||
---
|
||||
```lua
|
||||
GroundNodesIDs.bottom : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
Covering the bottom of reservoirs.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
312
docs/docs/types/MapGen.Biome.md
Normal file
312
docs/docs/types/MapGen.Biome.md
Normal file
@@ -0,0 +1,312 @@
|
||||
# class Biome
|
||||
|
||||
|
||||
|
||||
- namespace: MapGen
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## methods
|
||||
---
|
||||
|
||||
### Biome.new
|
||||
---
|
||||
```lua
|
||||
function Biome.new(
|
||||
name: string,
|
||||
def: MapGen.BiomeDef {
|
||||
tempPoint = number,
|
||||
humidityPoint = number,
|
||||
minY = number,
|
||||
maxY = number,
|
||||
groundNodes = MapGen.Biome.GroundNodes,
|
||||
soilHeight = number,
|
||||
generateAir = generateFunc?,
|
||||
generateCavernAir = generateFunc?,
|
||||
generateWater = generateFunc?,
|
||||
generateRock = generateFunc?,
|
||||
generateTurf = generateFunc?,
|
||||
generateSoil = generateFunc?,
|
||||
generateBottom = generateFunc?,
|
||||
}
|
||||
) -> MapGen.Biome {
|
||||
name = string,
|
||||
tempPoint = number,
|
||||
humidityPoint = number,
|
||||
minY = number,
|
||||
maxY = number,
|
||||
groundNodes = MapGen.Biome.GroundNodes,
|
||||
groundNodesIDs = MapGen.Biome.GroundNodesIDs,
|
||||
soilHeight = number,
|
||||
generateAir = generateFunc,
|
||||
generateCavernAir = generateFunc,
|
||||
generateWater = generateFunc,
|
||||
generateRock = generateFunc,
|
||||
generateTurf = generateFunc,
|
||||
generateSoil = generateFunc,
|
||||
generateBottom = generateFunc,
|
||||
new = function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### Biome.name
|
||||
---
|
||||
```lua
|
||||
Biome.name : string
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.tempPoint
|
||||
---
|
||||
```lua
|
||||
Biome.tempPoint : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.humidityPoint
|
||||
---
|
||||
```lua
|
||||
Biome.humidityPoint : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.minY
|
||||
---
|
||||
```lua
|
||||
Biome.minY : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.maxY
|
||||
---
|
||||
```lua
|
||||
Biome.maxY : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.groundNodes
|
||||
---
|
||||
```lua
|
||||
Biome.groundNodes : MapGen.Biome.GroundNodes {
|
||||
turf: string,
|
||||
soil: string,
|
||||
rock: string,
|
||||
bottom: string,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.groundNodesIDs
|
||||
---
|
||||
```lua
|
||||
Biome.groundNodesIDs : MapGen.Biome.GroundNodesIDs {
|
||||
turf: number,
|
||||
soil: number,
|
||||
rock: number,
|
||||
bottom: number,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.soilHeight
|
||||
---
|
||||
```lua
|
||||
Biome.soilHeight : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.generateAir
|
||||
---
|
||||
```lua
|
||||
Biome.generateAir : generateFunc
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.generateCavernAir
|
||||
---
|
||||
```lua
|
||||
Biome.generateCavernAir : generateFunc
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.generateWater
|
||||
---
|
||||
```lua
|
||||
Biome.generateWater : generateFunc
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.generateRock
|
||||
---
|
||||
```lua
|
||||
Biome.generateRock : generateFunc
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.generateTurf
|
||||
---
|
||||
```lua
|
||||
Biome.generateTurf : generateFunc
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.generateSoil
|
||||
---
|
||||
```lua
|
||||
Biome.generateSoil : generateFunc
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Biome.generateBottom
|
||||
---
|
||||
```lua
|
||||
Biome.generateBottom : generateFunc
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
226
docs/docs/types/MapGen.BiomeDef.md
Normal file
226
docs/docs/types/MapGen.BiomeDef.md
Normal file
@@ -0,0 +1,226 @@
|
||||
# class BiomeDef
|
||||
|
||||
|
||||
|
||||
- namespace: MapGen
|
||||
|
||||
|
||||
|
||||
Definition table for the `MapGen.Biome`.
|
||||
|
||||
**Only for EmmyLua.**
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### BiomeDef.tempPoint
|
||||
---
|
||||
```lua
|
||||
BiomeDef.tempPoint : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### BiomeDef.humidityPoint
|
||||
---
|
||||
```lua
|
||||
BiomeDef.humidityPoint : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### BiomeDef.minY
|
||||
---
|
||||
```lua
|
||||
BiomeDef.minY : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### BiomeDef.maxY
|
||||
---
|
||||
```lua
|
||||
BiomeDef.maxY : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### BiomeDef.groundNodes
|
||||
---
|
||||
```lua
|
||||
BiomeDef.groundNodes : MapGen.Biome.GroundNodes {
|
||||
turf: string,
|
||||
soil: string,
|
||||
rock: string,
|
||||
bottom: string,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### BiomeDef.soilHeight
|
||||
---
|
||||
```lua
|
||||
BiomeDef.soilHeight : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### BiomeDef.generateAir
|
||||
---
|
||||
```lua
|
||||
BiomeDef.generateAir : generateFunc?
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### BiomeDef.generateCavernAir
|
||||
---
|
||||
```lua
|
||||
BiomeDef.generateCavernAir : generateFunc?
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### BiomeDef.generateWater
|
||||
---
|
||||
```lua
|
||||
BiomeDef.generateWater : generateFunc?
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### BiomeDef.generateRock
|
||||
---
|
||||
```lua
|
||||
BiomeDef.generateRock : generateFunc?
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### BiomeDef.generateTurf
|
||||
---
|
||||
```lua
|
||||
BiomeDef.generateTurf : generateFunc?
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### BiomeDef.generateSoil
|
||||
---
|
||||
```lua
|
||||
BiomeDef.generateSoil : generateFunc?
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### BiomeDef.generateBottom
|
||||
---
|
||||
```lua
|
||||
BiomeDef.generateBottom : generateFunc?
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
208
docs/docs/types/MapGen.Cavern.md
Normal file
208
docs/docs/types/MapGen.Cavern.md
Normal file
@@ -0,0 +1,208 @@
|
||||
# class Cavern
|
||||
|
||||
|
||||
|
||||
- namespace: MapGen
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## methods
|
||||
---
|
||||
|
||||
### Cavern.getNoise
|
||||
---
|
||||
```lua
|
||||
function Cavern.getNoise()-> ValueNoise
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Cavern.initNoise
|
||||
---
|
||||
```lua
|
||||
function Cavern.initNoise()-> nil
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Cavern.getGroups
|
||||
---
|
||||
```lua
|
||||
function Cavern.getGroups()
|
||||
-> table<string,number>
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Cavern.new
|
||||
---
|
||||
```lua
|
||||
function Cavern.new(
|
||||
name: string,
|
||||
def: MapGen.CavernDef {
|
||||
minY = number,
|
||||
maxY = number,
|
||||
noiseParams = NoiseParams,
|
||||
smoothDistance = number,
|
||||
threshold = number?,
|
||||
groups = table<string,number>?,
|
||||
}
|
||||
) -> MapGen.Cavern {
|
||||
name = string,
|
||||
minY = number,
|
||||
maxY = number,
|
||||
smoothDistance = number,
|
||||
threshold = number,
|
||||
getNoise = function,
|
||||
initNoise = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
isCavern = function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Cavern.isCavern
|
||||
---
|
||||
```lua
|
||||
function Cavern.isCavern(
|
||||
x: integer,
|
||||
y: integer,
|
||||
z: integer
|
||||
) -> boolean
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns `true` if there is a cavern at the specified coordinates.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### Cavern.name
|
||||
---
|
||||
```lua
|
||||
Cavern.name : string
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Cavern.minY
|
||||
---
|
||||
```lua
|
||||
Cavern.minY : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Cavern.maxY
|
||||
---
|
||||
```lua
|
||||
Cavern.maxY : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Cavern.smoothDistance
|
||||
---
|
||||
```lua
|
||||
Cavern.smoothDistance : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Cavern.threshold
|
||||
---
|
||||
```lua
|
||||
Cavern.threshold : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
116
docs/docs/types/MapGen.CavernDef.md
Normal file
116
docs/docs/types/MapGen.CavernDef.md
Normal file
@@ -0,0 +1,116 @@
|
||||
# class CavernDef
|
||||
|
||||
|
||||
|
||||
- namespace: MapGen
|
||||
|
||||
|
||||
|
||||
Definition table for the `MapGen.Cavern`.
|
||||
|
||||
**Only for EmmyLua.**
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### CavernDef.minY
|
||||
---
|
||||
```lua
|
||||
CavernDef.minY : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### CavernDef.maxY
|
||||
---
|
||||
```lua
|
||||
CavernDef.maxY : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### CavernDef.noiseParams
|
||||
---
|
||||
```lua
|
||||
CavernDef.noiseParams : NoiseParams
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### CavernDef.smoothDistance
|
||||
---
|
||||
```lua
|
||||
CavernDef.smoothDistance : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### CavernDef.threshold
|
||||
---
|
||||
```lua
|
||||
CavernDef.threshold : number?
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### CavernDef.groups
|
||||
---
|
||||
```lua
|
||||
CavernDef.groups : table<string,number>?
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
43
docs/docs/types/MapGen.Decoration.md
Normal file
43
docs/docs/types/MapGen.Decoration.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# class Decoration
|
||||
|
||||
|
||||
|
||||
- namespace: MapGen
|
||||
|
||||
|
||||
|
||||
**NOT IMPLEMENTED**
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## methods
|
||||
---
|
||||
|
||||
### Decoration.new
|
||||
---
|
||||
```lua
|
||||
function Decoration.new() -> MapGen.Decoration {
|
||||
new = function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
16
docs/docs/types/MapGen.Layer.Category.md
Normal file
16
docs/docs/types/MapGen.Layer.Category.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# alias Category
|
||||
---
|
||||
|
||||
- namespace: MapGen.Layer
|
||||
|
||||
|
||||
|
||||
```lua
|
||||
(alias) Category = ("landscape"|"temp"|"humidity")
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
A category of noise that affects specific map generation objects.
|
||||
|
||||
678
docs/docs/types/MapGen.Layer.md
Normal file
678
docs/docs/types/MapGen.Layer.md
Normal file
@@ -0,0 +1,678 @@
|
||||
# class Layer
|
||||
|
||||
|
||||
|
||||
- namespace: MapGen
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## methods
|
||||
---
|
||||
|
||||
### Layer.calcTemp
|
||||
---
|
||||
```lua
|
||||
function Layer.calcTemp(
|
||||
self: MapGen.Layer {
|
||||
name = string,
|
||||
minY = integer,
|
||||
maxY = integer,
|
||||
minTemp = integer,
|
||||
maxTemp = integer,
|
||||
minHumidity = integer,
|
||||
maxHumidity = integer,
|
||||
waterLevel = integer,
|
||||
peaksList = { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] },
|
||||
noisesByColor = { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> },
|
||||
noisesParamsByColor = { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> },
|
||||
biomesByName = table<string,MapGen.Biome>,
|
||||
biomesList = MapGen.Biome[],
|
||||
biomesDiagram = table,
|
||||
biomesGorizontalScattering = integer,
|
||||
biomesVerticalScattering = integer,
|
||||
cavernsByName = table<string,MapGen.Cavern>,
|
||||
cavernsList = MapGen.Cavern[],
|
||||
trianglesList = { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] },
|
||||
tetrahedronsList = MapGen.Tetrahedron[],
|
||||
calcTemp = function,
|
||||
calcHumidity = function,
|
||||
new = function,
|
||||
addPeak = function,
|
||||
addNoiseParamsColor = function,
|
||||
getNoiseByColor = function,
|
||||
addBiome = function,
|
||||
addCavern = function,
|
||||
initNoises = function,
|
||||
initBiomesDiagram = function,
|
||||
},
|
||||
value: number,
|
||||
height: number
|
||||
)-> number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.calcHumidity
|
||||
---
|
||||
```lua
|
||||
function Layer.calcHumidity(
|
||||
self: MapGen.Layer {
|
||||
name = string,
|
||||
minY = integer,
|
||||
maxY = integer,
|
||||
minTemp = integer,
|
||||
maxTemp = integer,
|
||||
minHumidity = integer,
|
||||
maxHumidity = integer,
|
||||
waterLevel = integer,
|
||||
peaksList = { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] },
|
||||
noisesByColor = { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> },
|
||||
noisesParamsByColor = { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> },
|
||||
biomesByName = table<string,MapGen.Biome>,
|
||||
biomesList = MapGen.Biome[],
|
||||
biomesDiagram = table,
|
||||
biomesGorizontalScattering = integer,
|
||||
biomesVerticalScattering = integer,
|
||||
cavernsByName = table<string,MapGen.Cavern>,
|
||||
cavernsList = MapGen.Cavern[],
|
||||
trianglesList = { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] },
|
||||
tetrahedronsList = MapGen.Tetrahedron[],
|
||||
calcTemp = function,
|
||||
calcHumidity = function,
|
||||
new = function,
|
||||
addPeak = function,
|
||||
addNoiseParamsColor = function,
|
||||
getNoiseByColor = function,
|
||||
addBiome = function,
|
||||
addCavern = function,
|
||||
initNoises = function,
|
||||
initBiomesDiagram = function,
|
||||
},
|
||||
value: number,
|
||||
height: number
|
||||
)-> number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.new
|
||||
---
|
||||
```lua
|
||||
function Layer.new(
|
||||
name: string,
|
||||
def: MapGen.LayerDef {
|
||||
minY = number,
|
||||
maxY = number,
|
||||
minTemp = number,
|
||||
maxTemp = number,
|
||||
minHumidity = number,
|
||||
maxHumidity = number,
|
||||
waterLevel = number?,
|
||||
calcTemp = (fun(self: MapGen.Layer, value: number, height: number) -> number)?,
|
||||
calcHumidity = (fun(self: MapGen.Layer, value: number, height: number) -> number)?,
|
||||
biomesGorizontalScattering = number?,
|
||||
biomesVerticalScattering = number?,
|
||||
}
|
||||
) -> MapGen.Layer {
|
||||
name = string,
|
||||
minY = integer,
|
||||
maxY = integer,
|
||||
minTemp = integer,
|
||||
maxTemp = integer,
|
||||
minHumidity = integer,
|
||||
maxHumidity = integer,
|
||||
waterLevel = integer,
|
||||
peaksList = { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] },
|
||||
noisesByColor = { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> },
|
||||
noisesParamsByColor = { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> },
|
||||
biomesByName = table<string,MapGen.Biome>,
|
||||
biomesList = MapGen.Biome[],
|
||||
biomesDiagram = table,
|
||||
biomesGorizontalScattering = integer,
|
||||
biomesVerticalScattering = integer,
|
||||
cavernsByName = table<string,MapGen.Cavern>,
|
||||
cavernsList = MapGen.Cavern[],
|
||||
trianglesList = { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] },
|
||||
tetrahedronsList = MapGen.Tetrahedron[],
|
||||
calcTemp = function,
|
||||
calcHumidity = function,
|
||||
new = function,
|
||||
addPeak = function,
|
||||
addNoiseParamsColor = function,
|
||||
getNoiseByColor = function,
|
||||
addBiome = function,
|
||||
addCavern = function,
|
||||
initNoises = function,
|
||||
initBiomesDiagram = function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.addPeak
|
||||
---
|
||||
```lua
|
||||
function Layer.addPeak(
|
||||
category: MapGen.Layer.Category,
|
||||
peak: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
}
|
||||
) -> nil
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Adds a peak to the `Layer.peaksList`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.addNoiseParamsColor
|
||||
---
|
||||
```lua
|
||||
function Layer.addNoiseParamsColor(
|
||||
category: MapGen.Layer.Category,
|
||||
color: ColorString,
|
||||
noiseParams: NoiseParams
|
||||
) -> nil
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Adds a NoiseParams color to the `Layer.noisesParamsByColor`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.getNoiseByColor
|
||||
---
|
||||
```lua
|
||||
function Layer.getNoiseByColor(
|
||||
category: MapGen.Layer.Category,
|
||||
color: ColorString
|
||||
) -> ValueNoise
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns noise corresponding to a color.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.addBiome
|
||||
---
|
||||
```lua
|
||||
function Layer.addBiome(
|
||||
biomeName: string,
|
||||
biome: MapGen.Biome {
|
||||
name = string,
|
||||
tempPoint = number,
|
||||
humidityPoint = number,
|
||||
minY = number,
|
||||
maxY = number,
|
||||
groundNodes = MapGen.Biome.GroundNodes,
|
||||
groundNodesIDs = MapGen.Biome.GroundNodesIDs,
|
||||
soilHeight = number,
|
||||
generateAir = generateFunc,
|
||||
generateCavernAir = generateFunc,
|
||||
generateWater = generateFunc,
|
||||
generateRock = generateFunc,
|
||||
generateTurf = generateFunc,
|
||||
generateSoil = generateFunc,
|
||||
generateBottom = generateFunc,
|
||||
new = function,
|
||||
}
|
||||
) -> nil
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Adds a biome to the `Layer.biomesByName` & `Layer.biomesList`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.addCavern
|
||||
---
|
||||
```lua
|
||||
function Layer.addCavern(
|
||||
cavernName: string,
|
||||
cavern: MapGen.Cavern {
|
||||
name = string,
|
||||
minY = number,
|
||||
maxY = number,
|
||||
smoothDistance = number,
|
||||
threshold = number,
|
||||
getNoise = function,
|
||||
initNoise = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
isCavern = function,
|
||||
}
|
||||
) -> nil
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Adds a cavern to the `Layer.cavernsByName` & `Layer.cavernsList`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.initNoises
|
||||
---
|
||||
```lua
|
||||
function Layer.initNoises() -> nil
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Initializes noise for generation.
|
||||
|
||||
Should only be called after the mapgen object has been loaded.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.initBiomesDiagram
|
||||
---
|
||||
```lua
|
||||
function Layer.initBiomesDiagram() -> nil
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Initialization of the biome diagram using the Voronoi method.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### Layer.name
|
||||
---
|
||||
```lua
|
||||
Layer.name : string
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.minY
|
||||
---
|
||||
```lua
|
||||
Layer.minY : integer
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.maxY
|
||||
---
|
||||
```lua
|
||||
Layer.maxY : integer
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.minTemp
|
||||
---
|
||||
```lua
|
||||
Layer.minTemp : integer
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.maxTemp
|
||||
---
|
||||
```lua
|
||||
Layer.maxTemp : integer
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.minHumidity
|
||||
---
|
||||
```lua
|
||||
Layer.minHumidity : integer
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.maxHumidity
|
||||
---
|
||||
```lua
|
||||
Layer.maxHumidity : integer
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.waterLevel
|
||||
---
|
||||
```lua
|
||||
Layer.waterLevel : integer
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.peaksList
|
||||
---
|
||||
```lua
|
||||
Layer.peaksList : { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] }
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.noisesByColor
|
||||
---
|
||||
```lua
|
||||
Layer.noisesByColor : { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> }
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.noisesParamsByColor
|
||||
---
|
||||
```lua
|
||||
Layer.noisesParamsByColor : { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> }
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.biomesByName
|
||||
---
|
||||
```lua
|
||||
Layer.biomesByName : table<string,MapGen.Biome>
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.biomesList
|
||||
---
|
||||
```lua
|
||||
Layer.biomesList : MapGen.Biome[]
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.biomesDiagram
|
||||
---
|
||||
```lua
|
||||
Layer.biomesDiagram : table
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.biomesGorizontalScattering
|
||||
---
|
||||
```lua
|
||||
Layer.biomesGorizontalScattering : integer
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.biomesVerticalScattering
|
||||
---
|
||||
```lua
|
||||
Layer.biomesVerticalScattering : integer
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.cavernsByName
|
||||
---
|
||||
```lua
|
||||
Layer.cavernsByName : table<string,MapGen.Cavern>
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.cavernsList
|
||||
---
|
||||
```lua
|
||||
Layer.cavernsList : MapGen.Cavern[]
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.trianglesList
|
||||
---
|
||||
```lua
|
||||
Layer.trianglesList : { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] }
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Layer.tetrahedronsList
|
||||
---
|
||||
```lua
|
||||
Layer.tetrahedronsList : MapGen.Tetrahedron[]
|
||||
```
|
||||
|
||||
|
||||
|
||||
**Not supported**
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
191
docs/docs/types/MapGen.LayerDef.md
Normal file
191
docs/docs/types/MapGen.LayerDef.md
Normal file
@@ -0,0 +1,191 @@
|
||||
# class LayerDef
|
||||
|
||||
|
||||
|
||||
- namespace: MapGen
|
||||
|
||||
|
||||
|
||||
Definition table for the `MapGen.Layer`.
|
||||
|
||||
**Only for EmmyLua.**
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### LayerDef.minY
|
||||
---
|
||||
```lua
|
||||
LayerDef.minY : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### LayerDef.maxY
|
||||
---
|
||||
```lua
|
||||
LayerDef.maxY : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### LayerDef.minTemp
|
||||
---
|
||||
```lua
|
||||
LayerDef.minTemp : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### LayerDef.maxTemp
|
||||
---
|
||||
```lua
|
||||
LayerDef.maxTemp : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### LayerDef.minHumidity
|
||||
---
|
||||
```lua
|
||||
LayerDef.minHumidity : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### LayerDef.maxHumidity
|
||||
---
|
||||
```lua
|
||||
LayerDef.maxHumidity : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### LayerDef.waterLevel
|
||||
---
|
||||
```lua
|
||||
LayerDef.waterLevel : number?
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### LayerDef.calcTemp
|
||||
---
|
||||
```lua
|
||||
LayerDef.calcTemp : (fun(self: MapGen.Layer, value: number, height: number) -> number)?
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### LayerDef.calcHumidity
|
||||
---
|
||||
```lua
|
||||
LayerDef.calcHumidity : (fun(self: MapGen.Layer, value: number, height: number) -> number)?
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### LayerDef.biomesGorizontalScattering
|
||||
---
|
||||
```lua
|
||||
LayerDef.biomesGorizontalScattering : number?
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### LayerDef.biomesVerticalScattering
|
||||
---
|
||||
```lua
|
||||
LayerDef.biomesVerticalScattering : number?
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
14
docs/docs/types/MapGen.PastCalcNoiseValue.md
Normal file
14
docs/docs/types/MapGen.PastCalcNoiseValue.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# alias PastCalcNoiseValue
|
||||
---
|
||||
|
||||
- namespace: MapGen
|
||||
|
||||
|
||||
|
||||
```lua
|
||||
(alias) PastCalcNoiseValue = { noiseValue: number?, triangle: MapGen.Triangle?, x: integer?, z: integer? }
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
162
docs/docs/types/MapGen.Peak.md
Normal file
162
docs/docs/types/MapGen.Peak.md
Normal file
@@ -0,0 +1,162 @@
|
||||
# class Peak
|
||||
|
||||
|
||||
|
||||
- namespace: MapGen
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## methods
|
||||
---
|
||||
|
||||
### Peak.getPeakPos
|
||||
---
|
||||
```lua
|
||||
function Peak.getPeakPos(self)-> vector
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Peak.getColor
|
||||
---
|
||||
```lua
|
||||
function Peak.getColor(self)-> ColorString
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Peak.getGroups
|
||||
---
|
||||
```lua
|
||||
function Peak.getGroups(self)
|
||||
-> table<string,number>
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Peak.new
|
||||
---
|
||||
```lua
|
||||
function Peak.new(def: MapGen.PeakDef {
|
||||
pos = vector,
|
||||
color = ColorString,
|
||||
groups = table<string,number>?,
|
||||
}) -> MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Peak.toString
|
||||
---
|
||||
```lua
|
||||
function Peak.toString() -> string
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns a string describing the object in a readable form.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Peak.eq
|
||||
---
|
||||
```lua
|
||||
function Peak.eq(other: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
}) -> boolean
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns true if the peaks are equivalent.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### Peak.id
|
||||
---
|
||||
```lua
|
||||
Peak.id : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
71
docs/docs/types/MapGen.PeakDef.md
Normal file
71
docs/docs/types/MapGen.PeakDef.md
Normal file
@@ -0,0 +1,71 @@
|
||||
# class PeakDef
|
||||
|
||||
|
||||
|
||||
- namespace: MapGen
|
||||
|
||||
|
||||
|
||||
Definition table for the `MapGen.Peak`.
|
||||
|
||||
**Only for EmmyLua.**
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### PeakDef.pos
|
||||
---
|
||||
```lua
|
||||
PeakDef.pos : vector
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### PeakDef.color
|
||||
---
|
||||
```lua
|
||||
PeakDef.color : ColorString
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### PeakDef.groups
|
||||
---
|
||||
```lua
|
||||
PeakDef.groups : table<string,number>?
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
149
docs/docs/types/MapGen.StaticLayer.md
Normal file
149
docs/docs/types/MapGen.StaticLayer.md
Normal file
@@ -0,0 +1,149 @@
|
||||
# class StaticLayer
|
||||
|
||||
|
||||
|
||||
- namespace: MapGen
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## methods
|
||||
---
|
||||
|
||||
### StaticLayer.new
|
||||
---
|
||||
```lua
|
||||
function StaticLayer.new(
|
||||
name: string,
|
||||
def: MapGen.StaticLayerDef {
|
||||
minY = number,
|
||||
maxY = number,
|
||||
staticNode = string,
|
||||
generateStaticNode = generateFunc,
|
||||
}
|
||||
) -> MapGen.StaticLayer {
|
||||
name = string,
|
||||
minY = number,
|
||||
maxY = number,
|
||||
staticNode = string,
|
||||
staticNodeID = number,
|
||||
generateStaticNode = generateFunc,
|
||||
new = function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### StaticLayer.name
|
||||
---
|
||||
```lua
|
||||
StaticLayer.name : string
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### StaticLayer.minY
|
||||
---
|
||||
```lua
|
||||
StaticLayer.minY : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### StaticLayer.maxY
|
||||
---
|
||||
```lua
|
||||
StaticLayer.maxY : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### StaticLayer.staticNode
|
||||
---
|
||||
```lua
|
||||
StaticLayer.staticNode : string
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### StaticLayer.staticNodeID
|
||||
---
|
||||
```lua
|
||||
StaticLayer.staticNodeID : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### StaticLayer.generateStaticNode
|
||||
---
|
||||
```lua
|
||||
StaticLayer.generateStaticNode : generateFunc
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
86
docs/docs/types/MapGen.StaticLayerDef.md
Normal file
86
docs/docs/types/MapGen.StaticLayerDef.md
Normal file
@@ -0,0 +1,86 @@
|
||||
# class StaticLayerDef
|
||||
|
||||
|
||||
|
||||
- namespace: MapGen
|
||||
|
||||
|
||||
|
||||
Definition table for the `MapGen.StaticLayer`.
|
||||
|
||||
**Only for EmmyLua.**
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### StaticLayerDef.minY
|
||||
---
|
||||
```lua
|
||||
StaticLayerDef.minY : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### StaticLayerDef.maxY
|
||||
---
|
||||
```lua
|
||||
StaticLayerDef.maxY : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### StaticLayerDef.staticNode
|
||||
---
|
||||
```lua
|
||||
StaticLayerDef.staticNode : string
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### StaticLayerDef.generateStaticNode
|
||||
---
|
||||
```lua
|
||||
StaticLayerDef.generateStaticNode : generateFunc
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
541
docs/docs/types/MapGen.Tetrahedron.md
Normal file
541
docs/docs/types/MapGen.Tetrahedron.md
Normal file
@@ -0,0 +1,541 @@
|
||||
# class Tetrahedron
|
||||
|
||||
|
||||
|
||||
- namespace: MapGen
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## methods
|
||||
---
|
||||
|
||||
### Tetrahedron.new
|
||||
---
|
||||
```lua
|
||||
function Tetrahedron.new(
|
||||
p1: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
},
|
||||
p2: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
},
|
||||
p3: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
},
|
||||
p4: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
}
|
||||
) -> MapGen.Tetrahedron {
|
||||
p1 = MapGen.Peak,
|
||||
p2 = MapGen.Peak,
|
||||
p3 = MapGen.Peak,
|
||||
p4 = MapGen.Peak,
|
||||
h1 = MapGen.Triangulation.Edge,
|
||||
h2 = MapGen.Triangulation.Edge,
|
||||
h3 = MapGen.Triangulation.Edge,
|
||||
h4 = MapGen.Triangulation.Edge,
|
||||
f1 = MapGen.Triangle,
|
||||
f2 = MapGen.Triangle,
|
||||
f3 = MapGen.Triangle,
|
||||
f4 = MapGen.Triangle,
|
||||
new = function,
|
||||
toString = function,
|
||||
getHeight = function,
|
||||
getCircumSphereCenter = function,
|
||||
getCircumSphereRadius = function,
|
||||
inCircumSphere = function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.toString
|
||||
---
|
||||
```lua
|
||||
function Tetrahedron.toString() -> string
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns a string describing the object in a readable form.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.getHeight
|
||||
---
|
||||
```lua
|
||||
function Tetrahedron.getHeight(
|
||||
p1: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
},
|
||||
p2: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
},
|
||||
p3: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
},
|
||||
p4: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
}
|
||||
) -> MapGen.Triangulation.Edge?
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.getCircumSphereCenter
|
||||
---
|
||||
```lua
|
||||
function Tetrahedron.getCircumSphereCenter() -> vector
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns the center of the circumscribed sphere.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.getCircumSphereRadius
|
||||
---
|
||||
```lua
|
||||
function Tetrahedron.getCircumSphereRadius() -> number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns the radius of the circumscribed sphere.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.inCircumSphere
|
||||
---
|
||||
```lua
|
||||
function Tetrahedron.inCircumSphere(p: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
}) -> boolean
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Checks whether a given point lies within the circumscribed sphere of a tetrahedron.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### Tetrahedron.p1
|
||||
---
|
||||
```lua
|
||||
Tetrahedron.p1 : MapGen.Peak {
|
||||
id: number,
|
||||
getPeakPos: function,
|
||||
getColor: function,
|
||||
getGroups: function,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.p2
|
||||
---
|
||||
```lua
|
||||
Tetrahedron.p2 : MapGen.Peak {
|
||||
id: number,
|
||||
getPeakPos: function,
|
||||
getColor: function,
|
||||
getGroups: function,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.p3
|
||||
---
|
||||
```lua
|
||||
Tetrahedron.p3 : MapGen.Peak {
|
||||
id: number,
|
||||
getPeakPos: function,
|
||||
getColor: function,
|
||||
getGroups: function,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.p4
|
||||
---
|
||||
```lua
|
||||
Tetrahedron.p4 : MapGen.Peak {
|
||||
id: number,
|
||||
getPeakPos: function,
|
||||
getColor: function,
|
||||
getGroups: function,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.h1
|
||||
---
|
||||
```lua
|
||||
Tetrahedron.h1 : MapGen.Triangulation.Edge {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
same: function,
|
||||
length: function,
|
||||
getMidPoint: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.h2
|
||||
---
|
||||
```lua
|
||||
Tetrahedron.h2 : MapGen.Triangulation.Edge {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
same: function,
|
||||
length: function,
|
||||
getMidPoint: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.h3
|
||||
---
|
||||
```lua
|
||||
Tetrahedron.h3 : MapGen.Triangulation.Edge {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
same: function,
|
||||
length: function,
|
||||
getMidPoint: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.h4
|
||||
---
|
||||
```lua
|
||||
Tetrahedron.h4 : MapGen.Triangulation.Edge {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
same: function,
|
||||
length: function,
|
||||
getMidPoint: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.f1
|
||||
---
|
||||
```lua
|
||||
Tetrahedron.f1 : MapGen.Triangle {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
p3: MapGen.Peak,
|
||||
e1: MapGen.Triangulation.Edge,
|
||||
e2: MapGen.Triangulation.Edge,
|
||||
e3: MapGen.Triangulation.Edge,
|
||||
h1: MapGen.Triangulation.Edge,
|
||||
h2: MapGen.Triangulation.Edge,
|
||||
h3: MapGen.Triangulation.Edge,
|
||||
neighbours: MapGen.Triangle.Neighbours,
|
||||
color: ColorString?,
|
||||
new: function,
|
||||
...(+13)
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.f2
|
||||
---
|
||||
```lua
|
||||
Tetrahedron.f2 : MapGen.Triangle {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
p3: MapGen.Peak,
|
||||
e1: MapGen.Triangulation.Edge,
|
||||
e2: MapGen.Triangulation.Edge,
|
||||
e3: MapGen.Triangulation.Edge,
|
||||
h1: MapGen.Triangulation.Edge,
|
||||
h2: MapGen.Triangulation.Edge,
|
||||
h3: MapGen.Triangulation.Edge,
|
||||
neighbours: MapGen.Triangle.Neighbours,
|
||||
color: ColorString?,
|
||||
new: function,
|
||||
...(+13)
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.f3
|
||||
---
|
||||
```lua
|
||||
Tetrahedron.f3 : MapGen.Triangle {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
p3: MapGen.Peak,
|
||||
e1: MapGen.Triangulation.Edge,
|
||||
e2: MapGen.Triangulation.Edge,
|
||||
e3: MapGen.Triangulation.Edge,
|
||||
h1: MapGen.Triangulation.Edge,
|
||||
h2: MapGen.Triangulation.Edge,
|
||||
h3: MapGen.Triangulation.Edge,
|
||||
neighbours: MapGen.Triangle.Neighbours,
|
||||
color: ColorString?,
|
||||
new: function,
|
||||
...(+13)
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Tetrahedron.f4
|
||||
---
|
||||
```lua
|
||||
Tetrahedron.f4 : MapGen.Triangle {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
p3: MapGen.Peak,
|
||||
e1: MapGen.Triangulation.Edge,
|
||||
e2: MapGen.Triangulation.Edge,
|
||||
e3: MapGen.Triangulation.Edge,
|
||||
h1: MapGen.Triangulation.Edge,
|
||||
h2: MapGen.Triangulation.Edge,
|
||||
h3: MapGen.Triangulation.Edge,
|
||||
neighbours: MapGen.Triangle.Neighbours,
|
||||
color: ColorString?,
|
||||
new: function,
|
||||
...(+13)
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
14
docs/docs/types/MapGen.Triangle.CircumCircleEnum.md
Normal file
14
docs/docs/types/MapGen.Triangle.CircumCircleEnum.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# alias CircumCircleEnum
|
||||
---
|
||||
|
||||
- namespace: MapGen.Triangle
|
||||
|
||||
|
||||
|
||||
```lua
|
||||
(alias) CircumCircleEnum = ("IN"|"BEHIND"|"ON")
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
19
docs/docs/types/MapGen.Triangle.Neighbours.md
Normal file
19
docs/docs/types/MapGen.Triangle.Neighbours.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# alias Neighbours
|
||||
---
|
||||
|
||||
- namespace: MapGen.Triangle
|
||||
|
||||
|
||||
|
||||
```lua
|
||||
(alias) Neighbours = { t1: MapGen.Triangle?, t2: MapGen.Triangle?, t3: MapGen.Triangle? }
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
Adjacent triangles:
|
||||
* `t1` with a common side p1-p2
|
||||
* `t2` with a common side p2-p3
|
||||
* `t3` with a common side p3-p1
|
||||
|
||||
750
docs/docs/types/MapGen.Triangle.md
Normal file
750
docs/docs/types/MapGen.Triangle.md
Normal file
@@ -0,0 +1,750 @@
|
||||
# class Triangle
|
||||
|
||||
|
||||
|
||||
- namespace: MapGen
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## methods
|
||||
---
|
||||
|
||||
### Triangle.new
|
||||
---
|
||||
```lua
|
||||
function Triangle.new(
|
||||
p1: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
},
|
||||
p2: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
},
|
||||
p3: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
}
|
||||
) -> MapGen.Triangle {
|
||||
p1 = MapGen.Peak,
|
||||
p2 = MapGen.Peak,
|
||||
p3 = MapGen.Peak,
|
||||
e1 = MapGen.Triangulation.Edge,
|
||||
e2 = MapGen.Triangulation.Edge,
|
||||
e3 = MapGen.Triangulation.Edge,
|
||||
h1 = MapGen.Triangulation.Edge,
|
||||
h2 = MapGen.Triangulation.Edge,
|
||||
h3 = MapGen.Triangulation.Edge,
|
||||
neighbours = MapGen.Triangle.Neighbours,
|
||||
color = ColorString?,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
same = function,
|
||||
getCenter = function,
|
||||
getArea = function,
|
||||
getHeight = function,
|
||||
getHeight2D = function,
|
||||
getSidesLength = function,
|
||||
getSidesLength2D = function,
|
||||
getCircumCenter2D = function,
|
||||
getCircumRadius2D = function,
|
||||
getCircumCircle2D = function,
|
||||
inCircumCircle2D = function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.toString
|
||||
---
|
||||
```lua
|
||||
function Triangle.toString() -> string
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns a string describing the object in a readable form.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.eq
|
||||
---
|
||||
```lua
|
||||
function Triangle.eq(other: MapGen.Triangle {
|
||||
p1 = MapGen.Peak,
|
||||
p2 = MapGen.Peak,
|
||||
p3 = MapGen.Peak,
|
||||
e1 = MapGen.Triangulation.Edge,
|
||||
e2 = MapGen.Triangulation.Edge,
|
||||
e3 = MapGen.Triangulation.Edge,
|
||||
h1 = MapGen.Triangulation.Edge,
|
||||
h2 = MapGen.Triangulation.Edge,
|
||||
h3 = MapGen.Triangulation.Edge,
|
||||
neighbours = MapGen.Triangle.Neighbours,
|
||||
color = ColorString?,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
same = function,
|
||||
getCenter = function,
|
||||
getArea = function,
|
||||
getHeight = function,
|
||||
getHeight2D = function,
|
||||
getSidesLength = function,
|
||||
getSidesLength2D = function,
|
||||
getCircumCenter2D = function,
|
||||
getCircumRadius2D = function,
|
||||
getCircumCircle2D = function,
|
||||
inCircumCircle2D = function,
|
||||
}) -> boolean
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns true if the triangles are equivalent.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.same
|
||||
---
|
||||
```lua
|
||||
function Triangle.same(other: MapGen.Triangle {
|
||||
p1 = MapGen.Peak,
|
||||
p2 = MapGen.Peak,
|
||||
p3 = MapGen.Peak,
|
||||
e1 = MapGen.Triangulation.Edge,
|
||||
e2 = MapGen.Triangulation.Edge,
|
||||
e3 = MapGen.Triangulation.Edge,
|
||||
h1 = MapGen.Triangulation.Edge,
|
||||
h2 = MapGen.Triangulation.Edge,
|
||||
h3 = MapGen.Triangulation.Edge,
|
||||
neighbours = MapGen.Triangle.Neighbours,
|
||||
color = ColorString?,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
same = function,
|
||||
getCenter = function,
|
||||
getArea = function,
|
||||
getHeight = function,
|
||||
getHeight2D = function,
|
||||
getSidesLength = function,
|
||||
getSidesLength2D = function,
|
||||
getCircumCenter2D = function,
|
||||
getCircumRadius2D = function,
|
||||
getCircumCircle2D = function,
|
||||
inCircumCircle2D = function,
|
||||
}) -> boolean
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns true if the triangles are similar.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.getCenter
|
||||
---
|
||||
```lua
|
||||
function Triangle.getCenter() -> vector
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns the coordinates of the triangle's center.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.getArea
|
||||
---
|
||||
```lua
|
||||
function Triangle.getArea() -> number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns the area of a triangle.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.getHeight
|
||||
---
|
||||
```lua
|
||||
function Triangle.getHeight(
|
||||
p1: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
},
|
||||
p2: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
},
|
||||
p3: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
}
|
||||
) -> MapGen.Triangulation.Edge {
|
||||
p1 = MapGen.Peak,
|
||||
p2 = MapGen.Peak,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
same = function,
|
||||
length = function,
|
||||
getMidPoint = function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns the perpendicular from the vertex Peak1 to the line Peak2-Peak3.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.getHeight2D
|
||||
---
|
||||
```lua
|
||||
function Triangle.getHeight2D(
|
||||
p1: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
},
|
||||
p2: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
},
|
||||
p3: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
}
|
||||
) -> MapGen.Triangulation.Edge {
|
||||
p1 = MapGen.Peak,
|
||||
p2 = MapGen.Peak,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
same = function,
|
||||
length = function,
|
||||
getMidPoint = function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns the perpendicular from the vertex Peak1 to the line Peak2-Peak3.
|
||||
|
||||
Note: This function does not take into account the Y-coordinate,
|
||||
that is, the calculation is performed on the projection of the triangle XZ.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.getSidesLength
|
||||
---
|
||||
```lua
|
||||
function Triangle.getSidesLength()
|
||||
-> number
|
||||
-> number
|
||||
-> number
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns the length of the edges
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.getSidesLength2D
|
||||
---
|
||||
```lua
|
||||
function Triangle.getSidesLength2D()
|
||||
-> number
|
||||
-> number
|
||||
-> number
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns the length of the edges.
|
||||
|
||||
Note: This function does not take into account the Y-coordinate,
|
||||
that is, the calculation is performed on the projection of the triangle XZ.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.getCircumCenter2D
|
||||
---
|
||||
```lua
|
||||
function Triangle.getCircumCenter2D() -> vector
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns the coordinates of the circumcircle center.
|
||||
|
||||
Note: This function does not take into account the Y-coordinate,
|
||||
that is, the calculation is performed on the projection of the triangle XZ.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.getCircumRadius2D
|
||||
---
|
||||
```lua
|
||||
function Triangle.getCircumRadius2D() -> number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns the radius of the circumcircle.
|
||||
|
||||
Note: This function does not take into account the Y-coordinate,
|
||||
that is, the calculation is performed on the projection of the triangle XZ.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.getCircumCircle2D
|
||||
---
|
||||
```lua
|
||||
function Triangle.getCircumCircle2D()
|
||||
-> vector
|
||||
-> number
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns the coordinates of the circumcircle center and its radius.
|
||||
|
||||
Note: This function does not take into account the Y-coordinate,
|
||||
that is, the calculation is performed on the projection of the triangle XZ.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.inCircumCircle2D
|
||||
---
|
||||
```lua
|
||||
function Triangle.inCircumCircle2D(p: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
}) -> boolean
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Checks if a given point lies into the triangle circumcircle.
|
||||
|
||||
Note: This function does not take into account the Y-coordinate,
|
||||
that is, the calculation is performed on the projection of the triangle XZ.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### Triangle.p1
|
||||
---
|
||||
```lua
|
||||
Triangle.p1 : MapGen.Peak {
|
||||
id: number,
|
||||
getPeakPos: function,
|
||||
getColor: function,
|
||||
getGroups: function,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.p2
|
||||
---
|
||||
```lua
|
||||
Triangle.p2 : MapGen.Peak {
|
||||
id: number,
|
||||
getPeakPos: function,
|
||||
getColor: function,
|
||||
getGroups: function,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.p3
|
||||
---
|
||||
```lua
|
||||
Triangle.p3 : MapGen.Peak {
|
||||
id: number,
|
||||
getPeakPos: function,
|
||||
getColor: function,
|
||||
getGroups: function,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.e1
|
||||
---
|
||||
```lua
|
||||
Triangle.e1 : MapGen.Triangulation.Edge {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
same: function,
|
||||
length: function,
|
||||
getMidPoint: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.e2
|
||||
---
|
||||
```lua
|
||||
Triangle.e2 : MapGen.Triangulation.Edge {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
same: function,
|
||||
length: function,
|
||||
getMidPoint: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.e3
|
||||
---
|
||||
```lua
|
||||
Triangle.e3 : MapGen.Triangulation.Edge {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
same: function,
|
||||
length: function,
|
||||
getMidPoint: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.h1
|
||||
---
|
||||
```lua
|
||||
Triangle.h1 : MapGen.Triangulation.Edge {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
same: function,
|
||||
length: function,
|
||||
getMidPoint: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.h2
|
||||
---
|
||||
```lua
|
||||
Triangle.h2 : MapGen.Triangulation.Edge {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
same: function,
|
||||
length: function,
|
||||
getMidPoint: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.h3
|
||||
---
|
||||
```lua
|
||||
Triangle.h3 : MapGen.Triangulation.Edge {
|
||||
p1: MapGen.Peak,
|
||||
p2: MapGen.Peak,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
same: function,
|
||||
length: function,
|
||||
getMidPoint: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.neighbours
|
||||
---
|
||||
```lua
|
||||
Triangle.neighbours : MapGen.Triangle.Neighbours
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangle.color
|
||||
---
|
||||
```lua
|
||||
Triangle.color : ColorString?
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
230
docs/docs/types/MapGen.Triangulation.Edge.md
Normal file
230
docs/docs/types/MapGen.Triangulation.Edge.md
Normal file
@@ -0,0 +1,230 @@
|
||||
# class Edge
|
||||
|
||||
|
||||
|
||||
- namespace: MapGen.Triangulation
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## methods
|
||||
---
|
||||
|
||||
### Edge.new
|
||||
---
|
||||
```lua
|
||||
function Edge.new(
|
||||
p1: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
},
|
||||
p2: MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
}
|
||||
) -> MapGen.Triangulation.Edge {
|
||||
p1 = MapGen.Peak,
|
||||
p2 = MapGen.Peak,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
same = function,
|
||||
length = function,
|
||||
getMidPoint = function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Edge.toString
|
||||
---
|
||||
```lua
|
||||
function Edge.toString() -> string
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns a string describing the object in a readable form.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Edge.eq
|
||||
---
|
||||
```lua
|
||||
function Edge.eq(other: MapGen.Triangulation.Edge {
|
||||
p1 = MapGen.Peak,
|
||||
p2 = MapGen.Peak,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
same = function,
|
||||
length = function,
|
||||
getMidPoint = function,
|
||||
}) -> boolean
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns true if the edges are equivalent.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Edge.same
|
||||
---
|
||||
```lua
|
||||
function Edge.same(other: MapGen.Triangulation.Edge {
|
||||
p1 = MapGen.Peak,
|
||||
p2 = MapGen.Peak,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
same = function,
|
||||
length = function,
|
||||
getMidPoint = function,
|
||||
}) -> boolean
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns true if the edges are similar.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Edge.length
|
||||
---
|
||||
```lua
|
||||
function Edge.length() -> number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns the length of an edge.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Edge.getMidPoint
|
||||
---
|
||||
```lua
|
||||
function Edge.getMidPoint() -> vector
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns the vector of the point located in the middle of the edge.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### Edge.p1
|
||||
---
|
||||
```lua
|
||||
Edge.p1 : MapGen.Peak {
|
||||
id: number,
|
||||
getPeakPos: function,
|
||||
getColor: function,
|
||||
getGroups: function,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Edge.p2
|
||||
---
|
||||
```lua
|
||||
Edge.p2 : MapGen.Peak {
|
||||
id: number,
|
||||
getPeakPos: function,
|
||||
getColor: function,
|
||||
getGroups: function,
|
||||
new: function,
|
||||
toString: function,
|
||||
eq: function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
90
docs/docs/types/MapGen.Triangulation.FakePeak.md
Normal file
90
docs/docs/types/MapGen.Triangulation.FakePeak.md
Normal file
@@ -0,0 +1,90 @@
|
||||
# class FakePeak
|
||||
|
||||
|
||||
- supers: MapGen.Peak
|
||||
|
||||
|
||||
- namespace: MapGen.Triangulation
|
||||
|
||||
|
||||
|
||||
Allows you to create a `MapGen.Peak` without specifying a noise parameter.
|
||||
|
||||
**WARNING: MUST NOT BE PARTICIPATED IN GENERATION**
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## methods
|
||||
---
|
||||
|
||||
### FakePeak.getPeakPos
|
||||
---
|
||||
```lua
|
||||
function FakePeak.getPeakPos()-> vector
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### FakePeak.new
|
||||
---
|
||||
```lua
|
||||
function FakePeak.new(peakPos: vector) -> MapGen.Peak {
|
||||
id = number,
|
||||
getPeakPos = function,
|
||||
getColor = function,
|
||||
getGroups = function,
|
||||
new = function,
|
||||
toString = function,
|
||||
eq = function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Returns a fake `MapGen.Peak` that has no noise parameters.
|
||||
Note that the initialized peak should not be used in generation.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### FakePeak.id
|
||||
---
|
||||
```lua
|
||||
FakePeak.id : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
86
docs/docs/types/MapGen.Triangulation.md
Normal file
86
docs/docs/types/MapGen.Triangulation.md
Normal file
@@ -0,0 +1,86 @@
|
||||
# class Triangulation
|
||||
|
||||
|
||||
|
||||
- namespace: MapGen
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## methods
|
||||
---
|
||||
|
||||
### Triangulation.triangulate
|
||||
---
|
||||
```lua
|
||||
function Triangulation.triangulate(vertices: table<integer,MapGen.Peak>) -> ((MapGen.Triangle)|MapGen.Triangle[])
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
The Delaunay method divides a plane into triangles based on a list of their vertices.
|
||||
|
||||
Doesn't take into account the Y coordinate of the vertices.
|
||||
That is, all triangles that don't lie in the XZ plane will be projected onto it.
|
||||
|
||||
Vertices that do not have a `is2d` group will not participate in the triangulation.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Triangulation.tetrahedralize
|
||||
---
|
||||
```lua
|
||||
function Triangulation.tetrahedralize(vertices: table<integer,MapGen.Peak>) -> ((MapGen.Tetrahedron)|MapGen.Tetrahedron[])
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
The Delaunay method divides space into tetrahedra based on a list of their vertices.
|
||||
|
||||
Vertices that do not have a `is3d` group will not participate in the triangulation.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### Triangulation.convexMultiplier
|
||||
---
|
||||
```lua
|
||||
Triangulation.convexMultiplier : number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
741
docs/docs/types/MapGen.md
Normal file
741
docs/docs/types/MapGen.md
Normal file
@@ -0,0 +1,741 @@
|
||||
# class MapGen
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## methods
|
||||
---
|
||||
|
||||
### MapGen.new
|
||||
---
|
||||
```lua
|
||||
function MapGen.new(def: MapGenDef {
|
||||
nodes = table<string,string>,
|
||||
}) -> MapGen {
|
||||
layersByName = table<string,MapGen.Layer>,
|
||||
layersList = MapGen.Layer[],
|
||||
staticsByName = table<string,MapGen.StaticLayer>,
|
||||
staticsList = MapGen.StaticLayer[],
|
||||
layersNoisesInitialized = boolean,
|
||||
cavernsNoiseInitialized = boolean,
|
||||
isRunning = boolean,
|
||||
nodeIDs = table<string,number>,
|
||||
new = function,
|
||||
getLayerByHeight = function,
|
||||
getStaticByHeight = function,
|
||||
registerLayer = function,
|
||||
registerLayerNoiseColor = function,
|
||||
registerStaticLayer = function,
|
||||
registerPeak = function,
|
||||
register2DPeak = function,
|
||||
register2DPeaks = function,
|
||||
register2DPeaksFromFile = function,
|
||||
registerBiome = function,
|
||||
registerCavern = function,
|
||||
initLayersTriangultaion = function,
|
||||
initLayersNoises = function,
|
||||
initBiomesDiagram = function,
|
||||
initCavernsNoise = function,
|
||||
getNoises2dValue = function,
|
||||
onMapGenerated = function,
|
||||
run = function,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.getLayerByHeight
|
||||
---
|
||||
```lua
|
||||
function MapGen.getLayerByHeight(yPos: number) -> MapGen.Layer?
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Determines which layer a node belongs to based on its height coordinate.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.getStaticByHeight
|
||||
---
|
||||
```lua
|
||||
function MapGen.getStaticByHeight(yPos: number) -> MapGen.StaticLayer?
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Determines which statics layer a node belongs to based on its height coordinate.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.registerLayer
|
||||
---
|
||||
```lua
|
||||
function MapGen.registerLayer(
|
||||
name: string,
|
||||
def: MapGen.LayerDef {
|
||||
minY = number,
|
||||
maxY = number,
|
||||
minTemp = number,
|
||||
maxTemp = number,
|
||||
minHumidity = number,
|
||||
maxHumidity = number,
|
||||
waterLevel = number?,
|
||||
calcTemp = (fun(self: MapGen.Layer, value: number, height: number) -> number)?,
|
||||
calcHumidity = (fun(self: MapGen.Layer, value: number, height: number) -> number)?,
|
||||
biomesGorizontalScattering = number?,
|
||||
biomesVerticalScattering = number?,
|
||||
}
|
||||
) -> nil
|
||||
```
|
||||
@param `name` - The name that will be assigned to the layer. The name must be unique for each layer.
|
||||
|
||||
@param `def` - Layer description table, see details `MapGen.LayerDef`.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Mark the world area between two heights as a `MapGen.Layer`.
|
||||
|
||||
Note: layers must not overlap.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.registerLayerNoiseColor
|
||||
---
|
||||
```lua
|
||||
function MapGen.registerLayerNoiseColor(
|
||||
layerName: string,
|
||||
category: MapGen.Layer.Category,
|
||||
color: ColorString,
|
||||
noiseParams: NoiseParams
|
||||
) -> nil
|
||||
```
|
||||
@param `layerName` - The name of the layer for which the color will be registered.
|
||||
|
||||
@param `category` - Category indicating what will be generated by noise.
|
||||
|
||||
@param `color` - Noise color. Must be unique.
|
||||
|
||||
@param `noiseParams` - Fractal noise parameters.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Register the color and the noise parameters that correspond to it.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.registerStaticLayer
|
||||
---
|
||||
```lua
|
||||
function MapGen.registerStaticLayer(
|
||||
name: string,
|
||||
def: MapGen.StaticLayerDef {
|
||||
minY = number,
|
||||
maxY = number,
|
||||
staticNode = string,
|
||||
generateStaticNode = generateFunc,
|
||||
}
|
||||
) -> nil
|
||||
```
|
||||
@param `name` - The name that will be assigned to the static layer. The name must be unique for each layer.
|
||||
|
||||
@param `def` - Static layer description table, see details `MapGen.StaticLayerDef`.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Mark the world area between two heights as a `MapGen.StaticLayer`.
|
||||
|
||||
Note: layers must not overlap.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.registerPeak
|
||||
---
|
||||
```lua
|
||||
function MapGen.registerPeak(
|
||||
layerName: string,
|
||||
category: MapGen.Layer.Category,
|
||||
def: MapGen.PeakDef {
|
||||
pos = vector,
|
||||
color = ColorString,
|
||||
groups = table<string,number>?,
|
||||
}
|
||||
) -> nil
|
||||
```
|
||||
@param `layerName` - The name of the layer in which the new peak will be included.
|
||||
|
||||
@param `category` - Category indicating what will be generated by peak.
|
||||
|
||||
@param `def` - Peak description table, see details `MapGen.PeakDef`.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Mark a world point as `MapGen.Peak` and assign it a specific color that will affect the generation.
|
||||
|
||||
Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.register2DPeak
|
||||
---
|
||||
```lua
|
||||
function MapGen.register2DPeak(
|
||||
layerName: string,
|
||||
category: MapGen.Layer.Category,
|
||||
def: MapGen.PeakDef {
|
||||
pos = vector,
|
||||
color = ColorString,
|
||||
groups = table<string,number>?,
|
||||
}
|
||||
) -> nil
|
||||
```
|
||||
@param `layerName` - The name of the layer in which the new peak will be included.
|
||||
|
||||
@param `category` - Category indicating what will be generated by peak.
|
||||
|
||||
@param `def` - Peak description table, see details `MapGen.PeakDef`.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Mark a world point as `MapGen.Peak` and assign it a specific color that will affect the generation.
|
||||
The Y coordinate will be forced to zero, and the `is2d` group will be added to the groups field.
|
||||
|
||||
Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.register2DPeaks
|
||||
---
|
||||
```lua
|
||||
function MapGen.register2DPeaks(
|
||||
layerName: string,
|
||||
category: MapGen.Layer.Category,
|
||||
defs: MapGen.PeakDef[]
|
||||
) -> nil
|
||||
```
|
||||
@param `layerName` - The name of the layer in which the new peaks will be included.
|
||||
|
||||
@param `category` - Category indicating what will be generated by peaks.
|
||||
|
||||
@param `defs` - Peaks description table, see details `MapGen.PeakDef`.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Mark the world points as `MapGen.Peak` and assign them all a specific noise that will affect generation.
|
||||
The Y coordinate will be forced to zero, and the `is2d` group will be added to the groups field.
|
||||
|
||||
Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.register2DPeaksFromFile
|
||||
---
|
||||
```lua
|
||||
function MapGen.register2DPeaksFromFile(
|
||||
layerName: string,
|
||||
map: string,
|
||||
scale: number,
|
||||
zeroPos: Position2d,
|
||||
category: MapGen.Layer.Category,
|
||||
groups: table<string,number>?
|
||||
) -> nil
|
||||
```
|
||||
@param `layerName` - The name of the layer in which the new peaks will be included.
|
||||
|
||||
@param `map` - The name of the image from which the peaks will be extracted. It should be located in the `<mod_name>/textures/maps` folder and have the following format `<image_name>.ff`
|
||||
|
||||
@param `scale` - Multiplier of how many blocks (nodes) will be between image pixels. It is not recommended to set the value below 50 for performance reasons.
|
||||
|
||||
@param `zeroPos` - The position in pixels where the zero world coordinate will be in the image.
|
||||
|
||||
@param `category` - Category indicating what will be generated by peaks.
|
||||
|
||||
@param `groups` - Groups that will be added to all peaks.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Extract the `MapGen.Peak` from the image and assign them all a specific color that will affect the generation.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.registerBiome
|
||||
---
|
||||
```lua
|
||||
function MapGen.registerBiome(
|
||||
layerName: string,
|
||||
biomeName: string,
|
||||
def: MapGen.BiomeDef {
|
||||
tempPoint = number,
|
||||
humidityPoint = number,
|
||||
minY = number,
|
||||
maxY = number,
|
||||
groundNodes = MapGen.Biome.GroundNodes,
|
||||
soilHeight = number,
|
||||
generateAir = generateFunc?,
|
||||
generateCavernAir = generateFunc?,
|
||||
generateWater = generateFunc?,
|
||||
generateRock = generateFunc?,
|
||||
generateTurf = generateFunc?,
|
||||
generateSoil = generateFunc?,
|
||||
generateBottom = generateFunc?,
|
||||
}
|
||||
) -> nil
|
||||
```
|
||||
@param `layerName` - The name of the layer in which the new biome will be included.
|
||||
|
||||
@param `biomeName` - The name to be assigned to the biome. The name must be unique for each biome.
|
||||
|
||||
@param `def` - Biome description table, see details `MapGen.BiomeDef`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Mark a point on the biomes diagram and constrain the world area by height to mark it as `MapGen.Biome`.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.registerCavern
|
||||
---
|
||||
```lua
|
||||
function MapGen.registerCavern(
|
||||
layerName: string,
|
||||
cavernName: string,
|
||||
def: MapGen.CavernDef {
|
||||
minY = number,
|
||||
maxY = number,
|
||||
noiseParams = NoiseParams,
|
||||
smoothDistance = number,
|
||||
threshold = number?,
|
||||
groups = table<string,number>?,
|
||||
}
|
||||
) -> nil
|
||||
```
|
||||
@param `layerName` - The name of the layer in which the new cavern will be included.
|
||||
|
||||
@param `cavernName` - The name to be assigned to the cavern. The name must be unique for each cavern.
|
||||
|
||||
@param `def` - Cavern description table, see details `MapGen.CavernDef`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Mark the world area between two heights as a `MapGen.Cavern` and assign the noise that the cave will be generated from.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.initLayersTriangultaion
|
||||
---
|
||||
```lua
|
||||
function MapGen.initLayersTriangultaion() -> nil
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Divide all layers into triangles whose vertices are the `Mapgen.Peak` belonging to these layers.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.initLayersNoises
|
||||
---
|
||||
```lua
|
||||
function MapGen.initLayersNoises() -> nil
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Initialize all layer noises. This should be called after the map object is loaded.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.initBiomesDiagram
|
||||
---
|
||||
```lua
|
||||
function MapGen.initBiomesDiagram() -> nil
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Initialization of the biome diagram using the Voronoi method.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.initCavernsNoise
|
||||
---
|
||||
```lua
|
||||
function MapGen.initCavernsNoise() -> nil
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Initialize caverns's noises. This should be called after the map object is loaded.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.getNoises2dValue
|
||||
---
|
||||
```lua
|
||||
function MapGen.getNoises2dValue(
|
||||
category: MapGen.Layer.Category,
|
||||
layer: MapGen.Layer {
|
||||
name = string,
|
||||
minY = integer,
|
||||
maxY = integer,
|
||||
minTemp = integer,
|
||||
maxTemp = integer,
|
||||
minHumidity = integer,
|
||||
maxHumidity = integer,
|
||||
waterLevel = integer,
|
||||
peaksList = { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] },
|
||||
noisesByColor = { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> },
|
||||
noisesParamsByColor = { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> },
|
||||
biomesByName = table<string,MapGen.Biome>,
|
||||
biomesList = MapGen.Biome[],
|
||||
biomesDiagram = table,
|
||||
biomesGorizontalScattering = integer,
|
||||
biomesVerticalScattering = integer,
|
||||
cavernsByName = table<string,MapGen.Cavern>,
|
||||
cavernsList = MapGen.Cavern[],
|
||||
trianglesList = { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] },
|
||||
tetrahedronsList = MapGen.Tetrahedron[],
|
||||
calcTemp = function,
|
||||
calcHumidity = function,
|
||||
new = function,
|
||||
addPeak = function,
|
||||
addNoiseParamsColor = function,
|
||||
getNoiseByColor = function,
|
||||
addBiome = function,
|
||||
addCavern = function,
|
||||
initNoises = function,
|
||||
initBiomesDiagram = function,
|
||||
},
|
||||
x: integer,
|
||||
y: integer,
|
||||
z: integer
|
||||
) -> number?
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Calculates a smoothed 2D noise value based on a preliminary space partitioning.
|
||||
|
||||
Returns `nil` if the point is not included in any triangle.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.onMapGenerated
|
||||
---
|
||||
```lua
|
||||
function MapGen.onMapGenerated(
|
||||
voxelManip: VoxelManip,
|
||||
minPos: Position,
|
||||
maxPos: Position,
|
||||
blockseed: number
|
||||
) -> nil
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Chunk generation handler.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.run
|
||||
---
|
||||
```lua
|
||||
function MapGen.run() -> nil
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Run world generation through this mapgen object
|
||||
|
||||
Note: only one instance of a `MapGen` class can be running.
|
||||
|
||||
**FOR MAPGEN ENVIRONMENT ONLY**
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### MapGen.layersByName
|
||||
---
|
||||
```lua
|
||||
MapGen.layersByName : table<string,MapGen.Layer>
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.layersList
|
||||
---
|
||||
```lua
|
||||
MapGen.layersList : MapGen.Layer[]
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.staticsByName
|
||||
---
|
||||
```lua
|
||||
MapGen.staticsByName : table<string,MapGen.StaticLayer>
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.staticsList
|
||||
---
|
||||
```lua
|
||||
MapGen.staticsList : MapGen.StaticLayer[]
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.layersNoisesInitialized
|
||||
---
|
||||
```lua
|
||||
MapGen.layersNoisesInitialized : boolean
|
||||
```
|
||||
|
||||
|
||||
|
||||
Is the fractal noise of the layer initialized? This is necessary for a one-time noise initialization.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.cavernsNoiseInitialized
|
||||
---
|
||||
```lua
|
||||
MapGen.cavernsNoiseInitialized : boolean
|
||||
```
|
||||
|
||||
|
||||
|
||||
Is the fractal noise of the caverns initialized? This is necessary for a one-time noise initialization.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.isRunning
|
||||
---
|
||||
```lua
|
||||
MapGen.isRunning : boolean
|
||||
```
|
||||
|
||||
|
||||
|
||||
A static field that guarantees that only one instance of the `MapGen` class will work.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### MapGen.nodeIDs
|
||||
---
|
||||
```lua
|
||||
MapGen.nodeIDs : table<string,number>
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
39
docs/docs/types/MapGenDef.md
Normal file
39
docs/docs/types/MapGenDef.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# class MapGenDef
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Definition table for the `MapGen`.
|
||||
|
||||
**Only for EmmyLua.**
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
## fields
|
||||
---
|
||||
|
||||
### MapGenDef.nodes
|
||||
---
|
||||
```lua
|
||||
MapGenDef.nodes : table<string,string>
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
12
docs/docs/types/generateFunc.md
Normal file
12
docs/docs/types/generateFunc.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# alias generateFunc
|
||||
---
|
||||
|
||||
|
||||
|
||||
```lua
|
||||
(alias) generateFunc = fun(self, mapGenerator: MapGen, data: number[], index: number, x: number, y: number, z: number)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
80
docs/mkdocs.yml
Normal file
80
docs/mkdocs.yml
Normal file
@@ -0,0 +1,80 @@
|
||||
|
||||
site_name: Docs
|
||||
|
||||
|
||||
theme:
|
||||
name: material
|
||||
font:
|
||||
text: Roboto
|
||||
code: Roboto Mono
|
||||
search: true
|
||||
features:
|
||||
- quick-links
|
||||
- navigation
|
||||
- search
|
||||
- toc
|
||||
- fullscreen
|
||||
- bookmarks
|
||||
- tabs
|
||||
- code
|
||||
- edit-on-github
|
||||
- language-selector
|
||||
- code
|
||||
- cover
|
||||
- footer
|
||||
- social-share
|
||||
- theme-switcher
|
||||
nav:
|
||||
- Home: index.md
|
||||
|
||||
- Types:
|
||||
- alias Category : types/MapGen.Layer.Category.md
|
||||
- alias CircumCircleEnum : types/MapGen.Triangle.CircumCircleEnum.md
|
||||
- alias ColoredDotsTable : types/ColoredDotsTable.md
|
||||
- alias Neighbours : types/MapGen.Triangle.Neighbours.md
|
||||
- alias PastCalcNoiseValue : types/MapGen.PastCalcNoiseValue.md
|
||||
- alias generateFunc : types/generateFunc.md
|
||||
- class Biome : types/MapGen.Biome.md
|
||||
- class BiomeDef : types/MapGen.BiomeDef.md
|
||||
- class Cavern : types/MapGen.Cavern.md
|
||||
- class CavernDef : types/MapGen.CavernDef.md
|
||||
- class Decoration : types/MapGen.Decoration.md
|
||||
- class Edge : types/MapGen.Triangulation.Edge.md
|
||||
- class FakePeak : types/MapGen.Triangulation.FakePeak.md
|
||||
- class GroundNodes : types/MapGen.Biome.GroundNodes.md
|
||||
- class GroundNodesIDs : types/MapGen.Biome.GroundNodesIDs.md
|
||||
- class Layer : types/MapGen.Layer.md
|
||||
- class LayerDef : types/MapGen.LayerDef.md
|
||||
- class MapGen : types/MapGen.md
|
||||
- class MapGenDef : types/MapGenDef.md
|
||||
- class Peak : types/MapGen.Peak.md
|
||||
- class PeakDef : types/MapGen.PeakDef.md
|
||||
- class StaticLayer : types/MapGen.StaticLayer.md
|
||||
- class StaticLayerDef : types/MapGen.StaticLayerDef.md
|
||||
- class Tetrahedron : types/MapGen.Tetrahedron.md
|
||||
- class Triangle : types/MapGen.Triangle.md
|
||||
- class Triangulation : types/MapGen.Triangulation.md
|
||||
|
||||
|
||||
|
||||
- Modules:
|
||||
- MapGen : modules/MapGen.md
|
||||
- MapGen.Biome : modules/MapGen.Biome.md
|
||||
- MapGen.Biome.GroundNodes : modules/MapGen.Biome.GroundNodes.md
|
||||
- MapGen.Biome.GroundNodesIds : modules/MapGen.Biome.GroundNodesIds.md
|
||||
- MapGen.Cavern : modules/MapGen.Cavern.md
|
||||
- MapGen.Decoration : modules/MapGen.Decoration.md
|
||||
- MapGen.Layer : modules/MapGen.Layer.md
|
||||
- MapGen.Peak : modules/MapGen.Peak.md
|
||||
- MapGen.StaticLayer : modules/MapGen.StaticLayer.md
|
||||
- MapGen.Tetrahedron : modules/MapGen.Tetrahedron.md
|
||||
- MapGen.Triangle : modules/MapGen.Triangle.md
|
||||
- MapGen.Triangulation : modules/MapGen.Triangulation.md
|
||||
- MapGen.Triangulation.Edge : modules/MapGen.Triangulation.Edge.md
|
||||
- MapGen.Triangulation.FakePeak : modules/MapGen.Triangulation.FakePeak.md
|
||||
- MapGen.ff2luat : modules/MapGen.ff2luat.md
|
||||
|
||||
|
||||
|
||||
extra:
|
||||
footer: ""
|
||||
@@ -1,4 +0,0 @@
|
||||
local modInfo = Mod.getInfo('smc__api__api_loader')
|
||||
local require = modInfo.require
|
||||
|
||||
require('Api')
|
||||
@@ -1,3 +0,0 @@
|
||||
name = smc__api__api_loader
|
||||
description = Include this mod in your `depends` to ensure all necessary APIs are loaded for your mod
|
||||
depends = smc__api__ensure, smc__api__math, smc__api__mod, smc__api__require, smc__api__table, smc__api__string, smc__api__utf8, smc__api__class
|
||||
@@ -1,6 +0,0 @@
|
||||
Api = {}
|
||||
|
||||
local modInfo = Mod.getInfo('smc__api__api_loader')
|
||||
local require = modInfo.require
|
||||
|
||||
require('Api.globalStep')
|
||||
@@ -1,9 +0,0 @@
|
||||
---@class Class
|
||||
Class = {}
|
||||
|
||||
---Returns a child class with inherited parameters from the parent class.
|
||||
---@param parent table
|
||||
---@param child table
|
||||
function Class.extend(parent ,child)
|
||||
return setmetatable(child or {}, { __index = parent })
|
||||
end
|
||||
@@ -1 +0,0 @@
|
||||
name = smc__api__class
|
||||
@@ -1 +0,0 @@
|
||||
name = smc__api__ensure
|
||||
@@ -1,2 +0,0 @@
|
||||
name = smc__api__events
|
||||
depends = smc__api__table
|
||||
@@ -1 +0,0 @@
|
||||
name = smc__api__logger
|
||||
@@ -1 +0,0 @@
|
||||
name = smc__api__math
|
||||
@@ -1 +0,0 @@
|
||||
name = smc__api__mod
|
||||
@@ -1 +0,0 @@
|
||||
name = smc__api__require
|
||||
@@ -1,2 +0,0 @@
|
||||
name = smc__api__string
|
||||
depends = smc__api__ensure
|
||||
@@ -1,2 +0,0 @@
|
||||
name = smc__api__table
|
||||
depends = smc__api__ensure
|
||||
Submodule mods/API/Utf8 deleted from d612fc127f
0
mods/API/Utf8/init.lua
Normal file
0
mods/API/Utf8/init.lua
Normal file
@@ -1 +0,0 @@
|
||||
name = smc__api
|
||||
@@ -1,2 +1,2 @@
|
||||
name = smc__core__control
|
||||
depends = smc__api__api_loader
|
||||
depends = smc__system__system_loader
|
||||
|
||||
@@ -80,7 +80,7 @@ core.register_on_leaveplayer(function(player, timed_out)
|
||||
playersControlTimer[playerName] = nil
|
||||
end)
|
||||
|
||||
Api.registerGlobalStepForEachPlayer(0, function(deltaTime, player)
|
||||
Smc.registerGlobalStepForEachPlayer(0, function(deltaTime, player)
|
||||
if player == nil then
|
||||
return
|
||||
end
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
name = smc__core__craft_system
|
||||
depends = smc__api__api_loader
|
||||
depends = smc__system__system_loader
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
name = smc__core__formspec
|
||||
depends = smc__api__api_loader
|
||||
depends = smc__system__system_loader
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,2 +1,2 @@
|
||||
name = smc__core__item
|
||||
depends = smc__api__api_loader, smc__core__item_factory
|
||||
depends = smc__system__system_loader, smc__core__item_factory
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
local getInstance = Class.getInstance
|
||||
|
||||
local modInfo = Mod.getInfo('smc__core__item')
|
||||
local require = modInfo.require
|
||||
|
||||
@@ -96,7 +98,7 @@ function Item:new(itemDef)
|
||||
itemDef = defMerge(itemDef, self.defaultDef, true)
|
||||
|
||||
---@type Item
|
||||
local instance = setmetatable({}, {__index = self})
|
||||
local instance = getInstance(self, {})
|
||||
|
||||
local luantiDef = itemDefToLuantiDef(itemDef)
|
||||
local visual = itemDef.settings.visual
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
name = smc__core__item_factory
|
||||
depends = smc__api__api_loader
|
||||
depends = smc__system__system_loader
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
local getInstance = Class.getInstance
|
||||
|
||||
---@class ItemFactory
|
||||
---@field defaultDef Item.ItemDefinition|Node.NodeDefinition
|
||||
---@field itemClass Item|Node
|
||||
@@ -8,10 +10,10 @@ local ItemFactory = {}
|
||||
---@return ItemFactory
|
||||
function ItemFactory:new(itemClass, defaultDef)
|
||||
---@type ItemFactory
|
||||
local instance = setmetatable({
|
||||
local instance =getInstance(self, {
|
||||
defaultDef = defaultDef,
|
||||
itemClass = itemClass,
|
||||
}, {__index = self})
|
||||
})
|
||||
|
||||
return instance
|
||||
end
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
name = smc__core__map_gen
|
||||
depends = smc__api__api_loader
|
||||
depends = smc__system__system_loader
|
||||
@@ -1,26 +1,20 @@
|
||||
local mathAbs, mathRound, mathMin, mathMax, id
|
||||
= math.abs, math.round, math.min, math.max, core.get_content_id
|
||||
|
||||
local pastNoise2DCalc = {
|
||||
---@type MapGen.Triangle?
|
||||
triangle = nil,
|
||||
---@type number?
|
||||
x = nil,
|
||||
---@type number?
|
||||
y = nil,
|
||||
noiseValues = {
|
||||
---@type number?
|
||||
height = nil,
|
||||
---@type number?
|
||||
humidity = nil,
|
||||
---@type number?
|
||||
temp = nil,
|
||||
}
|
||||
}
|
||||
local getInstance = Class.getInstance
|
||||
|
||||
local modInfo = Mod.getInfo('smc__core__map_gen')
|
||||
local require = modInfo.require
|
||||
|
||||
---@alias MapGen.PastCalcNoiseValue {triangle:MapGen.Triangle?, x:integer?, z:integer?, noiseValue:number?}
|
||||
|
||||
---@type table<MapGen.Layer.Category, MapGen.PastCalcNoiseValue>
|
||||
local pastNoise2DCalc = {
|
||||
landscape = {},
|
||||
temp = {},
|
||||
humidity = {}
|
||||
}
|
||||
|
||||
---@type MapGen.Layer
|
||||
local Layer = require('MapGen.Layer')
|
||||
|
||||
@@ -39,30 +33,35 @@ local Triangulation = require('MapGen.Triangulation')
|
||||
---@type MapGen.Cavern
|
||||
local Cavern = require('MapGen.Cavern')
|
||||
|
||||
---@type MapGen.Region
|
||||
local Region = require('MapGen.Region')
|
||||
|
||||
local ff2luat = require('MapGen.ff2luat')
|
||||
|
||||
---@class MapGen
|
||||
---@field layersByName table<string, MapGen.Layer>
|
||||
---@field layersList MapGen.Layer[]
|
||||
---@field staticsByName table<string, MapGen.StaticLayer>
|
||||
---@field staticsList MapGen.StaticLayer[]
|
||||
---@field peaksMultinoiseInitialized boolean Is the fractal noise of the peaks initialized? This is necessary for a one-time noise initialization.
|
||||
---@field cavernsNoiseInitialized boolean Is the fractal noise of the caverns initialized? This is necessary for a one-time noise initialization.
|
||||
---@field isRunning boolean A static field that guarantees that only one instance of the `MapGen` class will work.
|
||||
---@field nodeIDs table<string, number>
|
||||
---@field layersByName table<string, MapGen.Layer>
|
||||
---@field layersList MapGen.Layer[]
|
||||
---@field staticsByName table<string, MapGen.StaticLayer>
|
||||
---@field staticsList MapGen.StaticLayer[]
|
||||
---@field isLayersNoisesInitialized boolean Is the fractal noise of the layer initialized? This is necessary for a one-time noise initialization.
|
||||
---@field isCavernsNoiseInitialized boolean Is the fractal noise of the caverns initialized? This is necessary for a one-time noise initialization.
|
||||
---@field isRunning boolean A static field that guarantees that only one instance of the `MapGen` class will work.
|
||||
---@field nodeIDs table<string, number>
|
||||
local MapGen = {
|
||||
layersByName = {},
|
||||
layersList = {},
|
||||
staticsByName = {},
|
||||
staticsList = {},
|
||||
peaksMultinoiseInitialized = false,
|
||||
cavernsNoiseInitialized = false,
|
||||
isRunning = false,
|
||||
isLayersNoisesInitialized = false,
|
||||
isCavernsNoiseInitialized = false,
|
||||
isRunning = false,
|
||||
}
|
||||
|
||||
---Definition table for the `MapGen`.
|
||||
---
|
||||
---**Only for EmmyLua.**
|
||||
---@class MapGenDef
|
||||
---@field nodes table<string, string>
|
||||
---@field nodes table<string, string>
|
||||
|
||||
---@param def MapGenDef
|
||||
---@return MapGen
|
||||
@@ -74,14 +73,25 @@ function MapGen:new(def)
|
||||
end
|
||||
|
||||
---@type MapGen
|
||||
local instance = setmetatable({
|
||||
nodes = def.nodes,
|
||||
nodeIDs = nodesIDs,
|
||||
}, {__index = self})
|
||||
local instance = getInstance(self, {
|
||||
nodes = def.nodes,
|
||||
nodeIDs = nodesIDs,
|
||||
})
|
||||
|
||||
return instance
|
||||
end
|
||||
|
||||
---Returns a layer by name. If such a layer does not exist, an error will be raised.
|
||||
---@param layerName string The name of the layer to be retrieved.
|
||||
---@return MapGen.Layer
|
||||
function MapGen:getLayerByName(layerName)
|
||||
local layer = self.layersByName[layerName]
|
||||
|
||||
assert(layer ~= nil, ('There is no layer named `%s` registered.'):format(layerName))
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
---Determines which layer a node belongs to based on its height coordinate.
|
||||
---@param yPos number
|
||||
---@return MapGen.Layer?
|
||||
@@ -120,6 +130,229 @@ function MapGen:getStaticByHeight(yPos)
|
||||
end
|
||||
end
|
||||
|
||||
---Returns the `MapGen.Peak` at the coordinates. If there is no peak at these coordinates, it returns `nil`.
|
||||
---@param layer string|MapGen.Layer The layer or name of the layer in which the peak is located.
|
||||
---@param category MapGen.Layer.Category The category in which the peak is located.
|
||||
---@param pos Position Coordinate of the desired peak.
|
||||
---@return MapGen.Peak?
|
||||
function MapGen:getPeakByPos(layer, category, pos)
|
||||
if type(layer) == 'string' then
|
||||
local layerName = layer
|
||||
layer = self:getLayerByName(layerName)
|
||||
end
|
||||
|
||||
return layer:getPeakByPos(category, pos)
|
||||
end
|
||||
|
||||
---Returns `true` if the point is within the triangle's region.
|
||||
---The barycentric coordinate method is used.
|
||||
---@param px integer
|
||||
---@param pz integer
|
||||
---@param triangle MapGen.Triangle
|
||||
local function pointInTriangle2D(px, pz, triangle)
|
||||
local posP = vector.new(px, 0, pz)
|
||||
local pos1 = triangle.p1.getPeakPos()
|
||||
local pos2 = triangle.p2.getPeakPos()
|
||||
local pos3 = triangle.p3.getPeakPos()
|
||||
|
||||
local v0 = pos3 - pos1
|
||||
local v1 = pos2 - pos1
|
||||
local v2 = posP - pos1
|
||||
|
||||
local dot00 = vector.dot(v0, v0)
|
||||
local dot01 = vector.dot(v0, v1)
|
||||
local dot02 = vector.dot(v0, v2)
|
||||
local dot11 = vector.dot(v1, v1)
|
||||
local dot12 = vector.dot(v1, v2)
|
||||
|
||||
local invDenom = 1 / (dot00 * dot11 - dot01 * dot01)
|
||||
local u = (dot11 * dot02 - dot01 * dot12) * invDenom
|
||||
local v = (dot00 * dot12 - dot01 * dot02) * invDenom
|
||||
|
||||
return (u >= 0) and (v >= 0) and (u + v <= 1)
|
||||
end
|
||||
|
||||
---Returns the `MapGen.Triangle` at the coordinates. If there is no triangle at these coordinates, it returns `nil`.
|
||||
---
|
||||
---**Important:** works only in the XZ plane.
|
||||
---@param layer string|MapGen.Layer The layer or name of the layer the triangle is in.
|
||||
---@param category MapGen.Layer.Category The category in which the triangle is in.
|
||||
---@param pos Position Coordinate of the desired peak.
|
||||
---@return MapGen.Triangle?
|
||||
function MapGen:getTriangleByPos2D(layer, category, pos)
|
||||
if type(layer) == 'string' then
|
||||
local layerName = layer
|
||||
layer = self:getLayerByName(layerName)
|
||||
end
|
||||
|
||||
for _, triangle in ipairs(layer.trianglesList[category]) do
|
||||
if pointInTriangle2D(pos.x, pos.z, triangle) then
|
||||
return triangle
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---Checks if a point is inside a region.
|
||||
---If the point is inside the region, it will also return the distance to the nearest border.
|
||||
---@param layer MapGen.Layer The name of the layer in which the region is located.
|
||||
---@param regionName string The name of the region in which the location of the point is checked.
|
||||
---@param point Position Point position.
|
||||
---@return boolean, number?
|
||||
function MapGen:pointInRegion2D(layer, regionName, point)
|
||||
local region = layer.regionsByName[regionName]
|
||||
|
||||
assert(layer ~= nil, ('There is no region named `%s` registered.'):format(regionName))
|
||||
|
||||
return region:pointInRegion(point)
|
||||
end
|
||||
|
||||
---Returns `true` if there is a cavern at the specified coordinates.
|
||||
---@param layer MapGen.Layer
|
||||
---@param x integer
|
||||
---@param y integer
|
||||
---@param z integer
|
||||
---@return boolean
|
||||
function MapGen:isCavern(layer, x, y, z)
|
||||
for _, cavern in ipairs(layer.cavernsList) do
|
||||
if cavern.isRegional then
|
||||
local inRegion, distance = self:pointInRegion2D(layer, cavern.name, {x=x,y=y,z=z})
|
||||
|
||||
if inRegion and distance ~= nil then
|
||||
if cavern:isCavern(x, y, z, distance) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
else
|
||||
if cavern:isLayeredCavern(x, y, z) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
---Creates a unique key for a vertex (using X and Z coordinates).
|
||||
---@param peak MapGen.Peak
|
||||
---@return string
|
||||
local function vertexKey(peak)
|
||||
local pos = peak:getPeakPos()
|
||||
|
||||
return string.format("%.6f,%.6f", pos.x, pos.z)
|
||||
end
|
||||
|
||||
---Creates a canonical (sorted) key for an edge.
|
||||
---@param edge MapGen.Triangulation.Edge
|
||||
---@return string
|
||||
local function edgeKey(edge)
|
||||
local k1 = vertexKey(edge.p1)
|
||||
local k2 = vertexKey(edge.p2)
|
||||
|
||||
if k1 < k2 then
|
||||
return k1 .. "|" .. k2
|
||||
else
|
||||
return k2 .. "|" .. k1
|
||||
end
|
||||
end
|
||||
|
||||
---Calculates the outer boundary of a triangulated region.
|
||||
---Works on the XZ horizontal plane.
|
||||
---@param triangles MapGen.Triangle[]
|
||||
---@return table
|
||||
function MapGen:getTriangulateBoundaryVertices(triangles)
|
||||
-- Count how many triangles share each edge
|
||||
local edgeCount = {}
|
||||
---@type table<string, MapGen.Triangulation.Edge>
|
||||
local edgeData = {}
|
||||
|
||||
for _, triangle in ipairs(triangles) do
|
||||
local edges = {
|
||||
triangle.e1,
|
||||
triangle.e2,
|
||||
triangle.e3
|
||||
}
|
||||
|
||||
for _, edge in ipairs(edges) do
|
||||
local key = edgeKey(edge)
|
||||
|
||||
edgeCount[key] = (edgeCount[key] or 0) + 1
|
||||
edgeData[key] = edge
|
||||
end
|
||||
end
|
||||
|
||||
-- Boundary edges belong to exactly ONE triangle
|
||||
---@type MapGen.Triangulation.Edge[]
|
||||
local boundaryEdges = {}
|
||||
|
||||
for key, count in pairs(edgeCount) do
|
||||
if count == 1 then
|
||||
table.insert(boundaryEdges, edgeData[key])
|
||||
end
|
||||
end
|
||||
|
||||
if #boundaryEdges == 0 then
|
||||
return {}
|
||||
end
|
||||
|
||||
-- Build adjacency list for boundary vertices
|
||||
---@type table<string, MapGen.Peak>
|
||||
local adjacency = {}
|
||||
---@type table<string, MapGen.Peak>
|
||||
local vertexData = {}
|
||||
|
||||
for _, edge in ipairs(boundaryEdges) do
|
||||
local k1 = vertexKey(edge.p1)
|
||||
local k2 = vertexKey(edge.p2)
|
||||
|
||||
vertexData[k1] = edge.p1
|
||||
vertexData[k2] = edge.p2
|
||||
|
||||
adjacency[k1] = adjacency[k1] or {}
|
||||
adjacency[k2] = adjacency[k2] or {}
|
||||
|
||||
table.insert(adjacency[k1], k2)
|
||||
table.insert(adjacency[k2], k1)
|
||||
end
|
||||
|
||||
-- Walk along boundary edges to create ordered vertex list
|
||||
---@type Position[]
|
||||
local boundary = {}
|
||||
---@type table<string, boolean>
|
||||
local visited = {}
|
||||
|
||||
if boundaryEdges[1] == nil then
|
||||
error()
|
||||
end
|
||||
|
||||
---@type string?
|
||||
local currentKey = vertexKey(boundaryEdges[1].p1)
|
||||
|
||||
while currentKey and not visited[currentKey] do
|
||||
visited[currentKey] = true
|
||||
local pos = vertexData[currentKey]:getPeakPos()
|
||||
|
||||
table.insert(boundary, {
|
||||
x = pos.x,
|
||||
y = 0,
|
||||
z = pos.z
|
||||
})
|
||||
|
||||
-- Move to next unvisited neighbor
|
||||
local nextKey = nil
|
||||
|
||||
for _, neighborKey in ipairs(adjacency[currentKey] or {}) do
|
||||
if not visited[neighborKey] then
|
||||
nextKey = neighborKey
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
currentKey = nextKey
|
||||
end
|
||||
|
||||
return boundary
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- --- REGISTRATION METHODS ---
|
||||
@@ -128,7 +361,7 @@ end
|
||||
---
|
||||
---Note: layers must not overlap.
|
||||
---@param name string The name that will be assigned to the layer. The name must be unique for each layer.
|
||||
---@param def MapGen.LayerDef Layer description table, see details `MapGen.LayerDef`
|
||||
---@param def MapGen.LayerDef Layer description table, see details `MapGen.LayerDef`.
|
||||
function MapGen:registerLayer(name, def)
|
||||
-- Layers with the same name cannot exist.
|
||||
assert(self.layersByName[name] == nil, ('A layer named `%s` is already registered.'):format(name))
|
||||
@@ -148,11 +381,22 @@ function MapGen:registerLayer(name, def)
|
||||
end)
|
||||
end
|
||||
|
||||
---Register the color and the noise parameters that correspond to it.
|
||||
---@param layerName string The name of the layer for which the color will be registered.
|
||||
---@param category MapGen.Layer.Category Category indicating what will be generated by noise.
|
||||
---@param color ColorString Noise color. Must be unique.
|
||||
---@param noiseParams NoiseParams Fractal noise parameters.
|
||||
function MapGen:registerLayerNoiseColor(layerName, category, color, noiseParams)
|
||||
local layer = self:getLayerByName(layerName)
|
||||
|
||||
layer:addNoiseParamsColor(category, color, noiseParams)
|
||||
end
|
||||
|
||||
---Mark the world area between two heights as a `MapGen.StaticLayer`.
|
||||
---
|
||||
---Note: layers must not overlap.
|
||||
---@param name string The name that will be assigned to the static layer. The name must be unique for each layer.
|
||||
---@param def MapGen.StaticLayerDef Static layer description table, see details `MapGen.StaticLayerDef`
|
||||
---@param name string The name that will be assigned to the static layer. The name must be unique for each layer.
|
||||
---@param def MapGen.StaticLayerDef Static layer description table, see details `MapGen.StaticLayerDef`.
|
||||
function MapGen:registerStaticLayer(name, def)
|
||||
-- Static layer with the same name cannot exist.
|
||||
assert(self.staticsByName[name] == nil, ('A static layer named `%s` is already registered.'):format(name))
|
||||
@@ -172,74 +416,126 @@ function MapGen:registerStaticLayer(name, def)
|
||||
end)
|
||||
end
|
||||
|
||||
---Mark a world point as `MapGen.Peak` and assign it a specific noise that will affect the generation.
|
||||
---Mark a world point as `MapGen.Peak` and assign it a specific color that will affect the generation.
|
||||
---
|
||||
---Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
||||
---@param layerName string The name of the layer in which the new peak will be included.
|
||||
---@param peakPos vector The coordinate where the peak will be placed.
|
||||
---@param multinoise MapGen.Peak.MultinoiseParams Noise that will be assigned to the peak and that will influence map generation
|
||||
---@param groups table<string, number>? Peak groups that may affect processing.
|
||||
function MapGen:registerPeak(layerName, peakPos, multinoise, groups)
|
||||
---@type MapGen.Layer
|
||||
local layer = self.layersByName[layerName]
|
||||
---Note: The peaks shouldn't overlap.
|
||||
---@param layerName string The name of the layer in which the new peak will be included.
|
||||
---@param category MapGen.Layer.Category Category indicating what will be generated by peak.
|
||||
---@param def MapGen.PeakDef Peak description table, see details `MapGen.PeakDef`.
|
||||
function MapGen:registerPeak(layerName, category, def)
|
||||
local layer = self:getLayerByName(layerName)
|
||||
|
||||
assert(layer ~= nil, ('There is no layer named `%s` registered.'):format(layerName))
|
||||
|
||||
if not layer then
|
||||
error('Invalid layer: ' .. layerName)
|
||||
end
|
||||
|
||||
--TODO: добавить проверку, что координата пиков не совпадают
|
||||
--assert(self:getPeakByPos(layer, category, def.pos) == nil,
|
||||
--('In the `%s` layer in the `%s` category there is already a peak with coordinates: %s, %s, %s.'):format(
|
||||
-- layerName, category, def.pos.x, def.pos.y, def.pos.z))
|
||||
|
||||
---@type MapGen.Peak
|
||||
local peak = Peak:new(peakPos, multinoise, groups)
|
||||
local peak = Peak:new(def)
|
||||
|
||||
layer:addPeak(peak)
|
||||
layer:addPeak(category, peak)
|
||||
end
|
||||
|
||||
---Mark a world point as `MapGen.Peak` and assign it a specific noise that will affect the generation.
|
||||
---Mark a world point as `MapGen.Peak` and assign it a specific color that will affect the generation.
|
||||
---The Y coordinate will be forced to zero, and the `is2d` group will be added to the groups field.
|
||||
---
|
||||
---Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
||||
---@param layerName string The name of the layer in which the new peak will be included.
|
||||
---@param peakPos vector The coordinate where the peak will be placed.
|
||||
---@param multinoise MapGen.Peak.MultinoiseParams Noise that will be assigned to the peak and that will influence map generation.
|
||||
---@param groups table<string, number>? Peak groups that may affect processing.
|
||||
function MapGen:register2DPeak(layerName, peakPos, multinoise, groups)
|
||||
local _peakPos = table.copy_with_metatables(peakPos)
|
||||
_peakPos.y = 0
|
||||
---Note: The peaks shouldn't overlap.
|
||||
---@param layerName string The name of the layer in which the new peak will be included.
|
||||
---@param category MapGen.Layer.Category Category indicating what will be generated by peak.
|
||||
---@param def MapGen.PeakDef Peak description table, see details `MapGen.PeakDef`.
|
||||
function MapGen:register2DPeak(layerName, category, def)
|
||||
def = table.copy_with_metatables(def)
|
||||
|
||||
if groups == nil then
|
||||
groups = {is2d = 1}
|
||||
def.pos.y = 0
|
||||
|
||||
if def.groups == nil then
|
||||
def.groups = {is2d = 1}
|
||||
else
|
||||
groups.is2d = 1
|
||||
def.groups.is2d = 1
|
||||
end
|
||||
|
||||
self:registerPeak(layerName, _peakPos, multinoise, groups)
|
||||
self:registerPeak(layerName, category, def)
|
||||
end
|
||||
|
||||
---Mark the world points as `MapGen.Peak` and assign them all a specific noise that will affect generation.
|
||||
---The Y coordinate will be forced to zero, and the `is2d` group will be added to the groups field.
|
||||
---
|
||||
---Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
||||
---@param layerName string The name of the layer in which the new peaks will be included.
|
||||
---@param multinoise MapGen.Peak.MultinoiseParams The noise that will be assigned to each peak and will affect the map generation.
|
||||
---@param peakPoses vector[] Set the coordinates where the peaks will be placed.
|
||||
---@param groups table<string, number>? Peak groups that may affect processing.
|
||||
function MapGen:register2DPeaks(layerName, multinoise, peakPoses, groups)
|
||||
for _, peakPos in ipairs(peakPoses) do
|
||||
self:register2DPeak(layerName, peakPos, multinoise, groups)
|
||||
---Note: The peaks shouldn't overlap.
|
||||
---@param layerName string The name of the layer in which the new peaks will be included.
|
||||
---@param category MapGen.Layer.Category Category indicating what will be generated by peaks.
|
||||
---@param defs MapGen.PeakDef[] Peaks description table, see details `MapGen.PeakDef`.
|
||||
function MapGen:register2DPeaks(layerName,category, defs)
|
||||
for _, def in ipairs(defs) do
|
||||
self:register2DPeak(layerName, category, def)
|
||||
end
|
||||
end
|
||||
|
||||
---Extract the `MapGen.Peak` from the image and assign them all a specific color that will affect the generation.
|
||||
---@param layerName string The name of the layer in which the new peaks will be included.
|
||||
---@param map string The name of the image from which the peaks will be extracted. It should be located in the `<mod_name>/textures/maps` folder and have the following format `<image_name>.ff`
|
||||
---@param scale number Multiplier of how many blocks (nodes) will be between image pixels. It is not recommended to set the value below 50 for performance reasons.
|
||||
---@param zeroPos Position2d The position in pixels where the zero world coordinate will be in the image.
|
||||
---@param category MapGen.Layer.Category Category indicating what will be generated by peaks.
|
||||
---@param groups? table<string, number> Groups that will be added to all peaks.
|
||||
function MapGen:register2DPeaksFromFile(layerName, map, scale,zeroPos, category, groups)
|
||||
if scale < 2 then
|
||||
error('The map scale should not be less than 2.')
|
||||
end
|
||||
|
||||
local modPath = core.get_modpath(core.get_current_modname())
|
||||
local peaks = ff2luat(modPath .. '/textures/maps/' .. map)
|
||||
|
||||
---@type {h:integer, w:integer}
|
||||
local mapSize = peaks.size
|
||||
peaks.size = nil
|
||||
|
||||
zeroPos.x = zeroPos.x + mathRound(mapSize.w/2)
|
||||
zeroPos.y = zeroPos.y + mathRound(mapSize.h/2)
|
||||
|
||||
local x, z
|
||||
|
||||
for color, peaksPos in pairs(peaks) do
|
||||
for _, peakPos in ipairs(peaksPos) do
|
||||
x, z = (peakPos.x - zeroPos.x - 1) * scale, (peakPos.y - zeroPos.y - 1) * -scale
|
||||
|
||||
-- Converting a rectangular grid into an isometric-like one.
|
||||
if peakPos.y % 2 == 1 then
|
||||
x = x + (scale/2)
|
||||
end
|
||||
|
||||
---@type MapGen.PeakDef
|
||||
local def = {
|
||||
pos = vector.new(x, 0, z),
|
||||
color = color,
|
||||
groups = groups,
|
||||
}
|
||||
|
||||
self:register2DPeak(layerName, category, def)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---Adds groups to the already registered groups in the peak by coordinate.
|
||||
---If the peak does not exist, an error will be raised.
|
||||
---@param layerName string The name of the layer in which the new peak will be included.
|
||||
---@param category MapGen.Layer.Category Category indicating what will be generated by peak.
|
||||
---@param pos Position The position of the peak to which the group should be added.
|
||||
---@param groups table<string, number> Groups to be added.
|
||||
function MapGen:addGroupsToPeakByPos(layerName, category, pos, groups)
|
||||
local layer = self:getLayerByName(layerName)
|
||||
|
||||
local peak = self:getPeakByPos(layer, category, pos)
|
||||
assert( peak ~= nil, ('In the `%s` layer in the `%s` category there is no peak with coordinates: %s, %s, %s.'):format(
|
||||
layerName, category, pos.x, pos.y, pos.z))
|
||||
|
||||
peak:addGroups(groups)
|
||||
end
|
||||
|
||||
---Mark a point on the biomes diagram and constrain the world area by height to mark it as `MapGen.Biome`.
|
||||
---@param layerName string The name of the layer in which the new biome will be included.
|
||||
---@param biomeName string The name to be assigned to the biome. The name must be unique for each biome.
|
||||
---@param def MapGen.BiomeDef Biome description table, see details `MapGen.BiomeDef`
|
||||
function MapGen:registerBiome(layerName, biomeName, def)
|
||||
local layer = self.layersByName[layerName]
|
||||
assert(layer ~= nil, ('There is no layer named `%s` registered.'):format(layerName))
|
||||
assert(layer.biomesByName[biomeName] == nil, ('A biome named `%s` already exists in the `%s` layer.'):format(biomeName, layerName))
|
||||
local layer = self:getLayerByName(layerName)
|
||||
|
||||
local biome = Biome:new(biomeName, def)
|
||||
|
||||
@@ -250,26 +546,78 @@ end
|
||||
---@param layerName string The name of the layer in which the new cavern will be included.
|
||||
---@param cavernName string The name to be assigned to the cavern. The name must be unique for each cavern.
|
||||
---@param def MapGen.CavernDef Cavern description table, see details `MapGen.CavernDef`
|
||||
function MapGen:registerCavern(layerName, cavernName, def)
|
||||
local layer = self.layersByName[layerName]
|
||||
assert(layer ~= nil, ('There is no layer named `%s` registered.'):format(layerName))
|
||||
assert(layer.cavernsByName[cavernName] == nil, ('A cavern named `%s` already exists in the `%s` layer.'):format(cavernName, layerName))
|
||||
---@param regionVertices Position[]? The region to which the cave generation will be limited.
|
||||
function MapGen:registerCavern(layerName, cavernName, def, regionVertices)
|
||||
local layer = self:getLayerByName(layerName)
|
||||
|
||||
if regionVertices ~= nil then
|
||||
self:registerRegion(layerName, cavernName, {
|
||||
vertices = regionVertices
|
||||
})
|
||||
|
||||
def.isRegional = true
|
||||
end
|
||||
|
||||
local cavern = Cavern:new(cavernName, def)
|
||||
|
||||
layer:addCavern(cavernName, cavern)
|
||||
end
|
||||
|
||||
---Mark the world region between the vertices as `MapGen.Region` and give it a name.
|
||||
---@param layerName string The name of the layer in which the new region will be included.
|
||||
---@param regionName string The name to be assigned to the region. The name must be unique for each region.
|
||||
---@param def MapGen.RegionDef Region description table, see details `MapGen.RegionDef`
|
||||
function MapGen:registerRegion(layerName, regionName, def)
|
||||
if regionName == 'landscape_boundary' or
|
||||
regionName == 'temp_boundary' or
|
||||
regionName == 'humidity_boundary' then
|
||||
error(('The name `%s` is reserved for special regions and cannot be used.'):format(regionName))
|
||||
end
|
||||
|
||||
local layer = self:getLayerByName(layerName)
|
||||
|
||||
local region = Region:new(regionName, def)
|
||||
|
||||
layer:addRegion(regionName, region)
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- --- INITIALIZATION METHODS ---
|
||||
|
||||
---Initialize the boundary region for a triangulated area.
|
||||
---@param layer MapGen.Layer
|
||||
---@param category MapGen.Layer.Category
|
||||
---@param triangles MapGen.Triangle[]
|
||||
function MapGen:initTriangultaionBoundaryRegion(layer, category, triangles)
|
||||
local regionVertices = self:getTriangulateBoundaryVertices(triangles)
|
||||
|
||||
local regionName = category..'_boundary'
|
||||
|
||||
local region = Region:new(regionName, {vertices = regionVertices})
|
||||
|
||||
layer:addRegion(regionName, region)
|
||||
end
|
||||
|
||||
---Divide all layers into triangles whose vertices are the `Mapgen.Peak` belonging to these layers.
|
||||
function MapGen:initLayersTriangultaion()
|
||||
---@param layer MapGen.Layer
|
||||
for _, layer in ipairs(self.layersList) do
|
||||
layer.trianglesList = Triangulation.triangulate(layer.peaksList)
|
||||
-- layer.tetrahedronsList = Triangulation.tetrahedralize(layer.peaksList)
|
||||
for category, peaks in pairs(layer.peaksList) do
|
||||
local triangles = Triangulation.triangulate(peaks)
|
||||
|
||||
layer.trianglesList[category] = triangles
|
||||
--self:initTriangultaionBoundaryRegion(layer, category, triangles)
|
||||
-- layer.tetrahedronsList = Triangulation.tetrahedralize(layer.peaksList) -- 3D not supported
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---Initialize all layer noises. This should be called after the map object is loaded.
|
||||
function MapGen:initLayersNoises()
|
||||
---@param layer MapGen.Layer
|
||||
for _, layer in ipairs(self.layersList) do
|
||||
layer:initNoises()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -281,22 +629,6 @@ function MapGen:initBiomesDiagram()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
---Initialize peak's noises. This should be called after the map object is loaded.
|
||||
function MapGen:initPeaksMultinoise()
|
||||
---@param layer MapGen.Layer
|
||||
for _, layer in ipairs(self.layersList) do
|
||||
|
||||
---@param peak MapGen.Peak
|
||||
for _, peak in ipairs(layer.peaksList) do
|
||||
peak:initMultinoise()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
self.peaksMultinoiseInitialized = true
|
||||
end
|
||||
|
||||
---Initialize caverns's noises. This should be called after the map object is loaded.
|
||||
function MapGen:initCavernsNoise()
|
||||
---@param layer MapGen.Layer
|
||||
@@ -309,29 +641,13 @@ function MapGen:initCavernsNoise()
|
||||
|
||||
end
|
||||
|
||||
self.cavernsNoiseInitialized = true
|
||||
self.isCavernsNoiseInitialized = true
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- --- GENERATION METHODS ---
|
||||
|
||||
---Returns `true` if there is a cavern at the specified coordinates.
|
||||
---@param layer MapGen.Layer
|
||||
---@param x number
|
||||
---@param y number
|
||||
---@param z number
|
||||
---@return boolean
|
||||
local function isCavern(layer, x, y, z)
|
||||
for _, cavern in ipairs(layer.cavernsList) do
|
||||
if cavern:isCavern(x, y, z) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
---The core logic of world generation. Determines which node type (water, rock, soil, air)
|
||||
---and which biome will be generated at the specified coordinates.
|
||||
---@param mapGenerator MapGen
|
||||
@@ -341,9 +657,9 @@ end
|
||||
---@param humidity number
|
||||
---@param data number[]
|
||||
---@param index number
|
||||
---@param x number
|
||||
---@param y number
|
||||
---@param z number
|
||||
---@param x integer
|
||||
---@param y integer
|
||||
---@param z integer
|
||||
local function generateNode(mapGenerator, layer, height, temp, humidity, data, index, x, y, z)
|
||||
local ids = mapGenerator.nodeIDs
|
||||
local waterLevel = layer.waterLevel
|
||||
@@ -353,17 +669,15 @@ local function generateNode(mapGenerator, layer, height, temp, humidity, data, i
|
||||
local scatteringVertical = layer.biomesVerticalScattering or 0
|
||||
local scattTemp = temp
|
||||
local scattHumidity = humidity
|
||||
---@type number
|
||||
local scattHeight = y
|
||||
|
||||
if scatteringGorizontal ~= 0 then
|
||||
---@diagnostic disable-next-line: param-type-not-match
|
||||
scattTemp = scattTemp + math.random(scatteringGorizontal * -1, scatteringGorizontal)
|
||||
---@diagnostic disable-next-line: param-type-not-match
|
||||
scattHumidity = scattHumidity + math.random(scatteringGorizontal * -1, scatteringGorizontal)
|
||||
end
|
||||
|
||||
if scatteringVertical ~= 0 then
|
||||
---@diagnostic disable-next-line: param-type-not-match
|
||||
scattHeight = scattHeight + math.random(scatteringVertical * -1, scatteringVertical)
|
||||
end
|
||||
|
||||
@@ -390,7 +704,7 @@ local function generateNode(mapGenerator, layer, height, temp, humidity, data, i
|
||||
-- If the block is below the surface height...
|
||||
elseif y <= height then
|
||||
-- ... and a cavern is generated in the block...
|
||||
if isCavern(layer, x, y, z) then
|
||||
if mapGenerator:isCavern(layer, x, y, z) then
|
||||
-- ... then airspace is generated.
|
||||
biome:generateCavernAir(mapGenerator, data, index, x, y, z)
|
||||
|
||||
@@ -432,9 +746,9 @@ end
|
||||
---the triangle's height and specifying the distance to the peak
|
||||
---for which the weight is calculated.
|
||||
---@param height MapGen.Triangulation.Edge
|
||||
---@param x number
|
||||
---@param y number
|
||||
---@param z number
|
||||
---@param x integer
|
||||
---@param y integer
|
||||
---@param z integer
|
||||
---@return number
|
||||
local function calcWeight(height, x, y, z)
|
||||
local pos1 = vector.new(x, y, z)
|
||||
@@ -454,48 +768,32 @@ local function calcWeight(height, x, y, z)
|
||||
return 1 - vector.distance(pos2, posP) / height:length()
|
||||
end
|
||||
|
||||
---Returns `true` if the point is within the triangle's region.
|
||||
---The barycentric coordinate method is used.
|
||||
---@param px number
|
||||
---@param pz number
|
||||
---Returns the weighted values of 2d noise.
|
||||
---@param category MapGen.Layer.Category
|
||||
---@param layer MapGen.Layer
|
||||
---@param triangle MapGen.Triangle
|
||||
local function pointInTriangle(px, pz, triangle)
|
||||
local posP = vector.new(px, 0, pz)
|
||||
local pos1 = triangle.p1.getPeakPos()
|
||||
local pos2 = triangle.p2.getPeakPos()
|
||||
local pos3 = triangle.p3.getPeakPos()
|
||||
---@param x integer
|
||||
---@param y integer
|
||||
---@param z integer
|
||||
---@return number
|
||||
local function calcNoise2dValue(category, layer, triangle, x, y, z)
|
||||
local triangleColor = triangle.color
|
||||
|
||||
local v0 = pos3 - pos1
|
||||
local v1 = pos2 - pos1
|
||||
local v2 = posP - pos1
|
||||
-- If the triangle is monochromatic (all peaks have the same color and,
|
||||
-- accordingly, the same noise), then there is no point in smoothing out the noise.
|
||||
if triangleColor ~= nil then
|
||||
return layer:getNoiseByColor(category, triangleColor):get_2d({x = x, y = z})
|
||||
end
|
||||
|
||||
local dot00 = vector.dot(v0, v0)
|
||||
local dot01 = vector.dot(v0, v1)
|
||||
local dot02 = vector.dot(v0, v2)
|
||||
local dot11 = vector.dot(v1, v1)
|
||||
local dot12 = vector.dot(v1, v2)
|
||||
|
||||
local invDenom = 1 / (dot00 * dot11 - dot01 * dot01)
|
||||
local u = (dot11 * dot02 - dot01 * dot12) * invDenom
|
||||
local v = (dot00 * dot12 - dot01 * dot02) * invDenom
|
||||
|
||||
return (u >= 0) and (v >= 0) and (u + v <= 1)
|
||||
end
|
||||
|
||||
---Returns the weighted values of 2d noises.
|
||||
---@param triangle MapGen.Triangle
|
||||
---@param x number
|
||||
---@param y number
|
||||
---@param z number
|
||||
---@return number, number, number
|
||||
local function calcNoises2dValues(triangle, x, y, z)
|
||||
local peak1 = triangle.p1
|
||||
local peak2 = triangle.p2
|
||||
local peak3 = triangle.p3
|
||||
|
||||
local noiseHeightValue = 0.0
|
||||
local noiseTempValue = 0.0
|
||||
local noiseHumidityValue = 0.0
|
||||
local noise1 = layer:getNoiseByColor(category, peak1:getColor())
|
||||
local noise2 = layer:getNoiseByColor(category, peak2:getColor())
|
||||
local noise3 = layer:getNoiseByColor(category, peak3:getColor())
|
||||
|
||||
local noiseValue = 0.0
|
||||
|
||||
local totalWeight = 0.0
|
||||
|
||||
@@ -503,72 +801,77 @@ local function calcNoises2dValues(triangle, x, y, z)
|
||||
-- ( peak1 * weight1 + peak2 * weight2 + peak3 * weight3) / totalWeight, when
|
||||
-- totalWeight = weight1 + weight2 + weight3
|
||||
local weight = calcWeight(triangle.h1, x, y, z)
|
||||
noiseHeightValue = noiseHeightValue + peak1:getMultinoise().landscapeNoise:get_2d({x = x, y = z}) * weight
|
||||
noiseTempValue = noiseTempValue + peak1:getMultinoise().tempNoise:get_2d({x = x, y = z}) * weight
|
||||
noiseHumidityValue = noiseHumidityValue + peak1:getMultinoise().humidityNoise:get_2d({x = x, y = z}) * weight
|
||||
noiseValue = noiseValue + noise1:get_2d({x = x, y = z}) * weight
|
||||
totalWeight = totalWeight + weight
|
||||
|
||||
weight = calcWeight(triangle.h2, x, y, z)
|
||||
noiseHeightValue = noiseHeightValue + peak2:getMultinoise().landscapeNoise:get_2d({x = x, y = z}) * weight
|
||||
noiseTempValue = noiseTempValue + peak2:getMultinoise().tempNoise:get_2d({x = x, y = z}) * weight
|
||||
noiseHumidityValue = noiseHumidityValue + peak2:getMultinoise().humidityNoise:get_2d({x = x, y = z}) * weight
|
||||
noiseValue = noiseValue + noise2:get_2d({x = x, y = z}) * weight
|
||||
totalWeight = totalWeight + weight
|
||||
|
||||
weight = calcWeight(triangle.h3, x, y, z)
|
||||
noiseHeightValue = noiseHeightValue + peak3:getMultinoise().landscapeNoise:get_2d({x = x, y = z}) * weight
|
||||
noiseTempValue = noiseTempValue + peak3:getMultinoise().tempNoise:get_2d({x = x, y = z}) * weight
|
||||
noiseHumidityValue = noiseHumidityValue + peak3:getMultinoise().humidityNoise:get_2d({x = x, y = z}) * weight
|
||||
noiseValue = noiseValue + noise3:get_2d({x = x, y = z}) * weight
|
||||
totalWeight = totalWeight + weight
|
||||
|
||||
return noiseHeightValue / totalWeight, noiseTempValue / totalWeight, noiseHumidityValue / totalWeight
|
||||
return (noiseValue / totalWeight)
|
||||
end
|
||||
|
||||
---Calculates a smoothed 2D noise value based on a preliminary space partitioning.
|
||||
---
|
||||
---Returns `nil` if the point is not included in any triangle.
|
||||
---@param layer MapGen.Layer
|
||||
---@param x number
|
||||
---@param y number
|
||||
---@param z number
|
||||
---@return number?, number?, number?
|
||||
function MapGen:getNoises2dValues(layer, x, y, z)
|
||||
if (pastNoise2DCalc.x ~= nil and pastNoise2DCalc.z ~= nil) and (x == pastNoise2DCalc.x and z == pastNoise2DCalc.z) then
|
||||
return pastNoise2DCalc.noiseValues.height, pastNoise2DCalc.noiseValues.temp, pastNoise2DCalc.noiseValues.humidity
|
||||
---@param category MapGen.Layer.Category
|
||||
---@param layer MapGen.Layer
|
||||
---@param x integer
|
||||
---@param y integer
|
||||
---@param z integer
|
||||
---@return number?
|
||||
function MapGen:getNoises2dValue(category, layer, x, y, z)
|
||||
---@type MapGen.PastCalcNoiseValue
|
||||
local pastCalc = pastNoise2DCalc[category]
|
||||
|
||||
if (pastCalc.x ~= nil and pastCalc.z ~= nil) and (x == pastCalc.x and z == pastCalc.z) then
|
||||
return pastCalc.noiseValue
|
||||
end
|
||||
|
||||
if pastNoise2DCalc.triangle ~= nil and pointInTriangle(x, z, pastNoise2DCalc.triangle) then
|
||||
local noiseHeightValue, noiseTempValue, noiseHumidityValue = calcNoises2dValues(pastNoise2DCalc.triangle, x, y, z)
|
||||
if pastCalc.triangle ~= nil then
|
||||
---@type number?
|
||||
local noiseValue
|
||||
|
||||
noiseTempValue, noiseHumidityValue = layer:calcTemp(noiseTempValue, y), layer:calcHumidity(noiseHumidityValue, y)
|
||||
|
||||
pastNoise2DCalc.x = x
|
||||
pastNoise2DCalc.z = z
|
||||
pastNoise2DCalc.noiseValues = {
|
||||
height = noiseHeightValue,
|
||||
temp = noiseTempValue,
|
||||
humidity = noiseHumidityValue,
|
||||
local triangles = {
|
||||
pastCalc.triangle,
|
||||
pastCalc.triangle.neighbours.t1,
|
||||
pastCalc.triangle.neighbours.t2,
|
||||
pastCalc.triangle.neighbours.t3,
|
||||
}
|
||||
|
||||
return noiseHeightValue, noiseTempValue, noiseHumidityValue
|
||||
---@param t MapGen.Triangle
|
||||
for _, t in ipairs(triangles) do
|
||||
if pointInTriangle2D(x, z, t) then
|
||||
noiseValue = calcNoise2dValue(category, layer, t, x, y, z)
|
||||
|
||||
pastCalc.x = x
|
||||
pastCalc.z = z
|
||||
pastCalc.noiseValue = noiseValue
|
||||
|
||||
return noiseValue
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if not self:pointInRegion2D(layer, category..'_boundary', {x=x, y=y, z=z}) then
|
||||
return nil
|
||||
end
|
||||
|
||||
---@param triangle MapGen.Triangle
|
||||
for _, triangle in ipairs(layer.trianglesList) do
|
||||
if pointInTriangle(x, z,triangle) then
|
||||
local noiseHeightValue, noiseTempValue, noiseHumidityValue = calcNoises2dValues(triangle, x, y, z)
|
||||
for _, triangle in ipairs(layer.trianglesList[category]) do
|
||||
if pointInTriangle2D(x, z, triangle) then
|
||||
local noiseValue = calcNoise2dValue(category, layer, triangle, x, y, z)
|
||||
|
||||
noiseTempValue, noiseHumidityValue = layer:calcTemp(noiseTempValue, y), layer:calcHumidity(noiseHumidityValue, y)
|
||||
pastCalc.triangle = triangle
|
||||
pastCalc.x = x
|
||||
pastCalc.z = z
|
||||
pastCalc.noiseValue = noiseValue
|
||||
|
||||
pastNoise2DCalc.triangle = triangle
|
||||
pastNoise2DCalc.x = x
|
||||
pastNoise2DCalc.z = z
|
||||
pastNoise2DCalc.noiseValues = {
|
||||
height = noiseHeightValue,
|
||||
temp = noiseTempValue,
|
||||
humidity = noiseHumidityValue,
|
||||
}
|
||||
|
||||
return noiseHeightValue, noiseTempValue, noiseHumidityValue
|
||||
return noiseValue
|
||||
end
|
||||
end
|
||||
|
||||
@@ -671,9 +974,9 @@ end
|
||||
---@param mapGenerator MapGen
|
||||
---@param data number[]
|
||||
---@param index number
|
||||
---@param x number
|
||||
---@param y number
|
||||
---@param z number
|
||||
---@param x integer
|
||||
---@param y integer
|
||||
---@param z integer
|
||||
local function generatorHandler(mapGenerator, data, index, x, y, z)
|
||||
-- If the node belongs to a static layer, then a static node is generated.
|
||||
local static = mapGenerator:getStaticByHeight(y)
|
||||
@@ -691,25 +994,37 @@ local function generatorHandler(mapGenerator, data, index, x, y, z)
|
||||
return
|
||||
end
|
||||
|
||||
-- Calculating landscape height
|
||||
local noiseHeightValue, noiseTempValue, noiseHumidityValue = mapGenerator:getNoises2dValues(layer, x, y, z)
|
||||
|
||||
-- If the height of the landscape is `nil`,
|
||||
-- If the value of the noise is `nil`,
|
||||
-- then the point does not fall within any of the triangles.
|
||||
local noiseHeightValue = mapGenerator:getNoises2dValue('landscape', layer, x, y, z)
|
||||
if noiseHeightValue == nil then
|
||||
noiseHeightValue = 0.0
|
||||
noiseTempValue = 0.0
|
||||
noiseHumidityValue = 0.0
|
||||
data[index] = core.CONTENT_IGNORE
|
||||
return
|
||||
end
|
||||
|
||||
---@diagnostic disable-next-line: param-type-not-match
|
||||
local noiseTempValue = mapGenerator:getNoises2dValue('temp', layer, x, y, z)
|
||||
if noiseTempValue == nil then
|
||||
data[index] = core.CONTENT_IGNORE
|
||||
return
|
||||
end
|
||||
|
||||
local noiseHumidityValue = mapGenerator:getNoises2dValue('humidity', layer, x, y, z)
|
||||
if noiseHumidityValue == nil then
|
||||
data[index] = core.CONTENT_IGNORE
|
||||
return
|
||||
end
|
||||
|
||||
-- We recalculate the climate based on altitude.
|
||||
noiseTempValue = layer:calcTemp(noiseTempValue, y)
|
||||
noiseHumidityValue = layer:calcHumidity(noiseHumidityValue, y)
|
||||
|
||||
generateNode(mapGenerator, layer, noiseHeightValue, noiseTempValue, noiseHumidityValue, data, index, x, y, z)
|
||||
end
|
||||
|
||||
---Chunk generation handler.
|
||||
---@param voxelManip VoxelManip
|
||||
---@param minPos table
|
||||
---@param maxPos table
|
||||
---@param minPos Position
|
||||
---@param maxPos Position
|
||||
---@param blockseed number
|
||||
function MapGen:onMapGenerated(voxelManip, minPos, maxPos, blockseed)
|
||||
-- We obtain a generation area for further manipulations
|
||||
@@ -717,11 +1032,11 @@ function MapGen:onMapGenerated(voxelManip, minPos, maxPos, blockseed)
|
||||
|
||||
local eMin, eMax = voxelManip:get_emerged_area()
|
||||
|
||||
if not self.peaksMultinoiseInitialized then
|
||||
self:initPeaksMultinoise()
|
||||
if not self.isLayersNoisesInitialized then
|
||||
self:initLayersNoises()
|
||||
end
|
||||
|
||||
if not self.cavernsNoiseInitialized then
|
||||
if not self.isCavernsNoiseInitialized then
|
||||
self:initCavernsNoise()
|
||||
end
|
||||
|
||||
@@ -771,6 +1086,7 @@ function MapGen:run()
|
||||
error('Only one instance of a `MapGen` class can be running.')
|
||||
end
|
||||
|
||||
---@param ... VoxelManip
|
||||
core.register_on_generated(function(...)
|
||||
self:onMapGenerated(...)
|
||||
end)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
local id = core.get_content_id
|
||||
|
||||
local getInstance = Class.getInstance
|
||||
|
||||
---@class MapGen.Biome
|
||||
---@field name string
|
||||
---@field tempPoint number
|
||||
@@ -165,7 +167,7 @@ function Biome:new(name, def)
|
||||
end
|
||||
|
||||
---@type MapGen.Biome
|
||||
local instance = setmetatable({
|
||||
local instance = getInstance(self, {
|
||||
name = name,
|
||||
tempPoint = def.tempPoint,
|
||||
humidityPoint = def.humidityPoint,
|
||||
@@ -181,7 +183,7 @@ function Biome:new(name, def)
|
||||
generateSoil = def.generateSoil,
|
||||
generateTurf = def.generateTurf,
|
||||
generateBottom = def.generateBottom,
|
||||
}, {__index = self})
|
||||
})
|
||||
|
||||
return instance
|
||||
end
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
local mathMin, mathMax, mathAbs
|
||||
= math.min, math.max, math.abs
|
||||
local mathMin, mathMax, mathAbs, mathClamp
|
||||
= math.min, math.max, math.abs, math.clamp
|
||||
|
||||
local getInstance = Class.getInstance
|
||||
|
||||
---@class MapGen.Cavern
|
||||
---@field name string
|
||||
---@field isRegional boolean
|
||||
---@field minY number
|
||||
---@field maxY number
|
||||
---@field smoothDistance number
|
||||
@@ -16,6 +19,7 @@ local Cavern = {}
|
||||
---
|
||||
---**Only for EmmyLua.**
|
||||
---@class MapGen.CavernDef
|
||||
---@field isRegional boolean?
|
||||
---@field minY number
|
||||
---@field maxY number
|
||||
---@field noiseParams NoiseParams
|
||||
@@ -50,13 +54,14 @@ function Cavern:new(name, def)
|
||||
end
|
||||
|
||||
---@type MapGen.Cavern
|
||||
local instance = setmetatable({
|
||||
local instance = getInstance(self, {
|
||||
name = name,
|
||||
minY = def.minY,
|
||||
maxY = def.maxY,
|
||||
smoothDistance = def.smoothDistance,
|
||||
threshold = def.threshold,
|
||||
}, {__index = self})
|
||||
isRegional = def.isRegional or false,
|
||||
})
|
||||
|
||||
function instance:getNoise()
|
||||
return _noise
|
||||
@@ -77,32 +82,49 @@ function Cavern:new(name, def)
|
||||
return instance
|
||||
end
|
||||
|
||||
---@param y number
|
||||
---@param minY number
|
||||
---@param maxY number
|
||||
---@param smoothDistance number
|
||||
---@return number
|
||||
local function calcCavernWeight(y, smoothDistance, minY, maxY)
|
||||
local maxDist = maxY - y
|
||||
local minDist = y - minY
|
||||
|
||||
return mathMax(0, mathMin(maxDist / smoothDistance, minDist / smoothDistance, 1))
|
||||
---@param distance number
|
||||
---@return number
|
||||
function Cavern:calcCavernWeight(distance)
|
||||
return mathClamp(distance / self.smoothDistance, 0, 1)
|
||||
end
|
||||
|
||||
---Returns `true` if there is a cavern at the specified coordinates.
|
||||
---@param x number
|
||||
---@param y number
|
||||
---@param z number
|
||||
---@return boolean
|
||||
function Cavern:isCavern(x, y, z)
|
||||
---@param x integer
|
||||
---@param y integer
|
||||
---@param z integer
|
||||
---@param distance number
|
||||
---@return boolean
|
||||
function Cavern:isCavern(x, y, z, distance)
|
||||
local minY, maxY = self.minY, self.maxY
|
||||
|
||||
if y >= maxY or y <= minY then
|
||||
return false
|
||||
end
|
||||
|
||||
distance = mathMin(maxY - y, y - minY, distance)
|
||||
|
||||
local noise = self:getNoise()
|
||||
local weight = self:calcCavernWeight(distance)
|
||||
|
||||
return noise:get_3d({x = x, y = y, z = z}) * weight > self.threshold
|
||||
end
|
||||
|
||||
---Returns `true` if there is a cavern at the specified coordinates.
|
||||
---@param x integer
|
||||
---@param y integer
|
||||
---@param z integer
|
||||
---@return boolean
|
||||
function Cavern:isLayeredCavern(x, y, z)
|
||||
local minY, maxY = self.minY, self.maxY
|
||||
|
||||
if y > maxY or y < minY then
|
||||
return false
|
||||
end
|
||||
|
||||
local distance = mathMin(maxY - y, y - minY)
|
||||
|
||||
local noise = self:getNoise()
|
||||
local weight = calcCavernWeight(y, self.smoothDistance, minY, maxY)
|
||||
local weight = self:calcCavernWeight(distance)
|
||||
|
||||
return noise:get_3d({x = x, y = y, z = z}) * weight > self.threshold
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
local getInstance = Class.getInstance
|
||||
|
||||
---**NOT IMPLEMENTED**
|
||||
---@class MapGen.Decoration
|
||||
local Decoration = {}
|
||||
@@ -5,9 +7,9 @@ local Decoration = {}
|
||||
---@return MapGen.Decoration
|
||||
function Decoration:new()
|
||||
---@type MapGen.Decoration
|
||||
local instance = setmetatable({
|
||||
local instance = getInstance(self, {
|
||||
|
||||
}, {__index = self})
|
||||
})
|
||||
|
||||
return instance
|
||||
end
|
||||
|
||||
@@ -1,32 +1,56 @@
|
||||
local getInstance = Class.getInstance
|
||||
|
||||
---@class MapGen.Layer
|
||||
---@field name string
|
||||
---@field minY number
|
||||
---@field maxY number
|
||||
---@field minTemp number
|
||||
---@field maxTemp number
|
||||
---@field minHumidity number
|
||||
---@field maxHumidity number
|
||||
---@field waterLevel number
|
||||
---@field minY integer
|
||||
---@field maxY integer
|
||||
---@field minTemp integer
|
||||
---@field maxTemp integer
|
||||
---@field minHumidity integer
|
||||
---@field maxHumidity integer
|
||||
---@field waterLevel integer
|
||||
---@field calcTemp fun(self:MapGen.Layer, value:number, height:number):number
|
||||
---@field calcHumidity fun(self:MapGen.Layer, value:number, height:number):number
|
||||
---@field peaksList MapGen.Peak[]
|
||||
---@field peaksList {['landscape']:MapGen.Peak[],['temp']:MapGen.Peak[],['humidity']:MapGen.Peak[]}
|
||||
---@field noisesByColor {['landscape']:table<ColorString, ValueNoise>,['temp']:table<ColorString, ValueNoise>,['humidity']:table<ColorString, ValueNoise>}
|
||||
---@field noisesParamsByColor {['landscape']:table<ColorString, NoiseParams>,['temp']:table<ColorString, NoiseParams>,['humidity']:table<ColorString, NoiseParams>}
|
||||
---@field biomesByName table<string, MapGen.Biome>
|
||||
---@field biomesList MapGen.Biome[]
|
||||
---@field biomesDiagram table
|
||||
---@field biomesGorizontalScattering number
|
||||
---@field biomesVerticalScattering number
|
||||
---@field biomesGorizontalScattering integer
|
||||
---@field biomesVerticalScattering integer
|
||||
---@field cavernsByName table<string, MapGen.Cavern>
|
||||
---@field cavernsList MapGen.Cavern[]
|
||||
---@field trianglesList MapGen.Triangle[]
|
||||
---@field tetrahedronsList MapGen.Tetrahedron[]
|
||||
---@field regionsByName table<string, MapGen.Region>
|
||||
---@field trianglesList {['landscape']:MapGen.Triangle[],['temp']:MapGen.Triangle[],['humidity']:MapGen.Triangle[]}
|
||||
---@field tetrahedronsList MapGen.Tetrahedron[] **Not supported**
|
||||
local Layer = {
|
||||
peaksList = {},
|
||||
peaksList = {
|
||||
landscape = {},
|
||||
temp = {},
|
||||
humidity = {},
|
||||
},
|
||||
noisesByColor = {
|
||||
landscape = {},
|
||||
temp = {},
|
||||
humidity = {},
|
||||
},
|
||||
noisesParamsByColor = {
|
||||
landscape = {},
|
||||
temp = {},
|
||||
humidity = {},
|
||||
},
|
||||
biomesByName = {},
|
||||
biomesList = {},
|
||||
biomesDiagram = {},
|
||||
cavernsByName = {},
|
||||
cavernsList = {},
|
||||
trianglesList = {},
|
||||
regionsByName = {},
|
||||
trianglesList = {
|
||||
landscape = {},
|
||||
temp = {},
|
||||
humidity = {},
|
||||
},
|
||||
tetrahedronsList = {},
|
||||
}
|
||||
|
||||
@@ -69,7 +93,7 @@ function Layer:new(name, def)
|
||||
end
|
||||
|
||||
---@type MapGen.Layer
|
||||
local instance = setmetatable({
|
||||
local instance = getInstance(self, {
|
||||
name = name,
|
||||
minY = def.minY,
|
||||
maxY = def.maxY,
|
||||
@@ -82,33 +106,157 @@ function Layer:new(name, def)
|
||||
calcHumidity = def.calcHumidity,
|
||||
biomesGorizontalScattering = def.biomesGorizontalScattering or 0,
|
||||
biomesVerticalScattering = def.biomesVerticalScattering or 0,
|
||||
}, {__index = self})
|
||||
})
|
||||
|
||||
return instance
|
||||
end
|
||||
|
||||
---A category of noise that affects specific map generation objects.
|
||||
---@alias MapGen.Layer.Category 'landscape'|'temp'|'humidity'
|
||||
|
||||
---Adds a peak to the `Layer.peaksList`
|
||||
---@param peak MapGen.Peak
|
||||
function Layer:addPeak(peak)
|
||||
table.insert(self.peaksList, peak)
|
||||
---@param category MapGen.Layer.Category
|
||||
---@param peak MapGen.Peak
|
||||
function Layer:addPeak(category, peak)
|
||||
if category == 'landscape' then
|
||||
table.insert(self.peaksList.landscape, peak)
|
||||
elseif category == 'temp' then
|
||||
table.insert(self.peaksList.temp, peak)
|
||||
elseif category == 'humidity' then
|
||||
table.insert(self.peaksList.humidity, peak)
|
||||
else
|
||||
error(('There is no peak category named %s.'):format(category))
|
||||
end
|
||||
end
|
||||
|
||||
---Returns the `MapGen.Peak` at the coordinates. If there is no peak at these coordinates, it returns `nil`.
|
||||
---@param category MapGen.Layer.Category The category in which the peak is located.
|
||||
---@param pos Position Coordinate of the desired peak.
|
||||
---@return MapGen.Peak?
|
||||
function Layer:getPeakByPos(category, pos)
|
||||
pos = vector.new(pos)
|
||||
|
||||
---@param peak MapGen.Peak
|
||||
for _, peak in ipairs(self.peaksList[category]) do
|
||||
if peak:getPeakPos() == pos then
|
||||
return peak
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---Adds a NoiseParams color to the `Layer.noisesParamsByColor`
|
||||
---@param category MapGen.Layer.Category
|
||||
---@param color ColorString
|
||||
---@param noiseParams NoiseParams
|
||||
function Layer:addNoiseParamsColor(category, color, noiseParams)
|
||||
color = Smc.fixColorString(color)
|
||||
|
||||
local noisesParams = self.noisesParamsByColor
|
||||
|
||||
if category == 'landscape' then
|
||||
assert(noisesParams.landscape[color] == nil, ('The color `%s` already exists.'):format(color))
|
||||
noisesParams.landscape[color] = noiseParams
|
||||
elseif category == 'temp' then
|
||||
assert(noisesParams.temp[color] == nil, ('The color `%s` already exists.'):format(color))
|
||||
noisesParams.temp[color] = noiseParams
|
||||
elseif category == 'humidity' then
|
||||
assert(noisesParams.humidity[color] == nil, ('The color `%s` already exists.'):format(color))
|
||||
noisesParams.humidity[color] = noiseParams
|
||||
else
|
||||
error(('There is no color category named `%s`.'):format(category))
|
||||
end
|
||||
end
|
||||
|
||||
---Returns noise corresponding to a color.
|
||||
---@param category MapGen.Layer.Category
|
||||
---@param color ColorString
|
||||
---@return ValueNoise
|
||||
function Layer:getNoiseByColor(category, color)
|
||||
color = Smc.fixColorString(color)
|
||||
|
||||
local noises = self.noisesByColor
|
||||
|
||||
if category == 'landscape' then
|
||||
assert(noises.landscape[color] ~= nil, ('`%s` color does not exist.'):format(color))
|
||||
return noises.landscape[color]
|
||||
elseif category == 'temp' then
|
||||
assert(noises.temp[color] ~= nil, ('`%s` color does not exist.'):format(color))
|
||||
return noises.temp[color]
|
||||
elseif category == 'humidity' then
|
||||
assert(noises.humidity[color] ~= nil, ('`%s` color does not exist.'):format(color))
|
||||
return noises.humidity[color]
|
||||
else
|
||||
error(('There is no color category named `%s`.'):format(category))
|
||||
end
|
||||
end
|
||||
|
||||
---Adds a biome to the `Layer.biomesByName` & `Layer.biomesList`
|
||||
---@param biomeName string
|
||||
---@param biome MapGen.Biome
|
||||
function Layer:addBiome(biomeName, biome)
|
||||
assert(self.biomesByName[biomeName] == nil,
|
||||
('A biome named `%s` already exists in the `%s` layer.'):format(
|
||||
biomeName, self.name))
|
||||
|
||||
self.biomesByName[biomeName] = biome
|
||||
table.insert(self.biomesList, biome)
|
||||
end
|
||||
|
||||
---Returns a biome by name, if there is no such biome, it will raise an error.
|
||||
---@param biomeName string
|
||||
---@return MapGen.Biome
|
||||
function Layer:getBiomeByName(biomeName)
|
||||
local biome = self.biomesByName[biomeName]
|
||||
assert(biome ~= nil, ('Biome named `%s` does not exist in the `%s` layer.'):format(
|
||||
biomeName, self.name))
|
||||
|
||||
return biome
|
||||
end
|
||||
|
||||
---Adds a cavern to the `Layer.cavernsByName` & `Layer.cavernsList`
|
||||
---@param cavernName string
|
||||
---@param cavern MapGen.Cavern
|
||||
function Layer:addCavern(cavernName, cavern)
|
||||
assert(self.cavernsByName[cavernName] == nil,
|
||||
('A cavern named `%s` already exists in the `%s` layer.'):format(
|
||||
cavernName, self.name))
|
||||
|
||||
self.cavernsByName[cavernName] = cavern
|
||||
table.insert(self.cavernsList, cavern)
|
||||
end
|
||||
|
||||
---Returns a cavern by name, if there is no such cavern, it will raise an error.
|
||||
---@param cavernName string
|
||||
---@return MapGen.Cavern
|
||||
function Layer:getCavernByName(cavernName)
|
||||
local cavern = self.cavernsByName[cavernName]
|
||||
assert(cavern ~= nil, ('Cavern named `%s` does not exist in the `%s` layer.'):format(
|
||||
cavernName, self.name))
|
||||
|
||||
return cavern
|
||||
end
|
||||
|
||||
function Layer:addRegion(regionName, region)
|
||||
assert(self.regionsByName[regionName] == nil,
|
||||
('A region named `%s` already exists in the `%s` layer.'):format(
|
||||
regionName, self.name))
|
||||
|
||||
self.regionsByName[regionName] = region
|
||||
--table.insert(self.regionsList, region)
|
||||
end
|
||||
|
||||
---Returns a region by name, if there is no such region, it will raise an error.
|
||||
---@param regionName string
|
||||
---@return MapGen.Region
|
||||
function Layer:getRegionByName(regionName)
|
||||
local region = self.regionsByName[regionName]
|
||||
assert(region ~= nil, ('Region named `%s` does not exist in the `%s` layer.'):format(
|
||||
regionName, self.name))
|
||||
|
||||
return region
|
||||
end
|
||||
|
||||
|
||||
---@param height number
|
||||
---@param biomesList MapGen.Biome[]
|
||||
---@return string[], MapGen.Biome[]
|
||||
@@ -128,6 +276,19 @@ local function getBiomesNamesByHeight(height, biomesList)
|
||||
return biomesNames, biomes
|
||||
end
|
||||
|
||||
---Initializes noise for generation.
|
||||
---
|
||||
---Should only be called after the mapgen object has been loaded.
|
||||
function Layer:initNoises()
|
||||
local noises = self.noisesByColor
|
||||
|
||||
for category, noisesParams in pairs(self.noisesParamsByColor) do
|
||||
for color, noiseParams in pairs(noisesParams) do
|
||||
noises[category][color] = core.get_value_noise(noiseParams)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---Initialization of the biome diagram using the Voronoi method.
|
||||
function Layer:initBiomesDiagram()
|
||||
local diagram = self.biomesDiagram
|
||||
|
||||
@@ -1,94 +1,63 @@
|
||||
local getInstance = Class.getInstance
|
||||
|
||||
---@class MapGen.Peak
|
||||
---@field id number
|
||||
---@field getPeakPos fun():vector
|
||||
---@field getMultinoiseParams fun():MapGen.Peak.MultinoiseParams
|
||||
---@field getMultinoise fun():MapGen.Peak.Multinoise
|
||||
---@field initMultinoise fun()
|
||||
---@field getGroups fun():table<string, number>
|
||||
---@field id number
|
||||
---@field getPeakPos fun(self):vector
|
||||
---@field getColor fun(self):ColorString
|
||||
---@field getGroups fun(self):table<string, number>
|
||||
---@field addGroups fun(self, groups:table<string, number>)
|
||||
local Peak = {
|
||||
id = 0,
|
||||
}
|
||||
|
||||
-- --- Helpers functions ---
|
||||
|
||||
---@param multinoiseParams MapGen.Peak.MultinoiseParams
|
||||
---@return MapGen.Peak.Multinoise
|
||||
local function multinoiseParamsToMultinoise(multinoiseParams)
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
---@type MapGen.Peak.Multinoise
|
||||
local multinoise = {}
|
||||
|
||||
for noiseName, noiseParams in pairs(multinoiseParams) do
|
||||
multinoise[noiseName] = core.get_value_noise(noiseParams)
|
||||
end
|
||||
|
||||
return multinoise
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- --- Class registration ---
|
||||
|
||||
---@param peakPos vector
|
||||
---@param multinoiseParams MapGen.Peak.MultinoiseParams
|
||||
---@param groups? table<string, number>
|
||||
---@return MapGen.Peak
|
||||
function Peak:new(peakPos, multinoiseParams, groups)
|
||||
---@type vector
|
||||
local _peakPos = peakPos
|
||||
---@type MapGen.Peak.MultinoiseParams
|
||||
local _multinoiseParams = multinoiseParams
|
||||
---Definition table for the `MapGen.Peak`.
|
||||
---
|
||||
---**Only for EmmyLua.**
|
||||
---@class MapGen.PeakDef
|
||||
---@field pos vector
|
||||
---@field color ColorString
|
||||
---@field groups? table<string, number>
|
||||
|
||||
---@param def MapGen.PeakDef
|
||||
---@return MapGen.Peak
|
||||
function Peak:new(def)
|
||||
local _pos = def.pos
|
||||
local _color = def.color
|
||||
local _groups
|
||||
|
||||
if groups == nil then
|
||||
if def.groups == nil then
|
||||
_groups = {}
|
||||
else
|
||||
_groups = groups
|
||||
_groups = def.groups
|
||||
end
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
---@type MapGen.Peak.Multinoise
|
||||
local _multinoise = {} -- note: must be empty until luanti mapgen objects are loaded.
|
||||
|
||||
---@type MapGen.Peak
|
||||
local instance = setmetatable({},
|
||||
local instance = getInstance(self,{},
|
||||
{
|
||||
__index = self,
|
||||
__tostring = self.toString,
|
||||
__eq = self.eq
|
||||
})
|
||||
|
||||
function instance:getPeakPos()
|
||||
return vector.new(_peakPos.x, _peakPos.y, _peakPos.z)
|
||||
return _pos:copy()
|
||||
end
|
||||
|
||||
function instance:getMultinoiseParams()
|
||||
return _multinoiseParams
|
||||
end
|
||||
|
||||
function instance:getMultinoise()
|
||||
if table.is_empty(_multinoise) then
|
||||
error('Attempt to get `MapGen.Triangulation.FakePeak` noise (empty noise).')
|
||||
end
|
||||
|
||||
return _multinoise
|
||||
end
|
||||
|
||||
function instance:initMultinoise()
|
||||
if not table.is_empty(_multinoise) then
|
||||
Logger.warningLog('Multinoise has already been initialized. Re-initialization is not recommended.')
|
||||
end
|
||||
|
||||
if table.is_empty(_multinoiseParams) then
|
||||
error('Attempt to initialize `MapGen.Triangulation.FakePeak` noise (noise parameter empty).')
|
||||
end
|
||||
|
||||
_multinoise = multinoiseParamsToMultinoise(_multinoiseParams)
|
||||
function instance:getColor()
|
||||
return _color
|
||||
end
|
||||
|
||||
function instance:getGroups()
|
||||
return _groups
|
||||
return table.copy_with_metatables(_groups)
|
||||
end
|
||||
|
||||
function instance:addGroups(groups)
|
||||
-- Groups that cannot be overwritten
|
||||
groups.is2d = nil
|
||||
groups.is3d = nil
|
||||
|
||||
_groups = table.merge(_groups, groups, true)
|
||||
end
|
||||
|
||||
return instance
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
---For EmmyLua only
|
||||
|
||||
---**For EmmyLua only**
|
||||
---@class MapGen.Peak.Multinoise
|
||||
---@field landscapeNoise ValueNoise
|
||||
---@field tempNoise ValueNoise
|
||||
---@field humidityNoise ValueNoise
|
||||
local Multinoise = {}
|
||||
|
||||
return Multinoise
|
||||
@@ -1,10 +0,0 @@
|
||||
---For EmmyLua only
|
||||
|
||||
---**For EmmyLua only**
|
||||
---@class MapGen.Peak.MultinoiseParams
|
||||
---@field landscapeNoise NoiseParams
|
||||
---@field tempNoise NoiseParams
|
||||
---@field humidityNoise NoiseParams
|
||||
local MultinoiseParams = {}
|
||||
|
||||
return MultinoiseParams
|
||||
112
mods/CORE/MapGen/src/MapGen/Region.lua
Normal file
112
mods/CORE/MapGen/src/MapGen/Region.lua
Normal file
@@ -0,0 +1,112 @@
|
||||
local mathClamp, mathHuge, mathSqrt = math.clamp, math.huge, math.sqrt
|
||||
|
||||
local getInstance = Class.getInstance
|
||||
|
||||
---@class MapGen.Region
|
||||
---@field name string
|
||||
---@field vertices Position[]
|
||||
local Region = {}
|
||||
|
||||
---@class MapGen.RegionDef
|
||||
---@field vertices Position[]
|
||||
|
||||
---@param def MapGen.RegionDef
|
||||
---@return MapGen.Region
|
||||
function Region:new(name, def)
|
||||
local instance = getInstance(self, {
|
||||
name = name,
|
||||
vertices = def.vertices
|
||||
})
|
||||
|
||||
return instance
|
||||
end
|
||||
|
||||
---Calculate squared distance from point to line segment.
|
||||
---@param px integer
|
||||
---@param pz integer
|
||||
---@param x1 integer
|
||||
---@param z1 integer
|
||||
---@param x2 integer
|
||||
---@param z2 integer
|
||||
---@return number
|
||||
local function calcDistanceSq(px, pz, x1, z1, x2, z2)
|
||||
local dx = x2 - x1
|
||||
local dz = z2 - z1
|
||||
local len_sq = dx * dx + dz * dz
|
||||
|
||||
-- Degenerate segment (a single point):
|
||||
if len_sq == 0 then
|
||||
return (px - x1)^2 + (pz - z1)^2
|
||||
end
|
||||
|
||||
-- Project point onto line, clamped to segment [0, 1]
|
||||
local param = mathClamp(((px - x1) * dx + (pz - z1) * dz) / len_sq, 0, 1)
|
||||
|
||||
-- Closest point on segment
|
||||
local closest_x = x1 + param * dx
|
||||
local closest_z = z1 + param * dz
|
||||
|
||||
return (px - closest_x)^2 + (pz - closest_z)^2
|
||||
end
|
||||
|
||||
---Checks if a point is inside a `MapGen.Region` (2D check using x and z coordinates).
|
||||
---@param point Position
|
||||
---@return boolean, number?
|
||||
function Region:pointInRegion(point)
|
||||
local vertices = self.vertices
|
||||
local px, pz = point.x, point.z
|
||||
|
||||
local n = #vertices
|
||||
if n < 3 then
|
||||
return false
|
||||
end
|
||||
|
||||
-- Calculate minimum squared distance to any edge
|
||||
local minDistanceSq = mathHuge
|
||||
for i = 1, n do
|
||||
local j = (i % n) + 1
|
||||
local v1, v2 = vertices[i], vertices[j]
|
||||
|
||||
if v1 == nil or v2 == nil then error() end
|
||||
|
||||
local dist_sq = calcDistanceSq(px, pz, v1.x, v1.z, v2.x, v2.z)
|
||||
|
||||
if dist_sq < minDistanceSq then
|
||||
minDistanceSq = dist_sq
|
||||
end
|
||||
end
|
||||
|
||||
local minDistance = mathSqrt(minDistanceSq)
|
||||
|
||||
-- Check if point is on edge (within small epsilon)
|
||||
if minDistance <= 1e-9 then
|
||||
return true, minDistance
|
||||
end
|
||||
|
||||
-- Ray casting algorithm: count edge crossings
|
||||
local inside = false
|
||||
|
||||
for i = 1, n do
|
||||
local j = (i % n) + 1
|
||||
local vi, vj = vertices[i], vertices[j]
|
||||
|
||||
if vi == nil or vj == nil then error() end
|
||||
|
||||
local xi, zi = vi.x, vi.z
|
||||
local xj, zj = vj.x, vj.z
|
||||
|
||||
-- Check if horizontal ray from point (going +x) crosses this edge
|
||||
if ((zi > pz) ~= (zj > pz)) and
|
||||
(px < (xj - xi) * (pz - zi) / (zj - zi) + xi) then
|
||||
inside = not inside
|
||||
end
|
||||
end
|
||||
|
||||
if inside then
|
||||
return true, minDistance
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
return Region
|
||||
@@ -1,5 +1,7 @@
|
||||
local id = core.get_content_id
|
||||
|
||||
local getInstance = Class.getInstance
|
||||
|
||||
---@class MapGen.StaticLayer
|
||||
---@field name string
|
||||
---@field minY number
|
||||
@@ -43,14 +45,14 @@ function StaticLayer:new(name, def)
|
||||
local staticNodeID = id(def.staticNode)
|
||||
|
||||
---@type MapGen.StaticLayer
|
||||
local instance = setmetatable({
|
||||
local instance = getInstance(self, {
|
||||
name = name,
|
||||
minY = def.minY,
|
||||
maxY = def.maxY,
|
||||
staticNode = def.staticNode,
|
||||
staticNodeID = staticNodeID,
|
||||
generateStaticNode = def.generateStaticNode
|
||||
}, {__index = self})
|
||||
})
|
||||
|
||||
return instance
|
||||
end
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
local mathAbs = math.abs
|
||||
|
||||
local getInstance = Class.getInstance
|
||||
|
||||
local modInfo = Mod.getInfo('smc__core__map_gen')
|
||||
local require = modInfo.require
|
||||
|
||||
@@ -31,7 +33,7 @@ local Tetrahedron = {}
|
||||
---@param p4 MapGen.Peak
|
||||
---@return MapGen.Tetrahedron
|
||||
function Tetrahedron:new(p1, p2, p3, p4)
|
||||
local instance = setmetatable({
|
||||
local instance = getInstance(self, {
|
||||
p1 = p1,
|
||||
p2 = p2,
|
||||
p3 = p3,
|
||||
@@ -44,8 +46,8 @@ function Tetrahedron:new(p1, p2, p3, p4)
|
||||
f2 = Triangle:new(p1, p2, p4),
|
||||
f3 = Triangle:new(p1, p3, p4),
|
||||
f4 = Triangle:new(p2, p3, p4),
|
||||
}, {
|
||||
__index = self,
|
||||
},
|
||||
{
|
||||
__tostring = self.toString
|
||||
})
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
local mathSqrt, mathAbs
|
||||
= math.sqrt, math.abs
|
||||
|
||||
local getInstance = Class.getInstance
|
||||
|
||||
local modInfo = Mod.getInfo('smc__core__map_gen')
|
||||
local require = modInfo.require
|
||||
|
||||
@@ -54,6 +56,12 @@ end
|
||||
|
||||
-- --- Class registration ---
|
||||
|
||||
---Adjacent triangles:
|
||||
--- * `t1` with a common side p1-p2
|
||||
--- * `t2` with a common side p2-p3
|
||||
--- * `t3` with a common side p3-p1
|
||||
---@alias MapGen.Triangle.Neighbours {t1:MapGen.Triangle?,t2:MapGen.Triangle?,t3:MapGen.Triangle?}
|
||||
|
||||
---@class MapGen.Triangle
|
||||
---@field p1 MapGen.Peak
|
||||
---@field p2 MapGen.Peak
|
||||
@@ -64,17 +72,30 @@ end
|
||||
---@field h1 MapGen.Triangulation.Edge
|
||||
---@field h2 MapGen.Triangulation.Edge
|
||||
---@field h3 MapGen.Triangulation.Edge
|
||||
local Triangle = {}
|
||||
---@field neighbours MapGen.Triangle.Neighbours
|
||||
---@field color ColorString?
|
||||
local Triangle = {
|
||||
neighbours = {}
|
||||
}
|
||||
|
||||
---@param p1 MapGen.Peak
|
||||
---@param p2 MapGen.Peak
|
||||
---@param p3 MapGen.Peak
|
||||
---@return MapGen.Triangle
|
||||
function Triangle:new( p1, p2, p3 )
|
||||
function Triangle:new(p1, p2, p3)
|
||||
assert(not isFlatAngle(p1, p2, p3), ("angle (p1, p2, p3) is flat:\n %s\n %s\n %s")
|
||||
:format(tostring(p1), tostring(p2), tostring(p3)))
|
||||
|
||||
local instance = setmetatable({
|
||||
---@type ColorString?
|
||||
local color = nil
|
||||
|
||||
local c1, c2, c3 = p1.getColor(), p2.getColor(), p3.getColor()
|
||||
|
||||
if c1 == c2 and c2 == c3 and c3 == c1 then
|
||||
color = c1
|
||||
end
|
||||
|
||||
local instance = getInstance(self, {
|
||||
p1 = p1,
|
||||
p2 = p2,
|
||||
p3 = p3,
|
||||
@@ -83,10 +104,10 @@ function Triangle:new( p1, p2, p3 )
|
||||
h3 = Triangle:getHeight(p3, p1, p2),
|
||||
e1 = Edge:new(p1, p2),
|
||||
e2 = Edge:new(p2, p3),
|
||||
e3 = Edge:new(p3, p1)
|
||||
e3 = Edge:new(p3, p1),
|
||||
color = color
|
||||
},
|
||||
{
|
||||
__index = self,
|
||||
__tostring = self.toString,
|
||||
__eq = self.eq
|
||||
})
|
||||
@@ -130,7 +151,7 @@ function Triangle:getCenter()
|
||||
return (pos1 + pos2 + pos3) / 3
|
||||
end
|
||||
|
||||
---Returns the area of a triangle.
|
||||
---Returns the area of a triangle.
|
||||
---@return number
|
||||
function Triangle:getArea()
|
||||
local a, b, c = self:getSidesLength()
|
||||
@@ -260,6 +281,8 @@ function Triangle:getCircumCircle2D()
|
||||
return c, r
|
||||
end
|
||||
|
||||
---@alias MapGen.Triangle.CircumCircleEnum 'IN'|'BEHIND'|'ON'
|
||||
|
||||
---Checks if a given point lies into the triangle circumcircle.
|
||||
---
|
||||
---Note: This function does not take into account the Y-coordinate,
|
||||
@@ -273,6 +296,7 @@ function Triangle:inCircumCircle2D(p)
|
||||
|
||||
local distance = (c - pos):length()
|
||||
|
||||
|
||||
return distance <= r
|
||||
end
|
||||
|
||||
|
||||
@@ -8,9 +8,10 @@
|
||||
-- * splitting code into different files (classes);
|
||||
-- * Adapting the code to the mapgen concept;
|
||||
-- * Adding tetrahedralization;
|
||||
-- * Fixed non-determinism by sorting vertices before processing;
|
||||
|
||||
local assert, mathMax, tableRemove
|
||||
= assert, math.max, table.remove
|
||||
local assert, mathMax, tableRemove, tableSort
|
||||
= assert, math.max, table.remove, table.sort
|
||||
|
||||
local modInfo = Mod.getInfo('smc__core__map_gen')
|
||||
local require = modInfo.require
|
||||
@@ -28,6 +29,67 @@ local Triangulation = {
|
||||
convexMultiplier = 1e3,
|
||||
}
|
||||
|
||||
---Finds and writes adjacent triangles into triangles.
|
||||
---@param triangles MapGen.Triangle[]
|
||||
local function findTrianglesNeighbours(triangles)
|
||||
for _, triangle in ipairs(triangles) do
|
||||
for _, t in ipairs(triangles) do
|
||||
if triangle.e1 == t.e1 and triangle.p3 ~= t.p3 then
|
||||
triangle.neighbours.t1 = t
|
||||
elseif triangle.e2 == t.e2 and triangle.p3 ~= t.p1 then
|
||||
triangle.neighbours.t2 = t
|
||||
elseif triangle.e3 == t.e3 and triangle.p3 ~= t.p2 then
|
||||
triangle.neighbours.t3 = t
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---Filter vertices by group and return a new table
|
||||
---@param vertices table<integer, MapGen.Peak>
|
||||
---@param groupKey string
|
||||
---@return table<integer, MapGen.Peak>
|
||||
local function filterVerticesByGroup(vertices, groupKey)
|
||||
local result = {}
|
||||
for i = 1, #vertices do
|
||||
local vertex = vertices[i]
|
||||
if vertex:getGroups()[groupKey] ~= nil then
|
||||
result[#result + 1] = vertex
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
---Sort vertices deterministically by position to ensure consistent triangulation
|
||||
---@param vertices table<integer, MapGen.Peak>
|
||||
local function sortVerticesDeterministically(vertices)
|
||||
tableSort(vertices, function(a, b)
|
||||
local posA = a:getPeakPos()
|
||||
local posB = b:getPeakPos()
|
||||
|
||||
-- Sort by X first
|
||||
if posA.x ~= posB.x then
|
||||
return posA.x < posB.x
|
||||
end
|
||||
|
||||
-- Then by Z
|
||||
if posA.z ~= posB.z then
|
||||
return posA.z < posB.z
|
||||
end
|
||||
|
||||
-- Then by Y
|
||||
if posA.y ~= posB.y then
|
||||
return posA.y < posB.y
|
||||
end
|
||||
|
||||
-- Fallback to unique identifier if positions are identical
|
||||
-- This handles potential duplicate positions
|
||||
local nameA = a.getName and a:getName() or ""
|
||||
local nameB = b.getName and b:getName() or ""
|
||||
return nameA < nameB
|
||||
end)
|
||||
end
|
||||
|
||||
---The Delaunay method divides a plane into triangles based on a list of their vertices.
|
||||
---
|
||||
---Doesn't take into account the Y coordinate of the vertices.
|
||||
@@ -35,31 +97,28 @@ local Triangulation = {
|
||||
---
|
||||
---Vertices that do not have a `is2d` group will not participate in the triangulation.
|
||||
---@param vertices table<integer, MapGen.Peak>
|
||||
function Triangulation.triangulate( vertices )
|
||||
vertices = table.copy_with_metatables(vertices)
|
||||
function Triangulation.triangulate(vertices)
|
||||
-- Filter vertices with is2d group (creates a new table)
|
||||
vertices = filterVerticesByGroup(vertices, "is2d")
|
||||
|
||||
-- Only peaks with a `is2d` group can be triangulated.
|
||||
for i, vertex in ipairs(vertices) do
|
||||
if vertex:getGroups().is2d == nil then
|
||||
table.remove(vertices, i)
|
||||
end
|
||||
end
|
||||
-- Sort deterministically to ensure consistent results across sessions
|
||||
sortVerticesDeterministically(vertices)
|
||||
|
||||
local nvertices = #vertices
|
||||
|
||||
assert( nvertices > 2, "Cannot triangulate, needs more than 3 vertices" )
|
||||
assert(nvertices > 2, "Cannot triangulate, needs more than 3 vertices")
|
||||
|
||||
if nvertices == 3 then
|
||||
return {Triangle:new(vertices[1], vertices[2], vertices[3])}
|
||||
end
|
||||
|
||||
local minPos = vertices[1].getPeakPos()
|
||||
local minPos = vertices[1]:getPeakPos()
|
||||
local minX, minY = minPos.x, minPos.z
|
||||
local maxX, maxY = minX, minY
|
||||
|
||||
for i = 1, nvertices do
|
||||
local vertex = vertices[i]
|
||||
local vertexPos = vertex.getPeakPos()
|
||||
local vertexPos = vertex:getPeakPos()
|
||||
vertex.id = i
|
||||
|
||||
if vertexPos.x < minX then
|
||||
@@ -79,21 +138,21 @@ function Triangulation.triangulate( vertices )
|
||||
end
|
||||
end
|
||||
|
||||
---Finding the vertices of a supertriangle
|
||||
-- Finding the vertices of a supertriangle
|
||||
local convex_mult = Triangulation.convexMultiplier
|
||||
local dx, dy = (maxX - minX) * convex_mult, (maxY - minY) * convex_mult
|
||||
local deltaMax = mathMax(dx, dy)
|
||||
local midx, midy = (minX + maxX) * 0.5, (minY + maxY) * 0.5
|
||||
|
||||
local p1 = FakePeak:new(vector.new( midx - 2 * deltaMax,0, midy - deltaMax ))
|
||||
local p2 = FakePeak:new(vector.new(midx,0, midy + 2 * deltaMax ))
|
||||
local p3 = FakePeak:new( vector.new(midx + 2 * deltaMax,0, midy - deltaMax ))
|
||||
local p1 = FakePeak:new(vector.new(midx - 2 * deltaMax, 0, midy - deltaMax))
|
||||
local p2 = FakePeak:new(vector.new(midx, 0, midy + 2 * deltaMax))
|
||||
local p3 = FakePeak:new(vector.new(midx + 2 * deltaMax, 0, midy - deltaMax))
|
||||
|
||||
p1.id, p2.id, p3.id = nvertices + 1, nvertices + 2, nvertices + 3
|
||||
vertices[p1.id], vertices[p2.id], vertices[p3.id] = p1, p2, p3
|
||||
|
||||
---@type MapGen.Triangle[]
|
||||
local triangles = {Triangle:new( vertices[nvertices + 1], vertices[nvertices + 2], vertices[nvertices + 3] )}
|
||||
local triangles = {Triangle:new(vertices[nvertices + 1], vertices[nvertices + 2], vertices[nvertices + 3])}
|
||||
|
||||
for i = 1, nvertices do
|
||||
---@type MapGen.Triangulation.Edge[]
|
||||
@@ -107,7 +166,7 @@ function Triangulation.triangulate( vertices )
|
||||
edges[#edges + 1] = curTriangle.e1
|
||||
edges[#edges + 1] = curTriangle.e2
|
||||
edges[#edges + 1] = curTriangle.e3
|
||||
tableRemove( triangles, j )
|
||||
tableRemove(triangles, j)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -115,8 +174,8 @@ function Triangulation.triangulate( vertices )
|
||||
for j = #edges - 1, 1, -1 do
|
||||
for k = #edges, j + 1, -1 do
|
||||
if edges[j] and edges[k] and edges[j]:same(edges[k]) then
|
||||
tableRemove( edges, j )
|
||||
tableRemove( edges, k-1 )
|
||||
tableRemove(edges, j)
|
||||
tableRemove(edges, k - 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -127,19 +186,21 @@ function Triangulation.triangulate( vertices )
|
||||
end
|
||||
end
|
||||
|
||||
-- Remove tetrahedra associated with the vertices of a supertriangle.
|
||||
-- Remove triangles associated with the vertices of a supertriangle.
|
||||
for i = #triangles, 1, -1 do
|
||||
local triangle = triangles[i]
|
||||
if triangle.p1.id > nvertices or triangle.p2.id > nvertices or triangle.p3.id > nvertices then
|
||||
tableRemove( triangles, i )
|
||||
tableRemove(triangles, i)
|
||||
end
|
||||
end
|
||||
|
||||
-- Removing the vertices of a super supertriangle.
|
||||
for _ = 1,3 do
|
||||
tableRemove( vertices )
|
||||
-- Removing the vertices of a supertriangle.
|
||||
for _ = 1, 3 do
|
||||
tableRemove(vertices)
|
||||
end
|
||||
|
||||
findTrianglesNeighbours(triangles)
|
||||
|
||||
return triangles
|
||||
end
|
||||
|
||||
@@ -148,14 +209,11 @@ end
|
||||
---Vertices that do not have a `is3d` group will not participate in the triangulation.
|
||||
---@param vertices table<integer, MapGen.Peak>
|
||||
function Triangulation.tetrahedralize(vertices)
|
||||
vertices = table.copy_with_metatables(vertices)
|
||||
-- Filter vertices with is3d group (creates a new table)
|
||||
vertices = filterVerticesByGroup(vertices, "is3d")
|
||||
|
||||
-- Only peaks with a `is3d` group can be triangulated.
|
||||
for i, vertex in ipairs(vertices) do
|
||||
if vertex:getGroups().is3d == nil then
|
||||
table.remove(vertices, i)
|
||||
end
|
||||
end
|
||||
-- Sort deterministically to ensure consistent results across sessions
|
||||
sortVerticesDeterministically(vertices)
|
||||
|
||||
local nvertices = #vertices
|
||||
|
||||
@@ -165,13 +223,13 @@ function Triangulation.tetrahedralize(vertices)
|
||||
return {Tetrahedron:new(vertices[1], vertices[2], vertices[3], vertices[4])}
|
||||
end
|
||||
|
||||
local minPos = vertices[1].getPeakPos()
|
||||
local minPos = vertices[1]:getPeakPos()
|
||||
local minX, minY, minZ = minPos.x, minPos.y, minPos.z
|
||||
local maxX, maxY, maxZ = minX, minY, minZ
|
||||
|
||||
for i = 1, nvertices do
|
||||
local vertex = vertices[i]
|
||||
local vertexPos = vertex.getPeakPos()
|
||||
local vertexPos = vertex:getPeakPos()
|
||||
vertex.id = i
|
||||
|
||||
if vertexPos.x < minX then
|
||||
@@ -237,8 +295,8 @@ function Triangulation.tetrahedralize(vertices)
|
||||
for j = #faces - 1, 1, -1 do
|
||||
for k = #faces, j + 1, -1 do
|
||||
if faces[j] and faces[k] and faces[j]:same(faces[k]) then
|
||||
tableRemove( faces, j )
|
||||
tableRemove( faces, k-1 )
|
||||
tableRemove(faces, j)
|
||||
tableRemove(faces, k - 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -247,20 +305,19 @@ function Triangulation.tetrahedralize(vertices)
|
||||
for j = 1, #faces do
|
||||
tetrahedrons[#tetrahedrons + 1] = Tetrahedron:new(faces[j].p1, faces[j].p2, faces[j].p3, vertices[i])
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- Remove tetrahedra associated with the vertices of a supertetrahedron.
|
||||
for i = #tetrahedrons, 1, -1 do
|
||||
local tetrahedron = tetrahedrons[i]
|
||||
if tetrahedron.p1.id > nvertices or tetrahedron.p2.id > nvertices or tetrahedron.p3.id > nvertices or tetrahedron.p4.id > nvertices then
|
||||
tableRemove( tetrahedrons, i )
|
||||
tableRemove(tetrahedrons, i)
|
||||
end
|
||||
end
|
||||
|
||||
-- Removing the vertices of a supertetrahedron.
|
||||
for i = 1, 4 do
|
||||
tableRemove( vertices )
|
||||
for _ = 1, 4 do
|
||||
tableRemove(vertices)
|
||||
end
|
||||
|
||||
return tetrahedrons
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
local getInstance = Class.getInstance
|
||||
|
||||
---@class MapGen.Triangulation.Edge
|
||||
---@field p1 MapGen.Peak
|
||||
---@field p2 MapGen.Peak
|
||||
@@ -8,12 +10,11 @@ local Edge = {}
|
||||
---@return MapGen.Triangulation.Edge
|
||||
function Edge:new( p1, p2 )
|
||||
---@type MapGen.Triangulation.Edge
|
||||
local instance = setmetatable({
|
||||
local instance = getInstance(self, {
|
||||
p1 = p1,
|
||||
p2 = p2
|
||||
},
|
||||
{
|
||||
__index = self,
|
||||
__tostring = self.toString,
|
||||
__eq = self.eq
|
||||
})
|
||||
|
||||
@@ -17,8 +17,7 @@ local FakePeak = Class.extend(Peak, {})
|
||||
---@param peakPos vector
|
||||
---@return MapGen.Peak
|
||||
function FakePeak:new(peakPos)
|
||||
---@diagnostic disable-next-line: missing-fields, param-type-not-match
|
||||
local instance = Peak:new(peakPos, {}, 1)
|
||||
local instance = Peak:new({pos = peakPos, color = '#000000'})
|
||||
|
||||
return instance
|
||||
end
|
||||
|
||||
101
mods/CORE/MapGen/src/MapGen/ff2luat.lua
Normal file
101
mods/CORE/MapGen/src/MapGen/ff2luat.lua
Normal file
@@ -0,0 +1,101 @@
|
||||
-- A method for converting an image with colored dots (pixels) into a Lua table grouped by color.
|
||||
-- Author: @ssdaniel24 (github)
|
||||
|
||||
---Table with color as key and value is table with coordinates of dots. Note: coords begin from 1,1 (not 0,0).
|
||||
---Example of table:
|
||||
---```lua
|
||||
---{
|
||||
--- 'size': { h=256, w=256 },
|
||||
--- '#fff': { {x=1,y=1}, {x=2,y=2}, ... },
|
||||
--- '#ff0': { {x=3,y=3}, {x=4,y=4}, ... },
|
||||
--- ...
|
||||
---}
|
||||
---```
|
||||
---@alias ColoredDotsTable table<string,table>
|
||||
|
||||
---@param uintb string unsigned int bytes
|
||||
---@return number
|
||||
local function uintb2num(uintb)
|
||||
local num = 0
|
||||
local len = string.len(uintb)
|
||||
|
||||
for i = 1,len do
|
||||
num = num*256 + string.byte(uintb, i)
|
||||
end
|
||||
|
||||
return num
|
||||
end
|
||||
|
||||
---Converts (scaling) 16-bit unsigned integer to 8-bit unsigned integer.
|
||||
---Why? Because hex codes of colors are 8-bit: #ffffff -> ff = 256 (8 bit). Not 65536 (16 bit).
|
||||
---@param num number 16-bit number
|
||||
---@return number 8-bit number
|
||||
local function uint16ToUint8(num)
|
||||
return math.floor(num / 256)
|
||||
end
|
||||
|
||||
---Converts given farbfeld image to ColoredDotsTable.
|
||||
---Farbfeld format:
|
||||
---```
|
||||
---╔════════╤═════════════════════════════════════════════════════════╗
|
||||
---║ Bytes │ Description ║
|
||||
---╠════════╪═════════════════════════════════════════════════════════╣
|
||||
---║ 8 │ 'farbfeld' magic value ║
|
||||
---╟────────┼─────────────────────────────────────────────────────────╢
|
||||
---║ 4 │ 32-Bit BE unsigned integer (width) ║
|
||||
---╟────────┼─────────────────────────────────────────────────────────╢
|
||||
---║ 4 │ 32-Bit BE unsigned integer (height) ║
|
||||
---╟────────┼─────────────────────────────────────────────────────────╢
|
||||
---║ [2222] │ 4x16-Bit BE unsigned integers [RGBA] / pixel, row-major ║
|
||||
---╚════════╧═════════════════════════════════════════════════════════╝
|
||||
---```
|
||||
---[tools/farbfeld | suckless.org software that sucks less](https://tools.suckless.org/farbfeld/)
|
||||
---@param filepath string image in farbfeld format
|
||||
---@param backgroundColor string? ColorString, will be ignored while processing image. Default: `#000000FF`
|
||||
---@return ColoredDotsTable
|
||||
local function ff2luat(filepath, backgroundColor)
|
||||
local file = io.open(filepath, 'rb')
|
||||
if not file then error('Can\'t open farbfeld image: ' .. dump(filepath)) end
|
||||
local ff = file:read('*a') -- binary!
|
||||
file:close()
|
||||
-- TODO: make it decompressing gzip format -> https://en.wikipedia.org/wiki/Gzip
|
||||
-- I should skip 10 bytes in a beginning, read how many extra fields after it, skip them too, and skip last 8 bytes
|
||||
-- (read wiki for information).
|
||||
-- if filepath:sub(-3) == '.gz' then ff = core.decompress(ff, 'deflate') end
|
||||
if not ff:sub(1,8) == 'farbfeld' then error('Not farbfeld image: ' .. dump(filepath)) end
|
||||
|
||||
if not backgroundColor then backgroundColor = '#000000FF' end
|
||||
--HACK: normalizing colorstring for future string comparison ('#000' -> '#000000FF')
|
||||
backgroundColor = Smc.fixColorString(backgroundColor)
|
||||
|
||||
---@type ColoredDotsTable
|
||||
local dots = { size = { w = uintb2num(ff:sub(9,12)), h = uintb2num(ff:sub(13,16)) } }
|
||||
|
||||
local cursor
|
||||
for i = 1,dots.size.h do
|
||||
for j = 1,dots.size.w do
|
||||
cursor = 16 + ((i-1)*dots.size.w + j-1)*8 + 1
|
||||
local colorT = {
|
||||
r = uint16ToUint8(uintb2num(ff:sub(cursor, cursor+1))),
|
||||
g = uint16ToUint8(uintb2num(ff:sub(cursor+2,cursor+3))),
|
||||
b = uint16ToUint8(uintb2num(ff:sub(cursor+4,cursor+5))),
|
||||
a = uint16ToUint8(uintb2num(ff:sub(cursor+6,cursor+7)))
|
||||
}
|
||||
|
||||
---@type string @ColorString
|
||||
local color = core.colorspec_to_colorstring(colorT) or ''
|
||||
|
||||
if color ~= backgroundColor then
|
||||
if not dots[color] then
|
||||
dots[color] = {}
|
||||
end
|
||||
|
||||
table.insert(dots[color], { x=j, y=i })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return dots
|
||||
end
|
||||
|
||||
return ff2luat
|
||||
@@ -1,2 +1,2 @@
|
||||
name = smc__core__player
|
||||
depends = smc__api__api_loader
|
||||
depends = smc__system__system_loader
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
name = smc__core__sound
|
||||
depends = smc__api__api_loader
|
||||
depends = smc__system__system_loader
|
||||
@@ -1,2 +1,2 @@
|
||||
name = smc__core__tilesheet
|
||||
depends = smc__api__api_loader
|
||||
depends = smc__system__system_loader
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
local mathRound = math.round
|
||||
|
||||
local getInstance = Class.getInstance
|
||||
|
||||
---@class TileSheet
|
||||
---@field image string Name of texture
|
||||
---@field width number Number of tiles in the table horizontally
|
||||
@@ -70,11 +72,11 @@ function TileSheet:new(image, tileWidth, tileHeight)
|
||||
end
|
||||
|
||||
---@type TileSheet
|
||||
local instance = setmetatable({
|
||||
local instance = getInstance(self, {
|
||||
image = image,
|
||||
width = mathRound(width / tileWidth),
|
||||
height = mathRound(height / tileHeight),
|
||||
}, {__index = self})
|
||||
})
|
||||
|
||||
return instance
|
||||
end
|
||||
|
||||
@@ -12,13 +12,12 @@ listForm:list('current_player', 'main', 10.5, 6.5, 8, 4)
|
||||
|
||||
local listFormItems = Formspec:new()
|
||||
|
||||
local items = core.registered_nodes
|
||||
|
||||
local items = table.get_keys(core.registered_nodes)
|
||||
table.sort(items)
|
||||
local w, h = 0, 0
|
||||
|
||||
---@param name string
|
||||
---@param def NodeDefinition
|
||||
for name, def in pairs(items) do
|
||||
for _, name in ipairs(items) do
|
||||
listFormItems:itemImageButton(w, h, 1, 1, name, name..'::item_button')
|
||||
|
||||
w = w + 1
|
||||
@@ -31,10 +30,9 @@ end
|
||||
|
||||
--listFormItems:list('current_player', 'main', 0, 0, 1, 32)
|
||||
|
||||
listForm:scrollContainer(listFormItems, 0.5, 0.5, 9, 11, 'admin_commands:list_items', 'vertical')
|
||||
listForm:scrollbar(10, 0.5, 0.25, 10, 'vertical', 'admin_commands:list_items')
|
||||
|
||||
core.log(listForm:toString())
|
||||
listForm:
|
||||
scrollContainer(listFormItems, 0.5, 0.5, 9, 11, 'admin_commands:list_items', 'vertical'):
|
||||
scrollbar(10, 0.5, 0.25, 10, 'vertical', 'admin_commands:list_items')
|
||||
|
||||
core.register_chatcommand('list', {
|
||||
privs = {server = true},
|
||||
@@ -55,9 +53,13 @@ core.register_on_player_receive_fields(function(player, formname, fields)
|
||||
|
||||
for key, value in pairs(fields) do
|
||||
if string.ends_with(key, '::item_button') then
|
||||
---@type ItemStackString
|
||||
---@type ItemStackString?
|
||||
local stack = string.match(key, '(%S+)::item_button')
|
||||
|
||||
if stack == nil then
|
||||
return
|
||||
end
|
||||
|
||||
core.log(tostring(stack))
|
||||
|
||||
---@type InvRef
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
name = smc__core__admin_commands
|
||||
depends = smc__api__api_loader, smc__core__formspec, smc__core__item
|
||||
depends = smc__system__system_loader, smc__core__formspec, smc__core__item
|
||||
|
||||
@@ -6,37 +6,39 @@
|
||||
|
||||
-- --- Global APIs load --
|
||||
-- Class
|
||||
dofile(core.get_modpath('smc__api__class')..'/init.lua')
|
||||
dofile(core.get_modpath('smc__system__class')..'/init.lua')
|
||||
|
||||
-- Ensure
|
||||
dofile(core.get_modpath('smc__api__ensure')..'/init.lua')
|
||||
dofile(core.get_modpath('smc__system__ensure')..'/init.lua')
|
||||
|
||||
-- Logger
|
||||
dofile(core.get_modpath('smc__api__logger')..'/init.lua')
|
||||
dofile(core.get_modpath('smc__system__logger')..'/init.lua')
|
||||
|
||||
-- Math
|
||||
dofile(core.get_modpath('smc__api__math')..'/init.lua')
|
||||
dofile(core.get_modpath('smc__system__math')..'/init.lua')
|
||||
|
||||
-- Require
|
||||
dofile(core.get_modpath('smc__api__require')..'/init.lua')
|
||||
dofile(core.get_modpath('smc__system__require')..'/init.lua')
|
||||
|
||||
-- Mod
|
||||
dofile(core.get_modpath('smc__api__mod')..'/init.lua')
|
||||
dofile(core.get_modpath('smc__system__mod')..'/init.lua')
|
||||
|
||||
-- TODO: исправить загрузку строковых библиотек (хотя они пока что не юзаются в мапгене)
|
||||
-- Они не работают из-за get_current_modname внутри utf8
|
||||
-- UTF-8
|
||||
-- dofile(core.get_modpath('smc__api__utf8')..'/init.lua')
|
||||
-- dofile(core.get_modpath('smc__system__utf8')..'/init.lua')
|
||||
|
||||
-- String
|
||||
-- dofile(core.get_modpath('smc__api__string')..'/init.lua')
|
||||
-- dofile(core.get_modpath('smc__system__string')..'/init.lua')
|
||||
|
||||
-- Table
|
||||
dofile(core.get_modpath('smc__api__table')..'/init.lua')
|
||||
dofile(core.get_modpath('smc__system__table')..'/init.lua')
|
||||
|
||||
-- TODO: пока что закоментировано, поскольку вызывает ошибку из-за global_step
|
||||
-- Api loader
|
||||
-- dofile(core.get_modpath('smc__api__api_loader')..'/init.lua')
|
||||
-- Smc lib loader
|
||||
-- dofile(core.get_modpath('smc__system__helper_lib')..'/init.lua')
|
||||
Smc = {}
|
||||
dofile(core.get_modpath('smc__system__helper_lib')..'/src/Lib/color.lua')
|
||||
|
||||
---@type MapGen
|
||||
local mapGenerator = dofile(core.get_modpath('smc__core__map_generator')..'/src/mapGenerator.lua')
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user