Compare commits
8 Commits
tahrion_te
...
ssdaniel24
| Author | SHA1 | Date | |
|---|---|---|---|
| 8fb3235937 | |||
| 83e22f192b | |||
| 52630eb85a | |||
|
|
7658d74387 | ||
| 4c143b2055 | |||
|
|
54184fc32a | ||
| 108c0c8817 | |||
| a97d806f6b |
@@ -24,7 +24,6 @@
|
|||||||
"enables": [],
|
"enables": [],
|
||||||
"globals": [
|
"globals": [
|
||||||
"core",
|
"core",
|
||||||
"Smc",
|
|
||||||
"table",
|
"table",
|
||||||
"Events",
|
"Events",
|
||||||
"VoxelArea",
|
"VoxelArea",
|
||||||
|
|||||||
@@ -1,52 +0,0 @@
|
|||||||
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: |
|
|
||||||
Спасибо, что уделили время и заполнили этот отчет об ошибке!
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
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
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
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
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
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,2 +1 @@
|
|||||||
IGNORE
|
|
||||||
/mods/IGNORE
|
/mods/IGNORE
|
||||||
7
.gitmodules
vendored
7
.gitmodules
vendored
@@ -1,6 +1,7 @@
|
|||||||
|
[submodule "mods/API/Utf8"]
|
||||||
|
path = mods/API/Utf8
|
||||||
|
url = https://github.com/ApancoreStudio/utf8_api.git
|
||||||
|
branch = main
|
||||||
[submodule "util/ide-helper"]
|
[submodule "util/ide-helper"]
|
||||||
path = util/ide-helper
|
path = util/ide-helper
|
||||||
url = https://github.com/Voxrame/luanti-ide-helper.git
|
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
|
|
||||||
|
|||||||
@@ -1,218 +0,0 @@
|
|||||||
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:
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
# 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)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
# 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.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
# 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.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,307 +0,0 @@
|
|||||||
# 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
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,203 +0,0 @@
|
|||||||
# 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
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
# global MapGen.Decoration
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## methods
|
|
||||||
---
|
|
||||||
|
|
||||||
### Decoration.new
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Decoration.new() -> MapGen.Decoration {
|
|
||||||
new = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,673 +0,0 @@
|
|||||||
# 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**
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,157 +0,0 @@
|
|||||||
# 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
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,144 +0,0 @@
|
|||||||
# 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
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,536 +0,0 @@
|
|||||||
# 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)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,745 +0,0 @@
|
|||||||
# 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?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,225 +0,0 @@
|
|||||||
# 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,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
# 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
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
# 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
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
# 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/)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,738 +0,0 @@
|
|||||||
# 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>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
# 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}, ... },
|
|
||||||
...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
# 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.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
# 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.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,312 +0,0 @@
|
|||||||
# 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
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,226 +0,0 @@
|
|||||||
# 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?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,208 +0,0 @@
|
|||||||
# 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
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,116 +0,0 @@
|
|||||||
# 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>?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
# class Decoration
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- namespace: MapGen
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
**NOT IMPLEMENTED**
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## methods
|
|
||||||
---
|
|
||||||
|
|
||||||
### Decoration.new
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Decoration.new() -> MapGen.Decoration {
|
|
||||||
new = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
# alias Category
|
|
||||||
---
|
|
||||||
|
|
||||||
- namespace: MapGen.Layer
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```lua
|
|
||||||
(alias) Category = ("landscape"|"temp"|"humidity")
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
A category of noise that affects specific map generation objects.
|
|
||||||
|
|
||||||
@@ -1,678 +0,0 @@
|
|||||||
# 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**
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,191 +0,0 @@
|
|||||||
# 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?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
# alias PastCalcNoiseValue
|
|
||||||
---
|
|
||||||
|
|
||||||
- namespace: MapGen
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```lua
|
|
||||||
(alias) PastCalcNoiseValue = { noiseValue: number?, triangle: MapGen.Triangle?, x: integer?, z: integer? }
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,162 +0,0 @@
|
|||||||
# 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
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
# 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>?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,149 +0,0 @@
|
|||||||
# 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
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
# 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
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,541 +0,0 @@
|
|||||||
# 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)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
# alias CircumCircleEnum
|
|
||||||
---
|
|
||||||
|
|
||||||
- namespace: MapGen.Triangle
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```lua
|
|
||||||
(alias) CircumCircleEnum = ("IN"|"BEHIND"|"ON")
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
# 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
|
|
||||||
|
|
||||||
@@ -1,750 +0,0 @@
|
|||||||
# 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?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,230 +0,0 @@
|
|||||||
# 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,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
# 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
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
# 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
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,741 +0,0 @@
|
|||||||
# 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>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
# class MapGenDef
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Definition table for the `MapGen`.
|
|
||||||
|
|
||||||
**Only for EmmyLua.**
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### MapGenDef.nodes
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
MapGenDef.nodes : table<string,string>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
# alias generateFunc
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```lua
|
|
||||||
(alias) generateFunc = fun(self, mapGenerator: MapGen, data: number[], index: number, x: number, y: number, z: number)
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
|
|
||||||
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: ""
|
|
||||||
4
mods/API/ApiLoader/init.lua
Normal file
4
mods/API/ApiLoader/init.lua
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
local modInfo = Mod.getInfo('smc__api__api_loader')
|
||||||
|
local require = modInfo.require
|
||||||
|
|
||||||
|
require('Api')
|
||||||
3
mods/API/ApiLoader/mod.conf
Normal file
3
mods/API/ApiLoader/mod.conf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
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
|
||||||
7
mods/API/ApiLoader/src/Api.lua
Normal file
7
mods/API/ApiLoader/src/Api.lua
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
Api = {}
|
||||||
|
|
||||||
|
local modInfo = Mod.getInfo('smc__api__api_loader')
|
||||||
|
local require = modInfo.require
|
||||||
|
|
||||||
|
require('Api.ff2lua')
|
||||||
|
require('Api.globalStep')
|
||||||
@@ -53,7 +53,7 @@ end
|
|||||||
---@param filepath string image in farbfeld format
|
---@param filepath string image in farbfeld format
|
||||||
---@param backgroundColor string? ColorString, will be ignored while processing image. Default: `#000000FF`
|
---@param backgroundColor string? ColorString, will be ignored while processing image. Default: `#000000FF`
|
||||||
---@return ColoredDotsTable
|
---@return ColoredDotsTable
|
||||||
local function ff2luat(filepath, backgroundColor)
|
function Api.ff2luat(filepath, backgroundColor)
|
||||||
local file = io.open(filepath, 'rb')
|
local file = io.open(filepath, 'rb')
|
||||||
if not file then error('Can\'t open farbfeld image: ' .. dump(filepath)) end
|
if not file then error('Can\'t open farbfeld image: ' .. dump(filepath)) end
|
||||||
local ff = file:read('*a') -- binary!
|
local ff = file:read('*a') -- binary!
|
||||||
@@ -66,7 +66,7 @@ local function ff2luat(filepath, backgroundColor)
|
|||||||
|
|
||||||
if not backgroundColor then backgroundColor = '#000000FF' end
|
if not backgroundColor then backgroundColor = '#000000FF' end
|
||||||
--HACK: normalizing colorstring for future string comparison ('#000' -> '#000000FF')
|
--HACK: normalizing colorstring for future string comparison ('#000' -> '#000000FF')
|
||||||
backgroundColor = Smc.fixColorString(backgroundColor)
|
backgroundColor = core.colorspec_to_colorstring(core.colorspec_to_table(backgroundColor))
|
||||||
|
|
||||||
---@type ColoredDotsTable
|
---@type ColoredDotsTable
|
||||||
local dots = { size = { w = uintb2num(ff:sub(9,12)), h = uintb2num(ff:sub(13,16)) } }
|
local dots = { size = { w = uintb2num(ff:sub(9,12)), h = uintb2num(ff:sub(13,16)) } }
|
||||||
@@ -83,7 +83,7 @@ local function ff2luat(filepath, backgroundColor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
---@type string @ColorString
|
---@type string @ColorString
|
||||||
local color = core.colorspec_to_colorstring(colorT) or ''
|
local color = core.colorspec_to_colorstring(colorT)
|
||||||
|
|
||||||
if color ~= backgroundColor then
|
if color ~= backgroundColor then
|
||||||
if not dots[color] then
|
if not dots[color] then
|
||||||
@@ -97,5 +97,3 @@ local function ff2luat(filepath, backgroundColor)
|
|||||||
|
|
||||||
return dots
|
return dots
|
||||||
end
|
end
|
||||||
|
|
||||||
return ff2luat
|
|
||||||
@@ -3,7 +3,7 @@ local callsWithDelay = {}
|
|||||||
|
|
||||||
---@param timeDelay number
|
---@param timeDelay number
|
||||||
---@param callbackFunc fun(deltaTime:number)
|
---@param callbackFunc fun(deltaTime:number)
|
||||||
function Smc.registerGlobalStepWithDelay(timeDelay, callbackFunc)
|
function Api.registerGlobalStepWithDelay(timeDelay, callbackFunc)
|
||||||
table.insert(callsWithDelay, {
|
table.insert(callsWithDelay, {
|
||||||
timeDelay = timeDelay,
|
timeDelay = timeDelay,
|
||||||
callbackFunc = callbackFunc,
|
callbackFunc = callbackFunc,
|
||||||
@@ -40,7 +40,7 @@ local callsForEachPlayer = {}
|
|||||||
|
|
||||||
---@param timeDelay number
|
---@param timeDelay number
|
||||||
---@param callbackFunc fun(deltaTime:number, player:Player)
|
---@param callbackFunc fun(deltaTime:number, player:Player)
|
||||||
function Smc.registerGlobalStepForEachPlayer(timeDelay, callbackFunc)
|
function Api.registerGlobalStepForEachPlayer(timeDelay, callbackFunc)
|
||||||
table.insert(callsWithDelay, {
|
table.insert(callsWithDelay, {
|
||||||
timeDelay = timeDelay,
|
timeDelay = timeDelay,
|
||||||
callbackFunc = callbackFunc,
|
callbackFunc = callbackFunc,
|
||||||
9
mods/API/Class/init.lua
Normal file
9
mods/API/Class/init.lua
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
---@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
mods/API/Class/mod.conf
Normal file
1
mods/API/Class/mod.conf
Normal file
@@ -0,0 +1 @@
|
|||||||
|
name = smc__api__class
|
||||||
1
mods/API/Ensure/mod.conf
Normal file
1
mods/API/Ensure/mod.conf
Normal file
@@ -0,0 +1 @@
|
|||||||
|
name = smc__api__ensure
|
||||||
2
mods/API/Events/mod.conf
Normal file
2
mods/API/Events/mod.conf
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
name = smc__api__events
|
||||||
|
depends = smc__api__table
|
||||||
1
mods/API/Logger/mod.conf
Normal file
1
mods/API/Logger/mod.conf
Normal file
@@ -0,0 +1 @@
|
|||||||
|
name = smc__api__logger
|
||||||
@@ -4,7 +4,6 @@ local math = math
|
|||||||
---@param value number The value to be limited.
|
---@param value number The value to be limited.
|
||||||
---@param min number Minimum limit.
|
---@param min number Minimum limit.
|
||||||
---@param max number Maximum limit.
|
---@param max number Maximum limit.
|
||||||
---@return number
|
|
||||||
math.clamp = function(value, min, max)
|
math.clamp = function(value, min, max)
|
||||||
return math.min(math.max(value, min), max)
|
return math.min(math.max(value, min), max)
|
||||||
end
|
end
|
||||||
@@ -13,7 +12,6 @@ end
|
|||||||
---@param a number Minimum value.
|
---@param a number Minimum value.
|
||||||
---@param b number Maximum value.
|
---@param b number Maximum value.
|
||||||
---@param t number Number in range [0, 1].
|
---@param t number Number in range [0, 1].
|
||||||
---@return number
|
|
||||||
math.lerp = function (a, b, t)
|
math.lerp = function (a, b, t)
|
||||||
t = math.clamp(t, 0, 1)
|
t = math.clamp(t, 0, 1)
|
||||||
|
|
||||||
1
mods/API/Math/mod.conf
Normal file
1
mods/API/Math/mod.conf
Normal file
@@ -0,0 +1 @@
|
|||||||
|
name = smc__api__math
|
||||||
1
mods/API/Mod/mod.conf
Normal file
1
mods/API/Mod/mod.conf
Normal file
@@ -0,0 +1 @@
|
|||||||
|
name = smc__api__mod
|
||||||
1
mods/API/Require/mod.conf
Normal file
1
mods/API/Require/mod.conf
Normal file
@@ -0,0 +1 @@
|
|||||||
|
name = smc__api__require
|
||||||
2
mods/API/String/mod.conf
Normal file
2
mods/API/String/mod.conf
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
name = smc__api__string
|
||||||
|
depends = smc__api__ensure
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
local tableCopy, tableKeyOf, pairs, ipairs, next, type, assert, ensureArgType, ensureArgNotNil, toString
|
local tableCopy, tableKeyOf, pairs, ipairs, next, type, assert, ensureArgType, ensureArgNotNil
|
||||||
= table.copy, table.keyof, pairs, ipairs, next, type, assert, Ensure.argType, Ensure.argNotNil, tostring
|
= table.copy, table.keyof, pairs, ipairs, next, type, assert, Ensure.argType, Ensure.argNotNil
|
||||||
|
|
||||||
-- While extending Lua's table library, we maintain snake_case naming for standard library
|
-- While extending Lua's table library, we maintain snake_case naming for standard library
|
||||||
-- functions and arguments to match standard library conventions. The code that is not exposed
|
-- functions and arguments to match standard library conventions. The code that is not exposed
|
||||||
@@ -57,8 +57,6 @@ end
|
|||||||
--- @return boolean
|
--- @return boolean
|
||||||
function table.contains(t, value)
|
function table.contains(t, value)
|
||||||
ensureArgType(t, 'table', 1, 'table.contains')
|
ensureArgType(t, 'table', 1, 'table.contains')
|
||||||
|
|
||||||
---@diagnostic disable-next-line: param-type-not-match
|
|
||||||
return tableKeyOf(t, value) ~= nil
|
return tableKeyOf(t, value) ~= nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -360,27 +358,3 @@ function table.divide_values(t1, t2, empty_value)
|
|||||||
end
|
end
|
||||||
return operateValues(t1, t2, empty_value or 1, operation)
|
return operateValues(t1, t2, empty_value or 1, operation)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Returns a string of the format `'key1=value1,key2=value2...keyN=valueN'`.
|
|
||||||
--- @param t table
|
|
||||||
--- @param separator string? Default: `,`
|
|
||||||
--- @return string
|
|
||||||
function table.key_value_list(t, separator)
|
|
||||||
separator = separator or ','
|
|
||||||
|
|
||||||
local result = ''
|
|
||||||
|
|
||||||
local size = #t
|
|
||||||
local k = 1
|
|
||||||
for key, value in pairs(t) do
|
|
||||||
if size < k then
|
|
||||||
result = result..key..'='..toString(value)..separator
|
|
||||||
else
|
|
||||||
result = result..key..'='..toString(value)
|
|
||||||
end
|
|
||||||
|
|
||||||
k = k + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
return result
|
|
||||||
end
|
|
||||||
2
mods/API/Table/mod.conf
Normal file
2
mods/API/Table/mod.conf
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
name = smc__api__table
|
||||||
|
depends = smc__api__ensure
|
||||||
1
mods/API/Utf8
Submodule
1
mods/API/Utf8
Submodule
Submodule mods/API/Utf8 added at d612fc127f
1
mods/API/modpack.conf
Normal file
1
mods/API/modpack.conf
Normal file
@@ -0,0 +1 @@
|
|||||||
|
name = smc__api
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
name = smc__core__control
|
name = smc__core__control
|
||||||
depends = smc__system__system_loader
|
depends = smc__api__api_loader
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ core.register_on_leaveplayer(function(player, timed_out)
|
|||||||
playersControlTimer[playerName] = nil
|
playersControlTimer[playerName] = nil
|
||||||
end)
|
end)
|
||||||
|
|
||||||
Smc.registerGlobalStepForEachPlayer(0, function(deltaTime, player)
|
Api.registerGlobalStepForEachPlayer(0, function(deltaTime, player)
|
||||||
if player == nil then
|
if player == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
name = smc__core__craft_system
|
name = smc__core__craft_system
|
||||||
depends = smc__system__system_loader
|
depends = smc__api__api_loader
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
name = smc__core__formspec
|
name = smc__core__formspec
|
||||||
depends = smc__system__system_loader
|
depends = smc__api__api_loader
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,2 +1,2 @@
|
|||||||
name = smc__core__item
|
name = smc__core__item
|
||||||
depends = smc__system__system_loader, smc__core__item_factory
|
depends = smc__api__api_loader, smc__core__item_factory
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
local getInstance = Class.getInstance
|
|
||||||
|
|
||||||
local modInfo = Mod.getInfo('smc__core__item')
|
local modInfo = Mod.getInfo('smc__core__item')
|
||||||
local require = modInfo.require
|
local require = modInfo.require
|
||||||
|
|
||||||
@@ -98,7 +96,7 @@ function Item:new(itemDef)
|
|||||||
itemDef = defMerge(itemDef, self.defaultDef, true)
|
itemDef = defMerge(itemDef, self.defaultDef, true)
|
||||||
|
|
||||||
---@type Item
|
---@type Item
|
||||||
local instance = getInstance(self, {})
|
local instance = setmetatable({}, {__index = self})
|
||||||
|
|
||||||
local luantiDef = itemDefToLuantiDef(itemDef)
|
local luantiDef = itemDefToLuantiDef(itemDef)
|
||||||
local visual = itemDef.settings.visual
|
local visual = itemDef.settings.visual
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
name = smc__core__item_factory
|
name = smc__core__item_factory
|
||||||
depends = smc__system__system_loader
|
depends = smc__api__api_loader
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
local getInstance = Class.getInstance
|
|
||||||
|
|
||||||
---@class ItemFactory
|
---@class ItemFactory
|
||||||
---@field defaultDef Item.ItemDefinition|Node.NodeDefinition
|
---@field defaultDef Item.ItemDefinition|Node.NodeDefinition
|
||||||
---@field itemClass Item|Node
|
---@field itemClass Item|Node
|
||||||
@@ -10,10 +8,10 @@ local ItemFactory = {}
|
|||||||
---@return ItemFactory
|
---@return ItemFactory
|
||||||
function ItemFactory:new(itemClass, defaultDef)
|
function ItemFactory:new(itemClass, defaultDef)
|
||||||
---@type ItemFactory
|
---@type ItemFactory
|
||||||
local instance =getInstance(self, {
|
local instance = setmetatable({
|
||||||
defaultDef = defaultDef,
|
defaultDef = defaultDef,
|
||||||
itemClass = itemClass,
|
itemClass = itemClass,
|
||||||
})
|
}, {__index = self})
|
||||||
|
|
||||||
return instance
|
return instance
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
name = smc__core__map_gen
|
name = smc__core__map_gen
|
||||||
depends = smc__system__system_loader
|
depends = smc__api__api_loader
|
||||||
@@ -1,20 +1,26 @@
|
|||||||
local mathAbs, mathRound, mathMin, mathMax, id
|
local mathAbs, mathRound, mathMin, mathMax, id
|
||||||
= math.abs, math.round, math.min, math.max, core.get_content_id
|
= math.abs, math.round, math.min, math.max, core.get_content_id
|
||||||
|
|
||||||
local getInstance = Class.getInstance
|
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 modInfo = Mod.getInfo('smc__core__map_gen')
|
local modInfo = Mod.getInfo('smc__core__map_gen')
|
||||||
local require = modInfo.require
|
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
|
---@type MapGen.Layer
|
||||||
local Layer = require('MapGen.Layer')
|
local Layer = require('MapGen.Layer')
|
||||||
|
|
||||||
@@ -33,18 +39,13 @@ local Triangulation = require('MapGen.Triangulation')
|
|||||||
---@type MapGen.Cavern
|
---@type MapGen.Cavern
|
||||||
local Cavern = require('MapGen.Cavern')
|
local Cavern = require('MapGen.Cavern')
|
||||||
|
|
||||||
---@type MapGen.Region
|
|
||||||
local Region = require('MapGen.Region')
|
|
||||||
|
|
||||||
local ff2luat = require('MapGen.ff2luat')
|
|
||||||
|
|
||||||
---@class MapGen
|
---@class MapGen
|
||||||
---@field layersByName table<string, MapGen.Layer>
|
---@field layersByName table<string, MapGen.Layer>
|
||||||
---@field layersList MapGen.Layer[]
|
---@field layersList MapGen.Layer[]
|
||||||
---@field staticsByName table<string, MapGen.StaticLayer>
|
---@field staticsByName table<string, MapGen.StaticLayer>
|
||||||
---@field staticsList 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 peaksMultinoiseInitialized boolean Is the fractal noise of the peaks 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 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 isRunning boolean A static field that guarantees that only one instance of the `MapGen` class will work.
|
||||||
---@field nodeIDs table<string, number>
|
---@field nodeIDs table<string, number>
|
||||||
local MapGen = {
|
local MapGen = {
|
||||||
@@ -52,8 +53,8 @@ local MapGen = {
|
|||||||
layersList = {},
|
layersList = {},
|
||||||
staticsByName = {},
|
staticsByName = {},
|
||||||
staticsList = {},
|
staticsList = {},
|
||||||
isLayersNoisesInitialized = false,
|
peaksMultinoiseInitialized = false,
|
||||||
isCavernsNoiseInitialized = false,
|
cavernsNoiseInitialized = false,
|
||||||
isRunning = false,
|
isRunning = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,25 +74,14 @@ function MapGen:new(def)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---@type MapGen
|
---@type MapGen
|
||||||
local instance = getInstance(self, {
|
local instance = setmetatable({
|
||||||
nodes = def.nodes,
|
nodes = def.nodes,
|
||||||
nodeIDs = nodesIDs,
|
nodeIDs = nodesIDs,
|
||||||
})
|
}, {__index = self})
|
||||||
|
|
||||||
return instance
|
return instance
|
||||||
end
|
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.
|
---Determines which layer a node belongs to based on its height coordinate.
|
||||||
---@param yPos number
|
---@param yPos number
|
||||||
---@return MapGen.Layer?
|
---@return MapGen.Layer?
|
||||||
@@ -130,229 +120,6 @@ function MapGen:getStaticByHeight(yPos)
|
|||||||
end
|
end
|
||||||
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 ---
|
-- --- REGISTRATION METHODS ---
|
||||||
@@ -361,7 +128,7 @@ end
|
|||||||
---
|
---
|
||||||
---Note: layers must not overlap.
|
---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 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)
|
function MapGen:registerLayer(name, def)
|
||||||
-- Layers with the same name cannot exist.
|
-- Layers with the same name cannot exist.
|
||||||
assert(self.layersByName[name] == nil, ('A layer named `%s` is already registered.'):format(name))
|
assert(self.layersByName[name] == nil, ('A layer named `%s` is already registered.'):format(name))
|
||||||
@@ -381,22 +148,11 @@ function MapGen:registerLayer(name, def)
|
|||||||
end)
|
end)
|
||||||
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`.
|
---Mark the world area between two heights as a `MapGen.StaticLayer`.
|
||||||
---
|
---
|
||||||
---Note: layers must not overlap.
|
---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 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 def MapGen.StaticLayerDef Static layer description table, see details `MapGen.StaticLayerDef`
|
||||||
function MapGen:registerStaticLayer(name, def)
|
function MapGen:registerStaticLayer(name, def)
|
||||||
-- Static layer with the same name cannot exist.
|
-- Static layer with the same name cannot exist.
|
||||||
assert(self.staticsByName[name] == nil, ('A static layer named `%s` is already registered.'):format(name))
|
assert(self.staticsByName[name] == nil, ('A static layer named `%s` is already registered.'):format(name))
|
||||||
@@ -416,126 +172,99 @@ function MapGen:registerStaticLayer(name, def)
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
---Mark a world point as `MapGen.Peak` and assign it a specific color that will affect the generation.
|
---Mark a world point as `MapGen.Peak` and assign it a specific noise that will affect the generation.
|
||||||
---
|
---
|
||||||
---Note: The peaks shouldn't overlap.
|
---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 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 peakPos vector The coordinate where the peak will be placed.
|
||||||
---@param def MapGen.PeakDef Peak description table, see details `MapGen.PeakDef`.
|
---@param multinoise MapGen.Peak.MultinoiseParams Noise that will be assigned to the peak and that will influence map generation
|
||||||
function MapGen:registerPeak(layerName, category, def)
|
---@param groups table<string, number>? Peak groups that may affect processing.
|
||||||
local layer = self:getLayerByName(layerName)
|
function MapGen:registerPeak(layerName, peakPos, multinoise, groups)
|
||||||
|
---@type MapGen.Layer
|
||||||
|
local layer = self.layersByName[layerName]
|
||||||
|
|
||||||
--assert(self:getPeakByPos(layer, category, def.pos) == nil,
|
assert(layer ~= nil, ('There is no layer named `%s` registered.'):format(layerName))
|
||||||
--('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))
|
if not layer then
|
||||||
|
error('Invalid layer: ' .. layerName)
|
||||||
|
end
|
||||||
|
|
||||||
|
--TODO: добавить проверку, что координата пиков не совпадают
|
||||||
|
|
||||||
---@type MapGen.Peak
|
---@type MapGen.Peak
|
||||||
local peak = Peak:new(def)
|
local peak = Peak:new(peakPos, multinoise, groups)
|
||||||
|
|
||||||
layer:addPeak(category, peak)
|
layer:addPeak(peak)
|
||||||
end
|
end
|
||||||
|
|
||||||
---Mark a world point as `MapGen.Peak` and assign it a specific color that will affect the generation.
|
---Mark a world point as `MapGen.Peak` and assign it a specific noise that will affect the generation.
|
||||||
---The Y coordinate will be forced to zero, and the `is2d` group will be added to the groups field.
|
---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.
|
---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 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 peakPos vector The coordinate where the peak will be placed.
|
||||||
---@param def MapGen.PeakDef Peak description table, see details `MapGen.PeakDef`.
|
---@param multinoise MapGen.Peak.MultinoiseParams Noise that will be assigned to the peak and that will influence map generation.
|
||||||
function MapGen:register2DPeak(layerName, category, def)
|
---@param groups table<string, number>? Peak groups that may affect processing.
|
||||||
def = table.copy_with_metatables(def)
|
function MapGen:register2DPeak(layerName, peakPos, multinoise, groups)
|
||||||
|
local _peakPos = table.copy_with_metatables(peakPos)
|
||||||
|
_peakPos.y = 0
|
||||||
|
|
||||||
def.pos.y = 0
|
if groups == nil then
|
||||||
|
groups = {is2d = 1}
|
||||||
if def.groups == nil then
|
|
||||||
def.groups = {is2d = 1}
|
|
||||||
else
|
else
|
||||||
def.groups.is2d = 1
|
groups.is2d = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
self:registerPeak(layerName, category, def)
|
self:registerPeak(layerName, _peakPos, multinoise, groups)
|
||||||
end
|
end
|
||||||
|
|
||||||
---Mark the world points as `MapGen.Peak` and assign them all a specific noise that will affect generation.
|
---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.
|
---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.
|
---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 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 multinoise MapGen.Peak.MultinoiseParams The noise that will be assigned to each peak and will affect the map generation.
|
||||||
---@param defs MapGen.PeakDef[] Peaks description table, see details `MapGen.PeakDef`.
|
---@param peakPoses vector[] Set the coordinates where the peaks will be placed.
|
||||||
function MapGen:register2DPeaks(layerName,category, defs)
|
---@param groups table<string, number>? Peak groups that may affect processing.
|
||||||
for _, def in ipairs(defs) do
|
function MapGen:register2DPeaks(layerName, multinoise, peakPoses, groups)
|
||||||
self:register2DPeak(layerName, category, def)
|
for _, peakPos in ipairs(peakPoses) do
|
||||||
|
self:register2DPeak(layerName, peakPos, multinoise, groups)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---Extract the `MapGen.Peak` from the image and assign them all a specific color that will affect the generation.
|
---TODO: описание
|
||||||
---@param layerName string The name of the layer in which the new peaks will be included.
|
---@alias PeakColors table<ColorString, {noise:MapGen.Peak.MultinoiseParams, groups:table<string, number>?}>
|
||||||
---@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
|
|
||||||
|
|
||||||
|
---TODO: описание
|
||||||
|
---@param layerName string The name of the layer in which the new peaks will be included.
|
||||||
|
---@param map string TODO
|
||||||
|
---@param zeroPos Position2d
|
||||||
|
---@param peakColors PeakColors TODO
|
||||||
|
function MapGen:register2DPeaksFromFile(layerName, map, zeroPos,peakColors)
|
||||||
local modPath = core.get_modpath(core.get_current_modname())
|
local modPath = core.get_modpath(core.get_current_modname())
|
||||||
local peaks = ff2luat(modPath .. '/textures/maps/' .. map)
|
local peaks = Api.ff2luat(modPath .. '/textures/maps/' .. map)
|
||||||
|
|
||||||
---@type {h:integer, w:integer}
|
|
||||||
local mapSize = peaks.size
|
local mapSize = peaks.size
|
||||||
peaks.size = nil
|
peaks.size = nil
|
||||||
|
|
||||||
zeroPos.x = zeroPos.x + mathRound(mapSize.w/2)
|
print(dump(peaks))
|
||||||
zeroPos.y = zeroPos.y + mathRound(mapSize.h/2)
|
|
||||||
|
|
||||||
local x, z
|
|
||||||
|
|
||||||
for color, peaksPos in pairs(peaks) do
|
for color, peaksPos in pairs(peaks) do
|
||||||
|
local peakParams = peakColors[color]
|
||||||
|
assert(peakParams ~= nil, ('There are no generation settings declared for the color `%s`'):format(color))
|
||||||
|
|
||||||
for _, peakPos in ipairs(peaksPos) do
|
for _, peakPos in ipairs(peaksPos) do
|
||||||
x, z = (peakPos.x - zeroPos.x - 1) * scale, (peakPos.y - zeroPos.y - 1) * -scale
|
self:register2DPeak(layerName, vector.new(peakPos.x - zeroPos.x, 0, peakPos.y - zeroPos.y), peakParams.noise, peakParams.groups)
|
||||||
|
|
||||||
-- 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
|
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`.
|
---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 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 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`
|
---@param def MapGen.BiomeDef Biome description table, see details `MapGen.BiomeDef`
|
||||||
function MapGen:registerBiome(layerName, biomeName, def)
|
function MapGen:registerBiome(layerName, biomeName, def)
|
||||||
local layer = self:getLayerByName(layerName)
|
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 biome = Biome:new(biomeName, def)
|
local biome = Biome:new(biomeName, def)
|
||||||
|
|
||||||
@@ -546,78 +275,26 @@ end
|
|||||||
---@param layerName string The name of the layer in which the new cavern will be included.
|
---@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 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`
|
---@param def MapGen.CavernDef Cavern description table, see details `MapGen.CavernDef`
|
||||||
---@param regionVertices Position[]? The region to which the cave generation will be limited.
|
function MapGen:registerCavern(layerName, cavernName, def)
|
||||||
function MapGen:registerCavern(layerName, cavernName, def, regionVertices)
|
local layer = self.layersByName[layerName]
|
||||||
local layer = self:getLayerByName(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))
|
||||||
if regionVertices ~= nil then
|
|
||||||
self:registerRegion(layerName, cavernName, {
|
|
||||||
vertices = regionVertices
|
|
||||||
})
|
|
||||||
|
|
||||||
def.isRegional = true
|
|
||||||
end
|
|
||||||
|
|
||||||
local cavern = Cavern:new(cavernName, def)
|
local cavern = Cavern:new(cavernName, def)
|
||||||
|
|
||||||
layer:addCavern(cavernName, cavern)
|
layer:addCavern(cavernName, cavern)
|
||||||
end
|
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 ---
|
-- --- 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.
|
---Divide all layers into triangles whose vertices are the `Mapgen.Peak` belonging to these layers.
|
||||||
function MapGen:initLayersTriangultaion()
|
function MapGen:initLayersTriangultaion()
|
||||||
---@param layer MapGen.Layer
|
---@param layer MapGen.Layer
|
||||||
for _, layer in ipairs(self.layersList) do
|
for _, layer in ipairs(self.layersList) do
|
||||||
for category, peaks in pairs(layer.peaksList) do
|
layer.trianglesList = Triangulation.triangulate(layer.peaksList)
|
||||||
local triangles = Triangulation.triangulate(peaks)
|
-- layer.tetrahedronsList = Triangulation.tetrahedralize(layer.peaksList)
|
||||||
|
|
||||||
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
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -629,6 +306,22 @@ function MapGen:initBiomesDiagram()
|
|||||||
end
|
end
|
||||||
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.
|
---Initialize caverns's noises. This should be called after the map object is loaded.
|
||||||
function MapGen:initCavernsNoise()
|
function MapGen:initCavernsNoise()
|
||||||
---@param layer MapGen.Layer
|
---@param layer MapGen.Layer
|
||||||
@@ -641,13 +334,29 @@ function MapGen:initCavernsNoise()
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
self.isCavernsNoiseInitialized = true
|
self.cavernsNoiseInitialized = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- --- GENERATION METHODS ---
|
-- --- 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)
|
---The core logic of world generation. Determines which node type (water, rock, soil, air)
|
||||||
---and which biome will be generated at the specified coordinates.
|
---and which biome will be generated at the specified coordinates.
|
||||||
---@param mapGenerator MapGen
|
---@param mapGenerator MapGen
|
||||||
@@ -657,9 +366,9 @@ end
|
|||||||
---@param humidity number
|
---@param humidity number
|
||||||
---@param data number[]
|
---@param data number[]
|
||||||
---@param index number
|
---@param index number
|
||||||
---@param x integer
|
---@param x number
|
||||||
---@param y integer
|
---@param y number
|
||||||
---@param z integer
|
---@param z number
|
||||||
local function generateNode(mapGenerator, layer, height, temp, humidity, data, index, x, y, z)
|
local function generateNode(mapGenerator, layer, height, temp, humidity, data, index, x, y, z)
|
||||||
local ids = mapGenerator.nodeIDs
|
local ids = mapGenerator.nodeIDs
|
||||||
local waterLevel = layer.waterLevel
|
local waterLevel = layer.waterLevel
|
||||||
@@ -669,15 +378,17 @@ local function generateNode(mapGenerator, layer, height, temp, humidity, data, i
|
|||||||
local scatteringVertical = layer.biomesVerticalScattering or 0
|
local scatteringVertical = layer.biomesVerticalScattering or 0
|
||||||
local scattTemp = temp
|
local scattTemp = temp
|
||||||
local scattHumidity = humidity
|
local scattHumidity = humidity
|
||||||
---@type number
|
|
||||||
local scattHeight = y
|
local scattHeight = y
|
||||||
|
|
||||||
if scatteringGorizontal ~= 0 then
|
if scatteringGorizontal ~= 0 then
|
||||||
|
---@diagnostic disable-next-line: param-type-not-match
|
||||||
scattTemp = scattTemp + math.random(scatteringGorizontal * -1, scatteringGorizontal)
|
scattTemp = scattTemp + math.random(scatteringGorizontal * -1, scatteringGorizontal)
|
||||||
|
---@diagnostic disable-next-line: param-type-not-match
|
||||||
scattHumidity = scattHumidity + math.random(scatteringGorizontal * -1, scatteringGorizontal)
|
scattHumidity = scattHumidity + math.random(scatteringGorizontal * -1, scatteringGorizontal)
|
||||||
end
|
end
|
||||||
|
|
||||||
if scatteringVertical ~= 0 then
|
if scatteringVertical ~= 0 then
|
||||||
|
---@diagnostic disable-next-line: param-type-not-match
|
||||||
scattHeight = scattHeight + math.random(scatteringVertical * -1, scatteringVertical)
|
scattHeight = scattHeight + math.random(scatteringVertical * -1, scatteringVertical)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -704,7 +415,7 @@ local function generateNode(mapGenerator, layer, height, temp, humidity, data, i
|
|||||||
-- If the block is below the surface height...
|
-- If the block is below the surface height...
|
||||||
elseif y <= height then
|
elseif y <= height then
|
||||||
-- ... and a cavern is generated in the block...
|
-- ... and a cavern is generated in the block...
|
||||||
if mapGenerator:isCavern(layer, x, y, z) then
|
if isCavern(layer, x, y, z) then
|
||||||
-- ... then airspace is generated.
|
-- ... then airspace is generated.
|
||||||
biome:generateCavernAir(mapGenerator, data, index, x, y, z)
|
biome:generateCavernAir(mapGenerator, data, index, x, y, z)
|
||||||
|
|
||||||
@@ -746,9 +457,9 @@ end
|
|||||||
---the triangle's height and specifying the distance to the peak
|
---the triangle's height and specifying the distance to the peak
|
||||||
---for which the weight is calculated.
|
---for which the weight is calculated.
|
||||||
---@param height MapGen.Triangulation.Edge
|
---@param height MapGen.Triangulation.Edge
|
||||||
---@param x integer
|
---@param x number
|
||||||
---@param y integer
|
---@param y number
|
||||||
---@param z integer
|
---@param z number
|
||||||
---@return number
|
---@return number
|
||||||
local function calcWeight(height, x, y, z)
|
local function calcWeight(height, x, y, z)
|
||||||
local pos1 = vector.new(x, y, z)
|
local pos1 = vector.new(x, y, z)
|
||||||
@@ -768,32 +479,48 @@ local function calcWeight(height, x, y, z)
|
|||||||
return 1 - vector.distance(pos2, posP) / height:length()
|
return 1 - vector.distance(pos2, posP) / height:length()
|
||||||
end
|
end
|
||||||
|
|
||||||
---Returns the weighted values of 2d noise.
|
---Returns `true` if the point is within the triangle's region.
|
||||||
---@param category MapGen.Layer.Category
|
---The barycentric coordinate method is used.
|
||||||
---@param layer MapGen.Layer
|
---@param px number
|
||||||
|
---@param pz number
|
||||||
---@param triangle MapGen.Triangle
|
---@param triangle MapGen.Triangle
|
||||||
---@param x integer
|
local function pointInTriangle(px, pz, triangle)
|
||||||
---@param y integer
|
local posP = vector.new(px, 0, pz)
|
||||||
---@param z integer
|
local pos1 = triangle.p1.getPeakPos()
|
||||||
---@return number
|
local pos2 = triangle.p2.getPeakPos()
|
||||||
local function calcNoise2dValue(category, layer, triangle, x, y, z)
|
local pos3 = triangle.p3.getPeakPos()
|
||||||
local triangleColor = triangle.color
|
|
||||||
|
|
||||||
-- If the triangle is monochromatic (all peaks have the same color and,
|
local v0 = pos3 - pos1
|
||||||
-- accordingly, the same noise), then there is no point in smoothing out the noise.
|
local v1 = pos2 - pos1
|
||||||
if triangleColor ~= nil then
|
local v2 = posP - pos1
|
||||||
return layer:getNoiseByColor(category, triangleColor):get_2d({x = x, y = z})
|
|
||||||
|
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
|
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 peak1 = triangle.p1
|
||||||
local peak2 = triangle.p2
|
local peak2 = triangle.p2
|
||||||
local peak3 = triangle.p3
|
local peak3 = triangle.p3
|
||||||
|
|
||||||
local noise1 = layer:getNoiseByColor(category, peak1:getColor())
|
local noiseHeightValue = 0.0
|
||||||
local noise2 = layer:getNoiseByColor(category, peak2:getColor())
|
local noiseTempValue = 0.0
|
||||||
local noise3 = layer:getNoiseByColor(category, peak3:getColor())
|
local noiseHumidityValue = 0.0
|
||||||
|
|
||||||
local noiseValue = 0.0
|
|
||||||
|
|
||||||
local totalWeight = 0.0
|
local totalWeight = 0.0
|
||||||
|
|
||||||
@@ -801,77 +528,72 @@ local function calcNoise2dValue(category, layer, triangle, x, y, z)
|
|||||||
-- ( peak1 * weight1 + peak2 * weight2 + peak3 * weight3) / totalWeight, when
|
-- ( peak1 * weight1 + peak2 * weight2 + peak3 * weight3) / totalWeight, when
|
||||||
-- totalWeight = weight1 + weight2 + weight3
|
-- totalWeight = weight1 + weight2 + weight3
|
||||||
local weight = calcWeight(triangle.h1, x, y, z)
|
local weight = calcWeight(triangle.h1, x, y, z)
|
||||||
noiseValue = noiseValue + noise1:get_2d({x = x, y = z}) * weight
|
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
|
||||||
totalWeight = totalWeight + weight
|
totalWeight = totalWeight + weight
|
||||||
|
|
||||||
weight = calcWeight(triangle.h2, x, y, z)
|
weight = calcWeight(triangle.h2, x, y, z)
|
||||||
noiseValue = noiseValue + noise2:get_2d({x = x, y = z}) * weight
|
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
|
||||||
totalWeight = totalWeight + weight
|
totalWeight = totalWeight + weight
|
||||||
|
|
||||||
weight = calcWeight(triangle.h3, x, y, z)
|
weight = calcWeight(triangle.h3, x, y, z)
|
||||||
noiseValue = noiseValue + noise3:get_2d({x = x, y = z}) * weight
|
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
|
||||||
totalWeight = totalWeight + weight
|
totalWeight = totalWeight + weight
|
||||||
|
|
||||||
return (noiseValue / totalWeight)
|
return noiseHeightValue / totalWeight, noiseTempValue / totalWeight, noiseHumidityValue / totalWeight
|
||||||
end
|
end
|
||||||
|
|
||||||
---Calculates a smoothed 2D noise value based on a preliminary space partitioning.
|
---Calculates a smoothed 2D noise value based on a preliminary space partitioning.
|
||||||
---
|
---
|
||||||
---Returns `nil` if the point is not included in any triangle.
|
---Returns `nil` if the point is not included in any triangle.
|
||||||
---@param category MapGen.Layer.Category
|
|
||||||
---@param layer MapGen.Layer
|
---@param layer MapGen.Layer
|
||||||
---@param x integer
|
---@param x number
|
||||||
---@param y integer
|
---@param y number
|
||||||
---@param z integer
|
---@param z number
|
||||||
---@return number?
|
---@return number?, number?, number?
|
||||||
function MapGen:getNoises2dValue(category, layer, x, y, z)
|
function MapGen:getNoises2dValues(layer, x, y, z)
|
||||||
---@type MapGen.PastCalcNoiseValue
|
if (pastNoise2DCalc.x ~= nil and pastNoise2DCalc.z ~= nil) and (x == pastNoise2DCalc.x and z == pastNoise2DCalc.z) then
|
||||||
local pastCalc = pastNoise2DCalc[category]
|
return pastNoise2DCalc.noiseValues.height, pastNoise2DCalc.noiseValues.temp, pastNoise2DCalc.noiseValues.humidity
|
||||||
|
|
||||||
if (pastCalc.x ~= nil and pastCalc.z ~= nil) and (x == pastCalc.x and z == pastCalc.z) then
|
|
||||||
return pastCalc.noiseValue
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if pastCalc.triangle ~= nil then
|
if pastNoise2DCalc.triangle ~= nil and pointInTriangle(x, z, pastNoise2DCalc.triangle) then
|
||||||
---@type number?
|
local noiseHeightValue, noiseTempValue, noiseHumidityValue = calcNoises2dValues(pastNoise2DCalc.triangle, x, y, z)
|
||||||
local noiseValue
|
|
||||||
|
|
||||||
local triangles = {
|
noiseTempValue, noiseHumidityValue = layer:calcTemp(noiseTempValue, y), layer:calcHumidity(noiseHumidityValue, y)
|
||||||
pastCalc.triangle,
|
|
||||||
pastCalc.triangle.neighbours.t1,
|
pastNoise2DCalc.x = x
|
||||||
pastCalc.triangle.neighbours.t2,
|
pastNoise2DCalc.z = z
|
||||||
pastCalc.triangle.neighbours.t3,
|
pastNoise2DCalc.noiseValues = {
|
||||||
|
height = noiseHeightValue,
|
||||||
|
temp = noiseTempValue,
|
||||||
|
humidity = noiseHumidityValue,
|
||||||
}
|
}
|
||||||
|
|
||||||
---@param t MapGen.Triangle
|
return noiseHeightValue, noiseTempValue, noiseHumidityValue
|
||||||
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
|
end
|
||||||
|
|
||||||
---@param triangle MapGen.Triangle
|
---@param triangle MapGen.Triangle
|
||||||
for _, triangle in ipairs(layer.trianglesList[category]) do
|
for _, triangle in ipairs(layer.trianglesList) do
|
||||||
if pointInTriangle2D(x, z, triangle) then
|
if pointInTriangle(x, z,triangle) then
|
||||||
local noiseValue = calcNoise2dValue(category, layer, triangle, x, y, z)
|
local noiseHeightValue, noiseTempValue, noiseHumidityValue = calcNoises2dValues(triangle, x, y, z)
|
||||||
|
|
||||||
pastCalc.triangle = triangle
|
noiseTempValue, noiseHumidityValue = layer:calcTemp(noiseTempValue, y), layer:calcHumidity(noiseHumidityValue, y)
|
||||||
pastCalc.x = x
|
|
||||||
pastCalc.z = z
|
|
||||||
pastCalc.noiseValue = noiseValue
|
|
||||||
|
|
||||||
return noiseValue
|
pastNoise2DCalc.triangle = triangle
|
||||||
|
pastNoise2DCalc.x = x
|
||||||
|
pastNoise2DCalc.z = z
|
||||||
|
pastNoise2DCalc.noiseValues = {
|
||||||
|
height = noiseHeightValue,
|
||||||
|
temp = noiseTempValue,
|
||||||
|
humidity = noiseHumidityValue,
|
||||||
|
}
|
||||||
|
|
||||||
|
return noiseHeightValue, noiseTempValue, noiseHumidityValue
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -974,9 +696,9 @@ end
|
|||||||
---@param mapGenerator MapGen
|
---@param mapGenerator MapGen
|
||||||
---@param data number[]
|
---@param data number[]
|
||||||
---@param index number
|
---@param index number
|
||||||
---@param x integer
|
---@param x number
|
||||||
---@param y integer
|
---@param y number
|
||||||
---@param z integer
|
---@param z number
|
||||||
local function generatorHandler(mapGenerator, data, index, x, y, z)
|
local function generatorHandler(mapGenerator, data, index, x, y, z)
|
||||||
-- If the node belongs to a static layer, then a static node is generated.
|
-- If the node belongs to a static layer, then a static node is generated.
|
||||||
local static = mapGenerator:getStaticByHeight(y)
|
local static = mapGenerator:getStaticByHeight(y)
|
||||||
@@ -994,37 +716,25 @@ local function generatorHandler(mapGenerator, data, index, x, y, z)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- If the value of the noise is `nil`,
|
-- Calculating landscape height
|
||||||
|
local noiseHeightValue, noiseTempValue, noiseHumidityValue = mapGenerator:getNoises2dValues(layer, x, y, z)
|
||||||
|
|
||||||
|
-- If the height of the landscape is `nil`,
|
||||||
-- then the point does not fall within any of the triangles.
|
-- then the point does not fall within any of the triangles.
|
||||||
local noiseHeightValue = mapGenerator:getNoises2dValue('landscape', layer, x, y, z)
|
|
||||||
if noiseHeightValue == nil then
|
if noiseHeightValue == nil then
|
||||||
data[index] = core.CONTENT_IGNORE
|
noiseHeightValue = 0.0
|
||||||
return
|
noiseTempValue = 0.0
|
||||||
|
noiseHumidityValue = 0.0
|
||||||
end
|
end
|
||||||
|
|
||||||
local noiseTempValue = mapGenerator:getNoises2dValue('temp', layer, x, y, z)
|
---@diagnostic disable-next-line: param-type-not-match
|
||||||
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)
|
generateNode(mapGenerator, layer, noiseHeightValue, noiseTempValue, noiseHumidityValue, data, index, x, y, z)
|
||||||
end
|
end
|
||||||
|
|
||||||
---Chunk generation handler.
|
---Chunk generation handler.
|
||||||
---@param voxelManip VoxelManip
|
---@param voxelManip VoxelManip
|
||||||
---@param minPos Position
|
---@param minPos table
|
||||||
---@param maxPos Position
|
---@param maxPos table
|
||||||
---@param blockseed number
|
---@param blockseed number
|
||||||
function MapGen:onMapGenerated(voxelManip, minPos, maxPos, blockseed)
|
function MapGen:onMapGenerated(voxelManip, minPos, maxPos, blockseed)
|
||||||
-- We obtain a generation area for further manipulations
|
-- We obtain a generation area for further manipulations
|
||||||
@@ -1032,11 +742,11 @@ function MapGen:onMapGenerated(voxelManip, minPos, maxPos, blockseed)
|
|||||||
|
|
||||||
local eMin, eMax = voxelManip:get_emerged_area()
|
local eMin, eMax = voxelManip:get_emerged_area()
|
||||||
|
|
||||||
if not self.isLayersNoisesInitialized then
|
if not self.peaksMultinoiseInitialized then
|
||||||
self:initLayersNoises()
|
self:initPeaksMultinoise()
|
||||||
end
|
end
|
||||||
|
|
||||||
if not self.isCavernsNoiseInitialized then
|
if not self.cavernsNoiseInitialized then
|
||||||
self:initCavernsNoise()
|
self:initCavernsNoise()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1086,7 +796,6 @@ function MapGen:run()
|
|||||||
error('Only one instance of a `MapGen` class can be running.')
|
error('Only one instance of a `MapGen` class can be running.')
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param ... VoxelManip
|
|
||||||
core.register_on_generated(function(...)
|
core.register_on_generated(function(...)
|
||||||
self:onMapGenerated(...)
|
self:onMapGenerated(...)
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
local id = core.get_content_id
|
local id = core.get_content_id
|
||||||
|
|
||||||
local getInstance = Class.getInstance
|
|
||||||
|
|
||||||
---@class MapGen.Biome
|
---@class MapGen.Biome
|
||||||
---@field name string
|
---@field name string
|
||||||
---@field tempPoint number
|
---@field tempPoint number
|
||||||
@@ -167,7 +165,7 @@ function Biome:new(name, def)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---@type MapGen.Biome
|
---@type MapGen.Biome
|
||||||
local instance = getInstance(self, {
|
local instance = setmetatable({
|
||||||
name = name,
|
name = name,
|
||||||
tempPoint = def.tempPoint,
|
tempPoint = def.tempPoint,
|
||||||
humidityPoint = def.humidityPoint,
|
humidityPoint = def.humidityPoint,
|
||||||
@@ -183,7 +181,7 @@ function Biome:new(name, def)
|
|||||||
generateSoil = def.generateSoil,
|
generateSoil = def.generateSoil,
|
||||||
generateTurf = def.generateTurf,
|
generateTurf = def.generateTurf,
|
||||||
generateBottom = def.generateBottom,
|
generateBottom = def.generateBottom,
|
||||||
})
|
}, {__index = self})
|
||||||
|
|
||||||
return instance
|
return instance
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
local mathMin, mathMax, mathAbs, mathClamp
|
local mathMin, mathMax, mathAbs
|
||||||
= math.min, math.max, math.abs, math.clamp
|
= math.min, math.max, math.abs
|
||||||
|
|
||||||
local getInstance = Class.getInstance
|
|
||||||
|
|
||||||
---@class MapGen.Cavern
|
---@class MapGen.Cavern
|
||||||
---@field name string
|
---@field name string
|
||||||
---@field isRegional boolean
|
|
||||||
---@field minY number
|
---@field minY number
|
||||||
---@field maxY number
|
---@field maxY number
|
||||||
---@field smoothDistance number
|
---@field smoothDistance number
|
||||||
@@ -19,7 +16,6 @@ local Cavern = {}
|
|||||||
---
|
---
|
||||||
---**Only for EmmyLua.**
|
---**Only for EmmyLua.**
|
||||||
---@class MapGen.CavernDef
|
---@class MapGen.CavernDef
|
||||||
---@field isRegional boolean?
|
|
||||||
---@field minY number
|
---@field minY number
|
||||||
---@field maxY number
|
---@field maxY number
|
||||||
---@field noiseParams NoiseParams
|
---@field noiseParams NoiseParams
|
||||||
@@ -54,14 +50,13 @@ function Cavern:new(name, def)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---@type MapGen.Cavern
|
---@type MapGen.Cavern
|
||||||
local instance = getInstance(self, {
|
local instance = setmetatable({
|
||||||
name = name,
|
name = name,
|
||||||
minY = def.minY,
|
minY = def.minY,
|
||||||
maxY = def.maxY,
|
maxY = def.maxY,
|
||||||
smoothDistance = def.smoothDistance,
|
smoothDistance = def.smoothDistance,
|
||||||
threshold = def.threshold,
|
threshold = def.threshold,
|
||||||
isRegional = def.isRegional or false,
|
}, {__index = self})
|
||||||
})
|
|
||||||
|
|
||||||
function instance:getNoise()
|
function instance:getNoise()
|
||||||
return _noise
|
return _noise
|
||||||
@@ -82,49 +77,32 @@ function Cavern:new(name, def)
|
|||||||
return instance
|
return instance
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param distance number
|
---@param y number
|
||||||
|
---@param minY number
|
||||||
|
---@param maxY number
|
||||||
|
---@param smoothDistance number
|
||||||
---@return number
|
---@return number
|
||||||
function Cavern:calcCavernWeight(distance)
|
local function calcCavernWeight(y, smoothDistance, minY, maxY)
|
||||||
return mathClamp(distance / self.smoothDistance, 0, 1)
|
local maxDist = maxY - y
|
||||||
|
local minDist = y - minY
|
||||||
|
|
||||||
|
return mathMax(0, mathMin(maxDist / smoothDistance, minDist / smoothDistance, 1))
|
||||||
end
|
end
|
||||||
|
|
||||||
---Returns `true` if there is a cavern at the specified coordinates.
|
---Returns `true` if there is a cavern at the specified coordinates.
|
||||||
---@param x integer
|
---@param x number
|
||||||
---@param y integer
|
---@param y number
|
||||||
---@param z integer
|
---@param z number
|
||||||
---@param distance number
|
|
||||||
---@return boolean
|
---@return boolean
|
||||||
function Cavern:isCavern(x, y, z, distance)
|
function Cavern:isCavern(x, y, z)
|
||||||
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
|
local minY, maxY = self.minY, self.maxY
|
||||||
|
|
||||||
if y > maxY or y < minY then
|
if y > maxY or y < minY then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
local distance = mathMin(maxY - y, y - minY)
|
|
||||||
|
|
||||||
local noise = self:getNoise()
|
local noise = self:getNoise()
|
||||||
local weight = self:calcCavernWeight(distance)
|
local weight = calcCavernWeight(y, self.smoothDistance, minY, maxY)
|
||||||
|
|
||||||
return noise:get_3d({x = x, y = y, z = z}) * weight > self.threshold
|
return noise:get_3d({x = x, y = y, z = z}) * weight > self.threshold
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
local getInstance = Class.getInstance
|
|
||||||
|
|
||||||
---**NOT IMPLEMENTED**
|
---**NOT IMPLEMENTED**
|
||||||
---@class MapGen.Decoration
|
---@class MapGen.Decoration
|
||||||
local Decoration = {}
|
local Decoration = {}
|
||||||
@@ -7,9 +5,9 @@ local Decoration = {}
|
|||||||
---@return MapGen.Decoration
|
---@return MapGen.Decoration
|
||||||
function Decoration:new()
|
function Decoration:new()
|
||||||
---@type MapGen.Decoration
|
---@type MapGen.Decoration
|
||||||
local instance = getInstance(self, {
|
local instance = setmetatable({
|
||||||
|
|
||||||
})
|
}, {__index = self})
|
||||||
|
|
||||||
return instance
|
return instance
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,56 +1,32 @@
|
|||||||
local getInstance = Class.getInstance
|
|
||||||
|
|
||||||
---@class MapGen.Layer
|
---@class MapGen.Layer
|
||||||
---@field name string
|
---@field name string
|
||||||
---@field minY integer
|
---@field minY number
|
||||||
---@field maxY integer
|
---@field maxY number
|
||||||
---@field minTemp integer
|
---@field minTemp number
|
||||||
---@field maxTemp integer
|
---@field maxTemp number
|
||||||
---@field minHumidity integer
|
---@field minHumidity number
|
||||||
---@field maxHumidity integer
|
---@field maxHumidity number
|
||||||
---@field waterLevel integer
|
---@field waterLevel number
|
||||||
---@field calcTemp fun(self:MapGen.Layer, value:number, height:number):number
|
---@field calcTemp fun(self:MapGen.Layer, value:number, height:number):number
|
||||||
---@field calcHumidity fun(self:MapGen.Layer, value:number, height:number):number
|
---@field calcHumidity fun(self:MapGen.Layer, value:number, height:number):number
|
||||||
---@field peaksList {['landscape']:MapGen.Peak[],['temp']:MapGen.Peak[],['humidity']:MapGen.Peak[]}
|
---@field peaksList 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 biomesByName table<string, MapGen.Biome>
|
||||||
---@field biomesList MapGen.Biome[]
|
---@field biomesList MapGen.Biome[]
|
||||||
---@field biomesDiagram table
|
---@field biomesDiagram table
|
||||||
---@field biomesGorizontalScattering integer
|
---@field biomesGorizontalScattering number
|
||||||
---@field biomesVerticalScattering integer
|
---@field biomesVerticalScattering number
|
||||||
---@field cavernsByName table<string, MapGen.Cavern>
|
---@field cavernsByName table<string, MapGen.Cavern>
|
||||||
---@field cavernsList MapGen.Cavern[]
|
---@field cavernsList MapGen.Cavern[]
|
||||||
---@field regionsByName table<string, MapGen.Region>
|
---@field trianglesList MapGen.Triangle[]
|
||||||
---@field trianglesList {['landscape']:MapGen.Triangle[],['temp']:MapGen.Triangle[],['humidity']:MapGen.Triangle[]}
|
---@field tetrahedronsList MapGen.Tetrahedron[]
|
||||||
---@field tetrahedronsList MapGen.Tetrahedron[] **Not supported**
|
|
||||||
local Layer = {
|
local Layer = {
|
||||||
peaksList = {
|
peaksList = {},
|
||||||
landscape = {},
|
|
||||||
temp = {},
|
|
||||||
humidity = {},
|
|
||||||
},
|
|
||||||
noisesByColor = {
|
|
||||||
landscape = {},
|
|
||||||
temp = {},
|
|
||||||
humidity = {},
|
|
||||||
},
|
|
||||||
noisesParamsByColor = {
|
|
||||||
landscape = {},
|
|
||||||
temp = {},
|
|
||||||
humidity = {},
|
|
||||||
},
|
|
||||||
biomesByName = {},
|
biomesByName = {},
|
||||||
biomesList = {},
|
biomesList = {},
|
||||||
biomesDiagram = {},
|
biomesDiagram = {},
|
||||||
cavernsByName = {},
|
cavernsByName = {},
|
||||||
cavernsList = {},
|
cavernsList = {},
|
||||||
regionsByName = {},
|
trianglesList = {},
|
||||||
trianglesList = {
|
|
||||||
landscape = {},
|
|
||||||
temp = {},
|
|
||||||
humidity = {},
|
|
||||||
},
|
|
||||||
tetrahedronsList = {},
|
tetrahedronsList = {},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,7 +69,7 @@ function Layer:new(name, def)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---@type MapGen.Layer
|
---@type MapGen.Layer
|
||||||
local instance = getInstance(self, {
|
local instance = setmetatable({
|
||||||
name = name,
|
name = name,
|
||||||
minY = def.minY,
|
minY = def.minY,
|
||||||
maxY = def.maxY,
|
maxY = def.maxY,
|
||||||
@@ -106,157 +82,33 @@ function Layer:new(name, def)
|
|||||||
calcHumidity = def.calcHumidity,
|
calcHumidity = def.calcHumidity,
|
||||||
biomesGorizontalScattering = def.biomesGorizontalScattering or 0,
|
biomesGorizontalScattering = def.biomesGorizontalScattering or 0,
|
||||||
biomesVerticalScattering = def.biomesVerticalScattering or 0,
|
biomesVerticalScattering = def.biomesVerticalScattering or 0,
|
||||||
})
|
}, {__index = self})
|
||||||
|
|
||||||
return instance
|
return instance
|
||||||
end
|
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`
|
---Adds a peak to the `Layer.peaksList`
|
||||||
---@param category MapGen.Layer.Category
|
|
||||||
---@param peak MapGen.Peak
|
---@param peak MapGen.Peak
|
||||||
function Layer:addPeak(category, peak)
|
function Layer:addPeak(peak)
|
||||||
if category == 'landscape' then
|
table.insert(self.peaksList, peak)
|
||||||
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
|
end
|
||||||
|
|
||||||
---Adds a biome to the `Layer.biomesByName` & `Layer.biomesList`
|
---Adds a biome to the `Layer.biomesByName` & `Layer.biomesList`
|
||||||
---@param biomeName string
|
---@param biomeName string
|
||||||
---@param biome MapGen.Biome
|
---@param biome MapGen.Biome
|
||||||
function Layer:addBiome(biomeName, 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
|
self.biomesByName[biomeName] = biome
|
||||||
table.insert(self.biomesList, biome)
|
table.insert(self.biomesList, biome)
|
||||||
end
|
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`
|
---Adds a cavern to the `Layer.cavernsByName` & `Layer.cavernsList`
|
||||||
---@param cavernName string
|
---@param cavernName string
|
||||||
---@param cavern MapGen.Cavern
|
---@param cavern MapGen.Cavern
|
||||||
function Layer:addCavern(cavernName, 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
|
self.cavernsByName[cavernName] = cavern
|
||||||
table.insert(self.cavernsList, cavern)
|
table.insert(self.cavernsList, cavern)
|
||||||
end
|
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 height number
|
||||||
---@param biomesList MapGen.Biome[]
|
---@param biomesList MapGen.Biome[]
|
||||||
---@return string[], MapGen.Biome[]
|
---@return string[], MapGen.Biome[]
|
||||||
@@ -276,19 +128,6 @@ local function getBiomesNamesByHeight(height, biomesList)
|
|||||||
return biomesNames, biomes
|
return biomesNames, biomes
|
||||||
end
|
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.
|
---Initialization of the biome diagram using the Voronoi method.
|
||||||
function Layer:initBiomesDiagram()
|
function Layer:initBiomesDiagram()
|
||||||
local diagram = self.biomesDiagram
|
local diagram = self.biomesDiagram
|
||||||
|
|||||||
@@ -1,63 +1,94 @@
|
|||||||
local getInstance = Class.getInstance
|
|
||||||
|
|
||||||
---@class MapGen.Peak
|
---@class MapGen.Peak
|
||||||
---@field id number
|
---@field id number
|
||||||
---@field getPeakPos fun(self):vector
|
---@field getPeakPos fun():vector
|
||||||
---@field getColor fun(self):ColorString
|
---@field getMultinoiseParams fun():MapGen.Peak.MultinoiseParams
|
||||||
---@field getGroups fun(self):table<string, number>
|
---@field getMultinoise fun():MapGen.Peak.Multinoise
|
||||||
---@field addGroups fun(self, groups:table<string, number>)
|
---@field initMultinoise fun()
|
||||||
|
---@field getGroups fun():table<string, number>
|
||||||
local Peak = {
|
local Peak = {
|
||||||
id = 0,
|
id = 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- --- Class registration ---
|
-- --- Helpers functions ---
|
||||||
|
|
||||||
---Definition table for the `MapGen.Peak`.
|
---@param multinoiseParams MapGen.Peak.MultinoiseParams
|
||||||
---
|
---@return MapGen.Peak.Multinoise
|
||||||
---**Only for EmmyLua.**
|
local function multinoiseParamsToMultinoise(multinoiseParams)
|
||||||
---@class MapGen.PeakDef
|
---@diagnostic disable-next-line: missing-fields
|
||||||
---@field pos vector
|
---@type MapGen.Peak.Multinoise
|
||||||
---@field color ColorString
|
local multinoise = {}
|
||||||
---@field groups? table<string, number>
|
|
||||||
|
|
||||||
---@param def MapGen.PeakDef
|
for noiseName, noiseParams in pairs(multinoiseParams) do
|
||||||
---@return MapGen.Peak
|
multinoise[noiseName] = core.get_value_noise(noiseParams)
|
||||||
function Peak:new(def)
|
|
||||||
local _pos = def.pos
|
|
||||||
local _color = def.color
|
|
||||||
local _groups
|
|
||||||
|
|
||||||
if def.groups == nil then
|
|
||||||
_groups = {}
|
|
||||||
else
|
|
||||||
_groups = def.groups
|
|
||||||
end
|
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
|
||||||
|
|
||||||
|
local _groups
|
||||||
|
|
||||||
|
if groups == nil then
|
||||||
|
_groups = {}
|
||||||
|
else
|
||||||
|
_groups = 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
|
---@type MapGen.Peak
|
||||||
local instance = getInstance(self,{},
|
local instance = setmetatable({},
|
||||||
{
|
{
|
||||||
|
__index = self,
|
||||||
__tostring = self.toString,
|
__tostring = self.toString,
|
||||||
__eq = self.eq
|
__eq = self.eq
|
||||||
})
|
})
|
||||||
|
|
||||||
function instance:getPeakPos()
|
function instance:getPeakPos()
|
||||||
return _pos:copy()
|
return vector.new(_peakPos.x, _peakPos.y, _peakPos.z)
|
||||||
end
|
end
|
||||||
|
|
||||||
function instance:getColor()
|
function instance:getMultinoiseParams()
|
||||||
return _color
|
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)
|
||||||
end
|
end
|
||||||
|
|
||||||
function instance:getGroups()
|
function instance:getGroups()
|
||||||
return table.copy_with_metatables(_groups)
|
return _groups
|
||||||
end
|
|
||||||
|
|
||||||
function instance:addGroups(groups)
|
|
||||||
-- Groups that cannot be overwritten
|
|
||||||
groups.is2d = nil
|
|
||||||
groups.is3d = nil
|
|
||||||
|
|
||||||
_groups = table.merge(_groups, groups, true)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return instance
|
return instance
|
||||||
|
|||||||
10
mods/CORE/MapGen/src/MapGen/Peak/Multinoise.lua
Normal file
10
mods/CORE/MapGen/src/MapGen/Peak/Multinoise.lua
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
---For EmmyLua only
|
||||||
|
|
||||||
|
---**For EmmyLua only**
|
||||||
|
---@class MapGen.Peak.Multinoise
|
||||||
|
---@field landscapeNoise ValueNoise
|
||||||
|
---@field tempNoise ValueNoise
|
||||||
|
---@field humidityNoise ValueNoise
|
||||||
|
local Multinoise = {}
|
||||||
|
|
||||||
|
return Multinoise
|
||||||
10
mods/CORE/MapGen/src/MapGen/Peak/MultinoiseParams.lua
Normal file
10
mods/CORE/MapGen/src/MapGen/Peak/MultinoiseParams.lua
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
---For EmmyLua only
|
||||||
|
|
||||||
|
---**For EmmyLua only**
|
||||||
|
---@class MapGen.Peak.MultinoiseParams
|
||||||
|
---@field landscapeNoise NoiseParams
|
||||||
|
---@field tempNoise NoiseParams
|
||||||
|
---@field humidityNoise NoiseParams
|
||||||
|
local MultinoiseParams = {}
|
||||||
|
|
||||||
|
return MultinoiseParams
|
||||||
@@ -1,112 +0,0 @@
|
|||||||
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,7 +1,5 @@
|
|||||||
local id = core.get_content_id
|
local id = core.get_content_id
|
||||||
|
|
||||||
local getInstance = Class.getInstance
|
|
||||||
|
|
||||||
---@class MapGen.StaticLayer
|
---@class MapGen.StaticLayer
|
||||||
---@field name string
|
---@field name string
|
||||||
---@field minY number
|
---@field minY number
|
||||||
@@ -45,14 +43,14 @@ function StaticLayer:new(name, def)
|
|||||||
local staticNodeID = id(def.staticNode)
|
local staticNodeID = id(def.staticNode)
|
||||||
|
|
||||||
---@type MapGen.StaticLayer
|
---@type MapGen.StaticLayer
|
||||||
local instance = getInstance(self, {
|
local instance = setmetatable({
|
||||||
name = name,
|
name = name,
|
||||||
minY = def.minY,
|
minY = def.minY,
|
||||||
maxY = def.maxY,
|
maxY = def.maxY,
|
||||||
staticNode = def.staticNode,
|
staticNode = def.staticNode,
|
||||||
staticNodeID = staticNodeID,
|
staticNodeID = staticNodeID,
|
||||||
generateStaticNode = def.generateStaticNode
|
generateStaticNode = def.generateStaticNode
|
||||||
})
|
}, {__index = self})
|
||||||
|
|
||||||
return instance
|
return instance
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
local mathAbs = math.abs
|
local mathAbs = math.abs
|
||||||
|
|
||||||
local getInstance = Class.getInstance
|
|
||||||
|
|
||||||
local modInfo = Mod.getInfo('smc__core__map_gen')
|
local modInfo = Mod.getInfo('smc__core__map_gen')
|
||||||
local require = modInfo.require
|
local require = modInfo.require
|
||||||
|
|
||||||
@@ -33,7 +31,7 @@ local Tetrahedron = {}
|
|||||||
---@param p4 MapGen.Peak
|
---@param p4 MapGen.Peak
|
||||||
---@return MapGen.Tetrahedron
|
---@return MapGen.Tetrahedron
|
||||||
function Tetrahedron:new(p1, p2, p3, p4)
|
function Tetrahedron:new(p1, p2, p3, p4)
|
||||||
local instance = getInstance(self, {
|
local instance = setmetatable({
|
||||||
p1 = p1,
|
p1 = p1,
|
||||||
p2 = p2,
|
p2 = p2,
|
||||||
p3 = p3,
|
p3 = p3,
|
||||||
@@ -46,8 +44,8 @@ function Tetrahedron:new(p1, p2, p3, p4)
|
|||||||
f2 = Triangle:new(p1, p2, p4),
|
f2 = Triangle:new(p1, p2, p4),
|
||||||
f3 = Triangle:new(p1, p3, p4),
|
f3 = Triangle:new(p1, p3, p4),
|
||||||
f4 = Triangle:new(p2, p3, p4),
|
f4 = Triangle:new(p2, p3, p4),
|
||||||
},
|
}, {
|
||||||
{
|
__index = self,
|
||||||
__tostring = self.toString
|
__tostring = self.toString
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
local mathSqrt, mathAbs
|
local mathSqrt, mathAbs
|
||||||
= math.sqrt, math.abs
|
= math.sqrt, math.abs
|
||||||
|
|
||||||
local getInstance = Class.getInstance
|
|
||||||
|
|
||||||
local modInfo = Mod.getInfo('smc__core__map_gen')
|
local modInfo = Mod.getInfo('smc__core__map_gen')
|
||||||
local require = modInfo.require
|
local require = modInfo.require
|
||||||
|
|
||||||
@@ -56,12 +54,6 @@ end
|
|||||||
|
|
||||||
-- --- Class registration ---
|
-- --- 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
|
---@class MapGen.Triangle
|
||||||
---@field p1 MapGen.Peak
|
---@field p1 MapGen.Peak
|
||||||
---@field p2 MapGen.Peak
|
---@field p2 MapGen.Peak
|
||||||
@@ -72,11 +64,7 @@ end
|
|||||||
---@field h1 MapGen.Triangulation.Edge
|
---@field h1 MapGen.Triangulation.Edge
|
||||||
---@field h2 MapGen.Triangulation.Edge
|
---@field h2 MapGen.Triangulation.Edge
|
||||||
---@field h3 MapGen.Triangulation.Edge
|
---@field h3 MapGen.Triangulation.Edge
|
||||||
---@field neighbours MapGen.Triangle.Neighbours
|
local Triangle = {}
|
||||||
---@field color ColorString?
|
|
||||||
local Triangle = {
|
|
||||||
neighbours = {}
|
|
||||||
}
|
|
||||||
|
|
||||||
---@param p1 MapGen.Peak
|
---@param p1 MapGen.Peak
|
||||||
---@param p2 MapGen.Peak
|
---@param p2 MapGen.Peak
|
||||||
@@ -86,16 +74,7 @@ function Triangle:new(p1, p2, p3)
|
|||||||
assert(not isFlatAngle(p1, p2, p3), ("angle (p1, p2, p3) is flat:\n %s\n %s\n %s")
|
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)))
|
:format(tostring(p1), tostring(p2), tostring(p3)))
|
||||||
|
|
||||||
---@type ColorString?
|
local instance = setmetatable({
|
||||||
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,
|
p1 = p1,
|
||||||
p2 = p2,
|
p2 = p2,
|
||||||
p3 = p3,
|
p3 = p3,
|
||||||
@@ -104,10 +83,10 @@ function Triangle:new(p1, p2, p3)
|
|||||||
h3 = Triangle:getHeight(p3, p1, p2),
|
h3 = Triangle:getHeight(p3, p1, p2),
|
||||||
e1 = Edge:new(p1, p2),
|
e1 = Edge:new(p1, p2),
|
||||||
e2 = Edge:new(p2, p3),
|
e2 = Edge:new(p2, p3),
|
||||||
e3 = Edge:new(p3, p1),
|
e3 = Edge:new(p3, p1)
|
||||||
color = color
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__index = self,
|
||||||
__tostring = self.toString,
|
__tostring = self.toString,
|
||||||
__eq = self.eq
|
__eq = self.eq
|
||||||
})
|
})
|
||||||
@@ -151,7 +130,7 @@ function Triangle:getCenter()
|
|||||||
return (pos1 + pos2 + pos3) / 3
|
return (pos1 + pos2 + pos3) / 3
|
||||||
end
|
end
|
||||||
|
|
||||||
---Returns the area of a triangle.
|
---Returns the area of a triangle.
|
||||||
---@return number
|
---@return number
|
||||||
function Triangle:getArea()
|
function Triangle:getArea()
|
||||||
local a, b, c = self:getSidesLength()
|
local a, b, c = self:getSidesLength()
|
||||||
@@ -281,8 +260,6 @@ function Triangle:getCircumCircle2D()
|
|||||||
return c, r
|
return c, r
|
||||||
end
|
end
|
||||||
|
|
||||||
---@alias MapGen.Triangle.CircumCircleEnum 'IN'|'BEHIND'|'ON'
|
|
||||||
|
|
||||||
---Checks if a given point lies into the triangle circumcircle.
|
---Checks if a given point lies into the triangle circumcircle.
|
||||||
---
|
---
|
||||||
---Note: This function does not take into account the Y-coordinate,
|
---Note: This function does not take into account the Y-coordinate,
|
||||||
@@ -296,7 +273,6 @@ function Triangle:inCircumCircle2D(p)
|
|||||||
|
|
||||||
local distance = (c - pos):length()
|
local distance = (c - pos):length()
|
||||||
|
|
||||||
|
|
||||||
return distance <= r
|
return distance <= r
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,9 @@
|
|||||||
-- * splitting code into different files (classes);
|
-- * splitting code into different files (classes);
|
||||||
-- * Adapting the code to the mapgen concept;
|
-- * Adapting the code to the mapgen concept;
|
||||||
-- * Adding tetrahedralization;
|
-- * Adding tetrahedralization;
|
||||||
-- * Fixed non-determinism by sorting vertices before processing;
|
|
||||||
|
|
||||||
local assert, mathMax, tableRemove, tableSort
|
local assert, mathMax, tableRemove
|
||||||
= assert, math.max, table.remove, table.sort
|
= assert, math.max, table.remove
|
||||||
|
|
||||||
local modInfo = Mod.getInfo('smc__core__map_gen')
|
local modInfo = Mod.getInfo('smc__core__map_gen')
|
||||||
local require = modInfo.require
|
local require = modInfo.require
|
||||||
@@ -29,67 +28,6 @@ local Triangulation = {
|
|||||||
convexMultiplier = 1e3,
|
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.
|
---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.
|
---Doesn't take into account the Y coordinate of the vertices.
|
||||||
@@ -98,11 +36,14 @@ end
|
|||||||
---Vertices that do not have a `is2d` group will not participate in the triangulation.
|
---Vertices that do not have a `is2d` group will not participate in the triangulation.
|
||||||
---@param vertices table<integer, MapGen.Peak>
|
---@param vertices table<integer, MapGen.Peak>
|
||||||
function Triangulation.triangulate( vertices )
|
function Triangulation.triangulate( vertices )
|
||||||
-- Filter vertices with is2d group (creates a new table)
|
vertices = table.copy_with_metatables(vertices)
|
||||||
vertices = filterVerticesByGroup(vertices, "is2d")
|
|
||||||
|
|
||||||
-- Sort deterministically to ensure consistent results across sessions
|
-- Only peaks with a `is2d` group can be triangulated.
|
||||||
sortVerticesDeterministically(vertices)
|
for i, vertex in ipairs(vertices) do
|
||||||
|
if vertex:getGroups().is2d == nil then
|
||||||
|
table.remove(vertices, i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local nvertices = #vertices
|
local nvertices = #vertices
|
||||||
|
|
||||||
@@ -112,13 +53,13 @@ function Triangulation.triangulate(vertices)
|
|||||||
return {Triangle:new(vertices[1], vertices[2], vertices[3])}
|
return {Triangle:new(vertices[1], vertices[2], vertices[3])}
|
||||||
end
|
end
|
||||||
|
|
||||||
local minPos = vertices[1]:getPeakPos()
|
local minPos = vertices[1].getPeakPos()
|
||||||
local minX, minY = minPos.x, minPos.z
|
local minX, minY = minPos.x, minPos.z
|
||||||
local maxX, maxY = minX, minY
|
local maxX, maxY = minX, minY
|
||||||
|
|
||||||
for i = 1, nvertices do
|
for i = 1, nvertices do
|
||||||
local vertex = vertices[i]
|
local vertex = vertices[i]
|
||||||
local vertexPos = vertex:getPeakPos()
|
local vertexPos = vertex.getPeakPos()
|
||||||
vertex.id = i
|
vertex.id = i
|
||||||
|
|
||||||
if vertexPos.x < minX then
|
if vertexPos.x < minX then
|
||||||
@@ -138,7 +79,7 @@ function Triangulation.triangulate(vertices)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Finding the vertices of a supertriangle
|
---Finding the vertices of a supertriangle
|
||||||
local convex_mult = Triangulation.convexMultiplier
|
local convex_mult = Triangulation.convexMultiplier
|
||||||
local dx, dy = (maxX - minX) * convex_mult, (maxY - minY) * convex_mult
|
local dx, dy = (maxX - minX) * convex_mult, (maxY - minY) * convex_mult
|
||||||
local deltaMax = mathMax(dx, dy)
|
local deltaMax = mathMax(dx, dy)
|
||||||
@@ -186,7 +127,7 @@ function Triangulation.triangulate(vertices)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Remove triangles associated with the vertices of a supertriangle.
|
-- Remove tetrahedra associated with the vertices of a supertriangle.
|
||||||
for i = #triangles, 1, -1 do
|
for i = #triangles, 1, -1 do
|
||||||
local triangle = triangles[i]
|
local triangle = triangles[i]
|
||||||
if triangle.p1.id > nvertices or triangle.p2.id > nvertices or triangle.p3.id > nvertices then
|
if triangle.p1.id > nvertices or triangle.p2.id > nvertices or triangle.p3.id > nvertices then
|
||||||
@@ -194,13 +135,11 @@ function Triangulation.triangulate(vertices)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Removing the vertices of a supertriangle.
|
-- Removing the vertices of a super supertriangle.
|
||||||
for _ = 1,3 do
|
for _ = 1,3 do
|
||||||
tableRemove( vertices )
|
tableRemove( vertices )
|
||||||
end
|
end
|
||||||
|
|
||||||
findTrianglesNeighbours(triangles)
|
|
||||||
|
|
||||||
return triangles
|
return triangles
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -209,11 +148,14 @@ end
|
|||||||
---Vertices that do not have a `is3d` group will not participate in the triangulation.
|
---Vertices that do not have a `is3d` group will not participate in the triangulation.
|
||||||
---@param vertices table<integer, MapGen.Peak>
|
---@param vertices table<integer, MapGen.Peak>
|
||||||
function Triangulation.tetrahedralize(vertices)
|
function Triangulation.tetrahedralize(vertices)
|
||||||
-- Filter vertices with is3d group (creates a new table)
|
vertices = table.copy_with_metatables(vertices)
|
||||||
vertices = filterVerticesByGroup(vertices, "is3d")
|
|
||||||
|
|
||||||
-- Sort deterministically to ensure consistent results across sessions
|
-- Only peaks with a `is3d` group can be triangulated.
|
||||||
sortVerticesDeterministically(vertices)
|
for i, vertex in ipairs(vertices) do
|
||||||
|
if vertex:getGroups().is3d == nil then
|
||||||
|
table.remove(vertices, i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local nvertices = #vertices
|
local nvertices = #vertices
|
||||||
|
|
||||||
@@ -223,13 +165,13 @@ function Triangulation.tetrahedralize(vertices)
|
|||||||
return {Tetrahedron:new(vertices[1], vertices[2], vertices[3], vertices[4])}
|
return {Tetrahedron:new(vertices[1], vertices[2], vertices[3], vertices[4])}
|
||||||
end
|
end
|
||||||
|
|
||||||
local minPos = vertices[1]:getPeakPos()
|
local minPos = vertices[1].getPeakPos()
|
||||||
local minX, minY, minZ = minPos.x, minPos.y, minPos.z
|
local minX, minY, minZ = minPos.x, minPos.y, minPos.z
|
||||||
local maxX, maxY, maxZ = minX, minY, minZ
|
local maxX, maxY, maxZ = minX, minY, minZ
|
||||||
|
|
||||||
for i = 1, nvertices do
|
for i = 1, nvertices do
|
||||||
local vertex = vertices[i]
|
local vertex = vertices[i]
|
||||||
local vertexPos = vertex:getPeakPos()
|
local vertexPos = vertex.getPeakPos()
|
||||||
vertex.id = i
|
vertex.id = i
|
||||||
|
|
||||||
if vertexPos.x < minX then
|
if vertexPos.x < minX then
|
||||||
@@ -305,6 +247,7 @@ function Triangulation.tetrahedralize(vertices)
|
|||||||
for j = 1, #faces do
|
for j = 1, #faces do
|
||||||
tetrahedrons[#tetrahedrons + 1] = Tetrahedron:new(faces[j].p1, faces[j].p2, faces[j].p3, vertices[i])
|
tetrahedrons[#tetrahedrons + 1] = Tetrahedron:new(faces[j].p1, faces[j].p2, faces[j].p3, vertices[i])
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Remove tetrahedra associated with the vertices of a supertetrahedron.
|
-- Remove tetrahedra associated with the vertices of a supertetrahedron.
|
||||||
@@ -316,7 +259,7 @@ function Triangulation.tetrahedralize(vertices)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Removing the vertices of a supertetrahedron.
|
-- Removing the vertices of a supertetrahedron.
|
||||||
for _ = 1, 4 do
|
for i = 1, 4 do
|
||||||
tableRemove( vertices )
|
tableRemove( vertices )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user