Compare commits
156 Commits
57de1f4b42
...
mapgen-opt
| Author | SHA1 | Date | |
|---|---|---|---|
| ceb35639b8 | |||
| 79df8f2f52 | |||
| e986a4c538 | |||
| 93bda75727 | |||
| 1531abc3e2 | |||
| a34822ed54 | |||
| 145f65d4af | |||
| e359c4be09 | |||
| c009493484 | |||
| fab86c0486 | |||
| cb15f25d60 | |||
| 867238e11b | |||
| df247108ef | |||
| e34fd29a4b | |||
| 41cf4710da | |||
| c6573ae308 | |||
| 4ef2476771 | |||
| 2c13e1697f | |||
| 7b4839e63b | |||
| 2813d9d5fe | |||
| 652200f28c | |||
| eeffae6852 | |||
| fe3298d112 | |||
| 7d49bbf535 | |||
| efcbc909e0 | |||
| 17413df9c4 | |||
| 2eede05436 | |||
| b863c88838 | |||
| 692105abfa | |||
| 1a6086190e | |||
| e20c3b4ef4 | |||
| 8b55ccff72 | |||
| c7cfe26335 | |||
| 51e6763457 | |||
| c47ab6ac3c | |||
| 6fd8295500 | |||
| b12f890740 | |||
| 4c90041c68 | |||
| b50d642bcf | |||
| e0b9024458 | |||
| 745eaa8569 | |||
| b6051e5724 | |||
| 5c936025f1 | |||
| 5be847bf58 | |||
| 0198771c51 | |||
| 5272294aeb | |||
| 2eb7d04039 | |||
| c70bf96734 | |||
| b64c8e9350 | |||
| 319f155849 | |||
| ed4094d964 | |||
| 6b074c7a8c | |||
| 00633226cf | |||
| 6156a4bb6f | |||
| b6f354f6fe | |||
| cfc4502cb0 | |||
| bafe26983c | |||
| 7b43def5fb | |||
| f4896b89ef | |||
| c58467f22b | |||
| 1d5f93c35a | |||
| 46427f565f | |||
| 8fb4e4db00 | |||
| 9c56db6ac4 | |||
| 15bb906df7 | |||
| e9818fba24 | |||
| a6fa46bb96 | |||
| 44adcf9535 | |||
| 97292d6205 | |||
| f2af5e725a | |||
| 25f38d1acd | |||
| 1d43ae1255 | |||
| 9426ac01dd | |||
| 21232bd1f7 | |||
| 0c02c0045d | |||
| 205cbc10c2 | |||
| 660c96ab5c | |||
| ec8499ff76 | |||
| 430ac78ea1 | |||
| f7140fb3cc | |||
| 6153b053f6 | |||
| bc03aa4ba6 | |||
| 04f90a7b2d | |||
| 66380fb873 | |||
| 169dd64bce | |||
| 613b7ead83 | |||
| 94dc3fa819 | |||
| 6c77b5a38c | |||
| c41ee05b55 | |||
| 87c6e5f3f3 | |||
| e435b21b43 | |||
| 0baa7af759 | |||
| 83304bbfc1 | |||
| 7dbd2f3be8 | |||
| b41448da7b | |||
| 865f46b734 | |||
| 3dd28858f5 | |||
| 9119582ddd | |||
| a12091fc93 | |||
| cfadf47951 | |||
| b0fc925750 | |||
| e12b0d64e5 | |||
| efcee33a02 | |||
| ce778673c7 | |||
| 5ec4bdd933 | |||
| 6332f23bf3 | |||
| 966af2328a | |||
| d08ee33400 | |||
| ba97a8f36f | |||
| ef6c0d9fe6 | |||
| c3bdb29852 | |||
| 6904090d19 | |||
| f3c5beb341 | |||
| fc90ae54c0 | |||
| 0952e96452 | |||
| 19d6637a29 | |||
| 6fb06b7109 | |||
| d392414cb7 | |||
| 8c7aaefe09 | |||
| 1d1591accc | |||
| ec614e6080 | |||
| c32d324bfb | |||
| 37d759e48a | |||
| 4b9afcf97d | |||
| c9ce8e5f60 | |||
| b7124419e7 | |||
| 8742b86a44 | |||
| 79111b3cbd | |||
| 087a8eee86 | |||
| cb853778fe | |||
| bdd35af484 | |||
| 882165c9e7 | |||
| e294c34801 | |||
| b6e07d04e3 | |||
| 3d03477467 | |||
| c75e06d274 | |||
| 6d3e9af2f8 | |||
| cabe562dc4 | |||
| 43bee3dae0 | |||
| 4f4b268d3c | |||
| c2b0c54236 | |||
| 907230e67d | |||
| 03ce7983eb | |||
| e81e2141a6 | |||
| 3d0a906a59 | |||
| 18dbce95c0 | |||
| b646a8e3e3 | |||
| 7ec4f906c8 | |||
| 39dbf29ff6 | |||
| a4b1ff2ee5 | |||
| 0c5f508152 | |||
| 50dd702e6e | |||
| 426fea3691 | |||
| 299dad5e11 | |||
| 0e8edc4f05 | |||
| f13a0b1273 |
@@ -24,6 +24,7 @@
|
|||||||
"enables": [],
|
"enables": [],
|
||||||
"globals": [
|
"globals": [
|
||||||
"core",
|
"core",
|
||||||
|
"Smc",
|
||||||
"table",
|
"table",
|
||||||
"Events",
|
"Events",
|
||||||
"VoxelArea",
|
"VoxelArea",
|
||||||
@@ -31,7 +32,8 @@
|
|||||||
"vector",
|
"vector",
|
||||||
"Ensure",
|
"Ensure",
|
||||||
"string",
|
"string",
|
||||||
"string_utf8"
|
"string_utf8",
|
||||||
|
"Profiler"
|
||||||
],
|
],
|
||||||
"globalsRegex": []
|
"globalsRegex": []
|
||||||
},
|
},
|
||||||
|
|||||||
52
.gitea/issue_template/bug.yaml
Normal file
52
.gitea/issue_template/bug.yaml
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
name: Сообщение об ошибке
|
||||||
|
about: Сообщить о недоработке игры, которую необходимо исправить.
|
||||||
|
title: "[Bug]: "
|
||||||
|
labels:
|
||||||
|
- bug/need confirmed
|
||||||
|
body:
|
||||||
|
- type: textarea
|
||||||
|
id: bug-desc
|
||||||
|
attributes:
|
||||||
|
label: Описание ошибки
|
||||||
|
description: Опишите, что произошло, в чем по вашему мнению заключается ошибка и какое поведение игры вы ожидали.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: playback-order
|
||||||
|
attributes:
|
||||||
|
label: Как воспроизвести баг?
|
||||||
|
description: Опишите порядок действий, как воспроизвести описываемую ошибку.
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
|
- type: dropdown
|
||||||
|
id: game-version
|
||||||
|
attributes:
|
||||||
|
label: Версия игры
|
||||||
|
description: Сообщите на каких версиях клиента игры была замечена ошибка.
|
||||||
|
multiple: true
|
||||||
|
options:
|
||||||
|
- "5.15"
|
||||||
|
- "5.14"
|
||||||
|
- "5.13"
|
||||||
|
- "5.12"
|
||||||
|
- "5.11"
|
||||||
|
- "5.10"
|
||||||
|
- "< 5.10"
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: dropdown
|
||||||
|
id: bug-server
|
||||||
|
attributes:
|
||||||
|
label: Где была замечена ошибка?
|
||||||
|
description: Сообщите, где была замечена ошибка.
|
||||||
|
multiple: true
|
||||||
|
options:
|
||||||
|
- Игровой сервер
|
||||||
|
- Локальный мир
|
||||||
|
- Тестовый сервер
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Спасибо, что уделили время и заполнили этот отчет об ошибке!
|
||||||
19
.gitea/issue_template/idea.yaml
Normal file
19
.gitea/issue_template/idea.yaml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
name: Предложение
|
||||||
|
about: Описать предложение для рассмотрения мейнтейнерами проекта.
|
||||||
|
labels:
|
||||||
|
- idea/need a maintainer
|
||||||
|
body:
|
||||||
|
- type: textarea
|
||||||
|
id: task-desc
|
||||||
|
attributes:
|
||||||
|
label: Описание
|
||||||
|
description: Подробно опишите в чем заключается ваша идея, а так же объясните необходимость её реализации.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: task-additions
|
||||||
|
attributes:
|
||||||
|
label: Дополнения
|
||||||
|
description: Приложите дополнительные сведенья, файлы или изображения.
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
19
.gitea/issue_template/task.yaml
Normal file
19
.gitea/issue_template/task.yaml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
name: Задача
|
||||||
|
about: Сформировать и описать задачу, которую должен будет выполнить разработчик. Этот шаблон предназначен для мейнтейнеров проекта.
|
||||||
|
labels:
|
||||||
|
- task/need developer
|
||||||
|
body:
|
||||||
|
- type: textarea
|
||||||
|
id: task-desc
|
||||||
|
attributes:
|
||||||
|
label: Описание задачи
|
||||||
|
description: Подробно опишите в чем заключается задача для разработчика.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: task-additions
|
||||||
|
attributes:
|
||||||
|
label: Дополнения
|
||||||
|
description: Приложите дополнительные сведенья, файлы или изображения необходимые для выполнения задачи.
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
35
.gitea/pull_request_template.yml
Normal file
35
.gitea/pull_request_template.yml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
name: PR-template
|
||||||
|
about: PR-template
|
||||||
|
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: false
|
||||||
|
- label: Я указал в описании запроса метки (label) с префиксом `Edit:` в соответствии с теми изменениями, которые сделал.
|
||||||
|
required: false
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Спасибо, что прислали это запрос на слияние и помогли нам в разработке игры!
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
|
IGNORE
|
||||||
/mods/IGNORE
|
/mods/IGNORE
|
||||||
7
.gitmodules
vendored
7
.gitmodules
vendored
@@ -1,7 +1,6 @@
|
|||||||
[submodule "mods/API/Utf8"]
|
|
||||||
path = mods/API/Utf8
|
|
||||||
url = https://github.com/ApancoreStudio/utf8_api.git
|
|
||||||
branch = main
|
|
||||||
[submodule "util/ide-helper"]
|
[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,7 +1,8 @@
|
|||||||
Source code licensing:
|
# Source code licensing
|
||||||
|
|
||||||
The MIT License (MIT)
|
**The MIT License (MIT)**
|
||||||
Copyright (c) 2025 Apancore.Studio, Doloment
|
|
||||||
|
Copyright (c) 2025 Apancore.Studio, Van (varttist), Doloment
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
@@ -11,9 +12,13 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|||||||
|
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
Sprites licensing:
|
# Sprites licensing
|
||||||
|
|
||||||
CC BY 4.0
|
**CC BY 4.0**
|
||||||
Copyright (c) 2025 Apancore.Studio, Doloment and others (see list below)
|
|
||||||
|
Copyright (c) 2025 Apancore.Studio, Van (varttist) and others (see list below)
|
||||||
|
|
||||||
|
All textures except those listed here are copyrighted by Van (varttist) and are distributed under the CC BY 4.0.
|
||||||
|
|
||||||
List of all textures and authors:
|
List of all textures and authors:
|
||||||
|
- ...
|
||||||
218
docs/MapGen_docs.txt
Normal file
218
docs/MapGen_docs.txt
Normal file
@@ -0,0 +1,218 @@
|
|||||||
|
MapGen.PastCalcNoiseValue *MapGen.PastCalcNoiseValue*
|
||||||
|
|
||||||
|
Type: ~
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
MapGen *MapGen*
|
||||||
|
|
||||||
|
Fields: ~
|
||||||
|
{layersByName} (table<string,MapGen.Layer>)
|
||||||
|
{layersList} (MapGen.Layer[])
|
||||||
|
{staticsByName} (table<string,MapGen.StaticLayer>)
|
||||||
|
{staticsList} (MapGen.StaticLayer[])
|
||||||
|
{layersNoisesInitialized} (boolean) Is the fractal noise of the layer initialized? This is necessary for a one-time noise initialization.
|
||||||
|
{cavernsNoiseInitialized} (boolean) Is the fractal noise of the caverns initialized? This is necessary for a one-time noise initialization.
|
||||||
|
{isRunning} (boolean) A static field that guarantees that only one instance of the `MapGen` class will work.
|
||||||
|
{nodeIDs} (table<string,number>)
|
||||||
|
|
||||||
|
|
||||||
|
MapGenDef *MapGenDef*
|
||||||
|
Definition table for the `MapGen`.
|
||||||
|
|
||||||
|
**Only for EmmyLua.**
|
||||||
|
|
||||||
|
Fields: ~
|
||||||
|
{nodes} (table<string,string>)
|
||||||
|
|
||||||
|
|
||||||
|
MapGen:new({def}) *MapGen:new*
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
{def} (MapGenDef)
|
||||||
|
|
||||||
|
Returns: ~
|
||||||
|
(MapGen)
|
||||||
|
|
||||||
|
|
||||||
|
MapGen:getLayerByHeight({yPos}) *MapGen:getLayerByHeight*
|
||||||
|
Determines which layer a node belongs to based on its height coordinate.
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
{yPos} (number) @return MapGen.Layer?
|
||||||
|
|
||||||
|
|
||||||
|
MapGen:getStaticByHeight({yPos}) *MapGen:getStaticByHeight*
|
||||||
|
Determines which statics layer a node belongs to based on its height coordinate.
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
{yPos} (number) @return MapGen.StaticLayer?
|
||||||
|
|
||||||
|
|
||||||
|
MapGen:registerLayer({name}, {def}) *MapGen:registerLayer*
|
||||||
|
Mark the world area between two heights as a `MapGen.Layer`.
|
||||||
|
|
||||||
|
Note: layers must not overlap.
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
{name} (string) The name that will be assigned to the layer. The name must be unique for each layer.
|
||||||
|
{def} (MapGen.LayerDef) Layer description table, see details `MapGen.LayerDef`.
|
||||||
|
|
||||||
|
|
||||||
|
*MapGen:registerLayerNoiseColor*
|
||||||
|
MapGen:registerLayerNoiseColor({layerName}, {category}, {color}, {noiseParams})
|
||||||
|
Register the color and the noise parameters that correspond to it.
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
{layerName} (string) The name of the layer for which the color will be registered.
|
||||||
|
{category} (MapGen.Layer.Category) Category indicating what will be generated by noise.
|
||||||
|
{color} (ColorString) Noise color. Must be unique.
|
||||||
|
{noiseParams} (NoiseParams) Fractal noise parameters.
|
||||||
|
|
||||||
|
|
||||||
|
*MapGen:registerStaticLayer*
|
||||||
|
MapGen:registerStaticLayer({name}, {def})
|
||||||
|
Mark the world area between two heights as a `MapGen.StaticLayer`.
|
||||||
|
|
||||||
|
Note: layers must not overlap.
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
{name} (string) The name that will be assigned to the static layer. The name must be unique for each layer.
|
||||||
|
{def} (MapGen.StaticLayerDef) Static layer description table, see details `MapGen.StaticLayerDef`.
|
||||||
|
|
||||||
|
|
||||||
|
*MapGen:registerPeak*
|
||||||
|
MapGen:registerPeak({layerName}, {category}, {def})
|
||||||
|
Mark a world point as `MapGen.Peak` and assign it a specific color that will affect the generation.
|
||||||
|
|
||||||
|
Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
{layerName} (string) The name of the layer in which the new peak will be included.
|
||||||
|
{category} (MapGen.Layer.Category) Category indicating what will be generated by peak.
|
||||||
|
{def} (MapGen.PeakDef) Peak description table, see details `MapGen.PeakDef`.
|
||||||
|
|
||||||
|
|
||||||
|
*MapGen:register2DPeak*
|
||||||
|
MapGen:register2DPeak({layerName}, {category}, {def})
|
||||||
|
Mark a world point as `MapGen.Peak` and assign it a specific color that will affect the generation.
|
||||||
|
The Y coordinate will be forced to zero, and the `is2d` group will be added to the groups field.
|
||||||
|
|
||||||
|
Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
{layerName} (string) The name of the layer in which the new peak will be included.
|
||||||
|
{category} (MapGen.Layer.Category) Category indicating what will be generated by peak.
|
||||||
|
{def} (MapGen.PeakDef) Peak description table, see details `MapGen.PeakDef`.
|
||||||
|
|
||||||
|
|
||||||
|
*MapGen:register2DPeaks*
|
||||||
|
MapGen:register2DPeaks({layerName}, {category}, {defs})
|
||||||
|
Mark the world points as `MapGen.Peak` and assign them all a specific noise that will affect generation.
|
||||||
|
The Y coordinate will be forced to zero, and the `is2d` group will be added to the groups field.
|
||||||
|
|
||||||
|
Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
{layerName} (string) The name of the layer in which the new peaks will be included.
|
||||||
|
{category} (MapGen.Layer.Category) Category indicating what will be generated by peaks.
|
||||||
|
{defs} (MapGen.PeakDef[]) Peaks description table, see details `MapGen.PeakDef`.
|
||||||
|
|
||||||
|
|
||||||
|
*MapGen:register2DPeaksFromFile*
|
||||||
|
MapGen:register2DPeaksFromFile({layerName}, {map}, {scale}, {zeroPos}, {category}, {groups?})
|
||||||
|
Extract the `MapGen.Peak` from the image and assign them all a specific color that will affect the generation.
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
{layerName} (string) The name of the layer in which the new peaks will be included.
|
||||||
|
{map} (string) The name of the image from which the peaks will be extracted. It should be located in the `<mod_name>/textures/maps` folder and have the following format `<image_name>.ff`
|
||||||
|
{scale} (number) Multiplier of how many blocks (nodes) will be between image pixels. It is not recommended to set the value below 50 for performance reasons.
|
||||||
|
{zeroPos} (Position2d) The position in pixels where the zero world coordinate will be in the image.
|
||||||
|
{category} (MapGen.Layer.Category) Category indicating what will be generated by peaks.
|
||||||
|
{groups?} (table<string,number>) Groups that will be added to all peaks.
|
||||||
|
|
||||||
|
|
||||||
|
*MapGen:registerBiome*
|
||||||
|
MapGen:registerBiome({layerName}, {biomeName}, {def})
|
||||||
|
Mark a point on the biomes diagram and constrain the world area by height to mark it as `MapGen.Biome`.
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
{layerName} (string) The name of the layer in which the new biome will be included.
|
||||||
|
{biomeName} (string) The name to be assigned to the biome. The name must be unique for each biome.
|
||||||
|
{def} (MapGen.BiomeDef) Biome description table, see details `MapGen.BiomeDef`
|
||||||
|
|
||||||
|
|
||||||
|
*MapGen:registerCavern*
|
||||||
|
MapGen:registerCavern({layerName}, {cavernName}, {def})
|
||||||
|
Mark the world area between two heights as a `MapGen.Cavern` and assign the noise that the cave will be generated from.
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
{layerName} (string) The name of the layer in which the new cavern will be included.
|
||||||
|
{cavernName} (string) The name to be assigned to the cavern. The name must be unique for each cavern.
|
||||||
|
{def} (MapGen.CavernDef) Cavern description table, see details `MapGen.CavernDef`
|
||||||
|
|
||||||
|
|
||||||
|
MapGen:initLayersTriangultaion() *MapGen:initLayersTriangultaion*
|
||||||
|
Divide all layers into triangles whose vertices are the `Mapgen.Peak` belonging to these layers.
|
||||||
|
|
||||||
|
|
||||||
|
MapGen:initLayersNoises() *MapGen:initLayersNoises*
|
||||||
|
Initialize all layer noises. This should be called after the map object is loaded.
|
||||||
|
|
||||||
|
|
||||||
|
MapGen:initBiomesDiagram() *MapGen:initBiomesDiagram*
|
||||||
|
Initialization of the biome diagram using the Voronoi method.
|
||||||
|
|
||||||
|
|
||||||
|
MapGen:initCavernsNoise() *MapGen:initCavernsNoise*
|
||||||
|
Initialize caverns's noises. This should be called after the map object is loaded.
|
||||||
|
|
||||||
|
|
||||||
|
*MapGen:getNoises2dValue*
|
||||||
|
MapGen:getNoises2dValue({category}, {layer}, {x}, {y}, {z})
|
||||||
|
Calculates a smoothed 2D noise value based on a preliminary space partitioning.
|
||||||
|
|
||||||
|
Returns `nil` if the point is not included in any triangle.
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
{category} (MapGen.Layer.Category)
|
||||||
|
{layer} (MapGen.Layer)
|
||||||
|
{x} (integer)
|
||||||
|
{y} (integer)
|
||||||
|
{z} (integer) @return number?
|
||||||
|
|
||||||
|
|
||||||
|
*MapGen:getNoises3dValues*
|
||||||
|
MapGen:getNoises3dValues({layer}, {x}, {y}, {z})
|
||||||
|
Calculates a smoothed 3D noise value based on a preliminary space partitioning.
|
||||||
|
|
||||||
|
Returns `nil` if the point is not included in any tetrahedron.
|
||||||
|
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
{layer} (MapGen.Layer)
|
||||||
|
{x} (number)
|
||||||
|
{y} (number)
|
||||||
|
{z} (number) @return number?
|
||||||
|
|
||||||
|
|
||||||
|
*MapGen:onMapGenerated*
|
||||||
|
MapGen:onMapGenerated({voxelManip}, {minPos}, {maxPos}, {blockseed})
|
||||||
|
Chunk generation handler.
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
{voxelManip} (VoxelManip)
|
||||||
|
{minPos} (Position)
|
||||||
|
{maxPos} (Position)
|
||||||
|
{blockseed} (number)
|
||||||
|
|
||||||
|
|
||||||
|
MapGen:run() *MapGen:run*
|
||||||
|
Run world generation through this mapgen object
|
||||||
|
|
||||||
|
Note: only one instance of a `MapGen` class can be running.
|
||||||
|
|
||||||
|
**FOR MAPGEN ENVIRONMENT ONLY**
|
||||||
|
|
||||||
|
|
||||||
|
vim:tw=78:ts=8:noet:ft=help:norl:
|
||||||
54
docs/docs/index.md
Normal file
54
docs/docs/index.md
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
# index
|
||||||
|
|
||||||
|
|
||||||
|
## Types
|
||||||
|
|
||||||
|
- [alias Category](types/MapGen.Layer.Category.md)
|
||||||
|
- [alias CircumCircleEnum](types/MapGen.Triangle.CircumCircleEnum.md)
|
||||||
|
- [alias ColoredDotsTable](types/ColoredDotsTable.md)
|
||||||
|
- [alias Neighbours](types/MapGen.Triangle.Neighbours.md)
|
||||||
|
- [alias PastCalcNoiseValue](types/MapGen.PastCalcNoiseValue.md)
|
||||||
|
- [alias generateFunc](types/generateFunc.md)
|
||||||
|
- [class Biome](types/MapGen.Biome.md)
|
||||||
|
- [class BiomeDef](types/MapGen.BiomeDef.md)
|
||||||
|
- [class Cavern](types/MapGen.Cavern.md)
|
||||||
|
- [class CavernDef](types/MapGen.CavernDef.md)
|
||||||
|
- [class Decoration](types/MapGen.Decoration.md)
|
||||||
|
- [class Edge](types/MapGen.Triangulation.Edge.md)
|
||||||
|
- [class FakePeak](types/MapGen.Triangulation.FakePeak.md)
|
||||||
|
- [class GroundNodes](types/MapGen.Biome.GroundNodes.md)
|
||||||
|
- [class GroundNodesIDs](types/MapGen.Biome.GroundNodesIDs.md)
|
||||||
|
- [class Layer](types/MapGen.Layer.md)
|
||||||
|
- [class LayerDef](types/MapGen.LayerDef.md)
|
||||||
|
- [class MapGen](types/MapGen.md)
|
||||||
|
- [class MapGenDef](types/MapGenDef.md)
|
||||||
|
- [class Peak](types/MapGen.Peak.md)
|
||||||
|
- [class PeakDef](types/MapGen.PeakDef.md)
|
||||||
|
- [class StaticLayer](types/MapGen.StaticLayer.md)
|
||||||
|
- [class StaticLayerDef](types/MapGen.StaticLayerDef.md)
|
||||||
|
- [class Tetrahedron](types/MapGen.Tetrahedron.md)
|
||||||
|
- [class Triangle](types/MapGen.Triangle.md)
|
||||||
|
- [class Triangulation](types/MapGen.Triangulation.md)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Modules
|
||||||
|
- [MapGen](modules/MapGen.md)
|
||||||
|
- [MapGen.Biome](modules/MapGen.Biome.md)
|
||||||
|
- [MapGen.Biome.GroundNodes](modules/MapGen.Biome.GroundNodes.md)
|
||||||
|
- [MapGen.Biome.GroundNodesIds](modules/MapGen.Biome.GroundNodesIds.md)
|
||||||
|
- [MapGen.Cavern](modules/MapGen.Cavern.md)
|
||||||
|
- [MapGen.Decoration](modules/MapGen.Decoration.md)
|
||||||
|
- [MapGen.Layer](modules/MapGen.Layer.md)
|
||||||
|
- [MapGen.Peak](modules/MapGen.Peak.md)
|
||||||
|
- [MapGen.StaticLayer](modules/MapGen.StaticLayer.md)
|
||||||
|
- [MapGen.Tetrahedron](modules/MapGen.Tetrahedron.md)
|
||||||
|
- [MapGen.Triangle](modules/MapGen.Triangle.md)
|
||||||
|
- [MapGen.Triangulation](modules/MapGen.Triangulation.md)
|
||||||
|
- [MapGen.Triangulation.Edge](modules/MapGen.Triangulation.Edge.md)
|
||||||
|
- [MapGen.Triangulation.FakePeak](modules/MapGen.Triangulation.FakePeak.md)
|
||||||
|
- [MapGen.ff2luat](modules/MapGen.ff2luat.md)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
85
docs/docs/modules/MapGen.Biome.GroundNodes.md
Normal file
85
docs/docs/modules/MapGen.Biome.GroundNodes.md
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
# global MapGen.Biome.GroundNodes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### GroundNodes.turf
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
GroundNodes.turf : string
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The soil covering the surface of the biome
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### GroundNodes.soil
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
GroundNodes.soil : string
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The soil beneath the turf. The height of this layer depends on `Biome.soilHeight`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### GroundNodes.rock
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
GroundNodes.rock : string
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The rock found beneath the soil of a biome.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### GroundNodes.bottom
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
GroundNodes.bottom : string
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Covering the bottom of reservoirs.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
85
docs/docs/modules/MapGen.Biome.GroundNodesIds.md
Normal file
85
docs/docs/modules/MapGen.Biome.GroundNodesIds.md
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
# global MapGen.Biome.GroundNodesIds
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### GroundNodesIDs.turf
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
GroundNodesIDs.turf : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The soil covering the surface of the biome
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### GroundNodesIDs.soil
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
GroundNodesIDs.soil : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The soil beneath the turf. The height of this layer depends on `Biome.soilHeight`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### GroundNodesIDs.rock
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
GroundNodesIDs.rock : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The rock found beneath the soil of a biome.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### GroundNodesIDs.bottom
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
GroundNodesIDs.bottom : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Covering the bottom of reservoirs.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
307
docs/docs/modules/MapGen.Biome.md
Normal file
307
docs/docs/modules/MapGen.Biome.md
Normal file
@@ -0,0 +1,307 @@
|
|||||||
|
# global MapGen.Biome
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## methods
|
||||||
|
---
|
||||||
|
|
||||||
|
### Biome.new
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Biome.new(
|
||||||
|
name: string,
|
||||||
|
def: MapGen.BiomeDef {
|
||||||
|
tempPoint = number,
|
||||||
|
humidityPoint = number,
|
||||||
|
minY = number,
|
||||||
|
maxY = number,
|
||||||
|
groundNodes = MapGen.Biome.GroundNodes,
|
||||||
|
soilHeight = number,
|
||||||
|
generateAir = generateFunc?,
|
||||||
|
generateCavernAir = generateFunc?,
|
||||||
|
generateWater = generateFunc?,
|
||||||
|
generateRock = generateFunc?,
|
||||||
|
generateTurf = generateFunc?,
|
||||||
|
generateSoil = generateFunc?,
|
||||||
|
generateBottom = generateFunc?,
|
||||||
|
}
|
||||||
|
) -> MapGen.Biome {
|
||||||
|
name = string,
|
||||||
|
tempPoint = number,
|
||||||
|
humidityPoint = number,
|
||||||
|
minY = number,
|
||||||
|
maxY = number,
|
||||||
|
groundNodes = MapGen.Biome.GroundNodes,
|
||||||
|
groundNodesIDs = MapGen.Biome.GroundNodesIDs,
|
||||||
|
soilHeight = number,
|
||||||
|
generateAir = generateFunc,
|
||||||
|
generateCavernAir = generateFunc,
|
||||||
|
generateWater = generateFunc,
|
||||||
|
generateRock = generateFunc,
|
||||||
|
generateTurf = generateFunc,
|
||||||
|
generateSoil = generateFunc,
|
||||||
|
generateBottom = generateFunc,
|
||||||
|
new = function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### Biome.name
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.name : string
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.tempPoint
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.tempPoint : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.humidityPoint
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.humidityPoint : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.minY
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.minY : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.maxY
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.maxY : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.groundNodes
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.groundNodes : MapGen.Biome.GroundNodes {
|
||||||
|
turf: string,
|
||||||
|
soil: string,
|
||||||
|
rock: string,
|
||||||
|
bottom: string,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.groundNodesIDs
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.groundNodesIDs : MapGen.Biome.GroundNodesIDs {
|
||||||
|
turf: number,
|
||||||
|
soil: number,
|
||||||
|
rock: number,
|
||||||
|
bottom: number,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.soilHeight
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.soilHeight : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.generateAir
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.generateAir : generateFunc
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.generateCavernAir
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.generateCavernAir : generateFunc
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.generateWater
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.generateWater : generateFunc
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.generateRock
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.generateRock : generateFunc
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.generateTurf
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.generateTurf : generateFunc
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.generateSoil
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.generateSoil : generateFunc
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.generateBottom
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.generateBottom : generateFunc
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
203
docs/docs/modules/MapGen.Cavern.md
Normal file
203
docs/docs/modules/MapGen.Cavern.md
Normal file
@@ -0,0 +1,203 @@
|
|||||||
|
# global MapGen.Cavern
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## methods
|
||||||
|
---
|
||||||
|
|
||||||
|
### Cavern.getNoise
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Cavern.getNoise()-> ValueNoise
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Cavern.initNoise
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Cavern.initNoise()-> nil
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Cavern.getGroups
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Cavern.getGroups()
|
||||||
|
-> table<string,number>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Cavern.new
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Cavern.new(
|
||||||
|
name: string,
|
||||||
|
def: MapGen.CavernDef {
|
||||||
|
minY = number,
|
||||||
|
maxY = number,
|
||||||
|
noiseParams = NoiseParams,
|
||||||
|
smoothDistance = number,
|
||||||
|
threshold = number?,
|
||||||
|
groups = table<string,number>?,
|
||||||
|
}
|
||||||
|
) -> MapGen.Cavern {
|
||||||
|
name = string,
|
||||||
|
minY = number,
|
||||||
|
maxY = number,
|
||||||
|
smoothDistance = number,
|
||||||
|
threshold = number,
|
||||||
|
getNoise = function,
|
||||||
|
initNoise = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
isCavern = function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Cavern.isCavern
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Cavern.isCavern(
|
||||||
|
x: integer,
|
||||||
|
y: integer,
|
||||||
|
z: integer
|
||||||
|
) -> boolean
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns `true` if there is a cavern at the specified coordinates.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### Cavern.name
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Cavern.name : string
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Cavern.minY
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Cavern.minY : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Cavern.maxY
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Cavern.maxY : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Cavern.smoothDistance
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Cavern.smoothDistance : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Cavern.threshold
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Cavern.threshold : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
36
docs/docs/modules/MapGen.Decoration.md
Normal file
36
docs/docs/modules/MapGen.Decoration.md
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
# global MapGen.Decoration
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## methods
|
||||||
|
---
|
||||||
|
|
||||||
|
### Decoration.new
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Decoration.new() -> MapGen.Decoration {
|
||||||
|
new = function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
673
docs/docs/modules/MapGen.Layer.md
Normal file
673
docs/docs/modules/MapGen.Layer.md
Normal file
@@ -0,0 +1,673 @@
|
|||||||
|
# global MapGen.Layer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## methods
|
||||||
|
---
|
||||||
|
|
||||||
|
### Layer.calcTemp
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Layer.calcTemp(
|
||||||
|
self: MapGen.Layer {
|
||||||
|
name = string,
|
||||||
|
minY = integer,
|
||||||
|
maxY = integer,
|
||||||
|
minTemp = integer,
|
||||||
|
maxTemp = integer,
|
||||||
|
minHumidity = integer,
|
||||||
|
maxHumidity = integer,
|
||||||
|
waterLevel = integer,
|
||||||
|
peaksList = { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] },
|
||||||
|
noisesByColor = { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> },
|
||||||
|
noisesParamsByColor = { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> },
|
||||||
|
biomesByName = table<string,MapGen.Biome>,
|
||||||
|
biomesList = MapGen.Biome[],
|
||||||
|
biomesDiagram = table,
|
||||||
|
biomesGorizontalScattering = integer,
|
||||||
|
biomesVerticalScattering = integer,
|
||||||
|
cavernsByName = table<string,MapGen.Cavern>,
|
||||||
|
cavernsList = MapGen.Cavern[],
|
||||||
|
trianglesList = { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] },
|
||||||
|
tetrahedronsList = MapGen.Tetrahedron[],
|
||||||
|
calcTemp = function,
|
||||||
|
calcHumidity = function,
|
||||||
|
new = function,
|
||||||
|
addPeak = function,
|
||||||
|
addNoiseParamsColor = function,
|
||||||
|
getNoiseByColor = function,
|
||||||
|
addBiome = function,
|
||||||
|
addCavern = function,
|
||||||
|
initNoises = function,
|
||||||
|
initBiomesDiagram = function,
|
||||||
|
},
|
||||||
|
value: number,
|
||||||
|
height: number
|
||||||
|
)-> number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.calcHumidity
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Layer.calcHumidity(
|
||||||
|
self: MapGen.Layer {
|
||||||
|
name = string,
|
||||||
|
minY = integer,
|
||||||
|
maxY = integer,
|
||||||
|
minTemp = integer,
|
||||||
|
maxTemp = integer,
|
||||||
|
minHumidity = integer,
|
||||||
|
maxHumidity = integer,
|
||||||
|
waterLevel = integer,
|
||||||
|
peaksList = { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] },
|
||||||
|
noisesByColor = { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> },
|
||||||
|
noisesParamsByColor = { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> },
|
||||||
|
biomesByName = table<string,MapGen.Biome>,
|
||||||
|
biomesList = MapGen.Biome[],
|
||||||
|
biomesDiagram = table,
|
||||||
|
biomesGorizontalScattering = integer,
|
||||||
|
biomesVerticalScattering = integer,
|
||||||
|
cavernsByName = table<string,MapGen.Cavern>,
|
||||||
|
cavernsList = MapGen.Cavern[],
|
||||||
|
trianglesList = { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] },
|
||||||
|
tetrahedronsList = MapGen.Tetrahedron[],
|
||||||
|
calcTemp = function,
|
||||||
|
calcHumidity = function,
|
||||||
|
new = function,
|
||||||
|
addPeak = function,
|
||||||
|
addNoiseParamsColor = function,
|
||||||
|
getNoiseByColor = function,
|
||||||
|
addBiome = function,
|
||||||
|
addCavern = function,
|
||||||
|
initNoises = function,
|
||||||
|
initBiomesDiagram = function,
|
||||||
|
},
|
||||||
|
value: number,
|
||||||
|
height: number
|
||||||
|
)-> number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.new
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Layer.new(
|
||||||
|
name: string,
|
||||||
|
def: MapGen.LayerDef {
|
||||||
|
minY = number,
|
||||||
|
maxY = number,
|
||||||
|
minTemp = number,
|
||||||
|
maxTemp = number,
|
||||||
|
minHumidity = number,
|
||||||
|
maxHumidity = number,
|
||||||
|
waterLevel = number?,
|
||||||
|
calcTemp = (fun(self: MapGen.Layer, value: number, height: number) -> number)?,
|
||||||
|
calcHumidity = (fun(self: MapGen.Layer, value: number, height: number) -> number)?,
|
||||||
|
biomesGorizontalScattering = number?,
|
||||||
|
biomesVerticalScattering = number?,
|
||||||
|
}
|
||||||
|
) -> MapGen.Layer {
|
||||||
|
name = string,
|
||||||
|
minY = integer,
|
||||||
|
maxY = integer,
|
||||||
|
minTemp = integer,
|
||||||
|
maxTemp = integer,
|
||||||
|
minHumidity = integer,
|
||||||
|
maxHumidity = integer,
|
||||||
|
waterLevel = integer,
|
||||||
|
peaksList = { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] },
|
||||||
|
noisesByColor = { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> },
|
||||||
|
noisesParamsByColor = { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> },
|
||||||
|
biomesByName = table<string,MapGen.Biome>,
|
||||||
|
biomesList = MapGen.Biome[],
|
||||||
|
biomesDiagram = table,
|
||||||
|
biomesGorizontalScattering = integer,
|
||||||
|
biomesVerticalScattering = integer,
|
||||||
|
cavernsByName = table<string,MapGen.Cavern>,
|
||||||
|
cavernsList = MapGen.Cavern[],
|
||||||
|
trianglesList = { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] },
|
||||||
|
tetrahedronsList = MapGen.Tetrahedron[],
|
||||||
|
calcTemp = function,
|
||||||
|
calcHumidity = function,
|
||||||
|
new = function,
|
||||||
|
addPeak = function,
|
||||||
|
addNoiseParamsColor = function,
|
||||||
|
getNoiseByColor = function,
|
||||||
|
addBiome = function,
|
||||||
|
addCavern = function,
|
||||||
|
initNoises = function,
|
||||||
|
initBiomesDiagram = function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.addPeak
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Layer.addPeak(
|
||||||
|
category: MapGen.Layer.Category,
|
||||||
|
peak: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
}
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Adds a peak to the `Layer.peaksList`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.addNoiseParamsColor
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Layer.addNoiseParamsColor(
|
||||||
|
category: MapGen.Layer.Category,
|
||||||
|
color: ColorString,
|
||||||
|
noiseParams: NoiseParams
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Adds a NoiseParams color to the `Layer.noisesParamsByColor`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.getNoiseByColor
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Layer.getNoiseByColor(
|
||||||
|
category: MapGen.Layer.Category,
|
||||||
|
color: ColorString
|
||||||
|
) -> ValueNoise
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns noise corresponding to a color.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.addBiome
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Layer.addBiome(
|
||||||
|
biomeName: string,
|
||||||
|
biome: MapGen.Biome {
|
||||||
|
name = string,
|
||||||
|
tempPoint = number,
|
||||||
|
humidityPoint = number,
|
||||||
|
minY = number,
|
||||||
|
maxY = number,
|
||||||
|
groundNodes = MapGen.Biome.GroundNodes,
|
||||||
|
groundNodesIDs = MapGen.Biome.GroundNodesIDs,
|
||||||
|
soilHeight = number,
|
||||||
|
generateAir = generateFunc,
|
||||||
|
generateCavernAir = generateFunc,
|
||||||
|
generateWater = generateFunc,
|
||||||
|
generateRock = generateFunc,
|
||||||
|
generateTurf = generateFunc,
|
||||||
|
generateSoil = generateFunc,
|
||||||
|
generateBottom = generateFunc,
|
||||||
|
new = function,
|
||||||
|
}
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Adds a biome to the `Layer.biomesByName` & `Layer.biomesList`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.addCavern
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Layer.addCavern(
|
||||||
|
cavernName: string,
|
||||||
|
cavern: MapGen.Cavern {
|
||||||
|
name = string,
|
||||||
|
minY = number,
|
||||||
|
maxY = number,
|
||||||
|
smoothDistance = number,
|
||||||
|
threshold = number,
|
||||||
|
getNoise = function,
|
||||||
|
initNoise = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
isCavern = function,
|
||||||
|
}
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Adds a cavern to the `Layer.cavernsByName` & `Layer.cavernsList`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.initNoises
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Layer.initNoises() -> nil
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Initializes noise for generation.
|
||||||
|
|
||||||
|
Should only be called after the mapgen object has been loaded.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.initBiomesDiagram
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Layer.initBiomesDiagram() -> nil
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Initialization of the biome diagram using the Voronoi method.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### Layer.name
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.name : string
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.minY
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.minY : integer
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.maxY
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.maxY : integer
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.minTemp
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.minTemp : integer
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.maxTemp
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.maxTemp : integer
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.minHumidity
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.minHumidity : integer
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.maxHumidity
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.maxHumidity : integer
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.waterLevel
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.waterLevel : integer
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.peaksList
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.peaksList : { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] }
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.noisesByColor
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.noisesByColor : { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> }
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.noisesParamsByColor
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.noisesParamsByColor : { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> }
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.biomesByName
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.biomesByName : table<string,MapGen.Biome>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.biomesList
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.biomesList : MapGen.Biome[]
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.biomesDiagram
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.biomesDiagram : table
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.biomesGorizontalScattering
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.biomesGorizontalScattering : integer
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.biomesVerticalScattering
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.biomesVerticalScattering : integer
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.cavernsByName
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.cavernsByName : table<string,MapGen.Cavern>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.cavernsList
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.cavernsList : MapGen.Cavern[]
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.trianglesList
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.trianglesList : { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] }
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.tetrahedronsList
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.tetrahedronsList : MapGen.Tetrahedron[]
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Not supported**
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
157
docs/docs/modules/MapGen.Peak.md
Normal file
157
docs/docs/modules/MapGen.Peak.md
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
# global MapGen.Peak
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## methods
|
||||||
|
---
|
||||||
|
|
||||||
|
### Peak.getPeakPos
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Peak.getPeakPos(self)-> vector
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Peak.getColor
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Peak.getColor(self)-> ColorString
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Peak.getGroups
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Peak.getGroups(self)
|
||||||
|
-> table<string,number>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Peak.new
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Peak.new(def: MapGen.PeakDef {
|
||||||
|
pos = vector,
|
||||||
|
color = ColorString,
|
||||||
|
groups = table<string,number>?,
|
||||||
|
}) -> MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Peak.toString
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Peak.toString() -> string
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns a string describing the object in a readable form.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Peak.eq
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Peak.eq(other: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
}) -> boolean
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns true if the peaks are equivalent.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### Peak.id
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Peak.id : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
144
docs/docs/modules/MapGen.StaticLayer.md
Normal file
144
docs/docs/modules/MapGen.StaticLayer.md
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
# global MapGen.StaticLayer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## methods
|
||||||
|
---
|
||||||
|
|
||||||
|
### StaticLayer.new
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function StaticLayer.new(
|
||||||
|
name: string,
|
||||||
|
def: MapGen.StaticLayerDef {
|
||||||
|
minY = number,
|
||||||
|
maxY = number,
|
||||||
|
staticNode = string,
|
||||||
|
generateStaticNode = generateFunc,
|
||||||
|
}
|
||||||
|
) -> MapGen.StaticLayer {
|
||||||
|
name = string,
|
||||||
|
minY = number,
|
||||||
|
maxY = number,
|
||||||
|
staticNode = string,
|
||||||
|
staticNodeID = number,
|
||||||
|
generateStaticNode = generateFunc,
|
||||||
|
new = function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### StaticLayer.name
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
StaticLayer.name : string
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### StaticLayer.minY
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
StaticLayer.minY : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### StaticLayer.maxY
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
StaticLayer.maxY : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### StaticLayer.staticNode
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
StaticLayer.staticNode : string
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### StaticLayer.staticNodeID
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
StaticLayer.staticNodeID : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### StaticLayer.generateStaticNode
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
StaticLayer.generateStaticNode : generateFunc
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
536
docs/docs/modules/MapGen.Tetrahedron.md
Normal file
536
docs/docs/modules/MapGen.Tetrahedron.md
Normal file
@@ -0,0 +1,536 @@
|
|||||||
|
# global MapGen.Tetrahedron
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## methods
|
||||||
|
---
|
||||||
|
|
||||||
|
### Tetrahedron.new
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Tetrahedron.new(
|
||||||
|
p1: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
},
|
||||||
|
p2: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
},
|
||||||
|
p3: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
},
|
||||||
|
p4: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
}
|
||||||
|
) -> MapGen.Tetrahedron {
|
||||||
|
p1 = MapGen.Peak,
|
||||||
|
p2 = MapGen.Peak,
|
||||||
|
p3 = MapGen.Peak,
|
||||||
|
p4 = MapGen.Peak,
|
||||||
|
h1 = MapGen.Triangulation.Edge,
|
||||||
|
h2 = MapGen.Triangulation.Edge,
|
||||||
|
h3 = MapGen.Triangulation.Edge,
|
||||||
|
h4 = MapGen.Triangulation.Edge,
|
||||||
|
f1 = MapGen.Triangle,
|
||||||
|
f2 = MapGen.Triangle,
|
||||||
|
f3 = MapGen.Triangle,
|
||||||
|
f4 = MapGen.Triangle,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
getHeight = function,
|
||||||
|
getCircumSphereCenter = function,
|
||||||
|
getCircumSphereRadius = function,
|
||||||
|
inCircumSphere = function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.toString
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Tetrahedron.toString() -> string
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns a string describing the object in a readable form.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.getHeight
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Tetrahedron.getHeight(
|
||||||
|
p1: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
},
|
||||||
|
p2: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
},
|
||||||
|
p3: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
},
|
||||||
|
p4: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
}
|
||||||
|
) -> MapGen.Triangulation.Edge?
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.getCircumSphereCenter
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Tetrahedron.getCircumSphereCenter() -> vector
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the center of the circumscribed sphere.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.getCircumSphereRadius
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Tetrahedron.getCircumSphereRadius() -> number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the radius of the circumscribed sphere.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.inCircumSphere
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Tetrahedron.inCircumSphere(p: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
}) -> boolean
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Checks whether a given point lies within the circumscribed sphere of a tetrahedron.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### Tetrahedron.p1
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Tetrahedron.p1 : MapGen.Peak {
|
||||||
|
id: number,
|
||||||
|
getPeakPos: function,
|
||||||
|
getColor: function,
|
||||||
|
getGroups: function,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.p2
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Tetrahedron.p2 : MapGen.Peak {
|
||||||
|
id: number,
|
||||||
|
getPeakPos: function,
|
||||||
|
getColor: function,
|
||||||
|
getGroups: function,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.p3
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Tetrahedron.p3 : MapGen.Peak {
|
||||||
|
id: number,
|
||||||
|
getPeakPos: function,
|
||||||
|
getColor: function,
|
||||||
|
getGroups: function,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.p4
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Tetrahedron.p4 : MapGen.Peak {
|
||||||
|
id: number,
|
||||||
|
getPeakPos: function,
|
||||||
|
getColor: function,
|
||||||
|
getGroups: function,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.h1
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Tetrahedron.h1 : MapGen.Triangulation.Edge {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
same: function,
|
||||||
|
length: function,
|
||||||
|
getMidPoint: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.h2
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Tetrahedron.h2 : MapGen.Triangulation.Edge {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
same: function,
|
||||||
|
length: function,
|
||||||
|
getMidPoint: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.h3
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Tetrahedron.h3 : MapGen.Triangulation.Edge {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
same: function,
|
||||||
|
length: function,
|
||||||
|
getMidPoint: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.h4
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Tetrahedron.h4 : MapGen.Triangulation.Edge {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
same: function,
|
||||||
|
length: function,
|
||||||
|
getMidPoint: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.f1
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Tetrahedron.f1 : MapGen.Triangle {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
p3: MapGen.Peak,
|
||||||
|
e1: MapGen.Triangulation.Edge,
|
||||||
|
e2: MapGen.Triangulation.Edge,
|
||||||
|
e3: MapGen.Triangulation.Edge,
|
||||||
|
h1: MapGen.Triangulation.Edge,
|
||||||
|
h2: MapGen.Triangulation.Edge,
|
||||||
|
h3: MapGen.Triangulation.Edge,
|
||||||
|
neighbours: MapGen.Triangle.Neighbours,
|
||||||
|
color: ColorString?,
|
||||||
|
new: function,
|
||||||
|
...(+13)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.f2
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Tetrahedron.f2 : MapGen.Triangle {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
p3: MapGen.Peak,
|
||||||
|
e1: MapGen.Triangulation.Edge,
|
||||||
|
e2: MapGen.Triangulation.Edge,
|
||||||
|
e3: MapGen.Triangulation.Edge,
|
||||||
|
h1: MapGen.Triangulation.Edge,
|
||||||
|
h2: MapGen.Triangulation.Edge,
|
||||||
|
h3: MapGen.Triangulation.Edge,
|
||||||
|
neighbours: MapGen.Triangle.Neighbours,
|
||||||
|
color: ColorString?,
|
||||||
|
new: function,
|
||||||
|
...(+13)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.f3
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Tetrahedron.f3 : MapGen.Triangle {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
p3: MapGen.Peak,
|
||||||
|
e1: MapGen.Triangulation.Edge,
|
||||||
|
e2: MapGen.Triangulation.Edge,
|
||||||
|
e3: MapGen.Triangulation.Edge,
|
||||||
|
h1: MapGen.Triangulation.Edge,
|
||||||
|
h2: MapGen.Triangulation.Edge,
|
||||||
|
h3: MapGen.Triangulation.Edge,
|
||||||
|
neighbours: MapGen.Triangle.Neighbours,
|
||||||
|
color: ColorString?,
|
||||||
|
new: function,
|
||||||
|
...(+13)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.f4
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Tetrahedron.f4 : MapGen.Triangle {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
p3: MapGen.Peak,
|
||||||
|
e1: MapGen.Triangulation.Edge,
|
||||||
|
e2: MapGen.Triangulation.Edge,
|
||||||
|
e3: MapGen.Triangulation.Edge,
|
||||||
|
h1: MapGen.Triangulation.Edge,
|
||||||
|
h2: MapGen.Triangulation.Edge,
|
||||||
|
h3: MapGen.Triangulation.Edge,
|
||||||
|
neighbours: MapGen.Triangle.Neighbours,
|
||||||
|
color: ColorString?,
|
||||||
|
new: function,
|
||||||
|
...(+13)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
745
docs/docs/modules/MapGen.Triangle.md
Normal file
745
docs/docs/modules/MapGen.Triangle.md
Normal file
@@ -0,0 +1,745 @@
|
|||||||
|
# global MapGen.Triangle
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## methods
|
||||||
|
---
|
||||||
|
|
||||||
|
### Triangle.new
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.new(
|
||||||
|
p1: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
},
|
||||||
|
p2: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
},
|
||||||
|
p3: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
}
|
||||||
|
) -> MapGen.Triangle {
|
||||||
|
p1 = MapGen.Peak,
|
||||||
|
p2 = MapGen.Peak,
|
||||||
|
p3 = MapGen.Peak,
|
||||||
|
e1 = MapGen.Triangulation.Edge,
|
||||||
|
e2 = MapGen.Triangulation.Edge,
|
||||||
|
e3 = MapGen.Triangulation.Edge,
|
||||||
|
h1 = MapGen.Triangulation.Edge,
|
||||||
|
h2 = MapGen.Triangulation.Edge,
|
||||||
|
h3 = MapGen.Triangulation.Edge,
|
||||||
|
neighbours = MapGen.Triangle.Neighbours,
|
||||||
|
color = ColorString?,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
same = function,
|
||||||
|
getCenter = function,
|
||||||
|
getArea = function,
|
||||||
|
getHeight = function,
|
||||||
|
getHeight2D = function,
|
||||||
|
getSidesLength = function,
|
||||||
|
getSidesLength2D = function,
|
||||||
|
getCircumCenter2D = function,
|
||||||
|
getCircumRadius2D = function,
|
||||||
|
getCircumCircle2D = function,
|
||||||
|
inCircumCircle2D = function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.toString
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.toString() -> string
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns a string describing the object in a readable form.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.eq
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.eq(other: MapGen.Triangle {
|
||||||
|
p1 = MapGen.Peak,
|
||||||
|
p2 = MapGen.Peak,
|
||||||
|
p3 = MapGen.Peak,
|
||||||
|
e1 = MapGen.Triangulation.Edge,
|
||||||
|
e2 = MapGen.Triangulation.Edge,
|
||||||
|
e3 = MapGen.Triangulation.Edge,
|
||||||
|
h1 = MapGen.Triangulation.Edge,
|
||||||
|
h2 = MapGen.Triangulation.Edge,
|
||||||
|
h3 = MapGen.Triangulation.Edge,
|
||||||
|
neighbours = MapGen.Triangle.Neighbours,
|
||||||
|
color = ColorString?,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
same = function,
|
||||||
|
getCenter = function,
|
||||||
|
getArea = function,
|
||||||
|
getHeight = function,
|
||||||
|
getHeight2D = function,
|
||||||
|
getSidesLength = function,
|
||||||
|
getSidesLength2D = function,
|
||||||
|
getCircumCenter2D = function,
|
||||||
|
getCircumRadius2D = function,
|
||||||
|
getCircumCircle2D = function,
|
||||||
|
inCircumCircle2D = function,
|
||||||
|
}) -> boolean
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns true if the triangles are equivalent.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.same
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.same(other: MapGen.Triangle {
|
||||||
|
p1 = MapGen.Peak,
|
||||||
|
p2 = MapGen.Peak,
|
||||||
|
p3 = MapGen.Peak,
|
||||||
|
e1 = MapGen.Triangulation.Edge,
|
||||||
|
e2 = MapGen.Triangulation.Edge,
|
||||||
|
e3 = MapGen.Triangulation.Edge,
|
||||||
|
h1 = MapGen.Triangulation.Edge,
|
||||||
|
h2 = MapGen.Triangulation.Edge,
|
||||||
|
h3 = MapGen.Triangulation.Edge,
|
||||||
|
neighbours = MapGen.Triangle.Neighbours,
|
||||||
|
color = ColorString?,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
same = function,
|
||||||
|
getCenter = function,
|
||||||
|
getArea = function,
|
||||||
|
getHeight = function,
|
||||||
|
getHeight2D = function,
|
||||||
|
getSidesLength = function,
|
||||||
|
getSidesLength2D = function,
|
||||||
|
getCircumCenter2D = function,
|
||||||
|
getCircumRadius2D = function,
|
||||||
|
getCircumCircle2D = function,
|
||||||
|
inCircumCircle2D = function,
|
||||||
|
}) -> boolean
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns true if the triangles are similar.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.getCenter
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.getCenter() -> vector
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the coordinates of the triangle's center.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.getArea
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.getArea() -> number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the area of a triangle.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.getHeight
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.getHeight(
|
||||||
|
p1: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
},
|
||||||
|
p2: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
},
|
||||||
|
p3: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
}
|
||||||
|
) -> MapGen.Triangulation.Edge {
|
||||||
|
p1 = MapGen.Peak,
|
||||||
|
p2 = MapGen.Peak,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
same = function,
|
||||||
|
length = function,
|
||||||
|
getMidPoint = function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the perpendicular from the vertex Peak1 to the line Peak2-Peak3.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.getHeight2D
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.getHeight2D(
|
||||||
|
p1: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
},
|
||||||
|
p2: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
},
|
||||||
|
p3: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
}
|
||||||
|
) -> MapGen.Triangulation.Edge {
|
||||||
|
p1 = MapGen.Peak,
|
||||||
|
p2 = MapGen.Peak,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
same = function,
|
||||||
|
length = function,
|
||||||
|
getMidPoint = function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the perpendicular from the vertex Peak1 to the line Peak2-Peak3.
|
||||||
|
|
||||||
|
Note: This function does not take into account the Y-coordinate,
|
||||||
|
that is, the calculation is performed on the projection of the triangle XZ.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.getSidesLength
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.getSidesLength()
|
||||||
|
-> number
|
||||||
|
-> number
|
||||||
|
-> number
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the length of the edges
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.getSidesLength2D
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.getSidesLength2D()
|
||||||
|
-> number
|
||||||
|
-> number
|
||||||
|
-> number
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the length of the edges.
|
||||||
|
|
||||||
|
Note: This function does not take into account the Y-coordinate,
|
||||||
|
that is, the calculation is performed on the projection of the triangle XZ.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.getCircumCenter2D
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.getCircumCenter2D() -> vector
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the coordinates of the circumcircle center.
|
||||||
|
|
||||||
|
Note: This function does not take into account the Y-coordinate,
|
||||||
|
that is, the calculation is performed on the projection of the triangle XZ.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.getCircumRadius2D
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.getCircumRadius2D() -> number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the radius of the circumcircle.
|
||||||
|
|
||||||
|
Note: This function does not take into account the Y-coordinate,
|
||||||
|
that is, the calculation is performed on the projection of the triangle XZ.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.getCircumCircle2D
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.getCircumCircle2D()
|
||||||
|
-> vector
|
||||||
|
-> number
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the coordinates of the circumcircle center and its radius.
|
||||||
|
|
||||||
|
Note: This function does not take into account the Y-coordinate,
|
||||||
|
that is, the calculation is performed on the projection of the triangle XZ.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.inCircumCircle2D
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.inCircumCircle2D(p: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
}) -> boolean
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Checks if a given point lies into the triangle circumcircle.
|
||||||
|
|
||||||
|
Note: This function does not take into account the Y-coordinate,
|
||||||
|
that is, the calculation is performed on the projection of the triangle XZ.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### Triangle.p1
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Triangle.p1 : MapGen.Peak {
|
||||||
|
id: number,
|
||||||
|
getPeakPos: function,
|
||||||
|
getColor: function,
|
||||||
|
getGroups: function,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.p2
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Triangle.p2 : MapGen.Peak {
|
||||||
|
id: number,
|
||||||
|
getPeakPos: function,
|
||||||
|
getColor: function,
|
||||||
|
getGroups: function,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.p3
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Triangle.p3 : MapGen.Peak {
|
||||||
|
id: number,
|
||||||
|
getPeakPos: function,
|
||||||
|
getColor: function,
|
||||||
|
getGroups: function,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.e1
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Triangle.e1 : MapGen.Triangulation.Edge {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
same: function,
|
||||||
|
length: function,
|
||||||
|
getMidPoint: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.e2
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Triangle.e2 : MapGen.Triangulation.Edge {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
same: function,
|
||||||
|
length: function,
|
||||||
|
getMidPoint: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.e3
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Triangle.e3 : MapGen.Triangulation.Edge {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
same: function,
|
||||||
|
length: function,
|
||||||
|
getMidPoint: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.h1
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Triangle.h1 : MapGen.Triangulation.Edge {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
same: function,
|
||||||
|
length: function,
|
||||||
|
getMidPoint: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.h2
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Triangle.h2 : MapGen.Triangulation.Edge {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
same: function,
|
||||||
|
length: function,
|
||||||
|
getMidPoint: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.h3
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Triangle.h3 : MapGen.Triangulation.Edge {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
same: function,
|
||||||
|
length: function,
|
||||||
|
getMidPoint: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.neighbours
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Triangle.neighbours : MapGen.Triangle.Neighbours
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.color
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Triangle.color : ColorString?
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
225
docs/docs/modules/MapGen.Triangulation.Edge.md
Normal file
225
docs/docs/modules/MapGen.Triangulation.Edge.md
Normal file
@@ -0,0 +1,225 @@
|
|||||||
|
# global MapGen.Triangulation.Edge
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## methods
|
||||||
|
---
|
||||||
|
|
||||||
|
### Edge.new
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Edge.new(
|
||||||
|
p1: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
},
|
||||||
|
p2: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
}
|
||||||
|
) -> MapGen.Triangulation.Edge {
|
||||||
|
p1 = MapGen.Peak,
|
||||||
|
p2 = MapGen.Peak,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
same = function,
|
||||||
|
length = function,
|
||||||
|
getMidPoint = function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Edge.toString
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Edge.toString() -> string
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns a string describing the object in a readable form.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Edge.eq
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Edge.eq(other: MapGen.Triangulation.Edge {
|
||||||
|
p1 = MapGen.Peak,
|
||||||
|
p2 = MapGen.Peak,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
same = function,
|
||||||
|
length = function,
|
||||||
|
getMidPoint = function,
|
||||||
|
}) -> boolean
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns true if the edges are equivalent.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Edge.same
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Edge.same(other: MapGen.Triangulation.Edge {
|
||||||
|
p1 = MapGen.Peak,
|
||||||
|
p2 = MapGen.Peak,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
same = function,
|
||||||
|
length = function,
|
||||||
|
getMidPoint = function,
|
||||||
|
}) -> boolean
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns true if the edges are similar.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Edge.length
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Edge.length() -> number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the length of an edge.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Edge.getMidPoint
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Edge.getMidPoint() -> vector
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the vector of the point located in the middle of the edge.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### Edge.p1
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Edge.p1 : MapGen.Peak {
|
||||||
|
id: number,
|
||||||
|
getPeakPos: function,
|
||||||
|
getColor: function,
|
||||||
|
getGroups: function,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Edge.p2
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Edge.p2 : MapGen.Peak {
|
||||||
|
id: number,
|
||||||
|
getPeakPos: function,
|
||||||
|
getColor: function,
|
||||||
|
getGroups: function,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
79
docs/docs/modules/MapGen.Triangulation.FakePeak.md
Normal file
79
docs/docs/modules/MapGen.Triangulation.FakePeak.md
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
# global MapGen.Triangulation.FakePeak
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## methods
|
||||||
|
---
|
||||||
|
|
||||||
|
### FakePeak.getPeakPos
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function FakePeak.getPeakPos()-> vector
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### FakePeak.new
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function FakePeak.new(peakPos: vector) -> MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns a fake `MapGen.Peak` that has no noise parameters.
|
||||||
|
Note that the initialized peak should not be used in generation.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### FakePeak.id
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
FakePeak.id : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
81
docs/docs/modules/MapGen.Triangulation.md
Normal file
81
docs/docs/modules/MapGen.Triangulation.md
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
# global MapGen.Triangulation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## methods
|
||||||
|
---
|
||||||
|
|
||||||
|
### Triangulation.triangulate
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangulation.triangulate(vertices: table<integer,MapGen.Peak>) -> ((MapGen.Triangle)|MapGen.Triangle[])
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The Delaunay method divides a plane into triangles based on a list of their vertices.
|
||||||
|
|
||||||
|
Doesn't take into account the Y coordinate of the vertices.
|
||||||
|
That is, all triangles that don't lie in the XZ plane will be projected onto it.
|
||||||
|
|
||||||
|
Vertices that do not have a `is2d` group will not participate in the triangulation.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangulation.tetrahedralize
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangulation.tetrahedralize(vertices: table<integer,MapGen.Peak>) -> ((MapGen.Tetrahedron)|MapGen.Tetrahedron[])
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The Delaunay method divides space into tetrahedra based on a list of their vertices.
|
||||||
|
|
||||||
|
Vertices that do not have a `is3d` group will not participate in the triangulation.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### Triangulation.convexMultiplier
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Triangulation.convexMultiplier : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
30
docs/docs/modules/MapGen.ff2luat.md
Normal file
30
docs/docs/modules/MapGen.ff2luat.md
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# global MapGen.ff2luat
|
||||||
|
|
||||||
|
|
||||||
|
Converts given farbfeld image to ColoredDotsTable.
|
||||||
|
Farbfeld format:
|
||||||
|
```
|
||||||
|
╔════════╤═════════════════════════════════════════════════════════╗
|
||||||
|
║ Bytes │ Description ║
|
||||||
|
╠════════╪═════════════════════════════════════════════════════════╣
|
||||||
|
║ 8 │ 'farbfeld' magic value ║
|
||||||
|
╟────────┼─────────────────────────────────────────────────────────╢
|
||||||
|
║ 4 │ 32-Bit BE unsigned integer (width) ║
|
||||||
|
╟────────┼─────────────────────────────────────────────────────────╢
|
||||||
|
║ 4 │ 32-Bit BE unsigned integer (height) ║
|
||||||
|
╟────────┼─────────────────────────────────────────────────────────╢
|
||||||
|
║ [2222] │ 4x16-Bit BE unsigned integers [RGBA] / pixel, row-major ║
|
||||||
|
╚════════╧═════════════════════════════════════════════════════════╝
|
||||||
|
```
|
||||||
|
[tools/farbfeld | suckless.org software that sucks less](https://tools.suckless.org/farbfeld/)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
738
docs/docs/modules/MapGen.md
Normal file
738
docs/docs/modules/MapGen.md
Normal file
@@ -0,0 +1,738 @@
|
|||||||
|
# global MapGen
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## methods
|
||||||
|
---
|
||||||
|
|
||||||
|
### MapGen.new
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.new(def: MapGenDef {
|
||||||
|
nodes = table<string,string>,
|
||||||
|
}) -> MapGen {
|
||||||
|
layersByName = table<string,MapGen.Layer>,
|
||||||
|
layersList = MapGen.Layer[],
|
||||||
|
staticsByName = table<string,MapGen.StaticLayer>,
|
||||||
|
staticsList = MapGen.StaticLayer[],
|
||||||
|
layersNoisesInitialized = boolean,
|
||||||
|
cavernsNoiseInitialized = boolean,
|
||||||
|
isRunning = boolean,
|
||||||
|
nodeIDs = table<string,number>,
|
||||||
|
new = function,
|
||||||
|
getLayerByHeight = function,
|
||||||
|
getStaticByHeight = function,
|
||||||
|
registerLayer = function,
|
||||||
|
registerLayerNoiseColor = function,
|
||||||
|
registerStaticLayer = function,
|
||||||
|
registerPeak = function,
|
||||||
|
register2DPeak = function,
|
||||||
|
register2DPeaks = function,
|
||||||
|
register2DPeaksFromFile = function,
|
||||||
|
registerBiome = function,
|
||||||
|
registerCavern = function,
|
||||||
|
initLayersTriangultaion = function,
|
||||||
|
initLayersNoises = function,
|
||||||
|
initBiomesDiagram = function,
|
||||||
|
initCavernsNoise = function,
|
||||||
|
getNoises2dValue = function,
|
||||||
|
onMapGenerated = function,
|
||||||
|
run = function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.getLayerByHeight
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.getLayerByHeight(yPos: number) -> MapGen.Layer?
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Determines which layer a node belongs to based on its height coordinate.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.getStaticByHeight
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.getStaticByHeight(yPos: number) -> MapGen.StaticLayer?
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Determines which statics layer a node belongs to based on its height coordinate.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.registerLayer
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.registerLayer(
|
||||||
|
name: string,
|
||||||
|
def: MapGen.LayerDef {
|
||||||
|
minY = number,
|
||||||
|
maxY = number,
|
||||||
|
minTemp = number,
|
||||||
|
maxTemp = number,
|
||||||
|
minHumidity = number,
|
||||||
|
maxHumidity = number,
|
||||||
|
waterLevel = number?,
|
||||||
|
calcTemp = (fun(self: MapGen.Layer, value: number, height: number) -> number)?,
|
||||||
|
calcHumidity = (fun(self: MapGen.Layer, value: number, height: number) -> number)?,
|
||||||
|
biomesGorizontalScattering = number?,
|
||||||
|
biomesVerticalScattering = number?,
|
||||||
|
}
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
@param `name` - The name that will be assigned to the layer. The name must be unique for each layer.
|
||||||
|
|
||||||
|
@param `def` - Layer description table, see details `MapGen.LayerDef`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Mark the world area between two heights as a `MapGen.Layer`.
|
||||||
|
|
||||||
|
Note: layers must not overlap.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.registerLayerNoiseColor
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.registerLayerNoiseColor(
|
||||||
|
layerName: string,
|
||||||
|
category: MapGen.Layer.Category,
|
||||||
|
color: ColorString,
|
||||||
|
noiseParams: NoiseParams
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
@param `layerName` - The name of the layer for which the color will be registered.
|
||||||
|
|
||||||
|
@param `category` - Category indicating what will be generated by noise.
|
||||||
|
|
||||||
|
@param `color` - Noise color. Must be unique.
|
||||||
|
|
||||||
|
@param `noiseParams` - Fractal noise parameters.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Register the color and the noise parameters that correspond to it.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.registerStaticLayer
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.registerStaticLayer(
|
||||||
|
name: string,
|
||||||
|
def: MapGen.StaticLayerDef {
|
||||||
|
minY = number,
|
||||||
|
maxY = number,
|
||||||
|
staticNode = string,
|
||||||
|
generateStaticNode = generateFunc,
|
||||||
|
}
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
@param `name` - The name that will be assigned to the static layer. The name must be unique for each layer.
|
||||||
|
|
||||||
|
@param `def` - Static layer description table, see details `MapGen.StaticLayerDef`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Mark the world area between two heights as a `MapGen.StaticLayer`.
|
||||||
|
|
||||||
|
Note: layers must not overlap.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.registerPeak
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.registerPeak(
|
||||||
|
layerName: string,
|
||||||
|
category: MapGen.Layer.Category,
|
||||||
|
def: MapGen.PeakDef {
|
||||||
|
pos = vector,
|
||||||
|
color = ColorString,
|
||||||
|
groups = table<string,number>?,
|
||||||
|
}
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
@param `layerName` - The name of the layer in which the new peak will be included.
|
||||||
|
|
||||||
|
@param `category` - Category indicating what will be generated by peak.
|
||||||
|
|
||||||
|
@param `def` - Peak description table, see details `MapGen.PeakDef`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Mark a world point as `MapGen.Peak` and assign it a specific color that will affect the generation.
|
||||||
|
|
||||||
|
Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.register2DPeak
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.register2DPeak(
|
||||||
|
layerName: string,
|
||||||
|
category: MapGen.Layer.Category,
|
||||||
|
def: MapGen.PeakDef {
|
||||||
|
pos = vector,
|
||||||
|
color = ColorString,
|
||||||
|
groups = table<string,number>?,
|
||||||
|
}
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
@param `layerName` - The name of the layer in which the new peak will be included.
|
||||||
|
|
||||||
|
@param `category` - Category indicating what will be generated by peak.
|
||||||
|
|
||||||
|
@param `def` - Peak description table, see details `MapGen.PeakDef`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Mark a world point as `MapGen.Peak` and assign it a specific color that will affect the generation.
|
||||||
|
The Y coordinate will be forced to zero, and the `is2d` group will be added to the groups field.
|
||||||
|
|
||||||
|
Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.register2DPeaks
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.register2DPeaks(
|
||||||
|
layerName: string,
|
||||||
|
category: MapGen.Layer.Category,
|
||||||
|
defs: MapGen.PeakDef[]
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
@param `layerName` - The name of the layer in which the new peaks will be included.
|
||||||
|
|
||||||
|
@param `category` - Category indicating what will be generated by peaks.
|
||||||
|
|
||||||
|
@param `defs` - Peaks description table, see details `MapGen.PeakDef`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Mark the world points as `MapGen.Peak` and assign them all a specific noise that will affect generation.
|
||||||
|
The Y coordinate will be forced to zero, and the `is2d` group will be added to the groups field.
|
||||||
|
|
||||||
|
Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.register2DPeaksFromFile
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.register2DPeaksFromFile(
|
||||||
|
layerName: string,
|
||||||
|
map: string,
|
||||||
|
scale: number,
|
||||||
|
zeroPos: Position2d,
|
||||||
|
category: MapGen.Layer.Category,
|
||||||
|
groups: table<string,number>?
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
@param `layerName` - The name of the layer in which the new peaks will be included.
|
||||||
|
|
||||||
|
@param `map` - The name of the image from which the peaks will be extracted. It should be located in the `<mod_name>/textures/maps` folder and have the following format `<image_name>.ff`
|
||||||
|
|
||||||
|
@param `scale` - Multiplier of how many blocks (nodes) will be between image pixels. It is not recommended to set the value below 50 for performance reasons.
|
||||||
|
|
||||||
|
@param `zeroPos` - The position in pixels where the zero world coordinate will be in the image.
|
||||||
|
|
||||||
|
@param `category` - Category indicating what will be generated by peaks.
|
||||||
|
|
||||||
|
@param `groups` - Groups that will be added to all peaks.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Extract the `MapGen.Peak` from the image and assign them all a specific color that will affect the generation.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.registerBiome
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.registerBiome(
|
||||||
|
layerName: string,
|
||||||
|
biomeName: string,
|
||||||
|
def: MapGen.BiomeDef {
|
||||||
|
tempPoint = number,
|
||||||
|
humidityPoint = number,
|
||||||
|
minY = number,
|
||||||
|
maxY = number,
|
||||||
|
groundNodes = MapGen.Biome.GroundNodes,
|
||||||
|
soilHeight = number,
|
||||||
|
generateAir = generateFunc?,
|
||||||
|
generateCavernAir = generateFunc?,
|
||||||
|
generateWater = generateFunc?,
|
||||||
|
generateRock = generateFunc?,
|
||||||
|
generateTurf = generateFunc?,
|
||||||
|
generateSoil = generateFunc?,
|
||||||
|
generateBottom = generateFunc?,
|
||||||
|
}
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
@param `layerName` - The name of the layer in which the new biome will be included.
|
||||||
|
|
||||||
|
@param `biomeName` - The name to be assigned to the biome. The name must be unique for each biome.
|
||||||
|
|
||||||
|
@param `def` - Biome description table, see details `MapGen.BiomeDef`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Mark a point on the biomes diagram and constrain the world area by height to mark it as `MapGen.Biome`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.registerCavern
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.registerCavern(
|
||||||
|
layerName: string,
|
||||||
|
cavernName: string,
|
||||||
|
def: MapGen.CavernDef {
|
||||||
|
minY = number,
|
||||||
|
maxY = number,
|
||||||
|
noiseParams = NoiseParams,
|
||||||
|
smoothDistance = number,
|
||||||
|
threshold = number?,
|
||||||
|
groups = table<string,number>?,
|
||||||
|
}
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
@param `layerName` - The name of the layer in which the new cavern will be included.
|
||||||
|
|
||||||
|
@param `cavernName` - The name to be assigned to the cavern. The name must be unique for each cavern.
|
||||||
|
|
||||||
|
@param `def` - Cavern description table, see details `MapGen.CavernDef`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Mark the world area between two heights as a `MapGen.Cavern` and assign the noise that the cave will be generated from.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.initLayersTriangultaion
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.initLayersTriangultaion() -> nil
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Divide all layers into triangles whose vertices are the `Mapgen.Peak` belonging to these layers.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.initLayersNoises
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.initLayersNoises() -> nil
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Initialize all layer noises. This should be called after the map object is loaded.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.initBiomesDiagram
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.initBiomesDiagram() -> nil
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Initialization of the biome diagram using the Voronoi method.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.initCavernsNoise
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.initCavernsNoise() -> nil
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Initialize caverns's noises. This should be called after the map object is loaded.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.getNoises2dValue
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.getNoises2dValue(
|
||||||
|
category: MapGen.Layer.Category,
|
||||||
|
layer: MapGen.Layer {
|
||||||
|
name = string,
|
||||||
|
minY = integer,
|
||||||
|
maxY = integer,
|
||||||
|
minTemp = integer,
|
||||||
|
maxTemp = integer,
|
||||||
|
minHumidity = integer,
|
||||||
|
maxHumidity = integer,
|
||||||
|
waterLevel = integer,
|
||||||
|
peaksList = { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] },
|
||||||
|
noisesByColor = { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> },
|
||||||
|
noisesParamsByColor = { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> },
|
||||||
|
biomesByName = table<string,MapGen.Biome>,
|
||||||
|
biomesList = MapGen.Biome[],
|
||||||
|
biomesDiagram = table,
|
||||||
|
biomesGorizontalScattering = integer,
|
||||||
|
biomesVerticalScattering = integer,
|
||||||
|
cavernsByName = table<string,MapGen.Cavern>,
|
||||||
|
cavernsList = MapGen.Cavern[],
|
||||||
|
trianglesList = { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] },
|
||||||
|
tetrahedronsList = MapGen.Tetrahedron[],
|
||||||
|
calcTemp = function,
|
||||||
|
calcHumidity = function,
|
||||||
|
new = function,
|
||||||
|
addPeak = function,
|
||||||
|
addNoiseParamsColor = function,
|
||||||
|
getNoiseByColor = function,
|
||||||
|
addBiome = function,
|
||||||
|
addCavern = function,
|
||||||
|
initNoises = function,
|
||||||
|
initBiomesDiagram = function,
|
||||||
|
},
|
||||||
|
x: integer,
|
||||||
|
y: integer,
|
||||||
|
z: integer
|
||||||
|
) -> number?
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Calculates a smoothed 2D noise value based on a preliminary space partitioning.
|
||||||
|
|
||||||
|
Returns `nil` if the point is not included in any triangle.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.onMapGenerated
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.onMapGenerated(
|
||||||
|
voxelManip: VoxelManip,
|
||||||
|
minPos: Position,
|
||||||
|
maxPos: Position,
|
||||||
|
blockseed: number
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Chunk generation handler.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.run
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.run() -> nil
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Run world generation through this mapgen object
|
||||||
|
|
||||||
|
Note: only one instance of a `MapGen` class can be running.
|
||||||
|
|
||||||
|
**FOR MAPGEN ENVIRONMENT ONLY**
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### MapGen.layersByName
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
MapGen.layersByName : table<string,MapGen.Layer>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.layersList
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
MapGen.layersList : MapGen.Layer[]
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.staticsByName
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
MapGen.staticsByName : table<string,MapGen.StaticLayer>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.staticsList
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
MapGen.staticsList : MapGen.StaticLayer[]
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.layersNoisesInitialized
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
MapGen.layersNoisesInitialized : boolean
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Is the fractal noise of the layer initialized? This is necessary for a one-time noise initialization.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.cavernsNoiseInitialized
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
MapGen.cavernsNoiseInitialized : boolean
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Is the fractal noise of the caverns initialized? This is necessary for a one-time noise initialization.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.isRunning
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
MapGen.isRunning : boolean
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
A static field that guarantees that only one instance of the `MapGen` class will work.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.nodeIDs
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
MapGen.nodeIDs : table<string,number>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
23
docs/docs/types/ColoredDotsTable.md
Normal file
23
docs/docs/types/ColoredDotsTable.md
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# alias ColoredDotsTable
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```lua
|
||||||
|
(alias) ColoredDotsTable = table<string,table>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Table with color as key and value is table with coordinates of dots. Note: coords begin from 1,1 (not 0,0).
|
||||||
|
Example of table:
|
||||||
|
```lua
|
||||||
|
{
|
||||||
|
'size': { h=256, w=256 },
|
||||||
|
'#fff': { {x=1,y=1}, {x=2,y=2}, ... },
|
||||||
|
'#ff0': { {x=3,y=3}, {x=4,y=4}, ... },
|
||||||
|
...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
92
docs/docs/types/MapGen.Biome.GroundNodes.md
Normal file
92
docs/docs/types/MapGen.Biome.GroundNodes.md
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
# class GroundNodes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- namespace: MapGen.Biome
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Only for EmmyLua.**
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### GroundNodes.turf
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
GroundNodes.turf : string
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The soil covering the surface of the biome
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### GroundNodes.soil
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
GroundNodes.soil : string
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The soil beneath the turf. The height of this layer depends on `Biome.soilHeight`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### GroundNodes.rock
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
GroundNodes.rock : string
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The rock found beneath the soil of a biome.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### GroundNodes.bottom
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
GroundNodes.bottom : string
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Covering the bottom of reservoirs.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
92
docs/docs/types/MapGen.Biome.GroundNodesIDs.md
Normal file
92
docs/docs/types/MapGen.Biome.GroundNodesIDs.md
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
# class GroundNodesIDs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- namespace: MapGen.Biome
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Only for EmmyLua.**
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### GroundNodesIDs.turf
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
GroundNodesIDs.turf : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The soil covering the surface of the biome
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### GroundNodesIDs.soil
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
GroundNodesIDs.soil : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The soil beneath the turf. The height of this layer depends on `Biome.soilHeight`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### GroundNodesIDs.rock
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
GroundNodesIDs.rock : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The rock found beneath the soil of a biome.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### GroundNodesIDs.bottom
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
GroundNodesIDs.bottom : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Covering the bottom of reservoirs.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
312
docs/docs/types/MapGen.Biome.md
Normal file
312
docs/docs/types/MapGen.Biome.md
Normal file
@@ -0,0 +1,312 @@
|
|||||||
|
# class Biome
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- namespace: MapGen
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## methods
|
||||||
|
---
|
||||||
|
|
||||||
|
### Biome.new
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Biome.new(
|
||||||
|
name: string,
|
||||||
|
def: MapGen.BiomeDef {
|
||||||
|
tempPoint = number,
|
||||||
|
humidityPoint = number,
|
||||||
|
minY = number,
|
||||||
|
maxY = number,
|
||||||
|
groundNodes = MapGen.Biome.GroundNodes,
|
||||||
|
soilHeight = number,
|
||||||
|
generateAir = generateFunc?,
|
||||||
|
generateCavernAir = generateFunc?,
|
||||||
|
generateWater = generateFunc?,
|
||||||
|
generateRock = generateFunc?,
|
||||||
|
generateTurf = generateFunc?,
|
||||||
|
generateSoil = generateFunc?,
|
||||||
|
generateBottom = generateFunc?,
|
||||||
|
}
|
||||||
|
) -> MapGen.Biome {
|
||||||
|
name = string,
|
||||||
|
tempPoint = number,
|
||||||
|
humidityPoint = number,
|
||||||
|
minY = number,
|
||||||
|
maxY = number,
|
||||||
|
groundNodes = MapGen.Biome.GroundNodes,
|
||||||
|
groundNodesIDs = MapGen.Biome.GroundNodesIDs,
|
||||||
|
soilHeight = number,
|
||||||
|
generateAir = generateFunc,
|
||||||
|
generateCavernAir = generateFunc,
|
||||||
|
generateWater = generateFunc,
|
||||||
|
generateRock = generateFunc,
|
||||||
|
generateTurf = generateFunc,
|
||||||
|
generateSoil = generateFunc,
|
||||||
|
generateBottom = generateFunc,
|
||||||
|
new = function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### Biome.name
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.name : string
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.tempPoint
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.tempPoint : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.humidityPoint
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.humidityPoint : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.minY
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.minY : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.maxY
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.maxY : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.groundNodes
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.groundNodes : MapGen.Biome.GroundNodes {
|
||||||
|
turf: string,
|
||||||
|
soil: string,
|
||||||
|
rock: string,
|
||||||
|
bottom: string,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.groundNodesIDs
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.groundNodesIDs : MapGen.Biome.GroundNodesIDs {
|
||||||
|
turf: number,
|
||||||
|
soil: number,
|
||||||
|
rock: number,
|
||||||
|
bottom: number,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.soilHeight
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.soilHeight : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.generateAir
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.generateAir : generateFunc
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.generateCavernAir
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.generateCavernAir : generateFunc
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.generateWater
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.generateWater : generateFunc
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.generateRock
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.generateRock : generateFunc
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.generateTurf
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.generateTurf : generateFunc
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.generateSoil
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.generateSoil : generateFunc
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Biome.generateBottom
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Biome.generateBottom : generateFunc
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
226
docs/docs/types/MapGen.BiomeDef.md
Normal file
226
docs/docs/types/MapGen.BiomeDef.md
Normal file
@@ -0,0 +1,226 @@
|
|||||||
|
# class BiomeDef
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- namespace: MapGen
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Definition table for the `MapGen.Biome`.
|
||||||
|
|
||||||
|
**Only for EmmyLua.**
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### BiomeDef.tempPoint
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
BiomeDef.tempPoint : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### BiomeDef.humidityPoint
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
BiomeDef.humidityPoint : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### BiomeDef.minY
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
BiomeDef.minY : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### BiomeDef.maxY
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
BiomeDef.maxY : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### BiomeDef.groundNodes
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
BiomeDef.groundNodes : MapGen.Biome.GroundNodes {
|
||||||
|
turf: string,
|
||||||
|
soil: string,
|
||||||
|
rock: string,
|
||||||
|
bottom: string,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### BiomeDef.soilHeight
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
BiomeDef.soilHeight : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### BiomeDef.generateAir
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
BiomeDef.generateAir : generateFunc?
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### BiomeDef.generateCavernAir
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
BiomeDef.generateCavernAir : generateFunc?
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### BiomeDef.generateWater
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
BiomeDef.generateWater : generateFunc?
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### BiomeDef.generateRock
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
BiomeDef.generateRock : generateFunc?
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### BiomeDef.generateTurf
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
BiomeDef.generateTurf : generateFunc?
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### BiomeDef.generateSoil
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
BiomeDef.generateSoil : generateFunc?
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### BiomeDef.generateBottom
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
BiomeDef.generateBottom : generateFunc?
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
208
docs/docs/types/MapGen.Cavern.md
Normal file
208
docs/docs/types/MapGen.Cavern.md
Normal file
@@ -0,0 +1,208 @@
|
|||||||
|
# class Cavern
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- namespace: MapGen
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## methods
|
||||||
|
---
|
||||||
|
|
||||||
|
### Cavern.getNoise
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Cavern.getNoise()-> ValueNoise
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Cavern.initNoise
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Cavern.initNoise()-> nil
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Cavern.getGroups
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Cavern.getGroups()
|
||||||
|
-> table<string,number>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Cavern.new
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Cavern.new(
|
||||||
|
name: string,
|
||||||
|
def: MapGen.CavernDef {
|
||||||
|
minY = number,
|
||||||
|
maxY = number,
|
||||||
|
noiseParams = NoiseParams,
|
||||||
|
smoothDistance = number,
|
||||||
|
threshold = number?,
|
||||||
|
groups = table<string,number>?,
|
||||||
|
}
|
||||||
|
) -> MapGen.Cavern {
|
||||||
|
name = string,
|
||||||
|
minY = number,
|
||||||
|
maxY = number,
|
||||||
|
smoothDistance = number,
|
||||||
|
threshold = number,
|
||||||
|
getNoise = function,
|
||||||
|
initNoise = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
isCavern = function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Cavern.isCavern
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Cavern.isCavern(
|
||||||
|
x: integer,
|
||||||
|
y: integer,
|
||||||
|
z: integer
|
||||||
|
) -> boolean
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns `true` if there is a cavern at the specified coordinates.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### Cavern.name
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Cavern.name : string
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Cavern.minY
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Cavern.minY : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Cavern.maxY
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Cavern.maxY : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Cavern.smoothDistance
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Cavern.smoothDistance : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Cavern.threshold
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Cavern.threshold : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
116
docs/docs/types/MapGen.CavernDef.md
Normal file
116
docs/docs/types/MapGen.CavernDef.md
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
# class CavernDef
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- namespace: MapGen
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Definition table for the `MapGen.Cavern`.
|
||||||
|
|
||||||
|
**Only for EmmyLua.**
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### CavernDef.minY
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
CavernDef.minY : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### CavernDef.maxY
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
CavernDef.maxY : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### CavernDef.noiseParams
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
CavernDef.noiseParams : NoiseParams
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### CavernDef.smoothDistance
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
CavernDef.smoothDistance : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### CavernDef.threshold
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
CavernDef.threshold : number?
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### CavernDef.groups
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
CavernDef.groups : table<string,number>?
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
43
docs/docs/types/MapGen.Decoration.md
Normal file
43
docs/docs/types/MapGen.Decoration.md
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# class Decoration
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- namespace: MapGen
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**NOT IMPLEMENTED**
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## methods
|
||||||
|
---
|
||||||
|
|
||||||
|
### Decoration.new
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Decoration.new() -> MapGen.Decoration {
|
||||||
|
new = function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
16
docs/docs/types/MapGen.Layer.Category.md
Normal file
16
docs/docs/types/MapGen.Layer.Category.md
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# alias Category
|
||||||
|
---
|
||||||
|
|
||||||
|
- namespace: MapGen.Layer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```lua
|
||||||
|
(alias) Category = ("landscape"|"temp"|"humidity")
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
A category of noise that affects specific map generation objects.
|
||||||
|
|
||||||
678
docs/docs/types/MapGen.Layer.md
Normal file
678
docs/docs/types/MapGen.Layer.md
Normal file
@@ -0,0 +1,678 @@
|
|||||||
|
# class Layer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- namespace: MapGen
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## methods
|
||||||
|
---
|
||||||
|
|
||||||
|
### Layer.calcTemp
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Layer.calcTemp(
|
||||||
|
self: MapGen.Layer {
|
||||||
|
name = string,
|
||||||
|
minY = integer,
|
||||||
|
maxY = integer,
|
||||||
|
minTemp = integer,
|
||||||
|
maxTemp = integer,
|
||||||
|
minHumidity = integer,
|
||||||
|
maxHumidity = integer,
|
||||||
|
waterLevel = integer,
|
||||||
|
peaksList = { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] },
|
||||||
|
noisesByColor = { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> },
|
||||||
|
noisesParamsByColor = { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> },
|
||||||
|
biomesByName = table<string,MapGen.Biome>,
|
||||||
|
biomesList = MapGen.Biome[],
|
||||||
|
biomesDiagram = table,
|
||||||
|
biomesGorizontalScattering = integer,
|
||||||
|
biomesVerticalScattering = integer,
|
||||||
|
cavernsByName = table<string,MapGen.Cavern>,
|
||||||
|
cavernsList = MapGen.Cavern[],
|
||||||
|
trianglesList = { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] },
|
||||||
|
tetrahedronsList = MapGen.Tetrahedron[],
|
||||||
|
calcTemp = function,
|
||||||
|
calcHumidity = function,
|
||||||
|
new = function,
|
||||||
|
addPeak = function,
|
||||||
|
addNoiseParamsColor = function,
|
||||||
|
getNoiseByColor = function,
|
||||||
|
addBiome = function,
|
||||||
|
addCavern = function,
|
||||||
|
initNoises = function,
|
||||||
|
initBiomesDiagram = function,
|
||||||
|
},
|
||||||
|
value: number,
|
||||||
|
height: number
|
||||||
|
)-> number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.calcHumidity
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Layer.calcHumidity(
|
||||||
|
self: MapGen.Layer {
|
||||||
|
name = string,
|
||||||
|
minY = integer,
|
||||||
|
maxY = integer,
|
||||||
|
minTemp = integer,
|
||||||
|
maxTemp = integer,
|
||||||
|
minHumidity = integer,
|
||||||
|
maxHumidity = integer,
|
||||||
|
waterLevel = integer,
|
||||||
|
peaksList = { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] },
|
||||||
|
noisesByColor = { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> },
|
||||||
|
noisesParamsByColor = { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> },
|
||||||
|
biomesByName = table<string,MapGen.Biome>,
|
||||||
|
biomesList = MapGen.Biome[],
|
||||||
|
biomesDiagram = table,
|
||||||
|
biomesGorizontalScattering = integer,
|
||||||
|
biomesVerticalScattering = integer,
|
||||||
|
cavernsByName = table<string,MapGen.Cavern>,
|
||||||
|
cavernsList = MapGen.Cavern[],
|
||||||
|
trianglesList = { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] },
|
||||||
|
tetrahedronsList = MapGen.Tetrahedron[],
|
||||||
|
calcTemp = function,
|
||||||
|
calcHumidity = function,
|
||||||
|
new = function,
|
||||||
|
addPeak = function,
|
||||||
|
addNoiseParamsColor = function,
|
||||||
|
getNoiseByColor = function,
|
||||||
|
addBiome = function,
|
||||||
|
addCavern = function,
|
||||||
|
initNoises = function,
|
||||||
|
initBiomesDiagram = function,
|
||||||
|
},
|
||||||
|
value: number,
|
||||||
|
height: number
|
||||||
|
)-> number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.new
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Layer.new(
|
||||||
|
name: string,
|
||||||
|
def: MapGen.LayerDef {
|
||||||
|
minY = number,
|
||||||
|
maxY = number,
|
||||||
|
minTemp = number,
|
||||||
|
maxTemp = number,
|
||||||
|
minHumidity = number,
|
||||||
|
maxHumidity = number,
|
||||||
|
waterLevel = number?,
|
||||||
|
calcTemp = (fun(self: MapGen.Layer, value: number, height: number) -> number)?,
|
||||||
|
calcHumidity = (fun(self: MapGen.Layer, value: number, height: number) -> number)?,
|
||||||
|
biomesGorizontalScattering = number?,
|
||||||
|
biomesVerticalScattering = number?,
|
||||||
|
}
|
||||||
|
) -> MapGen.Layer {
|
||||||
|
name = string,
|
||||||
|
minY = integer,
|
||||||
|
maxY = integer,
|
||||||
|
minTemp = integer,
|
||||||
|
maxTemp = integer,
|
||||||
|
minHumidity = integer,
|
||||||
|
maxHumidity = integer,
|
||||||
|
waterLevel = integer,
|
||||||
|
peaksList = { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] },
|
||||||
|
noisesByColor = { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> },
|
||||||
|
noisesParamsByColor = { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> },
|
||||||
|
biomesByName = table<string,MapGen.Biome>,
|
||||||
|
biomesList = MapGen.Biome[],
|
||||||
|
biomesDiagram = table,
|
||||||
|
biomesGorizontalScattering = integer,
|
||||||
|
biomesVerticalScattering = integer,
|
||||||
|
cavernsByName = table<string,MapGen.Cavern>,
|
||||||
|
cavernsList = MapGen.Cavern[],
|
||||||
|
trianglesList = { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] },
|
||||||
|
tetrahedronsList = MapGen.Tetrahedron[],
|
||||||
|
calcTemp = function,
|
||||||
|
calcHumidity = function,
|
||||||
|
new = function,
|
||||||
|
addPeak = function,
|
||||||
|
addNoiseParamsColor = function,
|
||||||
|
getNoiseByColor = function,
|
||||||
|
addBiome = function,
|
||||||
|
addCavern = function,
|
||||||
|
initNoises = function,
|
||||||
|
initBiomesDiagram = function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.addPeak
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Layer.addPeak(
|
||||||
|
category: MapGen.Layer.Category,
|
||||||
|
peak: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
}
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Adds a peak to the `Layer.peaksList`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.addNoiseParamsColor
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Layer.addNoiseParamsColor(
|
||||||
|
category: MapGen.Layer.Category,
|
||||||
|
color: ColorString,
|
||||||
|
noiseParams: NoiseParams
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Adds a NoiseParams color to the `Layer.noisesParamsByColor`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.getNoiseByColor
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Layer.getNoiseByColor(
|
||||||
|
category: MapGen.Layer.Category,
|
||||||
|
color: ColorString
|
||||||
|
) -> ValueNoise
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns noise corresponding to a color.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.addBiome
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Layer.addBiome(
|
||||||
|
biomeName: string,
|
||||||
|
biome: MapGen.Biome {
|
||||||
|
name = string,
|
||||||
|
tempPoint = number,
|
||||||
|
humidityPoint = number,
|
||||||
|
minY = number,
|
||||||
|
maxY = number,
|
||||||
|
groundNodes = MapGen.Biome.GroundNodes,
|
||||||
|
groundNodesIDs = MapGen.Biome.GroundNodesIDs,
|
||||||
|
soilHeight = number,
|
||||||
|
generateAir = generateFunc,
|
||||||
|
generateCavernAir = generateFunc,
|
||||||
|
generateWater = generateFunc,
|
||||||
|
generateRock = generateFunc,
|
||||||
|
generateTurf = generateFunc,
|
||||||
|
generateSoil = generateFunc,
|
||||||
|
generateBottom = generateFunc,
|
||||||
|
new = function,
|
||||||
|
}
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Adds a biome to the `Layer.biomesByName` & `Layer.biomesList`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.addCavern
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Layer.addCavern(
|
||||||
|
cavernName: string,
|
||||||
|
cavern: MapGen.Cavern {
|
||||||
|
name = string,
|
||||||
|
minY = number,
|
||||||
|
maxY = number,
|
||||||
|
smoothDistance = number,
|
||||||
|
threshold = number,
|
||||||
|
getNoise = function,
|
||||||
|
initNoise = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
isCavern = function,
|
||||||
|
}
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Adds a cavern to the `Layer.cavernsByName` & `Layer.cavernsList`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.initNoises
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Layer.initNoises() -> nil
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Initializes noise for generation.
|
||||||
|
|
||||||
|
Should only be called after the mapgen object has been loaded.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.initBiomesDiagram
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Layer.initBiomesDiagram() -> nil
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Initialization of the biome diagram using the Voronoi method.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### Layer.name
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.name : string
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.minY
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.minY : integer
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.maxY
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.maxY : integer
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.minTemp
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.minTemp : integer
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.maxTemp
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.maxTemp : integer
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.minHumidity
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.minHumidity : integer
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.maxHumidity
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.maxHumidity : integer
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.waterLevel
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.waterLevel : integer
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.peaksList
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.peaksList : { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] }
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.noisesByColor
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.noisesByColor : { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> }
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.noisesParamsByColor
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.noisesParamsByColor : { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> }
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.biomesByName
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.biomesByName : table<string,MapGen.Biome>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.biomesList
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.biomesList : MapGen.Biome[]
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.biomesDiagram
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.biomesDiagram : table
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.biomesGorizontalScattering
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.biomesGorizontalScattering : integer
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.biomesVerticalScattering
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.biomesVerticalScattering : integer
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.cavernsByName
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.cavernsByName : table<string,MapGen.Cavern>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.cavernsList
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.cavernsList : MapGen.Cavern[]
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.trianglesList
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.trianglesList : { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] }
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Layer.tetrahedronsList
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Layer.tetrahedronsList : MapGen.Tetrahedron[]
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Not supported**
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
191
docs/docs/types/MapGen.LayerDef.md
Normal file
191
docs/docs/types/MapGen.LayerDef.md
Normal file
@@ -0,0 +1,191 @@
|
|||||||
|
# class LayerDef
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- namespace: MapGen
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Definition table for the `MapGen.Layer`.
|
||||||
|
|
||||||
|
**Only for EmmyLua.**
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### LayerDef.minY
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
LayerDef.minY : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### LayerDef.maxY
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
LayerDef.maxY : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### LayerDef.minTemp
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
LayerDef.minTemp : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### LayerDef.maxTemp
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
LayerDef.maxTemp : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### LayerDef.minHumidity
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
LayerDef.minHumidity : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### LayerDef.maxHumidity
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
LayerDef.maxHumidity : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### LayerDef.waterLevel
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
LayerDef.waterLevel : number?
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### LayerDef.calcTemp
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
LayerDef.calcTemp : (fun(self: MapGen.Layer, value: number, height: number) -> number)?
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### LayerDef.calcHumidity
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
LayerDef.calcHumidity : (fun(self: MapGen.Layer, value: number, height: number) -> number)?
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### LayerDef.biomesGorizontalScattering
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
LayerDef.biomesGorizontalScattering : number?
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### LayerDef.biomesVerticalScattering
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
LayerDef.biomesVerticalScattering : number?
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
14
docs/docs/types/MapGen.PastCalcNoiseValue.md
Normal file
14
docs/docs/types/MapGen.PastCalcNoiseValue.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# alias PastCalcNoiseValue
|
||||||
|
---
|
||||||
|
|
||||||
|
- namespace: MapGen
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```lua
|
||||||
|
(alias) PastCalcNoiseValue = { noiseValue: number?, triangle: MapGen.Triangle?, x: integer?, z: integer? }
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
162
docs/docs/types/MapGen.Peak.md
Normal file
162
docs/docs/types/MapGen.Peak.md
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
# class Peak
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- namespace: MapGen
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## methods
|
||||||
|
---
|
||||||
|
|
||||||
|
### Peak.getPeakPos
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Peak.getPeakPos(self)-> vector
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Peak.getColor
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Peak.getColor(self)-> ColorString
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Peak.getGroups
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Peak.getGroups(self)
|
||||||
|
-> table<string,number>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Peak.new
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Peak.new(def: MapGen.PeakDef {
|
||||||
|
pos = vector,
|
||||||
|
color = ColorString,
|
||||||
|
groups = table<string,number>?,
|
||||||
|
}) -> MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Peak.toString
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Peak.toString() -> string
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns a string describing the object in a readable form.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Peak.eq
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Peak.eq(other: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
}) -> boolean
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns true if the peaks are equivalent.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### Peak.id
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Peak.id : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
71
docs/docs/types/MapGen.PeakDef.md
Normal file
71
docs/docs/types/MapGen.PeakDef.md
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
# class PeakDef
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- namespace: MapGen
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Definition table for the `MapGen.Peak`.
|
||||||
|
|
||||||
|
**Only for EmmyLua.**
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### PeakDef.pos
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
PeakDef.pos : vector
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### PeakDef.color
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
PeakDef.color : ColorString
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### PeakDef.groups
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
PeakDef.groups : table<string,number>?
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
149
docs/docs/types/MapGen.StaticLayer.md
Normal file
149
docs/docs/types/MapGen.StaticLayer.md
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
# class StaticLayer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- namespace: MapGen
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## methods
|
||||||
|
---
|
||||||
|
|
||||||
|
### StaticLayer.new
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function StaticLayer.new(
|
||||||
|
name: string,
|
||||||
|
def: MapGen.StaticLayerDef {
|
||||||
|
minY = number,
|
||||||
|
maxY = number,
|
||||||
|
staticNode = string,
|
||||||
|
generateStaticNode = generateFunc,
|
||||||
|
}
|
||||||
|
) -> MapGen.StaticLayer {
|
||||||
|
name = string,
|
||||||
|
minY = number,
|
||||||
|
maxY = number,
|
||||||
|
staticNode = string,
|
||||||
|
staticNodeID = number,
|
||||||
|
generateStaticNode = generateFunc,
|
||||||
|
new = function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### StaticLayer.name
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
StaticLayer.name : string
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### StaticLayer.minY
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
StaticLayer.minY : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### StaticLayer.maxY
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
StaticLayer.maxY : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### StaticLayer.staticNode
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
StaticLayer.staticNode : string
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### StaticLayer.staticNodeID
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
StaticLayer.staticNodeID : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### StaticLayer.generateStaticNode
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
StaticLayer.generateStaticNode : generateFunc
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
86
docs/docs/types/MapGen.StaticLayerDef.md
Normal file
86
docs/docs/types/MapGen.StaticLayerDef.md
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
# class StaticLayerDef
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- namespace: MapGen
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Definition table for the `MapGen.StaticLayer`.
|
||||||
|
|
||||||
|
**Only for EmmyLua.**
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### StaticLayerDef.minY
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
StaticLayerDef.minY : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### StaticLayerDef.maxY
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
StaticLayerDef.maxY : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### StaticLayerDef.staticNode
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
StaticLayerDef.staticNode : string
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### StaticLayerDef.generateStaticNode
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
StaticLayerDef.generateStaticNode : generateFunc
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
541
docs/docs/types/MapGen.Tetrahedron.md
Normal file
541
docs/docs/types/MapGen.Tetrahedron.md
Normal file
@@ -0,0 +1,541 @@
|
|||||||
|
# class Tetrahedron
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- namespace: MapGen
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## methods
|
||||||
|
---
|
||||||
|
|
||||||
|
### Tetrahedron.new
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Tetrahedron.new(
|
||||||
|
p1: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
},
|
||||||
|
p2: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
},
|
||||||
|
p3: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
},
|
||||||
|
p4: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
}
|
||||||
|
) -> MapGen.Tetrahedron {
|
||||||
|
p1 = MapGen.Peak,
|
||||||
|
p2 = MapGen.Peak,
|
||||||
|
p3 = MapGen.Peak,
|
||||||
|
p4 = MapGen.Peak,
|
||||||
|
h1 = MapGen.Triangulation.Edge,
|
||||||
|
h2 = MapGen.Triangulation.Edge,
|
||||||
|
h3 = MapGen.Triangulation.Edge,
|
||||||
|
h4 = MapGen.Triangulation.Edge,
|
||||||
|
f1 = MapGen.Triangle,
|
||||||
|
f2 = MapGen.Triangle,
|
||||||
|
f3 = MapGen.Triangle,
|
||||||
|
f4 = MapGen.Triangle,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
getHeight = function,
|
||||||
|
getCircumSphereCenter = function,
|
||||||
|
getCircumSphereRadius = function,
|
||||||
|
inCircumSphere = function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.toString
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Tetrahedron.toString() -> string
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns a string describing the object in a readable form.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.getHeight
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Tetrahedron.getHeight(
|
||||||
|
p1: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
},
|
||||||
|
p2: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
},
|
||||||
|
p3: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
},
|
||||||
|
p4: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
}
|
||||||
|
) -> MapGen.Triangulation.Edge?
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.getCircumSphereCenter
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Tetrahedron.getCircumSphereCenter() -> vector
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the center of the circumscribed sphere.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.getCircumSphereRadius
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Tetrahedron.getCircumSphereRadius() -> number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the radius of the circumscribed sphere.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.inCircumSphere
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Tetrahedron.inCircumSphere(p: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
}) -> boolean
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Checks whether a given point lies within the circumscribed sphere of a tetrahedron.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### Tetrahedron.p1
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Tetrahedron.p1 : MapGen.Peak {
|
||||||
|
id: number,
|
||||||
|
getPeakPos: function,
|
||||||
|
getColor: function,
|
||||||
|
getGroups: function,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.p2
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Tetrahedron.p2 : MapGen.Peak {
|
||||||
|
id: number,
|
||||||
|
getPeakPos: function,
|
||||||
|
getColor: function,
|
||||||
|
getGroups: function,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.p3
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Tetrahedron.p3 : MapGen.Peak {
|
||||||
|
id: number,
|
||||||
|
getPeakPos: function,
|
||||||
|
getColor: function,
|
||||||
|
getGroups: function,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.p4
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Tetrahedron.p4 : MapGen.Peak {
|
||||||
|
id: number,
|
||||||
|
getPeakPos: function,
|
||||||
|
getColor: function,
|
||||||
|
getGroups: function,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.h1
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Tetrahedron.h1 : MapGen.Triangulation.Edge {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
same: function,
|
||||||
|
length: function,
|
||||||
|
getMidPoint: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.h2
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Tetrahedron.h2 : MapGen.Triangulation.Edge {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
same: function,
|
||||||
|
length: function,
|
||||||
|
getMidPoint: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.h3
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Tetrahedron.h3 : MapGen.Triangulation.Edge {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
same: function,
|
||||||
|
length: function,
|
||||||
|
getMidPoint: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.h4
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Tetrahedron.h4 : MapGen.Triangulation.Edge {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
same: function,
|
||||||
|
length: function,
|
||||||
|
getMidPoint: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.f1
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Tetrahedron.f1 : MapGen.Triangle {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
p3: MapGen.Peak,
|
||||||
|
e1: MapGen.Triangulation.Edge,
|
||||||
|
e2: MapGen.Triangulation.Edge,
|
||||||
|
e3: MapGen.Triangulation.Edge,
|
||||||
|
h1: MapGen.Triangulation.Edge,
|
||||||
|
h2: MapGen.Triangulation.Edge,
|
||||||
|
h3: MapGen.Triangulation.Edge,
|
||||||
|
neighbours: MapGen.Triangle.Neighbours,
|
||||||
|
color: ColorString?,
|
||||||
|
new: function,
|
||||||
|
...(+13)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.f2
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Tetrahedron.f2 : MapGen.Triangle {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
p3: MapGen.Peak,
|
||||||
|
e1: MapGen.Triangulation.Edge,
|
||||||
|
e2: MapGen.Triangulation.Edge,
|
||||||
|
e3: MapGen.Triangulation.Edge,
|
||||||
|
h1: MapGen.Triangulation.Edge,
|
||||||
|
h2: MapGen.Triangulation.Edge,
|
||||||
|
h3: MapGen.Triangulation.Edge,
|
||||||
|
neighbours: MapGen.Triangle.Neighbours,
|
||||||
|
color: ColorString?,
|
||||||
|
new: function,
|
||||||
|
...(+13)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.f3
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Tetrahedron.f3 : MapGen.Triangle {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
p3: MapGen.Peak,
|
||||||
|
e1: MapGen.Triangulation.Edge,
|
||||||
|
e2: MapGen.Triangulation.Edge,
|
||||||
|
e3: MapGen.Triangulation.Edge,
|
||||||
|
h1: MapGen.Triangulation.Edge,
|
||||||
|
h2: MapGen.Triangulation.Edge,
|
||||||
|
h3: MapGen.Triangulation.Edge,
|
||||||
|
neighbours: MapGen.Triangle.Neighbours,
|
||||||
|
color: ColorString?,
|
||||||
|
new: function,
|
||||||
|
...(+13)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tetrahedron.f4
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Tetrahedron.f4 : MapGen.Triangle {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
p3: MapGen.Peak,
|
||||||
|
e1: MapGen.Triangulation.Edge,
|
||||||
|
e2: MapGen.Triangulation.Edge,
|
||||||
|
e3: MapGen.Triangulation.Edge,
|
||||||
|
h1: MapGen.Triangulation.Edge,
|
||||||
|
h2: MapGen.Triangulation.Edge,
|
||||||
|
h3: MapGen.Triangulation.Edge,
|
||||||
|
neighbours: MapGen.Triangle.Neighbours,
|
||||||
|
color: ColorString?,
|
||||||
|
new: function,
|
||||||
|
...(+13)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
14
docs/docs/types/MapGen.Triangle.CircumCircleEnum.md
Normal file
14
docs/docs/types/MapGen.Triangle.CircumCircleEnum.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# alias CircumCircleEnum
|
||||||
|
---
|
||||||
|
|
||||||
|
- namespace: MapGen.Triangle
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```lua
|
||||||
|
(alias) CircumCircleEnum = ("IN"|"BEHIND"|"ON")
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
19
docs/docs/types/MapGen.Triangle.Neighbours.md
Normal file
19
docs/docs/types/MapGen.Triangle.Neighbours.md
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# alias Neighbours
|
||||||
|
---
|
||||||
|
|
||||||
|
- namespace: MapGen.Triangle
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```lua
|
||||||
|
(alias) Neighbours = { t1: MapGen.Triangle?, t2: MapGen.Triangle?, t3: MapGen.Triangle? }
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Adjacent triangles:
|
||||||
|
* `t1` with a common side p1-p2
|
||||||
|
* `t2` with a common side p2-p3
|
||||||
|
* `t3` with a common side p3-p1
|
||||||
|
|
||||||
750
docs/docs/types/MapGen.Triangle.md
Normal file
750
docs/docs/types/MapGen.Triangle.md
Normal file
@@ -0,0 +1,750 @@
|
|||||||
|
# class Triangle
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- namespace: MapGen
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## methods
|
||||||
|
---
|
||||||
|
|
||||||
|
### Triangle.new
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.new(
|
||||||
|
p1: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
},
|
||||||
|
p2: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
},
|
||||||
|
p3: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
}
|
||||||
|
) -> MapGen.Triangle {
|
||||||
|
p1 = MapGen.Peak,
|
||||||
|
p2 = MapGen.Peak,
|
||||||
|
p3 = MapGen.Peak,
|
||||||
|
e1 = MapGen.Triangulation.Edge,
|
||||||
|
e2 = MapGen.Triangulation.Edge,
|
||||||
|
e3 = MapGen.Triangulation.Edge,
|
||||||
|
h1 = MapGen.Triangulation.Edge,
|
||||||
|
h2 = MapGen.Triangulation.Edge,
|
||||||
|
h3 = MapGen.Triangulation.Edge,
|
||||||
|
neighbours = MapGen.Triangle.Neighbours,
|
||||||
|
color = ColorString?,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
same = function,
|
||||||
|
getCenter = function,
|
||||||
|
getArea = function,
|
||||||
|
getHeight = function,
|
||||||
|
getHeight2D = function,
|
||||||
|
getSidesLength = function,
|
||||||
|
getSidesLength2D = function,
|
||||||
|
getCircumCenter2D = function,
|
||||||
|
getCircumRadius2D = function,
|
||||||
|
getCircumCircle2D = function,
|
||||||
|
inCircumCircle2D = function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.toString
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.toString() -> string
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns a string describing the object in a readable form.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.eq
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.eq(other: MapGen.Triangle {
|
||||||
|
p1 = MapGen.Peak,
|
||||||
|
p2 = MapGen.Peak,
|
||||||
|
p3 = MapGen.Peak,
|
||||||
|
e1 = MapGen.Triangulation.Edge,
|
||||||
|
e2 = MapGen.Triangulation.Edge,
|
||||||
|
e3 = MapGen.Triangulation.Edge,
|
||||||
|
h1 = MapGen.Triangulation.Edge,
|
||||||
|
h2 = MapGen.Triangulation.Edge,
|
||||||
|
h3 = MapGen.Triangulation.Edge,
|
||||||
|
neighbours = MapGen.Triangle.Neighbours,
|
||||||
|
color = ColorString?,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
same = function,
|
||||||
|
getCenter = function,
|
||||||
|
getArea = function,
|
||||||
|
getHeight = function,
|
||||||
|
getHeight2D = function,
|
||||||
|
getSidesLength = function,
|
||||||
|
getSidesLength2D = function,
|
||||||
|
getCircumCenter2D = function,
|
||||||
|
getCircumRadius2D = function,
|
||||||
|
getCircumCircle2D = function,
|
||||||
|
inCircumCircle2D = function,
|
||||||
|
}) -> boolean
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns true if the triangles are equivalent.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.same
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.same(other: MapGen.Triangle {
|
||||||
|
p1 = MapGen.Peak,
|
||||||
|
p2 = MapGen.Peak,
|
||||||
|
p3 = MapGen.Peak,
|
||||||
|
e1 = MapGen.Triangulation.Edge,
|
||||||
|
e2 = MapGen.Triangulation.Edge,
|
||||||
|
e3 = MapGen.Triangulation.Edge,
|
||||||
|
h1 = MapGen.Triangulation.Edge,
|
||||||
|
h2 = MapGen.Triangulation.Edge,
|
||||||
|
h3 = MapGen.Triangulation.Edge,
|
||||||
|
neighbours = MapGen.Triangle.Neighbours,
|
||||||
|
color = ColorString?,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
same = function,
|
||||||
|
getCenter = function,
|
||||||
|
getArea = function,
|
||||||
|
getHeight = function,
|
||||||
|
getHeight2D = function,
|
||||||
|
getSidesLength = function,
|
||||||
|
getSidesLength2D = function,
|
||||||
|
getCircumCenter2D = function,
|
||||||
|
getCircumRadius2D = function,
|
||||||
|
getCircumCircle2D = function,
|
||||||
|
inCircumCircle2D = function,
|
||||||
|
}) -> boolean
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns true if the triangles are similar.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.getCenter
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.getCenter() -> vector
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the coordinates of the triangle's center.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.getArea
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.getArea() -> number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the area of a triangle.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.getHeight
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.getHeight(
|
||||||
|
p1: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
},
|
||||||
|
p2: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
},
|
||||||
|
p3: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
}
|
||||||
|
) -> MapGen.Triangulation.Edge {
|
||||||
|
p1 = MapGen.Peak,
|
||||||
|
p2 = MapGen.Peak,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
same = function,
|
||||||
|
length = function,
|
||||||
|
getMidPoint = function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the perpendicular from the vertex Peak1 to the line Peak2-Peak3.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.getHeight2D
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.getHeight2D(
|
||||||
|
p1: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
},
|
||||||
|
p2: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
},
|
||||||
|
p3: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
}
|
||||||
|
) -> MapGen.Triangulation.Edge {
|
||||||
|
p1 = MapGen.Peak,
|
||||||
|
p2 = MapGen.Peak,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
same = function,
|
||||||
|
length = function,
|
||||||
|
getMidPoint = function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the perpendicular from the vertex Peak1 to the line Peak2-Peak3.
|
||||||
|
|
||||||
|
Note: This function does not take into account the Y-coordinate,
|
||||||
|
that is, the calculation is performed on the projection of the triangle XZ.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.getSidesLength
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.getSidesLength()
|
||||||
|
-> number
|
||||||
|
-> number
|
||||||
|
-> number
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the length of the edges
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.getSidesLength2D
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.getSidesLength2D()
|
||||||
|
-> number
|
||||||
|
-> number
|
||||||
|
-> number
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the length of the edges.
|
||||||
|
|
||||||
|
Note: This function does not take into account the Y-coordinate,
|
||||||
|
that is, the calculation is performed on the projection of the triangle XZ.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.getCircumCenter2D
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.getCircumCenter2D() -> vector
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the coordinates of the circumcircle center.
|
||||||
|
|
||||||
|
Note: This function does not take into account the Y-coordinate,
|
||||||
|
that is, the calculation is performed on the projection of the triangle XZ.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.getCircumRadius2D
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.getCircumRadius2D() -> number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the radius of the circumcircle.
|
||||||
|
|
||||||
|
Note: This function does not take into account the Y-coordinate,
|
||||||
|
that is, the calculation is performed on the projection of the triangle XZ.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.getCircumCircle2D
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.getCircumCircle2D()
|
||||||
|
-> vector
|
||||||
|
-> number
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the coordinates of the circumcircle center and its radius.
|
||||||
|
|
||||||
|
Note: This function does not take into account the Y-coordinate,
|
||||||
|
that is, the calculation is performed on the projection of the triangle XZ.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.inCircumCircle2D
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangle.inCircumCircle2D(p: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
}) -> boolean
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Checks if a given point lies into the triangle circumcircle.
|
||||||
|
|
||||||
|
Note: This function does not take into account the Y-coordinate,
|
||||||
|
that is, the calculation is performed on the projection of the triangle XZ.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### Triangle.p1
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Triangle.p1 : MapGen.Peak {
|
||||||
|
id: number,
|
||||||
|
getPeakPos: function,
|
||||||
|
getColor: function,
|
||||||
|
getGroups: function,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.p2
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Triangle.p2 : MapGen.Peak {
|
||||||
|
id: number,
|
||||||
|
getPeakPos: function,
|
||||||
|
getColor: function,
|
||||||
|
getGroups: function,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.p3
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Triangle.p3 : MapGen.Peak {
|
||||||
|
id: number,
|
||||||
|
getPeakPos: function,
|
||||||
|
getColor: function,
|
||||||
|
getGroups: function,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.e1
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Triangle.e1 : MapGen.Triangulation.Edge {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
same: function,
|
||||||
|
length: function,
|
||||||
|
getMidPoint: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.e2
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Triangle.e2 : MapGen.Triangulation.Edge {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
same: function,
|
||||||
|
length: function,
|
||||||
|
getMidPoint: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.e3
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Triangle.e3 : MapGen.Triangulation.Edge {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
same: function,
|
||||||
|
length: function,
|
||||||
|
getMidPoint: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.h1
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Triangle.h1 : MapGen.Triangulation.Edge {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
same: function,
|
||||||
|
length: function,
|
||||||
|
getMidPoint: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.h2
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Triangle.h2 : MapGen.Triangulation.Edge {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
same: function,
|
||||||
|
length: function,
|
||||||
|
getMidPoint: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.h3
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Triangle.h3 : MapGen.Triangulation.Edge {
|
||||||
|
p1: MapGen.Peak,
|
||||||
|
p2: MapGen.Peak,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
same: function,
|
||||||
|
length: function,
|
||||||
|
getMidPoint: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.neighbours
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Triangle.neighbours : MapGen.Triangle.Neighbours
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangle.color
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Triangle.color : ColorString?
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
230
docs/docs/types/MapGen.Triangulation.Edge.md
Normal file
230
docs/docs/types/MapGen.Triangulation.Edge.md
Normal file
@@ -0,0 +1,230 @@
|
|||||||
|
# class Edge
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- namespace: MapGen.Triangulation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## methods
|
||||||
|
---
|
||||||
|
|
||||||
|
### Edge.new
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Edge.new(
|
||||||
|
p1: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
},
|
||||||
|
p2: MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
}
|
||||||
|
) -> MapGen.Triangulation.Edge {
|
||||||
|
p1 = MapGen.Peak,
|
||||||
|
p2 = MapGen.Peak,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
same = function,
|
||||||
|
length = function,
|
||||||
|
getMidPoint = function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Edge.toString
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Edge.toString() -> string
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns a string describing the object in a readable form.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Edge.eq
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Edge.eq(other: MapGen.Triangulation.Edge {
|
||||||
|
p1 = MapGen.Peak,
|
||||||
|
p2 = MapGen.Peak,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
same = function,
|
||||||
|
length = function,
|
||||||
|
getMidPoint = function,
|
||||||
|
}) -> boolean
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns true if the edges are equivalent.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Edge.same
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Edge.same(other: MapGen.Triangulation.Edge {
|
||||||
|
p1 = MapGen.Peak,
|
||||||
|
p2 = MapGen.Peak,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
same = function,
|
||||||
|
length = function,
|
||||||
|
getMidPoint = function,
|
||||||
|
}) -> boolean
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns true if the edges are similar.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Edge.length
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Edge.length() -> number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the length of an edge.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Edge.getMidPoint
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Edge.getMidPoint() -> vector
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the vector of the point located in the middle of the edge.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### Edge.p1
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Edge.p1 : MapGen.Peak {
|
||||||
|
id: number,
|
||||||
|
getPeakPos: function,
|
||||||
|
getColor: function,
|
||||||
|
getGroups: function,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Edge.p2
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Edge.p2 : MapGen.Peak {
|
||||||
|
id: number,
|
||||||
|
getPeakPos: function,
|
||||||
|
getColor: function,
|
||||||
|
getGroups: function,
|
||||||
|
new: function,
|
||||||
|
toString: function,
|
||||||
|
eq: function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
90
docs/docs/types/MapGen.Triangulation.FakePeak.md
Normal file
90
docs/docs/types/MapGen.Triangulation.FakePeak.md
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
# class FakePeak
|
||||||
|
|
||||||
|
|
||||||
|
- supers: MapGen.Peak
|
||||||
|
|
||||||
|
|
||||||
|
- namespace: MapGen.Triangulation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Allows you to create a `MapGen.Peak` without specifying a noise parameter.
|
||||||
|
|
||||||
|
**WARNING: MUST NOT BE PARTICIPATED IN GENERATION**
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## methods
|
||||||
|
---
|
||||||
|
|
||||||
|
### FakePeak.getPeakPos
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function FakePeak.getPeakPos()-> vector
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### FakePeak.new
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function FakePeak.new(peakPos: vector) -> MapGen.Peak {
|
||||||
|
id = number,
|
||||||
|
getPeakPos = function,
|
||||||
|
getColor = function,
|
||||||
|
getGroups = function,
|
||||||
|
new = function,
|
||||||
|
toString = function,
|
||||||
|
eq = function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns a fake `MapGen.Peak` that has no noise parameters.
|
||||||
|
Note that the initialized peak should not be used in generation.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### FakePeak.id
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
FakePeak.id : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
86
docs/docs/types/MapGen.Triangulation.md
Normal file
86
docs/docs/types/MapGen.Triangulation.md
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
# class Triangulation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- namespace: MapGen
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## methods
|
||||||
|
---
|
||||||
|
|
||||||
|
### Triangulation.triangulate
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangulation.triangulate(vertices: table<integer,MapGen.Peak>) -> ((MapGen.Triangle)|MapGen.Triangle[])
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The Delaunay method divides a plane into triangles based on a list of their vertices.
|
||||||
|
|
||||||
|
Doesn't take into account the Y coordinate of the vertices.
|
||||||
|
That is, all triangles that don't lie in the XZ plane will be projected onto it.
|
||||||
|
|
||||||
|
Vertices that do not have a `is2d` group will not participate in the triangulation.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Triangulation.tetrahedralize
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function Triangulation.tetrahedralize(vertices: table<integer,MapGen.Peak>) -> ((MapGen.Tetrahedron)|MapGen.Tetrahedron[])
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The Delaunay method divides space into tetrahedra based on a list of their vertices.
|
||||||
|
|
||||||
|
Vertices that do not have a `is3d` group will not participate in the triangulation.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### Triangulation.convexMultiplier
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
Triangulation.convexMultiplier : number
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
741
docs/docs/types/MapGen.md
Normal file
741
docs/docs/types/MapGen.md
Normal file
@@ -0,0 +1,741 @@
|
|||||||
|
# class MapGen
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## methods
|
||||||
|
---
|
||||||
|
|
||||||
|
### MapGen.new
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.new(def: MapGenDef {
|
||||||
|
nodes = table<string,string>,
|
||||||
|
}) -> MapGen {
|
||||||
|
layersByName = table<string,MapGen.Layer>,
|
||||||
|
layersList = MapGen.Layer[],
|
||||||
|
staticsByName = table<string,MapGen.StaticLayer>,
|
||||||
|
staticsList = MapGen.StaticLayer[],
|
||||||
|
layersNoisesInitialized = boolean,
|
||||||
|
cavernsNoiseInitialized = boolean,
|
||||||
|
isRunning = boolean,
|
||||||
|
nodeIDs = table<string,number>,
|
||||||
|
new = function,
|
||||||
|
getLayerByHeight = function,
|
||||||
|
getStaticByHeight = function,
|
||||||
|
registerLayer = function,
|
||||||
|
registerLayerNoiseColor = function,
|
||||||
|
registerStaticLayer = function,
|
||||||
|
registerPeak = function,
|
||||||
|
register2DPeak = function,
|
||||||
|
register2DPeaks = function,
|
||||||
|
register2DPeaksFromFile = function,
|
||||||
|
registerBiome = function,
|
||||||
|
registerCavern = function,
|
||||||
|
initLayersTriangultaion = function,
|
||||||
|
initLayersNoises = function,
|
||||||
|
initBiomesDiagram = function,
|
||||||
|
initCavernsNoise = function,
|
||||||
|
getNoises2dValue = function,
|
||||||
|
onMapGenerated = function,
|
||||||
|
run = function,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.getLayerByHeight
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.getLayerByHeight(yPos: number) -> MapGen.Layer?
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Determines which layer a node belongs to based on its height coordinate.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.getStaticByHeight
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.getStaticByHeight(yPos: number) -> MapGen.StaticLayer?
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Determines which statics layer a node belongs to based on its height coordinate.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.registerLayer
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.registerLayer(
|
||||||
|
name: string,
|
||||||
|
def: MapGen.LayerDef {
|
||||||
|
minY = number,
|
||||||
|
maxY = number,
|
||||||
|
minTemp = number,
|
||||||
|
maxTemp = number,
|
||||||
|
minHumidity = number,
|
||||||
|
maxHumidity = number,
|
||||||
|
waterLevel = number?,
|
||||||
|
calcTemp = (fun(self: MapGen.Layer, value: number, height: number) -> number)?,
|
||||||
|
calcHumidity = (fun(self: MapGen.Layer, value: number, height: number) -> number)?,
|
||||||
|
biomesGorizontalScattering = number?,
|
||||||
|
biomesVerticalScattering = number?,
|
||||||
|
}
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
@param `name` - The name that will be assigned to the layer. The name must be unique for each layer.
|
||||||
|
|
||||||
|
@param `def` - Layer description table, see details `MapGen.LayerDef`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Mark the world area between two heights as a `MapGen.Layer`.
|
||||||
|
|
||||||
|
Note: layers must not overlap.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.registerLayerNoiseColor
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.registerLayerNoiseColor(
|
||||||
|
layerName: string,
|
||||||
|
category: MapGen.Layer.Category,
|
||||||
|
color: ColorString,
|
||||||
|
noiseParams: NoiseParams
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
@param `layerName` - The name of the layer for which the color will be registered.
|
||||||
|
|
||||||
|
@param `category` - Category indicating what will be generated by noise.
|
||||||
|
|
||||||
|
@param `color` - Noise color. Must be unique.
|
||||||
|
|
||||||
|
@param `noiseParams` - Fractal noise parameters.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Register the color and the noise parameters that correspond to it.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.registerStaticLayer
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.registerStaticLayer(
|
||||||
|
name: string,
|
||||||
|
def: MapGen.StaticLayerDef {
|
||||||
|
minY = number,
|
||||||
|
maxY = number,
|
||||||
|
staticNode = string,
|
||||||
|
generateStaticNode = generateFunc,
|
||||||
|
}
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
@param `name` - The name that will be assigned to the static layer. The name must be unique for each layer.
|
||||||
|
|
||||||
|
@param `def` - Static layer description table, see details `MapGen.StaticLayerDef`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Mark the world area between two heights as a `MapGen.StaticLayer`.
|
||||||
|
|
||||||
|
Note: layers must not overlap.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.registerPeak
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.registerPeak(
|
||||||
|
layerName: string,
|
||||||
|
category: MapGen.Layer.Category,
|
||||||
|
def: MapGen.PeakDef {
|
||||||
|
pos = vector,
|
||||||
|
color = ColorString,
|
||||||
|
groups = table<string,number>?,
|
||||||
|
}
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
@param `layerName` - The name of the layer in which the new peak will be included.
|
||||||
|
|
||||||
|
@param `category` - Category indicating what will be generated by peak.
|
||||||
|
|
||||||
|
@param `def` - Peak description table, see details `MapGen.PeakDef`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Mark a world point as `MapGen.Peak` and assign it a specific color that will affect the generation.
|
||||||
|
|
||||||
|
Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.register2DPeak
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.register2DPeak(
|
||||||
|
layerName: string,
|
||||||
|
category: MapGen.Layer.Category,
|
||||||
|
def: MapGen.PeakDef {
|
||||||
|
pos = vector,
|
||||||
|
color = ColorString,
|
||||||
|
groups = table<string,number>?,
|
||||||
|
}
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
@param `layerName` - The name of the layer in which the new peak will be included.
|
||||||
|
|
||||||
|
@param `category` - Category indicating what will be generated by peak.
|
||||||
|
|
||||||
|
@param `def` - Peak description table, see details `MapGen.PeakDef`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Mark a world point as `MapGen.Peak` and assign it a specific color that will affect the generation.
|
||||||
|
The Y coordinate will be forced to zero, and the `is2d` group will be added to the groups field.
|
||||||
|
|
||||||
|
Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.register2DPeaks
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.register2DPeaks(
|
||||||
|
layerName: string,
|
||||||
|
category: MapGen.Layer.Category,
|
||||||
|
defs: MapGen.PeakDef[]
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
@param `layerName` - The name of the layer in which the new peaks will be included.
|
||||||
|
|
||||||
|
@param `category` - Category indicating what will be generated by peaks.
|
||||||
|
|
||||||
|
@param `defs` - Peaks description table, see details `MapGen.PeakDef`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Mark the world points as `MapGen.Peak` and assign them all a specific noise that will affect generation.
|
||||||
|
The Y coordinate will be forced to zero, and the `is2d` group will be added to the groups field.
|
||||||
|
|
||||||
|
Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.register2DPeaksFromFile
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.register2DPeaksFromFile(
|
||||||
|
layerName: string,
|
||||||
|
map: string,
|
||||||
|
scale: number,
|
||||||
|
zeroPos: Position2d,
|
||||||
|
category: MapGen.Layer.Category,
|
||||||
|
groups: table<string,number>?
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
@param `layerName` - The name of the layer in which the new peaks will be included.
|
||||||
|
|
||||||
|
@param `map` - The name of the image from which the peaks will be extracted. It should be located in the `<mod_name>/textures/maps` folder and have the following format `<image_name>.ff`
|
||||||
|
|
||||||
|
@param `scale` - Multiplier of how many blocks (nodes) will be between image pixels. It is not recommended to set the value below 50 for performance reasons.
|
||||||
|
|
||||||
|
@param `zeroPos` - The position in pixels where the zero world coordinate will be in the image.
|
||||||
|
|
||||||
|
@param `category` - Category indicating what will be generated by peaks.
|
||||||
|
|
||||||
|
@param `groups` - Groups that will be added to all peaks.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Extract the `MapGen.Peak` from the image and assign them all a specific color that will affect the generation.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.registerBiome
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.registerBiome(
|
||||||
|
layerName: string,
|
||||||
|
biomeName: string,
|
||||||
|
def: MapGen.BiomeDef {
|
||||||
|
tempPoint = number,
|
||||||
|
humidityPoint = number,
|
||||||
|
minY = number,
|
||||||
|
maxY = number,
|
||||||
|
groundNodes = MapGen.Biome.GroundNodes,
|
||||||
|
soilHeight = number,
|
||||||
|
generateAir = generateFunc?,
|
||||||
|
generateCavernAir = generateFunc?,
|
||||||
|
generateWater = generateFunc?,
|
||||||
|
generateRock = generateFunc?,
|
||||||
|
generateTurf = generateFunc?,
|
||||||
|
generateSoil = generateFunc?,
|
||||||
|
generateBottom = generateFunc?,
|
||||||
|
}
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
@param `layerName` - The name of the layer in which the new biome will be included.
|
||||||
|
|
||||||
|
@param `biomeName` - The name to be assigned to the biome. The name must be unique for each biome.
|
||||||
|
|
||||||
|
@param `def` - Biome description table, see details `MapGen.BiomeDef`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Mark a point on the biomes diagram and constrain the world area by height to mark it as `MapGen.Biome`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.registerCavern
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.registerCavern(
|
||||||
|
layerName: string,
|
||||||
|
cavernName: string,
|
||||||
|
def: MapGen.CavernDef {
|
||||||
|
minY = number,
|
||||||
|
maxY = number,
|
||||||
|
noiseParams = NoiseParams,
|
||||||
|
smoothDistance = number,
|
||||||
|
threshold = number?,
|
||||||
|
groups = table<string,number>?,
|
||||||
|
}
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
@param `layerName` - The name of the layer in which the new cavern will be included.
|
||||||
|
|
||||||
|
@param `cavernName` - The name to be assigned to the cavern. The name must be unique for each cavern.
|
||||||
|
|
||||||
|
@param `def` - Cavern description table, see details `MapGen.CavernDef`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Mark the world area between two heights as a `MapGen.Cavern` and assign the noise that the cave will be generated from.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.initLayersTriangultaion
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.initLayersTriangultaion() -> nil
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Divide all layers into triangles whose vertices are the `Mapgen.Peak` belonging to these layers.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.initLayersNoises
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.initLayersNoises() -> nil
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Initialize all layer noises. This should be called after the map object is loaded.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.initBiomesDiagram
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.initBiomesDiagram() -> nil
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Initialization of the biome diagram using the Voronoi method.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.initCavernsNoise
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.initCavernsNoise() -> nil
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Initialize caverns's noises. This should be called after the map object is loaded.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.getNoises2dValue
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.getNoises2dValue(
|
||||||
|
category: MapGen.Layer.Category,
|
||||||
|
layer: MapGen.Layer {
|
||||||
|
name = string,
|
||||||
|
minY = integer,
|
||||||
|
maxY = integer,
|
||||||
|
minTemp = integer,
|
||||||
|
maxTemp = integer,
|
||||||
|
minHumidity = integer,
|
||||||
|
maxHumidity = integer,
|
||||||
|
waterLevel = integer,
|
||||||
|
peaksList = { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] },
|
||||||
|
noisesByColor = { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> },
|
||||||
|
noisesParamsByColor = { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> },
|
||||||
|
biomesByName = table<string,MapGen.Biome>,
|
||||||
|
biomesList = MapGen.Biome[],
|
||||||
|
biomesDiagram = table,
|
||||||
|
biomesGorizontalScattering = integer,
|
||||||
|
biomesVerticalScattering = integer,
|
||||||
|
cavernsByName = table<string,MapGen.Cavern>,
|
||||||
|
cavernsList = MapGen.Cavern[],
|
||||||
|
trianglesList = { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] },
|
||||||
|
tetrahedronsList = MapGen.Tetrahedron[],
|
||||||
|
calcTemp = function,
|
||||||
|
calcHumidity = function,
|
||||||
|
new = function,
|
||||||
|
addPeak = function,
|
||||||
|
addNoiseParamsColor = function,
|
||||||
|
getNoiseByColor = function,
|
||||||
|
addBiome = function,
|
||||||
|
addCavern = function,
|
||||||
|
initNoises = function,
|
||||||
|
initBiomesDiagram = function,
|
||||||
|
},
|
||||||
|
x: integer,
|
||||||
|
y: integer,
|
||||||
|
z: integer
|
||||||
|
) -> number?
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Calculates a smoothed 2D noise value based on a preliminary space partitioning.
|
||||||
|
|
||||||
|
Returns `nil` if the point is not included in any triangle.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.onMapGenerated
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.onMapGenerated(
|
||||||
|
voxelManip: VoxelManip,
|
||||||
|
minPos: Position,
|
||||||
|
maxPos: Position,
|
||||||
|
blockseed: number
|
||||||
|
) -> nil
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Chunk generation handler.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.run
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
function MapGen.run() -> nil
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Run world generation through this mapgen object
|
||||||
|
|
||||||
|
Note: only one instance of a `MapGen` class can be running.
|
||||||
|
|
||||||
|
**FOR MAPGEN ENVIRONMENT ONLY**
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### MapGen.layersByName
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
MapGen.layersByName : table<string,MapGen.Layer>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.layersList
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
MapGen.layersList : MapGen.Layer[]
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.staticsByName
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
MapGen.staticsByName : table<string,MapGen.StaticLayer>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.staticsList
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
MapGen.staticsList : MapGen.StaticLayer[]
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.layersNoisesInitialized
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
MapGen.layersNoisesInitialized : boolean
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Is the fractal noise of the layer initialized? This is necessary for a one-time noise initialization.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.cavernsNoiseInitialized
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
MapGen.cavernsNoiseInitialized : boolean
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Is the fractal noise of the caverns initialized? This is necessary for a one-time noise initialization.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.isRunning
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
MapGen.isRunning : boolean
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
A static field that guarantees that only one instance of the `MapGen` class will work.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MapGen.nodeIDs
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
MapGen.nodeIDs : table<string,number>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
39
docs/docs/types/MapGenDef.md
Normal file
39
docs/docs/types/MapGenDef.md
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
# class MapGenDef
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Definition table for the `MapGen`.
|
||||||
|
|
||||||
|
**Only for EmmyLua.**
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## fields
|
||||||
|
---
|
||||||
|
|
||||||
|
### MapGenDef.nodes
|
||||||
|
---
|
||||||
|
```lua
|
||||||
|
MapGenDef.nodes : table<string,string>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
12
docs/docs/types/generateFunc.md
Normal file
12
docs/docs/types/generateFunc.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# alias generateFunc
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```lua
|
||||||
|
(alias) generateFunc = fun(self, mapGenerator: MapGen, data: number[], index: number, x: number, y: number, z: number)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
80
docs/mkdocs.yml
Normal file
80
docs/mkdocs.yml
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
|
||||||
|
site_name: Docs
|
||||||
|
|
||||||
|
|
||||||
|
theme:
|
||||||
|
name: material
|
||||||
|
font:
|
||||||
|
text: Roboto
|
||||||
|
code: Roboto Mono
|
||||||
|
search: true
|
||||||
|
features:
|
||||||
|
- quick-links
|
||||||
|
- navigation
|
||||||
|
- search
|
||||||
|
- toc
|
||||||
|
- fullscreen
|
||||||
|
- bookmarks
|
||||||
|
- tabs
|
||||||
|
- code
|
||||||
|
- edit-on-github
|
||||||
|
- language-selector
|
||||||
|
- code
|
||||||
|
- cover
|
||||||
|
- footer
|
||||||
|
- social-share
|
||||||
|
- theme-switcher
|
||||||
|
nav:
|
||||||
|
- Home: index.md
|
||||||
|
|
||||||
|
- Types:
|
||||||
|
- alias Category : types/MapGen.Layer.Category.md
|
||||||
|
- alias CircumCircleEnum : types/MapGen.Triangle.CircumCircleEnum.md
|
||||||
|
- alias ColoredDotsTable : types/ColoredDotsTable.md
|
||||||
|
- alias Neighbours : types/MapGen.Triangle.Neighbours.md
|
||||||
|
- alias PastCalcNoiseValue : types/MapGen.PastCalcNoiseValue.md
|
||||||
|
- alias generateFunc : types/generateFunc.md
|
||||||
|
- class Biome : types/MapGen.Biome.md
|
||||||
|
- class BiomeDef : types/MapGen.BiomeDef.md
|
||||||
|
- class Cavern : types/MapGen.Cavern.md
|
||||||
|
- class CavernDef : types/MapGen.CavernDef.md
|
||||||
|
- class Decoration : types/MapGen.Decoration.md
|
||||||
|
- class Edge : types/MapGen.Triangulation.Edge.md
|
||||||
|
- class FakePeak : types/MapGen.Triangulation.FakePeak.md
|
||||||
|
- class GroundNodes : types/MapGen.Biome.GroundNodes.md
|
||||||
|
- class GroundNodesIDs : types/MapGen.Biome.GroundNodesIDs.md
|
||||||
|
- class Layer : types/MapGen.Layer.md
|
||||||
|
- class LayerDef : types/MapGen.LayerDef.md
|
||||||
|
- class MapGen : types/MapGen.md
|
||||||
|
- class MapGenDef : types/MapGenDef.md
|
||||||
|
- class Peak : types/MapGen.Peak.md
|
||||||
|
- class PeakDef : types/MapGen.PeakDef.md
|
||||||
|
- class StaticLayer : types/MapGen.StaticLayer.md
|
||||||
|
- class StaticLayerDef : types/MapGen.StaticLayerDef.md
|
||||||
|
- class Tetrahedron : types/MapGen.Tetrahedron.md
|
||||||
|
- class Triangle : types/MapGen.Triangle.md
|
||||||
|
- class Triangulation : types/MapGen.Triangulation.md
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- Modules:
|
||||||
|
- MapGen : modules/MapGen.md
|
||||||
|
- MapGen.Biome : modules/MapGen.Biome.md
|
||||||
|
- MapGen.Biome.GroundNodes : modules/MapGen.Biome.GroundNodes.md
|
||||||
|
- MapGen.Biome.GroundNodesIds : modules/MapGen.Biome.GroundNodesIds.md
|
||||||
|
- MapGen.Cavern : modules/MapGen.Cavern.md
|
||||||
|
- MapGen.Decoration : modules/MapGen.Decoration.md
|
||||||
|
- MapGen.Layer : modules/MapGen.Layer.md
|
||||||
|
- MapGen.Peak : modules/MapGen.Peak.md
|
||||||
|
- MapGen.StaticLayer : modules/MapGen.StaticLayer.md
|
||||||
|
- MapGen.Tetrahedron : modules/MapGen.Tetrahedron.md
|
||||||
|
- MapGen.Triangle : modules/MapGen.Triangle.md
|
||||||
|
- MapGen.Triangulation : modules/MapGen.Triangulation.md
|
||||||
|
- MapGen.Triangulation.Edge : modules/MapGen.Triangulation.Edge.md
|
||||||
|
- MapGen.Triangulation.FakePeak : modules/MapGen.Triangulation.FakePeak.md
|
||||||
|
- MapGen.ff2luat : modules/MapGen.ff2luat.md
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
extra:
|
||||||
|
footer: ""
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
local modInfo = Mod.getInfo('smc__api__api_loader')
|
|
||||||
local require = modInfo.require
|
|
||||||
|
|
||||||
require('Api')
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
name = smc__api__api_loader
|
|
||||||
description = Include this mod in your `depends` to ensure all necessary APIs are loaded for your mod
|
|
||||||
depends = smc__api__ensure, smc__api__math, smc__api__mod, smc__api__require, smc__api__table, smc__api__string, smc__api__utf8, smc__api__class
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
Api = {}
|
|
||||||
|
|
||||||
local modInfo = Mod.getInfo('smc__api__api_loader')
|
|
||||||
local require = modInfo.require
|
|
||||||
|
|
||||||
require('Api.globalStep')
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
---@class Class
|
|
||||||
Class = {}
|
|
||||||
|
|
||||||
---Returns a child class with inherited parameters from the parent class.
|
|
||||||
---@param parent table
|
|
||||||
---@param child table
|
|
||||||
function Class.extend(parent ,child)
|
|
||||||
return setmetatable(child or {}, { __index = parent })
|
|
||||||
end
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
name = smc__api__class
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
name = smc__api__ensure
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
name = smc__api__events
|
|
||||||
depends = smc__api__table
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
name = smc__api__logger
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
name = smc__api__math
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
name = smc__api__mod
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
name = smc__api__require
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
name = smc__api__string
|
|
||||||
depends = smc__api__ensure
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
name = smc__api__table
|
|
||||||
depends = smc__api__ensure
|
|
||||||
Submodule mods/API/Utf8 deleted from d612fc127f
@@ -1 +0,0 @@
|
|||||||
name = smc__api
|
|
||||||
4
mods/CORE/BaseUI/init.lua
Normal file
4
mods/CORE/BaseUI/init.lua
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
local modInfo = Mod.getInfo('smc__core__base_ui')
|
||||||
|
local require = modInfo.require
|
||||||
|
|
||||||
|
return require('BaseUI')
|
||||||
2
mods/CORE/BaseUI/mod.conf
Normal file
2
mods/CORE/BaseUI/mod.conf
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
name = smc__core__base_ui
|
||||||
|
depends = smc__system__system_loader
|
||||||
130
mods/CORE/BaseUI/src/BaseUI.lua
Normal file
130
mods/CORE/BaseUI/src/BaseUI.lua
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
local getInstance = Class.getInstance
|
||||||
|
|
||||||
|
---@class BaseUI
|
||||||
|
---Context for transferring data between displaying
|
||||||
|
---the form spec to the player and handling callbacks.
|
||||||
|
---@field name string
|
||||||
|
---@field getFormSpecString fun(self:BaseUI,playerName:string,...):string
|
||||||
|
---@field contex table<string, table>
|
||||||
|
local BaseUI = {
|
||||||
|
contex = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
---@param name string The name of the formspec that will be shown to the player. It is recommended that the name be unique.
|
||||||
|
---@param getFormSpecString fun(self:BaseUI,playerName:string,...):string
|
||||||
|
---@param clearContex boolean? Whether to clear the context stored for a player when that player closes the form. Default `true`.
|
||||||
|
function BaseUI:new(name, getFormSpecString, clearContex)
|
||||||
|
if clearContex == nil then
|
||||||
|
clearContex = true
|
||||||
|
end
|
||||||
|
|
||||||
|
---@type BaseUI
|
||||||
|
local instance = getInstance(self, {})
|
||||||
|
instance.name = name
|
||||||
|
instance.getFormSpecString = getFormSpecString
|
||||||
|
|
||||||
|
if clearContex then
|
||||||
|
core.log(name)
|
||||||
|
-- Ensure that when the form is closed, the context is cleared.
|
||||||
|
instance:registerOnFormQuit(function(player)
|
||||||
|
instance:clearContex(player)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
return instance
|
||||||
|
end
|
||||||
|
|
||||||
|
---Set a value for a specific key.
|
||||||
|
---Recommended for use where `core.show_formspec` is used.
|
||||||
|
---
|
||||||
|
---In the future, the key value can be obtained in the formspec callback.
|
||||||
|
---@param player string|Player Player as an object (entity) or his name
|
||||||
|
---@param key string
|
||||||
|
---@param value any
|
||||||
|
function BaseUI:setContex(player, key, value)
|
||||||
|
if type(player) ~= 'string' then
|
||||||
|
player = player:get_player_name()
|
||||||
|
end
|
||||||
|
|
||||||
|
local contex = self.contex[player]
|
||||||
|
|
||||||
|
if contex == nil then
|
||||||
|
self.contex[player] = {[key]=value}
|
||||||
|
else
|
||||||
|
contex[key] = value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---Get the value of a specific key.
|
||||||
|
---Recommended for use in a formspec callback.
|
||||||
|
---@param player string|Player Player as an object (entity) or his name
|
||||||
|
---@param key string
|
||||||
|
---@return any?
|
||||||
|
function BaseUI:getContex(player, key)
|
||||||
|
if type(player) ~= 'string' then
|
||||||
|
player = player:get_player_name()
|
||||||
|
end
|
||||||
|
|
||||||
|
local contex = self.contex[player] or {}
|
||||||
|
return contex[key]
|
||||||
|
end
|
||||||
|
|
||||||
|
---Clear saved context data for a player.
|
||||||
|
---Recommended for use when closing formspec.
|
||||||
|
---@param player string|Player Player as an object (entity) or his name
|
||||||
|
function BaseUI:clearContex(player)
|
||||||
|
if type(player) ~= 'string' then
|
||||||
|
player = player:get_player_name()
|
||||||
|
end
|
||||||
|
|
||||||
|
self.contex[player] = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
---Register a callback for a specific player action in FormSpec.
|
||||||
|
---
|
||||||
|
---The callback is guaranteed to be called only for the specified field.
|
||||||
|
---@param fieldName string the name of the field for which the callback will be called.
|
||||||
|
---@param callback fun(player:Player, fieldName:string, fieldValue:any) Callback to handle the action. Parameters:
|
||||||
|
--- * `player` - the player who performed the action.
|
||||||
|
--- * `fieldName` - the name of the field on which the callback is called.
|
||||||
|
--- * `fieldValue` - the field value that is passed in the `fields` table.
|
||||||
|
function BaseUI:registerOnFormFieldAction(fieldName, callback)
|
||||||
|
Smc.registerOnFormFieldAction(self.name, fieldName, callback)
|
||||||
|
end
|
||||||
|
|
||||||
|
---Register a callback function to close the FormSpec.
|
||||||
|
---
|
||||||
|
---The callback is guaranteed to be called only for the specified form.
|
||||||
|
---@param callback fun(player:Player) Callback to handle the close. Parameters:
|
||||||
|
--- * `player` - the player who closed the form.
|
||||||
|
function BaseUI:registerOnFormQuit(callback)
|
||||||
|
Smc.registerOnFormQuit(self.name, callback)
|
||||||
|
end
|
||||||
|
|
||||||
|
---Register a callback for a specific player action in FormSpec.
|
||||||
|
---
|
||||||
|
---The callback function is guaranteed to be called only for the specified form and
|
||||||
|
---for the field whose name matches the pattern.
|
||||||
|
---@param fieldNamePattern string the name pattern of the field for which the callback will be called.
|
||||||
|
---@param callback fun(player:Player, fieldName:string, fieldValue:any) Callback to handle the action. Parameters:
|
||||||
|
--- * `player` - the player who performed the action.
|
||||||
|
--- * `fieldName` - the name of the field on which the callback is called (will match the pattern).
|
||||||
|
--- * `fieldValue` - the field value that is passed in the `fields` table.
|
||||||
|
function BaseUI:registerOnFormFieldActionMatch( fieldNamePattern, callback)
|
||||||
|
Smc.registerOnFormFieldActionMatch(self.name, fieldNamePattern, callback)
|
||||||
|
end
|
||||||
|
|
||||||
|
---Shows the player the FormSpec registered by the instance of this UI.
|
||||||
|
---@param playerName string
|
||||||
|
function BaseUI:showForm(playerName, ...)
|
||||||
|
core.show_formspec(playerName, self.name, self:getFormSpecString(playerName, ...))
|
||||||
|
end
|
||||||
|
|
||||||
|
---Close the player the FormSpec registered by the instance of this UI.
|
||||||
|
---@param playerName string
|
||||||
|
function BaseUI:closeForm(playerName)
|
||||||
|
core.close_formspec(playerName, self.name)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
return BaseUI
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
name = smc__core__control
|
name = smc__core__control
|
||||||
depends = smc__api__api_loader
|
depends = smc__system__system_loader
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
local Control = {}
|
local Control = {}
|
||||||
|
|
||||||
-- control.on_press
|
-- control.on_press
|
||||||
Events.registerEvent('control.on_press')
|
|
||||||
|
|
||||||
---@param callbackFunc fun(player:Player, controlName:string)
|
---@param callbackFunc fun(player:Player, controlName:string)
|
||||||
function Control.subcribeOnPress(callbackFunc)
|
function Control.subcribeOnPress(callbackFunc)
|
||||||
@@ -11,7 +10,6 @@ end
|
|||||||
|
|
||||||
|
|
||||||
-- control.on_release
|
-- control.on_release
|
||||||
Events.registerEvent('control.on_release')
|
|
||||||
|
|
||||||
---@param callbackFunc fun(player:Player, controlName:string, holdTime:number)
|
---@param callbackFunc fun(player:Player, controlName:string, holdTime:number)
|
||||||
function Control.subcribeOnRelease(callbackFunc)
|
function Control.subcribeOnRelease(callbackFunc)
|
||||||
@@ -20,7 +18,6 @@ end
|
|||||||
|
|
||||||
|
|
||||||
-- control.on_hold
|
-- control.on_hold
|
||||||
Events.registerEvent('control.on_hold')
|
|
||||||
|
|
||||||
---@param callbackFunc fun(player:Player, controlName:string, holdTime:number, dtime:number)
|
---@param callbackFunc fun(player:Player, controlName:string, holdTime:number, dtime:number)
|
||||||
function Control.subcribeOnHold(callbackFunc)
|
function Control.subcribeOnHold(callbackFunc)
|
||||||
@@ -29,7 +26,6 @@ end
|
|||||||
|
|
||||||
|
|
||||||
-- control.on_wield_change
|
-- control.on_wield_change
|
||||||
Events.registerEvent('control.on_wield_change')
|
|
||||||
|
|
||||||
---@param callbackFunc fun(player:Player, player_wield_index:number, player_last_wield_index:number)
|
---@param callbackFunc fun(player:Player, player_wield_index:number, player_last_wield_index:number)
|
||||||
function Control.subcribeOnWieldChange(callbackFunc)
|
function Control.subcribeOnWieldChange(callbackFunc)
|
||||||
@@ -80,7 +76,7 @@ core.register_on_leaveplayer(function(player, timed_out)
|
|||||||
playersControlTimer[playerName] = nil
|
playersControlTimer[playerName] = nil
|
||||||
end)
|
end)
|
||||||
|
|
||||||
Api.registerGlobalStepForEachPlayer(0, function(deltaTime, player)
|
Smc.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__api__api_loader
|
depends = smc__system__system_loader, smc__core__creature
|
||||||
|
|||||||
@@ -1,117 +1,28 @@
|
|||||||
local HASH_SPLITTER = '&'
|
|
||||||
|
|
||||||
local modInfo = Mod.getInfo('smc__core__craft_system')
|
local modInfo = Mod.getInfo('smc__core__craft_system')
|
||||||
local require = modInfo.require
|
local require = modInfo.require
|
||||||
|
|
||||||
---@alias CraftSystem.shapelessCraftsList table<CraftSystem.Craft.Group, table<string, CraftSystem.ShapelessCraft[]>>
|
---@type CraftSystem.PrimitiveCraftHandler
|
||||||
---@alias CraftSystem.processualCraftsList table<CraftSystem.Craft.Group, table<string, CraftSystem.ProcessualCraft[]>>
|
local PrimitiveCraftHandler = require('CraftSystem.PrimitiveCraftHandler')
|
||||||
|
---@type CraftSystem.ImmersiveCraftHandler
|
||||||
|
local ImmersiveCraftHandler= require('CraftSystem.ImmersiveCraftHandler')
|
||||||
|
|
||||||
|
---@alias CraftSystem.CraftGroup string
|
||||||
|
---@alias CraftSystem.CraftRecipe string[]
|
||||||
|
---@alias CraftSystem.CraftType 'primitive'|'immersive'
|
||||||
|
|
||||||
---@class CraftSystem
|
---@class CraftSystem
|
||||||
---@field shapelessCraftsList CraftSystem.shapelessCraftsList
|
local CraftSystem = {}
|
||||||
---@field processualCraftsList CraftSystem.processualCraftsList
|
|
||||||
local CraftSystem = {
|
|
||||||
shapelessCraftsList = {},
|
|
||||||
processualCraftsList = {},
|
|
||||||
}
|
|
||||||
|
|
||||||
---@alias CraftSystem.Craft.Type
|
---@param craftName string
|
||||||
---|'shapeless'
|
---@param def CraftSystem.PrimitiveCraftDef
|
||||||
---|'processual'
|
function CraftSystem.registerPrimitiveCraft(craftName, def)
|
||||||
---@alias CraftSystem.Craft.Group string
|
PrimitiveCraftHandler:registerCraft(craftName, def)
|
||||||
---@alias CraftSystem.Craft.Recipe string[]
|
|
||||||
|
|
||||||
---@alias shapelessCraftFunc fun(self:CraftSystem.ShapelessCraft, input:ItemStack[], workbenchMeta:NodeMetaRef?):boolean
|
|
||||||
---@alias processualCraftFunc fun(self:CraftSystem.ProcessualCraft, input:ItemStack[], workbenchMeta:NodeMetaRef?, processTime:number):boolean
|
|
||||||
|
|
||||||
---@class CraftSystem.BaseCraft
|
|
||||||
---@field type CraftSystem.Craft.Type
|
|
||||||
---@field group CraftSystem.Craft.Group
|
|
||||||
---@field output string
|
|
||||||
---@field recipe CraftSystem.Craft.Recipe
|
|
||||||
---@field return table? TODO: доделать тут тип
|
|
||||||
---@field craftFunc (fun(self, ...):boolean)?
|
|
||||||
|
|
||||||
---@class CraftSystem.ShapelessCraft : CraftSystem.BaseCraft
|
|
||||||
---@field craftFunc shapelessCraftFunc?
|
|
||||||
|
|
||||||
---@class CraftSystem.ProcessualCraft : CraftSystem.BaseCraft
|
|
||||||
---@field processTime number
|
|
||||||
---@field craftFunc processualCraftFunc?
|
|
||||||
|
|
||||||
---@param type CraftSystem.Craft.Type
|
|
||||||
---@return CraftSystem.shapelessCraftsList|CraftSystem.processualCraftsList
|
|
||||||
local function getCraftList(type)
|
|
||||||
local craftList
|
|
||||||
|
|
||||||
if type == 'shapeless' then
|
|
||||||
craftList = CraftSystem.shapelessCraftsList
|
|
||||||
elseif type == 'processual' then
|
|
||||||
craftList = CraftSystem.processualCraftsList
|
|
||||||
else
|
|
||||||
error(string.format('Craft type `%s` does not exist.', type))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return craftList
|
---@param craftName string
|
||||||
end
|
---@param def CraftSystem.ImmersiveCraftDef
|
||||||
|
function CraftSystem.registerImmersiveCraft(craftName, def)
|
||||||
---@param type CraftSystem.Craft.Type
|
ImmersiveCraftHandler:registerCraft(craftName, def)
|
||||||
---@param group CraftSystem.Craft.Group
|
|
||||||
---@return table<string, table>
|
|
||||||
local function getCraftGroup(type, group)
|
|
||||||
local craftList = getCraftList(type)
|
|
||||||
|
|
||||||
---@type table<string, table>?
|
|
||||||
local craftGroup = craftList[group]
|
|
||||||
|
|
||||||
assert(craftGroup ~= nil, string.format('Craft group `%s` does not exist.', type))
|
|
||||||
|
|
||||||
return craftGroup
|
|
||||||
end
|
|
||||||
|
|
||||||
---@param type CraftSystem.Craft.Type
|
|
||||||
---@param group CraftSystem.Craft.Group
|
|
||||||
function CraftSystem.registerCraftGroup(type, group)
|
|
||||||
local craftList = getCraftList(type)
|
|
||||||
|
|
||||||
assert(craftList[group] == nil, string.format('Craft group `%s` is already registered.', type))
|
|
||||||
|
|
||||||
craftList[group] = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
---@param recipe CraftSystem.Craft.Recipe
|
|
||||||
---@return string
|
|
||||||
function CraftSystem.getCraftHash(recipe)
|
|
||||||
table.sort(recipe)
|
|
||||||
|
|
||||||
local hash = ''
|
|
||||||
|
|
||||||
for i = 0, #recipe-1 do
|
|
||||||
hash = hash..recipe[i]..HASH_SPLITTER
|
|
||||||
end
|
|
||||||
|
|
||||||
return hash..recipe[#recipe]
|
|
||||||
end
|
|
||||||
|
|
||||||
---@param craftDef CraftSystem.ShapelessCraft|CraftSystem.ProcessualCraft
|
|
||||||
function CraftSystem.registerCraft(craftDef)
|
|
||||||
local craftGroup = getCraftGroup(craftDef.type, craftDef.group)
|
|
||||||
|
|
||||||
local hash = CraftSystem.getCraftHash(craftDef.recipe)
|
|
||||||
|
|
||||||
table.insert(craftGroup[hash], craftDef)
|
|
||||||
end
|
|
||||||
|
|
||||||
---@param type CraftSystem.Craft.Type
|
|
||||||
---@param group CraftSystem.Craft.Group
|
|
||||||
---@return CraftSystem.ShapelessCraft[] |
|
|
||||||
--- CraftSystem.processualCraftsList[] |
|
|
||||||
--- nil
|
|
||||||
function CraftSystem.getCraftResults(type, group, recipe)
|
|
||||||
local craftGroup = getCraftGroup(type, group)
|
|
||||||
|
|
||||||
local hash = CraftSystem.getCraftHash(recipe)
|
|
||||||
|
|
||||||
return craftGroup[hash]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return CraftSystem
|
return CraftSystem
|
||||||
13
mods/CORE/CraftSystem/src/CraftSystem/BaseCraft.lua
Normal file
13
mods/CORE/CraftSystem/src/CraftSystem/BaseCraft.lua
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
---Abstract class for craft.
|
||||||
|
---@class CraftSystem.BaseCraft
|
||||||
|
---@field name string
|
||||||
|
---@field group CraftSystem.CraftGroup
|
||||||
|
local BaseCraft = {}
|
||||||
|
|
||||||
|
---Definition table for the `CraftSystem.BaseCraft`.
|
||||||
|
---
|
||||||
|
---**Only for EmmyLua.**
|
||||||
|
---@class CraftSystem.BaseCraftDef
|
||||||
|
---@field group CraftSystem.CraftGroup
|
||||||
|
|
||||||
|
return BaseCraft
|
||||||
47
mods/CORE/CraftSystem/src/CraftSystem/BaseCraftHandler.lua
Normal file
47
mods/CORE/CraftSystem/src/CraftSystem/BaseCraftHandler.lua
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
---Abstract class for handling crafting.
|
||||||
|
---@class CraftSystem.BaseCraftHandler
|
||||||
|
---@field craftsByName table<string, CraftSystem.BaseCraft>
|
||||||
|
---@field craftsByGroup table<CraftSystem.CraftGroup, CraftSystem.BaseCraft[]>
|
||||||
|
---@field craftsList CraftSystem.BaseCraft[]
|
||||||
|
---@field learnedCrafts table<string, table<string, CraftSystem.BaseCraft>>
|
||||||
|
local BaseCraftHandler = {
|
||||||
|
craftsByName = {},
|
||||||
|
craftsByGroup = {},
|
||||||
|
craftsList = {},
|
||||||
|
learnedCrafts = {},
|
||||||
|
}
|
||||||
|
|
||||||
|
---@param craftName string
|
||||||
|
---@return CraftSystem.BaseCraft
|
||||||
|
function BaseCraftHandler:getCraftByName(craftName)
|
||||||
|
local craft = self.craftsByName[craftName]
|
||||||
|
|
||||||
|
assert(craft ~= nil, ('There is no primitive craft named `%s`.'):format(
|
||||||
|
craftName))
|
||||||
|
|
||||||
|
return craft
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param craftGroup CraftSystem.CraftGroup
|
||||||
|
---@return CraftSystem.BaseCraft[]
|
||||||
|
function BaseCraftHandler:getCraftsByGroup(craftGroup)
|
||||||
|
local crafts = self.craftsByGroup[craftGroup]
|
||||||
|
|
||||||
|
assert(crafts ~= nil, ('There are no primitive crafts with `%s` group'):format(
|
||||||
|
craftGroup))
|
||||||
|
|
||||||
|
return crafts
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param playerName string
|
||||||
|
---@return table<string, CraftSystem.BaseCraft>
|
||||||
|
function BaseCraftHandler:getLearnedCrafts(playerName)
|
||||||
|
local crafts = self.learnedCrafts[playerName]
|
||||||
|
|
||||||
|
assert(crafts ~= nil, ('There is no primitive crafting data for a player named `%s`.'):format(
|
||||||
|
playerName))
|
||||||
|
|
||||||
|
return crafts
|
||||||
|
end
|
||||||
|
|
||||||
|
return BaseCraftHandler
|
||||||
237
mods/CORE/CraftSystem/src/CraftSystem/ImmersiveCraft.lua
Normal file
237
mods/CORE/CraftSystem/src/CraftSystem/ImmersiveCraft.lua
Normal file
@@ -0,0 +1,237 @@
|
|||||||
|
local getInstance, extend = Class.getInstance, Class.extend
|
||||||
|
|
||||||
|
local modInfo = Mod.getInfo('smc__core__craft_system')
|
||||||
|
local require = modInfo.require
|
||||||
|
|
||||||
|
---@type CraftSystem.BaseCraft
|
||||||
|
local BaseCraft = require('CraftSystem.BaseCraft')
|
||||||
|
---@type CraftSystem.ImmersiveCraftCounter
|
||||||
|
local ImmersiveCraftCounter = require('CraftSystem.ImmersiveCraftCounter')
|
||||||
|
|
||||||
|
---Types of immersive stages.
|
||||||
|
---@class CraftSystem.StagesTypes : table<CraftSystem.ImmersiveCraftStage.Type, CraftSystem.ImmersiveCraftStage>
|
||||||
|
local stageTypes = {
|
||||||
|
---@type CraftSystem.ImmersiveCraftStage.TappingStage
|
||||||
|
tapping = require('CraftSystem.ImmersiveCraftStage.TappingStage'),
|
||||||
|
}
|
||||||
|
|
||||||
|
---Immersive crafting aimed at a more logical process of crafting items.
|
||||||
|
---@class CraftSystem.ImmersiveCraft : CraftSystem.BaseCraft
|
||||||
|
---@field startStageName string
|
||||||
|
---@field triggerItem string
|
||||||
|
---@field output ItemStackString
|
||||||
|
---@field stagesByName table<string, CraftSystem.ImmersiveCraftStage>
|
||||||
|
local ImmersiveCraft = extend(BaseCraft, {})
|
||||||
|
|
||||||
|
---Definition table for the `CraftSystem.ImmersiveCraft`.
|
||||||
|
---
|
||||||
|
---**Only for EmmyLua.**
|
||||||
|
---@class CraftSystem.ImmersiveCraftDef : CraftSystem.BaseCraftDef
|
||||||
|
---@field startStageName string
|
||||||
|
---@field triggerItem string
|
||||||
|
---@field output string
|
||||||
|
---@field stages CraftSystem.ImmersiveCraftStageDef[]
|
||||||
|
|
||||||
|
---@param name string
|
||||||
|
---@param def CraftSystem.ImmersiveCraftDef
|
||||||
|
---@return CraftSystem.ImmersiveCraft
|
||||||
|
function ImmersiveCraft:new(name, def)
|
||||||
|
-- We create a table of crafting stages that the player needs to complete.
|
||||||
|
---@type table<string, CraftSystem.ImmersiveCraftStage>
|
||||||
|
local stagesByName = {}
|
||||||
|
|
||||||
|
for _, stageDef in ipairs(def.stages) do
|
||||||
|
-- We get the stage class based on its type.
|
||||||
|
local StageClass = stageTypes[stageDef.type]
|
||||||
|
|
||||||
|
-- Create a stage and add the craft name to the instance.
|
||||||
|
stageDef.craftName = name
|
||||||
|
local stage = StageClass:new(stageDef)
|
||||||
|
|
||||||
|
-- We add an instance of the stage to the table by name.
|
||||||
|
stagesByName[stageDef.name] = stage
|
||||||
|
end
|
||||||
|
|
||||||
|
---@type CraftSystem.ImmersiveCraft
|
||||||
|
local instance = getInstance(self, {})
|
||||||
|
instance.name = name
|
||||||
|
instance.group = def.group
|
||||||
|
instance.startStageName = def.startStageName
|
||||||
|
instance.triggerItem = def.triggerItem
|
||||||
|
instance.output = def.output
|
||||||
|
instance.stagesByName = stagesByName
|
||||||
|
|
||||||
|
-- Subscribe to an event that will determine that the player has completed the crafting stage.
|
||||||
|
Events.subscribe('craft_system:next_immersive_stage:'..name,
|
||||||
|
---@param eventName string
|
||||||
|
---@param stage CraftSystem.ImmersiveCraftStage
|
||||||
|
---@param pos MapPosition
|
||||||
|
---@param Player Player
|
||||||
|
function(eventName, stage, pos, Player)
|
||||||
|
-- From the current stage (which has been completed) we get the name of the next one.
|
||||||
|
local nextStageName = stage.nextStage
|
||||||
|
|
||||||
|
-- If there is no next stage...
|
||||||
|
if nextStageName == nil then
|
||||||
|
-- ...we are finishing the craft.
|
||||||
|
instance:endCraft(pos, Player)
|
||||||
|
else
|
||||||
|
-- ...else we start the next stage.
|
||||||
|
local nextStage = instance.stagesByName[nextStageName]
|
||||||
|
|
||||||
|
-- We get a table of temporary data.
|
||||||
|
local craftData = Smc.getCraftDataByPos(pos)
|
||||||
|
assert(craftData ~= nil, 'Immersive crafting data is empty.')
|
||||||
|
|
||||||
|
-- We are updating the crafting stage in it.
|
||||||
|
craftData.stageName = nextStageName
|
||||||
|
-- We save it to the workstation metadata.
|
||||||
|
Smc.setCraftDataByPos(pos, craftData)
|
||||||
|
|
||||||
|
-- We are starting the next stage of crafting.
|
||||||
|
nextStage:startHandler(pos, Player)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
return instance
|
||||||
|
end
|
||||||
|
|
||||||
|
---Initialize the start of the immersive crafting process.
|
||||||
|
---
|
||||||
|
---Returns `true` if the crafting process was running.
|
||||||
|
---@param pos MapPosition
|
||||||
|
---@param player Player
|
||||||
|
---@param amount integer
|
||||||
|
---@return boolean
|
||||||
|
function ImmersiveCraft:startCraft(pos, player, amount)
|
||||||
|
-- Adding craft to the counter.
|
||||||
|
-- If crafting has not been added...
|
||||||
|
if not ImmersiveCraftCounter:addCraft(pos, player:get_player_name()) then
|
||||||
|
-- ...then we don't let the player start a new craft.
|
||||||
|
core.chat_send_player(player:get_player_name(),
|
||||||
|
'The limit of simultaneously active crafts has been reached: '..
|
||||||
|
'complete or cancel active crafts to start a new one')
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- We get the material as an ItemStack.
|
||||||
|
---@type ItemStack
|
||||||
|
local stack = ItemStack(self.triggerItem)
|
||||||
|
-- We edit the amount of materials in accordance with the number of crafts being performed.
|
||||||
|
stack:set_count(stack:get_count() * amount)
|
||||||
|
|
||||||
|
-- We get the player's inventory, from where we must take the materials for crafting.
|
||||||
|
local playerInventory = player:get_inventory()
|
||||||
|
|
||||||
|
-- If the player does not have the necessary materials for crafting...
|
||||||
|
if not playerInventory:contains_item('main', stack) then
|
||||||
|
-- ...we inform him about this.
|
||||||
|
core.chat_send_player(player:get_player_name(),
|
||||||
|
'Not enough materials for crafting')
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- If we have the materials, we take them and start initializing the craft.
|
||||||
|
playerInventory:remove_item('main', stack)
|
||||||
|
|
||||||
|
-- We get the first stage of crafting.
|
||||||
|
local stage = self.stagesByName[self.startStageName]
|
||||||
|
|
||||||
|
-- Create a temporary data table for crafting.
|
||||||
|
---@type ImmersiveCraftData
|
||||||
|
local craftData = {
|
||||||
|
playerName = player:get_player_name(), -- The name of the player who started the craft.
|
||||||
|
craftName = self.name,
|
||||||
|
stageName = stage.name,
|
||||||
|
amount = amount,
|
||||||
|
}
|
||||||
|
-- We save it to the workstation metadata.
|
||||||
|
Smc.setCraftDataByPos(pos, craftData)
|
||||||
|
|
||||||
|
-- We are starting the first stage of crafting.
|
||||||
|
stage:startHandler(pos, player)
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
---Complete the immersive crafting process.
|
||||||
|
---@param pos MapPosition
|
||||||
|
---@param player Player
|
||||||
|
function ImmersiveCraft:endCraft(pos, player)
|
||||||
|
-- We get current data on crafting.
|
||||||
|
---@type ImmersiveCraftData?
|
||||||
|
local craftData = Smc.getCraftDataByPos(pos)
|
||||||
|
assert(craftData ~= nil, 'Immersive crafting data is empty.')
|
||||||
|
|
||||||
|
-- We drop the result of crafting.
|
||||||
|
local dropPos = vector.new(pos) + vector.new(0, 0.9,0)
|
||||||
|
for i=1, craftData.amount do
|
||||||
|
core.item_drop(ItemStack(self.output), nil, dropPos)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Remove craft from the counter.
|
||||||
|
ImmersiveCraftCounter:removeCraft(pos, craftData.playerName)
|
||||||
|
|
||||||
|
-- Clearing the temporary data table for crafting, freeing up the work station for new crafts.
|
||||||
|
Smc.setCraftDataByPos(pos)
|
||||||
|
end
|
||||||
|
|
||||||
|
---Stop the crafting process and free up the workbench.
|
||||||
|
---@param pos MapPosition
|
||||||
|
function ImmersiveCraft:abortCraft(pos)
|
||||||
|
-- We get current data on crafting.
|
||||||
|
---@type ImmersiveCraftData?
|
||||||
|
local craftData = Smc.getCraftDataByPos(pos)
|
||||||
|
assert(craftData ~= nil, 'Immersive crafting data is empty.')
|
||||||
|
|
||||||
|
-- We get the current stage and start the abort process.
|
||||||
|
local stage = self.stagesByName[craftData.stageName]
|
||||||
|
stage:abortHandler(pos)
|
||||||
|
|
||||||
|
-- Clearing the temporary data table for crafting, freeing up the work station for new crafts.
|
||||||
|
Smc.setCraftDataByPos(pos)
|
||||||
|
|
||||||
|
-- Remove craft from the counter.
|
||||||
|
ImmersiveCraftCounter:removeCraft(pos, craftData.playerName)
|
||||||
|
end
|
||||||
|
|
||||||
|
---Returns a human-readable description of the crafting process.
|
||||||
|
---@return string
|
||||||
|
function ImmersiveCraft:toString()
|
||||||
|
-- We get the material as an ItemStack.
|
||||||
|
---@type ItemStack
|
||||||
|
local stack = ItemStack(self.triggerItem)
|
||||||
|
-- We obtain a table of item parameters.
|
||||||
|
---@type ItemDefinition
|
||||||
|
local itemDef = stack:get_definition()
|
||||||
|
|
||||||
|
-- Let's start writing a description of the craft.
|
||||||
|
local craftDesc = ('Material: %s x%s\n\n'):format(itemDef._title, stack:get_count())..
|
||||||
|
'Crafting process:\n'
|
||||||
|
|
||||||
|
-- Let's start with the first crafting stage.
|
||||||
|
---@type string?
|
||||||
|
local stageName = self.startStageName
|
||||||
|
local stages = self.stagesByName
|
||||||
|
|
||||||
|
-- While we have a stage name...
|
||||||
|
local count = 1
|
||||||
|
while stageName ~= nil do
|
||||||
|
-- We get a crafting stage...
|
||||||
|
local stage = stages[stageName]
|
||||||
|
|
||||||
|
-- ...and we add its description to the list of actions for crafting.
|
||||||
|
craftDesc = craftDesc..tostring(count)..'. '..stage:toString()..'\n'
|
||||||
|
|
||||||
|
-- We also get the name of the next stage.
|
||||||
|
stageName = stage.nextStage
|
||||||
|
end
|
||||||
|
|
||||||
|
-- If the cycle is interrupted, it means we have processed all the stages.
|
||||||
|
-- Return the craft description.
|
||||||
|
return craftDesc
|
||||||
|
end
|
||||||
|
|
||||||
|
return ImmersiveCraft
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
local posToString, getSize = core.pos_to_string, table.get_size
|
||||||
|
|
||||||
|
local CRAFT_LIMIT_PER_PLAYER = 2
|
||||||
|
local CRAFT_LIMIT_PER_SERVER = 10
|
||||||
|
|
||||||
|
local modStorage = core.get_mod_storage()
|
||||||
|
|
||||||
|
---@param key string
|
||||||
|
---@return table
|
||||||
|
local function getStorageTable(key)
|
||||||
|
return core.deserialize(modStorage:get_string(key)) or {}
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param key string
|
||||||
|
---@param t table
|
||||||
|
local function setStorageTable(key, t)
|
||||||
|
modStorage:set_string(key, core.serialize(t))
|
||||||
|
end
|
||||||
|
|
||||||
|
---Designed to keep track of active immersive
|
||||||
|
---crafts so as not to overload the server.
|
||||||
|
---
|
||||||
|
---The counter is individual for each player,
|
||||||
|
---but the total number of active crafts is also tracked.
|
||||||
|
---@class CraftSystem.ImmersiveCraftCounter
|
||||||
|
---@field craftsCountForPlayers table<string, table<string, boolean>>
|
||||||
|
---@field craftsCountForServer table<string, boolean>
|
||||||
|
local ImmersiveCraftCounter = {
|
||||||
|
craftsCountForPlayers = getStorageTable('crafts_count_for_players'),
|
||||||
|
craftsCountForServer = getStorageTable('crafts_count_for_serves')
|
||||||
|
}
|
||||||
|
|
||||||
|
---Add craft to the counter.
|
||||||
|
---
|
||||||
|
---Returns `false` if the counter is already full.
|
||||||
|
---@param pos MapPosition
|
||||||
|
---@param playerName string
|
||||||
|
---@return boolean
|
||||||
|
function ImmersiveCraftCounter:addCraft(pos, playerName)
|
||||||
|
if self.craftsCountForPlayers[playerName] == nil then
|
||||||
|
self.craftsCountForPlayers[playerName] = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
if getSize(self.craftsCountForPlayers[playerName]) >= CRAFT_LIMIT_PER_PLAYER then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
if getSize(self.craftsCountForServer) >= CRAFT_LIMIT_PER_SERVER then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local posString = posToString(pos)
|
||||||
|
self.craftsCountForPlayers[playerName][posString] = true
|
||||||
|
self.craftsCountForServer[posString] = true
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
---Remove craft from the counter.
|
||||||
|
---@param pos MapPosition
|
||||||
|
---@param playerName string
|
||||||
|
function ImmersiveCraftCounter:removeCraft(pos, playerName)
|
||||||
|
local playerCrafts = self.craftsCountForPlayers[playerName]
|
||||||
|
if playerCrafts == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local posString = posToString(pos)
|
||||||
|
playerCrafts[posString] = nil
|
||||||
|
self.craftsCountForServer[posString] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
core.register_on_shutdown(function()
|
||||||
|
setStorageTable('crafts_count_for_players', ImmersiveCraftCounter.craftsCountForPlayers)
|
||||||
|
setStorageTable('crafts_count_for_server', ImmersiveCraftCounter.craftsCountForServer)
|
||||||
|
end)
|
||||||
|
|
||||||
|
return ImmersiveCraftCounter
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
local extend = Class.extend
|
||||||
|
|
||||||
|
local tableInsert = table.insert
|
||||||
|
|
||||||
|
local modInfo = Mod.getInfo('smc__core__craft_system')
|
||||||
|
local require = modInfo.require
|
||||||
|
|
||||||
|
---@type CraftSystem.BaseCraftHandler
|
||||||
|
local BaseCraftHandler = require('CraftSystem.BaseCraftHandler')
|
||||||
|
---@type CraftSystem.ImmersiveCraft
|
||||||
|
local ImmersiveCraft = require('CraftSystem.ImmersiveCraft')
|
||||||
|
|
||||||
|
---A handler for immersive crafting that requires the player to complete
|
||||||
|
---crafting stages and interact with entities (crafting nodes)
|
||||||
|
---@class CraftSystem.ImmersiveCraftHandler : CraftSystem.BaseCraftHandler
|
||||||
|
---@field craftsByTriggerItem table<string, CraftSystem.ImmersiveCraft[]>
|
||||||
|
---@field getCraftByName fun(self, craftName:string):CraftSystem.ImmersiveCraft
|
||||||
|
---@field getCraftsByGroup fun(self, craftGroup):CraftSystem.ImmersiveCraft[]
|
||||||
|
---@field getLearnedCrafts fun(self, playerName):table<string, CraftSystem.ImmersiveCraft>
|
||||||
|
local ImmersiveCraftHandler = extend(BaseCraftHandler, {
|
||||||
|
craftsByTriggerItem = {},
|
||||||
|
})
|
||||||
|
|
||||||
|
---Register an immersive crafting experience that requires the player to complete
|
||||||
|
---one or more crafting stages that involve interaction with entities (crafting nodes)
|
||||||
|
---@param craftName string
|
||||||
|
---@param def CraftSystem.ImmersiveCraftDef
|
||||||
|
function ImmersiveCraftHandler:registerCraft(craftName, def)
|
||||||
|
assert(self.craftsByName[craftName] == nil, ('A craft named `%s` already exists.'):format(
|
||||||
|
craftName))
|
||||||
|
|
||||||
|
-- We obtain a crafting instance according to the given parameters.
|
||||||
|
local craft = ImmersiveCraft:new(craftName, def)
|
||||||
|
|
||||||
|
-- The craft group to which the craft belongs.
|
||||||
|
local group = def.group
|
||||||
|
|
||||||
|
-- If no craft with this group has been registered before...
|
||||||
|
if self.craftsByGroup[group] == nil then
|
||||||
|
-- ...then we create a list for this group.
|
||||||
|
self.craftsByGroup[group] = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
-- The material from which crafting begins (also known as the starting item).
|
||||||
|
local triggerItem = def.triggerItem
|
||||||
|
|
||||||
|
-- If no crafting for such a starting item has been registered before...
|
||||||
|
if self.craftsByTriggerItem[triggerItem] == nil then
|
||||||
|
-- ...then we create a list for this item.
|
||||||
|
self.craftsByTriggerItem[triggerItem] = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Adding craft to the lists:
|
||||||
|
self.craftsByName[craftName] = craft
|
||||||
|
tableInsert(self.craftsByGroup[group], craft)
|
||||||
|
tableInsert(self.craftsByTriggerItem[triggerItem], craft)
|
||||||
|
tableInsert(self.craftsList, craft)
|
||||||
|
end
|
||||||
|
|
||||||
|
---Returns a list of crafts that use the given item as a starting material.
|
||||||
|
---
|
||||||
|
---Will return `nil` if the item is not used in any craft as a starting item.
|
||||||
|
---@param triggerItem string
|
||||||
|
---@return CraftSystem.ImmersiveCraft[]?
|
||||||
|
function ImmersiveCraftHandler:getCraftsByTriggerItem(triggerItem)
|
||||||
|
local crafts = self.craftsByTriggerItem[triggerItem]
|
||||||
|
|
||||||
|
return crafts
|
||||||
|
end
|
||||||
|
|
||||||
|
return ImmersiveCraftHandler
|
||||||
14
mods/CORE/CraftSystem/src/CraftSystem/ImmersiveCraftNode.lua
Normal file
14
mods/CORE/CraftSystem/src/CraftSystem/ImmersiveCraftNode.lua
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
---@type Creature
|
||||||
|
local Creature = Mod.getInfo('smc__core__creature').require('Creature')
|
||||||
|
|
||||||
|
---The entity the player interacts with during immersive crafting.
|
||||||
|
---@class CraftSystem.ImmersiveCraftNode : Creature
|
||||||
|
local ImmersiveCraftNode = Creature:getExtended({
|
||||||
|
settings = {
|
||||||
|
_name = 'craft_system:immersive_craft_node',
|
||||||
|
_add_mod_name = false,
|
||||||
|
initial_properties = {},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return ImmersiveCraftNode
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
local modInfo = Mod.getInfo('smc__core__craft_system')
|
||||||
|
local require = modInfo.require
|
||||||
|
|
||||||
|
---@type CraftSystem.ImmersiveCraftNode
|
||||||
|
local ImmersiveCraftNode = require('CraftSystem.ImmersiveCraftNode')
|
||||||
|
|
||||||
|
---A class that extends `Creature.LuaEntity` to annotate custom fields needed for immersive crafting.
|
||||||
|
---
|
||||||
|
---**Only for EmmyLua.**
|
||||||
|
---@class CraftSystem.ImmersiveCraftNode.LuaTappingNode : Creature.LuaEntity
|
||||||
|
---The name of the item that the crafting node display.
|
||||||
|
---@field _item_name ItemStackString
|
||||||
|
---Sets the entity display of the item. If the item stack was not transferred, `self._item_name` is used.
|
||||||
|
---@field _set_item fun(self:CraftSystem.ImmersiveCraftNode.LuaTappingNode, itemName:ItemStackString?)
|
||||||
|
---@field _craft_name string
|
||||||
|
---@field _stage_name string
|
||||||
|
---@field _work_station_pos MapPosition
|
||||||
|
|
||||||
|
-- A crafting node (entity) that is used in the tapping crafting stage.
|
||||||
|
local tappingNode = ImmersiveCraftNode:new({
|
||||||
|
settings = {
|
||||||
|
_name = 'craft_system:tapping_node',
|
||||||
|
_add_mod_name = false,
|
||||||
|
|
||||||
|
---@type ObjectProperties
|
||||||
|
initial_properties = {
|
||||||
|
visual = 'wielditem',
|
||||||
|
visual_size = {x=0.5, y=0.5, z=0.5},
|
||||||
|
collisionbox = {
|
||||||
|
-0.375, -0.375, -0.375,
|
||||||
|
0.375, 0.375, 0.375
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
_item_name = '',
|
||||||
|
_craft_name = '',
|
||||||
|
_stage_name = '',
|
||||||
|
_work_station_pos = {},
|
||||||
|
},
|
||||||
|
callbacks = {
|
||||||
|
---@param luaEntity CraftSystem.ImmersiveCraftNode.LuaTappingNode
|
||||||
|
on_activate = function(luaEntity, staticdata, dtime)
|
||||||
|
-- We obtain a table of initial parameters for the craft node entity.
|
||||||
|
---@type CraftSystem.ImmersiveCraftStage.TappingNode.InitParams?
|
||||||
|
local params = core.deserialize(staticdata)
|
||||||
|
|
||||||
|
-- We enter parameters into the entity's custom fields.
|
||||||
|
if params ~= nil then
|
||||||
|
luaEntity._item_name = params.targetItem
|
||||||
|
luaEntity._craft_name = params.craftName
|
||||||
|
luaEntity._stage_name = params.stageName
|
||||||
|
luaEntity._work_station_pos = params.WorkStationPos
|
||||||
|
end
|
||||||
|
|
||||||
|
-- we set the appearance of the item to be processed on the crafting node.
|
||||||
|
luaEntity:_set_item(luaEntity._item_name)
|
||||||
|
-- We add an immortal group to the entity so that it cannot be killed.
|
||||||
|
luaEntity.object:set_armor_groups({immortal = 1})
|
||||||
|
end,
|
||||||
|
|
||||||
|
---@param luaEntity CraftSystem.ImmersiveCraftNode.LuaTappingNode
|
||||||
|
on_punch = function(luaEntity, puncher, time_from_last_punch, tool_capabilities, dir, damage)
|
||||||
|
-- We simply trigger the event that the player hits the crafting node, bound to the work station with coordinates.
|
||||||
|
Events.call(('craft_system:punch_tapping_node:%s:%s'):format(
|
||||||
|
luaEntity._craft_name, luaEntity._stage_name), luaEntity._work_station_pos, puncher, luaEntity)
|
||||||
|
|
||||||
|
return false
|
||||||
|
end,
|
||||||
|
|
||||||
|
---@param luaEntity CraftSystem.ImmersiveCraftNode.LuaTappingNode
|
||||||
|
get_staticdata = function(luaEntity)
|
||||||
|
---@type CraftSystem.ImmersiveCraftStage.TappingNode.InitParams?
|
||||||
|
local params = {
|
||||||
|
targetItem = luaEntity._item_name,
|
||||||
|
craftName = luaEntity._craft_name,
|
||||||
|
stageName = luaEntity._stage_name,
|
||||||
|
WorkStationPos = luaEntity._work_station_pos
|
||||||
|
}
|
||||||
|
|
||||||
|
return core.serialize(params)
|
||||||
|
end,
|
||||||
|
|
||||||
|
---Sets the entity display of the item. If the item stack was not transferred, `self._item_name` is used.
|
||||||
|
---@param luaEntity CraftSystem.ImmersiveCraftNode.LuaTappingNode
|
||||||
|
---@param itemName ItemStackString?
|
||||||
|
_set_item = function(luaEntity, itemName)
|
||||||
|
-- We change the entity field so that the engine itself displays it as a given item.
|
||||||
|
luaEntity.object:set_properties({
|
||||||
|
wield_item = itemName or luaEntity._item_name,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return tappingNode
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
local getInstance = Class.getInstance
|
||||||
|
|
||||||
|
---@alias CraftSystem.ImmersiveCraftStage.Type 'tapping'
|
||||||
|
|
||||||
|
---One of the stages of immersive crafting.
|
||||||
|
---@class CraftSystem.ImmersiveCraftStage
|
||||||
|
---@field name string
|
||||||
|
---@field type CraftSystem.ImmersiveCraftStage.Type
|
||||||
|
---@field craftName string
|
||||||
|
---@field startHandler fun(self, pos:Position, player:Player)
|
||||||
|
---@field processHandler fun(self, pos:Position, player:Player)
|
||||||
|
---@field endHandler fun(self, pos:Position, player:Player)
|
||||||
|
---@field abortHandler fun(self, pos:Position)
|
||||||
|
---@field toString fun(self):string
|
||||||
|
---@field nextStage string?
|
||||||
|
---@field returnItems ItemStackString[]?
|
||||||
|
local ImmersiveCraftStage = {}
|
||||||
|
|
||||||
|
---Definition table for the `CraftSystem.ImmersiveCraft`.
|
||||||
|
---
|
||||||
|
---**Only for EmmyLua.**
|
||||||
|
---@class CraftSystem.ImmersiveCraftStageDef
|
||||||
|
---@field name string
|
||||||
|
---@field type CraftSystem.ImmersiveCraftStage.Type
|
||||||
|
---@field craftName string?
|
||||||
|
---@field nextStage string?
|
||||||
|
---@field returnItems ItemStackString[]?
|
||||||
|
|
||||||
|
---@param def CraftSystem.ImmersiveCraftStageDef
|
||||||
|
---@return CraftSystem.ImmersiveCraftStage
|
||||||
|
function ImmersiveCraftStage:new(def)
|
||||||
|
---@type CraftSystem.ImmersiveCraftStage
|
||||||
|
local instance = getInstance(self, {})
|
||||||
|
instance.name = def.name
|
||||||
|
instance.type = def.type
|
||||||
|
instance.craftName = def.craftName
|
||||||
|
instance.nextStage = def.nextStage
|
||||||
|
instance.returnItems = def.returnItems
|
||||||
|
|
||||||
|
return instance
|
||||||
|
end
|
||||||
|
|
||||||
|
return ImmersiveCraftStage
|
||||||
@@ -0,0 +1,202 @@
|
|||||||
|
local extend = Class.extend
|
||||||
|
|
||||||
|
local getStageDataByPos, setStageDataByPos = Smc.getStageDataByPos, Smc.setStageDataByPos
|
||||||
|
|
||||||
|
local require = Mod.getInfo('smc__core__craft_system').require
|
||||||
|
|
||||||
|
---@type CraftSystem.ImmersiveCraftStage
|
||||||
|
local ImmersiveCraftStage = require('CraftSystem.ImmersiveCraftStage')
|
||||||
|
|
||||||
|
---A crafting step that requires the player to hit a crafting node (entity) a certain number of times.
|
||||||
|
---@class CraftSystem.ImmersiveCraftStage.TappingStage : CraftSystem.ImmersiveCraftStage
|
||||||
|
---@field targetItem string
|
||||||
|
---@field clicksNeed string
|
||||||
|
---@field toolGroup string?
|
||||||
|
---@field startHandler fun(self:CraftSystem.ImmersiveCraftStage.TappingStage, pos:MapPosition, Player:Player)
|
||||||
|
---@field processHandler fun(self:CraftSystem.ImmersiveCraftStage.TappingStage, pos:MapPosition, Player:Player)
|
||||||
|
---@field endHandler fun(self:CraftSystem.ImmersiveCraftStage.TappingStage, pos:MapPosition, Player:Player)
|
||||||
|
---@field toString fun(self:CraftSystem.ImmersiveCraftStage.TappingStage):string
|
||||||
|
local TappingStage = extend(ImmersiveCraftStage, {})
|
||||||
|
|
||||||
|
---Definition table for the `CraftSystem.ImmersiveCraftStage.TappingStage`.
|
||||||
|
---
|
||||||
|
---**Only for EmmyLua.**
|
||||||
|
---@class CraftSystem.ImmersiveCraftStage.TappingStageDef : CraftSystem.ImmersiveCraftStageDef
|
||||||
|
---@field targetItem string
|
||||||
|
---@field clicksNeed string
|
||||||
|
---@field toolGroup string?
|
||||||
|
|
||||||
|
---Data table for transferring various time parameters between calls.
|
||||||
|
---
|
||||||
|
---**Only for EmmyLua.**
|
||||||
|
---@class ImmersiveStageData.TappingStageData : ImmersiveStageData
|
||||||
|
---How many clicks were made by the player on the entity.
|
||||||
|
---@field clickCount integer
|
||||||
|
---Unique identifier of the entity (craft node).
|
||||||
|
---@field entityGUID string
|
||||||
|
|
||||||
|
---@param def CraftSystem.ImmersiveCraftStage.TappingStageDef
|
||||||
|
function TappingStage:new(def)
|
||||||
|
---@type CraftSystem.ImmersiveCraftStage.TappingStage
|
||||||
|
local instance = ImmersiveCraftStage:new(def)
|
||||||
|
instance.targetItem = def.targetItem
|
||||||
|
instance.clicksNeed = def.clicksNeed
|
||||||
|
instance.toolGroup = def.toolGroup
|
||||||
|
|
||||||
|
-- Registering the crafting stage start handler.
|
||||||
|
instance.startHandler = function(tappingStage , pos, player)
|
||||||
|
-- We determine the coordinate where we will create the crafting node (entity).
|
||||||
|
local entityPos = vector.new(pos) + vector.new(0,0.875,0)
|
||||||
|
|
||||||
|
-- We create a table of initial parameters that we will pass to the entity.
|
||||||
|
---@class CraftSystem.ImmersiveCraftStage.TappingNode.InitParams
|
||||||
|
local params = {
|
||||||
|
targetItem = tappingStage.targetItem,
|
||||||
|
craftName = tappingStage.craftName,
|
||||||
|
stageName = tappingStage.name,
|
||||||
|
WorkStationPos = pos,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Adding an entity to the world.
|
||||||
|
local obj = core.add_entity(entityPos, 'craft_system:tapping_node', core.serialize(params))
|
||||||
|
|
||||||
|
-- If the entity was not returned, something went wrong.
|
||||||
|
if obj == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Create a temporary table of crafting stage data.
|
||||||
|
---@type ImmersiveStageData.TappingStageData
|
||||||
|
local stageData = {
|
||||||
|
clickCount = 0,
|
||||||
|
entityGUID = obj:get_guid()
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Saving temporary data in work station metadata.
|
||||||
|
setStageDataByPos(pos, stageData)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Registering the crafting stage process handler.
|
||||||
|
-- Called when a player clicks on a crafting node (entity).
|
||||||
|
instance.processHandler = function(tappingStage, pos, player)
|
||||||
|
-- Obtaining stage time data from work station metadata.
|
||||||
|
---@type ImmersiveStageData.TappingStageData?
|
||||||
|
local stageData = getStageDataByPos(pos)
|
||||||
|
assert(stageData ~= nil, 'Immersive stage data is empty.')
|
||||||
|
|
||||||
|
-- Increasing the click counter
|
||||||
|
local clickCount = stageData.clickCount
|
||||||
|
clickCount = clickCount + 1
|
||||||
|
|
||||||
|
-- If the number of clicks is greater than required to complete the step...
|
||||||
|
if clickCount >= tappingStage.clicksNeed then
|
||||||
|
-- ...we are completing the stage.
|
||||||
|
tappingStage:endHandler(pos, player)
|
||||||
|
else
|
||||||
|
-- ...else we save the number of clicks in the temporary data table.
|
||||||
|
stageData.clickCount = clickCount
|
||||||
|
Smc.setStageDataByPos(pos, stageData)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Registering the crafting stage end handler.
|
||||||
|
instance.endHandler = function(tappingStage, pos, player)
|
||||||
|
-- Obtaining stage time data from work station metadata.
|
||||||
|
---@type ImmersiveStageData.TappingStageData?
|
||||||
|
local stageData = getStageDataByPos(pos)
|
||||||
|
assert(stageData ~= nil, 'Immersive stage data is empty.')
|
||||||
|
|
||||||
|
-- We get the entity object.
|
||||||
|
local entity = Smc.getObjectByGUID(stageData.entityGUID)
|
||||||
|
assert(entity ~= nil, 'The entity for immersive crafting is nil.')
|
||||||
|
|
||||||
|
-- Removing an entity from the world.
|
||||||
|
entity:remove()
|
||||||
|
|
||||||
|
-- We trigger an event that the crafting stage has been completed.
|
||||||
|
Events.call('craft_system:next_immersive_stage:'..tappingStage.craftName, tappingStage, pos, player)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Registering the aborting the crafting process handler.
|
||||||
|
---@param tappingStage CraftSystem.ImmersiveCraftStage.TappingStage
|
||||||
|
instance.abortHandler = function(tappingStage, pos)
|
||||||
|
-- We receive current data on crafting.
|
||||||
|
---@type ImmersiveCraftData?
|
||||||
|
local craftData = Smc.getCraftDataByPos(pos)
|
||||||
|
assert(craftData ~= nil, 'Immersive crafting data is empty.')
|
||||||
|
|
||||||
|
-- Obtaining stage time data from work station metadata.
|
||||||
|
---@type ImmersiveStageData.TappingStageData?
|
||||||
|
local stageData = craftData.stageData
|
||||||
|
assert(stageData ~= nil, 'Immersive stage data is empty.')
|
||||||
|
|
||||||
|
-- We get the entity object.
|
||||||
|
local entity = Smc.getObjectByGUID(stageData.entityGUID)
|
||||||
|
assert(entity ~= nil, 'The entity for immersive crafting is nil.')
|
||||||
|
|
||||||
|
-- Removing an entity from the world.
|
||||||
|
entity:remove()
|
||||||
|
|
||||||
|
-- We drop the item as it was before processing.
|
||||||
|
local dropPos = vector.new(pos)+vector.new(0, 0.9,0)
|
||||||
|
for i=1, craftData.amount do
|
||||||
|
core.item_drop(ItemStack(tappingStage.targetItem), nil, dropPos)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Returns a human-readable description of the crafting stage.
|
||||||
|
instance.toString = function(tappingStage)
|
||||||
|
local stageDesc
|
||||||
|
if tappingStage.toolGroup ~= nil then
|
||||||
|
stageDesc = ('Tapping x%s tool with a group "%s"'):format(tappingStage.clicksNeed, tappingStage.toolGroup)
|
||||||
|
else
|
||||||
|
stageDesc = ('Tapping x%s'):format(tappingStage.clicksNeed)
|
||||||
|
end
|
||||||
|
|
||||||
|
return stageDesc
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Subscribe to an event that means the player hit the entity.
|
||||||
|
Events.subscribe(('craft_system:punch_tapping_node:%s:%s'):format(instance.craftName, instance.name),
|
||||||
|
---@param craftNode LuaEntity
|
||||||
|
---@param player Player
|
||||||
|
function(eventName, pos, player, craftNode)
|
||||||
|
-- We get the item that the player clicked on the crafting node.
|
||||||
|
local toolDef = player:get_wielded_item():get_definition()
|
||||||
|
|
||||||
|
-- If a crafting stage requires a specific tool group and he doesn't have it...
|
||||||
|
if instance.toolGroup and (not toolDef.groups or not toolDef.groups[instance.toolGroup]) then
|
||||||
|
-- ...then we don't do anything.
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- DRAFT START:
|
||||||
|
-- Creating particles
|
||||||
|
for i=0, 10 do
|
||||||
|
core.add_particle({
|
||||||
|
pos = vector.new(pos)+vector.new(0,0.5,0),
|
||||||
|
velocity = {x=math.random(-1,1), y=4, z=math.random(-1,1)},
|
||||||
|
acceleration = {x=0, y=-9.8, z=0},
|
||||||
|
expirationtime = 2,
|
||||||
|
collision_removal = true,
|
||||||
|
node = {name=instance.targetItem}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Making the entity shake (silly method :P).
|
||||||
|
craftNode.object:set_rotation(vector.new(0.01,0.1,0.01))
|
||||||
|
core.after(0.1, function() craftNode.object:set_rotation(vector.new(-0.01,-0.1,-0.01))end)
|
||||||
|
core.after(0.2, function() craftNode.object:set_rotation(vector.new(0,0,0))end)
|
||||||
|
-- DRAFT END
|
||||||
|
|
||||||
|
-- Calling the crafting stage process handler.
|
||||||
|
instance:processHandler(pos, player)
|
||||||
|
end)
|
||||||
|
|
||||||
|
return instance
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Registering an entity for immersive tapping crafting.
|
||||||
|
require('CraftSystem.ImmersiveCraftNode.tappingNode')
|
||||||
|
|
||||||
|
return TappingStage
|
||||||
39
mods/CORE/CraftSystem/src/CraftSystem/PrimitiveCraft.lua
Normal file
39
mods/CORE/CraftSystem/src/CraftSystem/PrimitiveCraft.lua
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
local getInstance, extend = Class.getInstance, Class.extend
|
||||||
|
|
||||||
|
local modInfo = Mod.getInfo('smc__core__craft_system')
|
||||||
|
local require = modInfo.require
|
||||||
|
|
||||||
|
---@type CraftSystem.BaseCraft
|
||||||
|
local BaseCraft = require('CraftSystem.BaseCraft')
|
||||||
|
|
||||||
|
---@class CraftSystem.PrimitiveCraft : CraftSystem.BaseCraft
|
||||||
|
---@field output string
|
||||||
|
---@field recipe CraftSystem.CraftRecipe
|
||||||
|
---@field returnItems ItemStackString[]
|
||||||
|
local PrimitiveCraft = extend(BaseCraft, {})
|
||||||
|
|
||||||
|
---Definition table for the `CraftSystem.PrimitiveCraft`.
|
||||||
|
---
|
||||||
|
---**Only for EmmyLua.**
|
||||||
|
---@class CraftSystem.PrimitiveCraftDef : CraftSystem.BaseCraftDef
|
||||||
|
---@field output string
|
||||||
|
---@field recipe CraftSystem.CraftRecipe
|
||||||
|
---@field returnItems ItemStackString[]
|
||||||
|
|
||||||
|
---@param name string
|
||||||
|
---@param def CraftSystem.PrimitiveCraftDef
|
||||||
|
---@return CraftSystem.PrimitiveCraft
|
||||||
|
function PrimitiveCraft:new(name, def)
|
||||||
|
---@type CraftSystem.PrimitiveCraft
|
||||||
|
local instance = getInstance(self, {
|
||||||
|
name = name,
|
||||||
|
group = def.group,
|
||||||
|
output = def.output,
|
||||||
|
recipe = def.recipe,
|
||||||
|
returnItems = def.returnItems or {}
|
||||||
|
})
|
||||||
|
|
||||||
|
return instance
|
||||||
|
end
|
||||||
|
|
||||||
|
return PrimitiveCraft
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
local extend = Class.extend
|
||||||
|
|
||||||
|
local tableInsert = table.insert
|
||||||
|
|
||||||
|
local modInfo = Mod.getInfo('smc__core__craft_system')
|
||||||
|
local require = modInfo.require
|
||||||
|
|
||||||
|
---@type CraftSystem.BaseCraftHandler
|
||||||
|
local BaseCraftHandler = require('CraftSystem.BaseCraftHandler')
|
||||||
|
|
||||||
|
---@type CraftSystem.PrimitiveCraft
|
||||||
|
local PrimitiveCraft = require('CraftSystem.PrimitiveCraft')
|
||||||
|
|
||||||
|
---A primitive crafting processor that doesn't require much interaction and provides
|
||||||
|
---simple crafting based on a recipe-result scheme.
|
||||||
|
---@class CraftSystem.PrimitiveCraftHandler : CraftSystem.BaseCraftHandler
|
||||||
|
---@field getCraftByName fun(self, craftName:string):CraftSystem.PrimitiveCraft
|
||||||
|
---@field getCraftsByGroup fun(self, craftGroup):CraftSystem.PrimitiveCraft[]
|
||||||
|
---@field getLearnedCrafts fun(self, playerName):table<string, CraftSystem.PrimitiveCraft>
|
||||||
|
local PrimitiveCraftHandler = extend(BaseCraftHandler, {})
|
||||||
|
|
||||||
|
---Register a primitive craft that does not require special interaction.
|
||||||
|
---@param craftName string
|
||||||
|
---@param def CraftSystem.PrimitiveCraftDef
|
||||||
|
function PrimitiveCraftHandler:registerCraft(craftName, def)
|
||||||
|
assert(self.craftsByName[craftName] == nil, ('A craft named `%s` already exists.'):format(
|
||||||
|
craftName))
|
||||||
|
|
||||||
|
local craft = PrimitiveCraft:new(craftName, def)
|
||||||
|
|
||||||
|
local group = def.group
|
||||||
|
|
||||||
|
if self.craftsByGroup[group] == nil then
|
||||||
|
self.craftsByGroup[group] = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
self.craftsByName[craftName] = craft
|
||||||
|
tableInsert(self.craftsByGroup[group], craft)
|
||||||
|
tableInsert(self.craftsList, craft)
|
||||||
|
end
|
||||||
|
|
||||||
|
return PrimitiveCraftHandler
|
||||||
4
mods/CORE/Creature/init.lua
Normal file
4
mods/CORE/Creature/init.lua
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
local modInfo = Mod.getInfo('smc__core__creature')
|
||||||
|
local require = modInfo.require
|
||||||
|
|
||||||
|
return require('Creature')
|
||||||
1
mods/CORE/Creature/mod.conf
Normal file
1
mods/CORE/Creature/mod.conf
Normal file
@@ -0,0 +1 @@
|
|||||||
|
name = smc__core__creature
|
||||||
109
mods/CORE/Creature/src/Creature.lua
Normal file
109
mods/CORE/Creature/src/Creature.lua
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
local getInstance, extend = Class.getInstance, Class.extend
|
||||||
|
|
||||||
|
local tableCopy, tableMerge = table.copy, table.merge
|
||||||
|
|
||||||
|
---@class Creature
|
||||||
|
---@field entityDef Creature.CreatureDefinition
|
||||||
|
---@field luantiDef EntityDefinition
|
||||||
|
---@field defaultDef Creature.CreatureDefinition
|
||||||
|
local Creature = {
|
||||||
|
defaultDef = {
|
||||||
|
settings = {
|
||||||
|
_name = '',
|
||||||
|
_add_mod_name = true,
|
||||||
|
initial_properties = {},
|
||||||
|
},
|
||||||
|
callbacks = {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
---@param entityDef Creature.CreatureDefinition
|
||||||
|
---@return EntityDefinition
|
||||||
|
local function entityDefToLuantiDef(entityDef)
|
||||||
|
entityDef = tableCopy(entityDef)
|
||||||
|
local s = entityDef.settings
|
||||||
|
local c = entityDef.callbacks or {}
|
||||||
|
|
||||||
|
---@type EntityDefinition
|
||||||
|
local luantiDef = tableMerge(s, c)
|
||||||
|
|
||||||
|
return luantiDef
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param entityDef Creature.CreatureDefinition
|
||||||
|
---@return Creature
|
||||||
|
function Creature:new(entityDef)
|
||||||
|
-- Adding default parameters.
|
||||||
|
---@type Creature.CreatureDefinition
|
||||||
|
entityDef = tableMerge(entityDef, self.defaultDef, true)
|
||||||
|
|
||||||
|
-- The callback table may not be specified.
|
||||||
|
if entityDef.callbacks == nil then
|
||||||
|
---@type Creature.Callbacks
|
||||||
|
entityDef.callbacks = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
local s = entityDef.settings
|
||||||
|
local c = entityDef.callbacks
|
||||||
|
|
||||||
|
-- Add the short mod name prefix to the entity name.
|
||||||
|
if s._add_mod_name then
|
||||||
|
s._name = Mod.getInfo().shortName .. ':' .. s._name
|
||||||
|
end
|
||||||
|
|
||||||
|
local onActivate = c.on_activate or function() end
|
||||||
|
|
||||||
|
-- We rewrite the entity initialization function so that custom fields
|
||||||
|
-- can be passed to it directly via `core.add_entity(pos, name, [staticdata])`.
|
||||||
|
c.on_activate = function(luaEntity, staticdata, dtime)
|
||||||
|
local initCustomFields = {}
|
||||||
|
|
||||||
|
if staticdata and staticdata ~= '' then
|
||||||
|
initCustomFields = core.deserialize(staticdata) or {}
|
||||||
|
end
|
||||||
|
|
||||||
|
-- We reset the fields that should not be overwritten.
|
||||||
|
initCustomFields.name = nil
|
||||||
|
initCustomFields.object = nil
|
||||||
|
|
||||||
|
---@type LuaEntity
|
||||||
|
self = tableMerge(self, initCustomFields)
|
||||||
|
|
||||||
|
-- If an initialization callback was specified for the entity, then we call it.
|
||||||
|
if c.on_activate ~= nil then
|
||||||
|
onActivate(luaEntity, staticdata, dtime)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---@type Creature
|
||||||
|
local instance = getInstance(self, {})
|
||||||
|
|
||||||
|
local luantiDef = entityDefToLuantiDef(entityDef)
|
||||||
|
|
||||||
|
instance.entityDef = entityDef
|
||||||
|
instance.luantiDef = luantiDef
|
||||||
|
|
||||||
|
core.register_entity(':'..s._name, luantiDef)
|
||||||
|
|
||||||
|
return instance
|
||||||
|
end
|
||||||
|
|
||||||
|
---Allows you to create a child class of an entity by specifying
|
||||||
|
---default parameters that will be added to the entity's parameters
|
||||||
|
---when an instance is received.
|
||||||
|
---@param defaultDef Creature.CreatureDefinition
|
||||||
|
---@return Creature
|
||||||
|
function Creature:getExtended(defaultDef)
|
||||||
|
-- Adding default parameters.
|
||||||
|
---@type Creature.CreatureDefinition
|
||||||
|
defaultDef = tableMerge(self.defaultDef, defaultDef)
|
||||||
|
|
||||||
|
---@type Creature
|
||||||
|
local ChildClass = extend(self, {
|
||||||
|
defaultDef = defaultDef,
|
||||||
|
})
|
||||||
|
|
||||||
|
return ChildClass
|
||||||
|
end
|
||||||
|
|
||||||
|
return Creature
|
||||||
72
mods/CORE/Creature/src/Creature/Callbacks.lua
Normal file
72
mods/CORE/Creature/src/Creature/Callbacks.lua
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
---@class Creature.Callbacks
|
||||||
|
local Callbacks = {}
|
||||||
|
|
||||||
|
---Called when the object is instantiated.
|
||||||
|
--- * `dtime_s` is the time passed since the object was unloaded,
|
||||||
|
---which can be used for updating the entity state.
|
||||||
|
---@type fun(self:LuaEntity, staticdata:string, dtime_s:number)?
|
||||||
|
Callbacks.on_activate = nil
|
||||||
|
|
||||||
|
---Called when the object is about to get removed or unloaded.
|
||||||
|
--- * `removal`: boolean indicating whether the object is about to get removed.
|
||||||
|
--- Calling `object:remove()` on an active object will call this with `removal=true`.
|
||||||
|
--- The mapblock the entity resides in being unloaded will call this with `removal=false`.
|
||||||
|
---
|
||||||
|
---Note that this won't be called if the object hasn't been activated in the first place.
|
||||||
|
---In particular, `core.clear_objects({mode = "full"})` won't call this,
|
||||||
|
---whereas `core.clear_objects({mode = "quick"})` might call this.
|
||||||
|
---@type fun(self:LuaEntity, removal:boolean)?
|
||||||
|
Callbacks.on_deactivate = nil
|
||||||
|
|
||||||
|
---Called on every server tick, after movement and collision processing.
|
||||||
|
--- * `dtime`: elapsed time since last call
|
||||||
|
--- * `s`: table with collision info (only available if `physical=true`)
|
||||||
|
---@type fun(self:LuaEntity, dtime:number, moveresult:table)? -- TODO: дописать более точный тип moveresult
|
||||||
|
Callbacks.on_step = nil
|
||||||
|
|
||||||
|
---Called when somebody punches the object.
|
||||||
|
---Note that you probably want to handle most punches using the automatic armor group system.
|
||||||
|
--- * `puncher`: an `ObjectRef `(can be `nil`)
|
||||||
|
--- * `time_from_last_punch`: Meant for disallowing spamming of clicks (can be `nil`).
|
||||||
|
--- * `tool_capabilities`: capability table of used item
|
||||||
|
--- * `dir`: unit vector of direction of punch. Always defined. Points from the puncher to the punched.
|
||||||
|
--- * `damage``: damage that will be done to entity.
|
||||||
|
---
|
||||||
|
---Can return `true` to prevent the default damage mechanism.
|
||||||
|
---@type (fun(self:LuaEntity, puncher:ObjectRef|Player|nil, time_from_last_punch:number|nil, tool_capabilities:table|nil, dir:vector, damage:number):boolean)? -- TODO: дописать более точный тип для tool_capabilities
|
||||||
|
Callbacks.on_punch = nil
|
||||||
|
|
||||||
|
---Called when the object dies.
|
||||||
|
--- * `killer`: an `ObjectRef` (can be `nil`)
|
||||||
|
---@type fun(self:LuaEntity, killer:ObjectRef|Player|nil)?
|
||||||
|
Callbacks.on_death = nil
|
||||||
|
|
||||||
|
---Called when `clicker` pressed the 'place/use' key while
|
||||||
|
---pointing to the object (not necessarily an actual rightclick)
|
||||||
|
--- * `clicker`: an `ObjectRef` (may or may not be a player)
|
||||||
|
---@type fun(self:LuaEntity, clicker:ObjectRef|Player)?
|
||||||
|
Callbacks.on_rightclick = nil
|
||||||
|
|
||||||
|
---Called after another object is attached to this object.
|
||||||
|
--- * `child`: an `ObjectRef` of the child
|
||||||
|
---@type fun(self:LuaEntity, child:ObjectRef)?
|
||||||
|
Callbacks.on_attach_child = nil
|
||||||
|
|
||||||
|
---Called after another object has detached from this object.
|
||||||
|
--- * `child`: an `ObjectRef` of the child
|
||||||
|
---@type fun(self:LuaEntity, child:ObjectRef)?
|
||||||
|
Callbacks.on_detach_child = nil
|
||||||
|
|
||||||
|
---Called after detaching from another object.
|
||||||
|
--- * `parent`: an ObjectRef from where it got detached
|
||||||
|
---
|
||||||
|
---**Note**: this is also called before removal from the world.
|
||||||
|
---@type fun(self:LuaEntity, parent)?
|
||||||
|
Callbacks.on_detach = nil
|
||||||
|
|
||||||
|
---Should return a string that will be passed to `on_activate` when the object
|
||||||
|
---is instantiated the next time.
|
||||||
|
---@type (fun(self:LuaEntity):string)?
|
||||||
|
Callbacks.get_staticdata = nil
|
||||||
|
|
||||||
|
return Callbacks
|
||||||
6
mods/CORE/Creature/src/Creature/CreatureDefinition.lua
Normal file
6
mods/CORE/Creature/src/Creature/CreatureDefinition.lua
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
---@class Creature.CreatureDefinition
|
||||||
|
---@field settings Creature.Settings
|
||||||
|
---@field callbacks Creature.Callbacks?
|
||||||
|
local CreatureDefinition = {}
|
||||||
|
|
||||||
|
return CreatureDefinition
|
||||||
9
mods/CORE/Creature/src/Creature/LuaEntity.lua
Normal file
9
mods/CORE/Creature/src/Creature/LuaEntity.lua
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
---A class that extends `LuaEntity` to annotate custom fields.
|
||||||
|
---
|
||||||
|
---**Only for EmmyLua.**
|
||||||
|
---@class Creature.LuaEntity : LuaEntity
|
||||||
|
---@field _name string
|
||||||
|
---@field _add_mod_name boolean
|
||||||
|
local LuaEntity = {}
|
||||||
|
|
||||||
|
return LuaEntity
|
||||||
14
mods/CORE/Creature/src/Creature/Settings.lua
Normal file
14
mods/CORE/Creature/src/Creature/Settings.lua
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
---@class Creature.Settings
|
||||||
|
local Settings = {}
|
||||||
|
|
||||||
|
---Registration name for the entity. Must be unique.
|
||||||
|
---@type string
|
||||||
|
Settings._name = nil
|
||||||
|
|
||||||
|
---Whether to add the mod name to the settings._name. Default: `true`
|
||||||
|
Settings._add_mod_name = nil
|
||||||
|
|
||||||
|
---@type ObjectProperties
|
||||||
|
Settings.initial_properties = nil
|
||||||
|
|
||||||
|
return Settings
|
||||||
@@ -1 +0,0 @@
|
|||||||
name = smc__core__entity
|
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
name = smc__core__formspec
|
name = smc__core__formspec
|
||||||
depends = smc__api__api_loader
|
depends = smc__system__system_loader
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
9
mods/CORE/Item/locale/item.ru.tr
Normal file
9
mods/CORE/Item/locale/item.ru.tr
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# textdomain: item
|
||||||
|
|
||||||
|
Rarity=Редкость
|
||||||
|
common=простой
|
||||||
|
uncommon=необычный
|
||||||
|
distinguished=выдающийся
|
||||||
|
eminent=исключительный
|
||||||
|
prime=Превосходный
|
||||||
|
unique=Уникальный
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
name = smc__core__item
|
name = smc__core__item
|
||||||
depends = smc__api__api_loader, smc__core__item_factory
|
depends = smc__system__system_loader, smc__core__item_factory
|
||||||
|
|||||||
@@ -1,31 +1,82 @@
|
|||||||
local modInfo = Mod.getInfo('smc__core__item')
|
local getInstance, extend = Class.getInstance, Class.extend
|
||||||
local require = modInfo.require
|
|
||||||
|
|
||||||
local ItemFactory = Mod.getInfo('smc__core__item_factory').require('ItemFactory')
|
local tableCopy, tableMerge, colorize = table.copy, table.merge, core.colorize
|
||||||
|
|
||||||
|
local ItemFactory = Smc.requireItemFactory()
|
||||||
|
|
||||||
|
---Determines whether common rarity will be shown in item descriptions or not.
|
||||||
|
local SHOW_COMMON_RARITY = true
|
||||||
|
|
||||||
|
---Colors corresponding to the rarity color in the item description.
|
||||||
|
---@type table<Item.Rarity, ColorString>
|
||||||
|
local RARITY_COLORS = {
|
||||||
|
['common'] = '#C0C0C0',
|
||||||
|
['uncommon'] = '#7cd2e2',
|
||||||
|
['distinguished'] = '#7ce2da',
|
||||||
|
['eminent'] = '#44d1a9',
|
||||||
|
['prime'] = '#9CF0B1',
|
||||||
|
['unique'] = '#f4c95a'
|
||||||
|
}
|
||||||
|
|
||||||
|
---Whether to show the numeric index in the rarity description.
|
||||||
|
local SHOW_RARITY_INDEX = true
|
||||||
|
|
||||||
|
---@type table<Item.Rarity, integer>
|
||||||
|
local RARITY_INDEX = {
|
||||||
|
['common'] = 1,
|
||||||
|
['uncommon'] = 2,
|
||||||
|
['distinguished'] = 3,
|
||||||
|
['eminent'] = 4,
|
||||||
|
['prime'] = 5,
|
||||||
|
['unique'] = 0
|
||||||
|
}
|
||||||
|
|
||||||
---@class Item
|
---@class Item
|
||||||
---@field itemDef Item.ItemDefinition
|
---@field itemDef Item.ItemDefinition
|
||||||
---@field luantiDef table
|
---@field luantiDef ItemDefinition
|
||||||
---@field getVisual fun(): string
|
---@field getType fun():string
|
||||||
---@field defaultDef Item.ItemDefinition
|
---@field defaultDef Item.ItemDefinition
|
||||||
local Item = {
|
local Item = {
|
||||||
defaultDef = {
|
defaultDef = {
|
||||||
settings = {
|
settings = {
|
||||||
name = '',
|
name = '',
|
||||||
title = '',
|
_title = '',
|
||||||
description = '',
|
_description = '',
|
||||||
titleColor = '#FFFFFF',
|
_title_color = '#FFFFFF',
|
||||||
descriptionColor = '#C0C0C0',
|
_description_color = '#838383',
|
||||||
addModName = true,
|
_rarity = 'common',
|
||||||
|
_add_mod_name = true,
|
||||||
|
stack_max = 128,
|
||||||
},
|
},
|
||||||
callbacks = {}
|
callbacks = {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
---Adds an item's rarity tag to the description.
|
||||||
|
---@param rarity Item.Rarity
|
||||||
|
---@param desc string
|
||||||
|
---@return string
|
||||||
|
local function addRarityToDesc(rarity, desc)
|
||||||
|
if not SHOW_COMMON_RARITY and rarity == 'common' then
|
||||||
|
return desc
|
||||||
|
end
|
||||||
|
|
||||||
|
local S = core.get_translator('item')
|
||||||
|
local color = RARITY_COLORS[rarity]
|
||||||
|
|
||||||
|
local rarityString = S('Rarity')..': '..S(rarity)
|
||||||
|
|
||||||
|
if SHOW_RARITY_INDEX then
|
||||||
|
rarityString = rarityString..' ['..RARITY_INDEX[rarity]..']'
|
||||||
|
end
|
||||||
|
|
||||||
|
return desc..'\n'..colorize(color, rarityString)
|
||||||
|
end
|
||||||
|
|
||||||
---The alias `table.merge` for EmmyLua
|
---The alias `table.merge` for EmmyLua
|
||||||
---@type fun(...):(NodeDefinition|ItemDefinition)
|
---@type fun(...):(NodeDefinition|ItemDefinition)
|
||||||
local defMerge = function(...)
|
local defMerge = function(...)
|
||||||
return table.merge(...)
|
return tableMerge(...)
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param itemDef Item.ItemDefinition
|
---@param itemDef Item.ItemDefinition
|
||||||
@@ -34,16 +85,10 @@ local function itemDefToLuantiDef(itemDef)
|
|||||||
local modName = Mod.getInfo().shortName
|
local modName = Mod.getInfo().shortName
|
||||||
local S = core.get_translator(modName)
|
local S = core.get_translator(modName)
|
||||||
|
|
||||||
itemDef = table.copy(itemDef)
|
|
||||||
local s = itemDef.settings
|
local s = itemDef.settings
|
||||||
local c = itemDef.callbacks
|
local c = itemDef.callbacks
|
||||||
|
|
||||||
if s.addModName then
|
local title, description = s._title, s._description
|
||||||
s.name = modName .. ':' .. s.name
|
|
||||||
end
|
|
||||||
|
|
||||||
local title = s.title
|
|
||||||
local description = s.description
|
|
||||||
|
|
||||||
if title == nil or title == '' then
|
if title == nil or title == '' then
|
||||||
title = string.match(s.name, '%S:(%S+)')..'-title'
|
title = string.match(s.name, '%S:(%S+)')..'-title'
|
||||||
@@ -53,74 +98,106 @@ local function itemDefToLuantiDef(itemDef)
|
|||||||
description = string.match(s.name, '%S:(%S+)')..'-desc'
|
description = string.match(s.name, '%S:(%S+)')..'-desc'
|
||||||
end
|
end
|
||||||
|
|
||||||
if s.titleColor ~= nil and s.descriptionColor ~= nil then
|
if s._title_color ~= nil and s._description_color ~= nil then
|
||||||
description = core.colorize(s.titleColor ,S(title))..'\n'..
|
title = colorize(s._title_color , S(title))
|
||||||
core.colorize(s.descriptionColor, S(description))
|
description = colorize(s._description_color, S(description))
|
||||||
else
|
else
|
||||||
error('Item description color parameters cannot be empty.')
|
error('Item description color parameters cannot be empty.')
|
||||||
end
|
end
|
||||||
|
|
||||||
s.title, s.description = nil, description
|
assert(s._rarity ~= nil, 'The rarity of an item cannot be empty.')
|
||||||
|
|
||||||
|
local luantiDescription = addRarityToDesc(s._rarity, title..'\n '..description)
|
||||||
|
|
||||||
|
s._title = title
|
||||||
|
s._description = description
|
||||||
|
s.description = luantiDescription..core.get_background_escape_sequence('#110F13')
|
||||||
|
|
||||||
local luantiDef = defMerge(s, c)
|
local luantiDef = defMerge(s, c)
|
||||||
|
|
||||||
return luantiDef
|
return luantiDef
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param luantiDef NodeDefinition|ItemDefinition
|
---@param luantiDef NodeDefinition
|
||||||
local function register3dItem(luantiDef)
|
local function registerNode(luantiDef)
|
||||||
local ld = luantiDef
|
local name = luantiDef.name
|
||||||
local name = ld.name
|
luantiDef.name = nil
|
||||||
ld.name = nil
|
|
||||||
core.register_node(':'..name, luantiDef)
|
core.register_node(':'..name, luantiDef)
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param luantiDef ItemDefinition
|
---@param luantiDef ItemDefinition
|
||||||
local function registerFlatItem(luantiDef)
|
local function registerCraftitem(luantiDef)
|
||||||
local ld = luantiDef
|
local name = luantiDef.name
|
||||||
local name = ld.name
|
luantiDef.name = nil
|
||||||
ld.name = nil
|
|
||||||
core.register_craftitem(':'..name, luantiDef)
|
core.register_craftitem(':'..name, luantiDef)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param luantiDef ItemDefinition
|
||||||
|
local function registerTool(luantiDef)
|
||||||
|
local name = luantiDef.name
|
||||||
|
luantiDef.name = nil
|
||||||
|
|
||||||
|
core.register_tool(':'..name, luantiDef)
|
||||||
|
end
|
||||||
|
|
||||||
---The alias `table.merge` for EmmyLua
|
---The alias `table.merge` for EmmyLua
|
||||||
---@type fun(...):(Item.ItemDefinition)
|
---@type fun(...):(Item.ItemDefinition)
|
||||||
local defMerge = function(...)
|
local defMerge = function(...)
|
||||||
return table.merge(...)
|
return tableMerge(...)
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param itemDef Item.ItemDefinition|Node.NodeDefinition
|
---@param itemDef Item.ItemDefinition|Node.NodeDefinition
|
||||||
---@return Item
|
---@return Item
|
||||||
function Item:new(itemDef)
|
function Item:new(itemDef)
|
||||||
---Adding default parameters
|
assert(itemDef.settings.description == nil,
|
||||||
|
'The item description was specified using `description`, not `_description`. '..
|
||||||
|
'Please note that the `description` field should not be used when registering an item. '..
|
||||||
|
'Use `_title` and `_description` instead.')
|
||||||
|
|
||||||
|
itemDef = tableCopy(itemDef)
|
||||||
|
|
||||||
|
-- Adding default parameters
|
||||||
itemDef = defMerge(itemDef, self.defaultDef, true)
|
itemDef = defMerge(itemDef, self.defaultDef, true)
|
||||||
|
local s = itemDef.settings
|
||||||
|
|
||||||
|
local shortModName = Mod.getInfo().shortName
|
||||||
|
|
||||||
|
if s._add_mod_name then
|
||||||
|
s.name = shortModName .. ':' .. s.name
|
||||||
|
end
|
||||||
|
|
||||||
---@type Item
|
---@type Item
|
||||||
local instance = setmetatable({}, {__index = self})
|
local instance = getInstance(self, {})
|
||||||
|
|
||||||
local luantiDef = itemDefToLuantiDef(itemDef)
|
local luantiDef = itemDefToLuantiDef(itemDef)
|
||||||
local visual = itemDef.settings.visual
|
local type = itemDef.settings._type
|
||||||
|
|
||||||
if visual == nil then
|
if type == nil then
|
||||||
visual = 'item_2d'
|
type = 'craftitem'
|
||||||
end
|
end
|
||||||
|
|
||||||
itemDef.settings.visual = nil
|
itemDef.settings._type = nil
|
||||||
|
|
||||||
if visual == 'item_3d' then
|
if type == 'node' then
|
||||||
register3dItem(luantiDef)
|
registerNode(luantiDef)
|
||||||
|
elseif type == 'craftitem' then
|
||||||
|
registerCraftitem(luantiDef)
|
||||||
|
elseif type == 'tool' then
|
||||||
|
registerTool(luantiDef)
|
||||||
else
|
else
|
||||||
visual = 'item_2d'
|
error(('Unknown item type: `%s`.'):format(type))
|
||||||
registerFlatItem(luantiDef)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function instance:getVisual()
|
function instance:getType()
|
||||||
return visual
|
return type
|
||||||
end
|
end
|
||||||
|
|
||||||
instance.itemDef = itemDef
|
instance.itemDef = itemDef
|
||||||
instance.luantiDef = luantiDef
|
instance.luantiDef = luantiDef
|
||||||
|
|
||||||
|
Smc.addRegisteredItem(shortModName, instance)
|
||||||
return instance
|
return instance
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -130,8 +207,10 @@ end
|
|||||||
---@param defaultDef Item.ItemDefinition
|
---@param defaultDef Item.ItemDefinition
|
||||||
---@return Item
|
---@return Item
|
||||||
function Item:getExtended(defaultDef)
|
function Item:getExtended(defaultDef)
|
||||||
|
defaultDef = defMerge(defaultDef, self.defaultDef, true)
|
||||||
|
|
||||||
---@type Item
|
---@type Item
|
||||||
local ChildClass = Class.extend(self, {
|
local ChildClass = extend(self, {
|
||||||
defaultDef = defaultDef,
|
defaultDef = defaultDef,
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -144,6 +223,8 @@ end
|
|||||||
function Item:getFactory(defaultDef)
|
function Item:getFactory(defaultDef)
|
||||||
if defaultDef == nil then
|
if defaultDef == nil then
|
||||||
defaultDef = self.defaultDef
|
defaultDef = self.defaultDef
|
||||||
|
else
|
||||||
|
defaultDef = defMerge(self.defaultDef, defaultDef, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
---@type ItemFactory
|
---@type ItemFactory
|
||||||
|
|||||||
8
mods/CORE/Item/src/Item/Rarity.lua
Normal file
8
mods/CORE/Item/src/Item/Rarity.lua
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
---Rarity of items:
|
||||||
|
--- * `common`
|
||||||
|
--- * `uncommon`
|
||||||
|
--- * `distinguished`
|
||||||
|
--- * `eminent`
|
||||||
|
--- * `prime`
|
||||||
|
--- * `unique`
|
||||||
|
---@alias Item.Rarity 'common'|'uncommon'|'distinguished'|'eminent'|'prime'|'unique'
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user