Compare commits
95 Commits
craft-syst
...
9fd665aaa5
| Author | SHA1 | Date | |
|---|---|---|---|
| 9fd665aaa5 | |||
| 8e09f8fa53 | |||
| 97084c9060 | |||
| 7e46c858cc | |||
| ac28f9e92b | |||
| b62e19d10a | |||
| 6dba6f8c78 | |||
| 0a97ef3a83 | |||
| 7661cacbfe | |||
| c172198ff7 | |||
| f1c82d9220 | |||
| b4290ad1f9 | |||
| f31277f8b0 | |||
| 0189b29257 | |||
| b0aad2823a | |||
| 76f74743ba | |||
| cc8f896d6e | |||
| b579418b9a | |||
| bddcb4e36c | |||
| d5c6101c0f | |||
| b53753c6a5 | |||
| 427c674103 | |||
| 91603e21f8 | |||
| f5fba0b779 | |||
| d5b9504cc5 | |||
| a1e74978a5 | |||
| 1dc6fb3f39 | |||
| 89c52c80bc | |||
| 162f8d2639 | |||
| 7af83a87d8 | |||
| 0e59cf799a | |||
| 89de48b5a8 | |||
| 362d626f9b | |||
| defd3531bc | |||
| 584e710d5c | |||
| 8a0b5785ab | |||
| 9873e059cb | |||
| d05af7dacc | |||
| 9ed2319b14 | |||
| d6cc39a0b2 | |||
| 2935c4d10b | |||
| 53801a56a8 | |||
| f1610056cc | |||
| 914ea881a4 | |||
| cb87d16560 | |||
| ceb35639b8 | |||
| 79df8f2f52 | |||
| 44916bcd3b | |||
| 3483cd650a | |||
| c4104a1834 | |||
| e98935cf6f | |||
| 338cc7a36b | |||
| 18f06d13d3 | |||
| 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 |
@@ -32,7 +32,8 @@
|
|||||||
"vector",
|
"vector",
|
||||||
"Ensure",
|
"Ensure",
|
||||||
"string",
|
"string",
|
||||||
"string_utf8"
|
"string_utf8",
|
||||||
|
"Profiler"
|
||||||
],
|
],
|
||||||
"globalsRegex": []
|
"globalsRegex": []
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -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-2026 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-2026 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:
|
||||||
|
- ...
|
||||||
@@ -1,218 +0,0 @@
|
|||||||
MapGen.PastCalcNoiseValue *MapGen.PastCalcNoiseValue*
|
|
||||||
|
|
||||||
Type: ~
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MapGen *MapGen*
|
|
||||||
|
|
||||||
Fields: ~
|
|
||||||
{layersByName} (table<string,MapGen.Layer>)
|
|
||||||
{layersList} (MapGen.Layer[])
|
|
||||||
{staticsByName} (table<string,MapGen.StaticLayer>)
|
|
||||||
{staticsList} (MapGen.StaticLayer[])
|
|
||||||
{layersNoisesInitialized} (boolean) Is the fractal noise of the layer initialized? This is necessary for a one-time noise initialization.
|
|
||||||
{cavernsNoiseInitialized} (boolean) Is the fractal noise of the caverns initialized? This is necessary for a one-time noise initialization.
|
|
||||||
{isRunning} (boolean) A static field that guarantees that only one instance of the `MapGen` class will work.
|
|
||||||
{nodeIDs} (table<string,number>)
|
|
||||||
|
|
||||||
|
|
||||||
MapGenDef *MapGenDef*
|
|
||||||
Definition table for the `MapGen`.
|
|
||||||
|
|
||||||
**Only for EmmyLua.**
|
|
||||||
|
|
||||||
Fields: ~
|
|
||||||
{nodes} (table<string,string>)
|
|
||||||
|
|
||||||
|
|
||||||
MapGen:new({def}) *MapGen:new*
|
|
||||||
|
|
||||||
Parameters: ~
|
|
||||||
{def} (MapGenDef)
|
|
||||||
|
|
||||||
Returns: ~
|
|
||||||
(MapGen)
|
|
||||||
|
|
||||||
|
|
||||||
MapGen:getLayerByHeight({yPos}) *MapGen:getLayerByHeight*
|
|
||||||
Determines which layer a node belongs to based on its height coordinate.
|
|
||||||
|
|
||||||
Parameters: ~
|
|
||||||
{yPos} (number) @return MapGen.Layer?
|
|
||||||
|
|
||||||
|
|
||||||
MapGen:getStaticByHeight({yPos}) *MapGen:getStaticByHeight*
|
|
||||||
Determines which statics layer a node belongs to based on its height coordinate.
|
|
||||||
|
|
||||||
Parameters: ~
|
|
||||||
{yPos} (number) @return MapGen.StaticLayer?
|
|
||||||
|
|
||||||
|
|
||||||
MapGen:registerLayer({name}, {def}) *MapGen:registerLayer*
|
|
||||||
Mark the world area between two heights as a `MapGen.Layer`.
|
|
||||||
|
|
||||||
Note: layers must not overlap.
|
|
||||||
|
|
||||||
Parameters: ~
|
|
||||||
{name} (string) The name that will be assigned to the layer. The name must be unique for each layer.
|
|
||||||
{def} (MapGen.LayerDef) Layer description table, see details `MapGen.LayerDef`.
|
|
||||||
|
|
||||||
|
|
||||||
*MapGen:registerLayerNoiseColor*
|
|
||||||
MapGen:registerLayerNoiseColor({layerName}, {category}, {color}, {noiseParams})
|
|
||||||
Register the color and the noise parameters that correspond to it.
|
|
||||||
|
|
||||||
Parameters: ~
|
|
||||||
{layerName} (string) The name of the layer for which the color will be registered.
|
|
||||||
{category} (MapGen.Layer.Category) Category indicating what will be generated by noise.
|
|
||||||
{color} (ColorString) Noise color. Must be unique.
|
|
||||||
{noiseParams} (NoiseParams) Fractal noise parameters.
|
|
||||||
|
|
||||||
|
|
||||||
*MapGen:registerStaticLayer*
|
|
||||||
MapGen:registerStaticLayer({name}, {def})
|
|
||||||
Mark the world area between two heights as a `MapGen.StaticLayer`.
|
|
||||||
|
|
||||||
Note: layers must not overlap.
|
|
||||||
|
|
||||||
Parameters: ~
|
|
||||||
{name} (string) The name that will be assigned to the static layer. The name must be unique for each layer.
|
|
||||||
{def} (MapGen.StaticLayerDef) Static layer description table, see details `MapGen.StaticLayerDef`.
|
|
||||||
|
|
||||||
|
|
||||||
*MapGen:registerPeak*
|
|
||||||
MapGen:registerPeak({layerName}, {category}, {def})
|
|
||||||
Mark a world point as `MapGen.Peak` and assign it a specific color that will affect the generation.
|
|
||||||
|
|
||||||
Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
|
||||||
|
|
||||||
Parameters: ~
|
|
||||||
{layerName} (string) The name of the layer in which the new peak will be included.
|
|
||||||
{category} (MapGen.Layer.Category) Category indicating what will be generated by peak.
|
|
||||||
{def} (MapGen.PeakDef) Peak description table, see details `MapGen.PeakDef`.
|
|
||||||
|
|
||||||
|
|
||||||
*MapGen:register2DPeak*
|
|
||||||
MapGen:register2DPeak({layerName}, {category}, {def})
|
|
||||||
Mark a world point as `MapGen.Peak` and assign it a specific color that will affect the generation.
|
|
||||||
The Y coordinate will be forced to zero, and the `is2d` group will be added to the groups field.
|
|
||||||
|
|
||||||
Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
|
||||||
|
|
||||||
Parameters: ~
|
|
||||||
{layerName} (string) The name of the layer in which the new peak will be included.
|
|
||||||
{category} (MapGen.Layer.Category) Category indicating what will be generated by peak.
|
|
||||||
{def} (MapGen.PeakDef) Peak description table, see details `MapGen.PeakDef`.
|
|
||||||
|
|
||||||
|
|
||||||
*MapGen:register2DPeaks*
|
|
||||||
MapGen:register2DPeaks({layerName}, {category}, {defs})
|
|
||||||
Mark the world points as `MapGen.Peak` and assign them all a specific noise that will affect generation.
|
|
||||||
The Y coordinate will be forced to zero, and the `is2d` group will be added to the groups field.
|
|
||||||
|
|
||||||
Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
|
||||||
|
|
||||||
Parameters: ~
|
|
||||||
{layerName} (string) The name of the layer in which the new peaks will be included.
|
|
||||||
{category} (MapGen.Layer.Category) Category indicating what will be generated by peaks.
|
|
||||||
{defs} (MapGen.PeakDef[]) Peaks description table, see details `MapGen.PeakDef`.
|
|
||||||
|
|
||||||
|
|
||||||
*MapGen:register2DPeaksFromFile*
|
|
||||||
MapGen:register2DPeaksFromFile({layerName}, {map}, {scale}, {zeroPos}, {category}, {groups?})
|
|
||||||
Extract the `MapGen.Peak` from the image and assign them all a specific color that will affect the generation.
|
|
||||||
|
|
||||||
Parameters: ~
|
|
||||||
{layerName} (string) The name of the layer in which the new peaks will be included.
|
|
||||||
{map} (string) The name of the image from which the peaks will be extracted. It should be located in the `<mod_name>/textures/maps` folder and have the following format `<image_name>.ff`
|
|
||||||
{scale} (number) Multiplier of how many blocks (nodes) will be between image pixels. It is not recommended to set the value below 50 for performance reasons.
|
|
||||||
{zeroPos} (Position2d) The position in pixels where the zero world coordinate will be in the image.
|
|
||||||
{category} (MapGen.Layer.Category) Category indicating what will be generated by peaks.
|
|
||||||
{groups?} (table<string,number>) Groups that will be added to all peaks.
|
|
||||||
|
|
||||||
|
|
||||||
*MapGen:registerBiome*
|
|
||||||
MapGen:registerBiome({layerName}, {biomeName}, {def})
|
|
||||||
Mark a point on the biomes diagram and constrain the world area by height to mark it as `MapGen.Biome`.
|
|
||||||
|
|
||||||
Parameters: ~
|
|
||||||
{layerName} (string) The name of the layer in which the new biome will be included.
|
|
||||||
{biomeName} (string) The name to be assigned to the biome. The name must be unique for each biome.
|
|
||||||
{def} (MapGen.BiomeDef) Biome description table, see details `MapGen.BiomeDef`
|
|
||||||
|
|
||||||
|
|
||||||
*MapGen:registerCavern*
|
|
||||||
MapGen:registerCavern({layerName}, {cavernName}, {def})
|
|
||||||
Mark the world area between two heights as a `MapGen.Cavern` and assign the noise that the cave will be generated from.
|
|
||||||
|
|
||||||
Parameters: ~
|
|
||||||
{layerName} (string) The name of the layer in which the new cavern will be included.
|
|
||||||
{cavernName} (string) The name to be assigned to the cavern. The name must be unique for each cavern.
|
|
||||||
{def} (MapGen.CavernDef) Cavern description table, see details `MapGen.CavernDef`
|
|
||||||
|
|
||||||
|
|
||||||
MapGen:initLayersTriangultaion() *MapGen:initLayersTriangultaion*
|
|
||||||
Divide all layers into triangles whose vertices are the `Mapgen.Peak` belonging to these layers.
|
|
||||||
|
|
||||||
|
|
||||||
MapGen:initLayersNoises() *MapGen:initLayersNoises*
|
|
||||||
Initialize all layer noises. This should be called after the map object is loaded.
|
|
||||||
|
|
||||||
|
|
||||||
MapGen:initBiomesDiagram() *MapGen:initBiomesDiagram*
|
|
||||||
Initialization of the biome diagram using the Voronoi method.
|
|
||||||
|
|
||||||
|
|
||||||
MapGen:initCavernsNoise() *MapGen:initCavernsNoise*
|
|
||||||
Initialize caverns's noises. This should be called after the map object is loaded.
|
|
||||||
|
|
||||||
|
|
||||||
*MapGen:getNoises2dValue*
|
|
||||||
MapGen:getNoises2dValue({category}, {layer}, {x}, {y}, {z})
|
|
||||||
Calculates a smoothed 2D noise value based on a preliminary space partitioning.
|
|
||||||
|
|
||||||
Returns `nil` if the point is not included in any triangle.
|
|
||||||
|
|
||||||
Parameters: ~
|
|
||||||
{category} (MapGen.Layer.Category)
|
|
||||||
{layer} (MapGen.Layer)
|
|
||||||
{x} (integer)
|
|
||||||
{y} (integer)
|
|
||||||
{z} (integer) @return number?
|
|
||||||
|
|
||||||
|
|
||||||
*MapGen:getNoises3dValues*
|
|
||||||
MapGen:getNoises3dValues({layer}, {x}, {y}, {z})
|
|
||||||
Calculates a smoothed 3D noise value based on a preliminary space partitioning.
|
|
||||||
|
|
||||||
Returns `nil` if the point is not included in any tetrahedron.
|
|
||||||
|
|
||||||
|
|
||||||
Parameters: ~
|
|
||||||
{layer} (MapGen.Layer)
|
|
||||||
{x} (number)
|
|
||||||
{y} (number)
|
|
||||||
{z} (number) @return number?
|
|
||||||
|
|
||||||
|
|
||||||
*MapGen:onMapGenerated*
|
|
||||||
MapGen:onMapGenerated({voxelManip}, {minPos}, {maxPos}, {blockseed})
|
|
||||||
Chunk generation handler.
|
|
||||||
|
|
||||||
Parameters: ~
|
|
||||||
{voxelManip} (VoxelManip)
|
|
||||||
{minPos} (Position)
|
|
||||||
{maxPos} (Position)
|
|
||||||
{blockseed} (number)
|
|
||||||
|
|
||||||
|
|
||||||
MapGen:run() *MapGen:run*
|
|
||||||
Run world generation through this mapgen object
|
|
||||||
|
|
||||||
Note: only one instance of a `MapGen` class can be running.
|
|
||||||
|
|
||||||
**FOR MAPGEN ENVIRONMENT ONLY**
|
|
||||||
|
|
||||||
|
|
||||||
vim:tw=78:ts=8:noet:ft=help:norl:
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
# index
|
|
||||||
|
|
||||||
|
|
||||||
## Types
|
|
||||||
|
|
||||||
- [alias Category](types/MapGen.Layer.Category.md)
|
|
||||||
- [alias CircumCircleEnum](types/MapGen.Triangle.CircumCircleEnum.md)
|
|
||||||
- [alias ColoredDotsTable](types/ColoredDotsTable.md)
|
|
||||||
- [alias Neighbours](types/MapGen.Triangle.Neighbours.md)
|
|
||||||
- [alias PastCalcNoiseValue](types/MapGen.PastCalcNoiseValue.md)
|
|
||||||
- [alias generateFunc](types/generateFunc.md)
|
|
||||||
- [class Biome](types/MapGen.Biome.md)
|
|
||||||
- [class BiomeDef](types/MapGen.BiomeDef.md)
|
|
||||||
- [class Cavern](types/MapGen.Cavern.md)
|
|
||||||
- [class CavernDef](types/MapGen.CavernDef.md)
|
|
||||||
- [class Decoration](types/MapGen.Decoration.md)
|
|
||||||
- [class Edge](types/MapGen.Triangulation.Edge.md)
|
|
||||||
- [class FakePeak](types/MapGen.Triangulation.FakePeak.md)
|
|
||||||
- [class GroundNodes](types/MapGen.Biome.GroundNodes.md)
|
|
||||||
- [class GroundNodesIDs](types/MapGen.Biome.GroundNodesIDs.md)
|
|
||||||
- [class Layer](types/MapGen.Layer.md)
|
|
||||||
- [class LayerDef](types/MapGen.LayerDef.md)
|
|
||||||
- [class MapGen](types/MapGen.md)
|
|
||||||
- [class MapGenDef](types/MapGenDef.md)
|
|
||||||
- [class Peak](types/MapGen.Peak.md)
|
|
||||||
- [class PeakDef](types/MapGen.PeakDef.md)
|
|
||||||
- [class StaticLayer](types/MapGen.StaticLayer.md)
|
|
||||||
- [class StaticLayerDef](types/MapGen.StaticLayerDef.md)
|
|
||||||
- [class Tetrahedron](types/MapGen.Tetrahedron.md)
|
|
||||||
- [class Triangle](types/MapGen.Triangle.md)
|
|
||||||
- [class Triangulation](types/MapGen.Triangulation.md)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Modules
|
|
||||||
- [MapGen](modules/MapGen.md)
|
|
||||||
- [MapGen.Biome](modules/MapGen.Biome.md)
|
|
||||||
- [MapGen.Biome.GroundNodes](modules/MapGen.Biome.GroundNodes.md)
|
|
||||||
- [MapGen.Biome.GroundNodesIds](modules/MapGen.Biome.GroundNodesIds.md)
|
|
||||||
- [MapGen.Cavern](modules/MapGen.Cavern.md)
|
|
||||||
- [MapGen.Decoration](modules/MapGen.Decoration.md)
|
|
||||||
- [MapGen.Layer](modules/MapGen.Layer.md)
|
|
||||||
- [MapGen.Peak](modules/MapGen.Peak.md)
|
|
||||||
- [MapGen.StaticLayer](modules/MapGen.StaticLayer.md)
|
|
||||||
- [MapGen.Tetrahedron](modules/MapGen.Tetrahedron.md)
|
|
||||||
- [MapGen.Triangle](modules/MapGen.Triangle.md)
|
|
||||||
- [MapGen.Triangulation](modules/MapGen.Triangulation.md)
|
|
||||||
- [MapGen.Triangulation.Edge](modules/MapGen.Triangulation.Edge.md)
|
|
||||||
- [MapGen.Triangulation.FakePeak](modules/MapGen.Triangulation.FakePeak.md)
|
|
||||||
- [MapGen.ff2luat](modules/MapGen.ff2luat.md)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
# global MapGen.Biome.GroundNodes
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### GroundNodes.turf
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
GroundNodes.turf : string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
The soil covering the surface of the biome
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### GroundNodes.soil
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
GroundNodes.soil : string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
The soil beneath the turf. The height of this layer depends on `Biome.soilHeight`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### GroundNodes.rock
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
GroundNodes.rock : string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
The rock found beneath the soil of a biome.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### GroundNodes.bottom
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
GroundNodes.bottom : string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Covering the bottom of reservoirs.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
# global MapGen.Biome.GroundNodesIds
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### GroundNodesIDs.turf
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
GroundNodesIDs.turf : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
The soil covering the surface of the biome
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### GroundNodesIDs.soil
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
GroundNodesIDs.soil : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
The soil beneath the turf. The height of this layer depends on `Biome.soilHeight`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### GroundNodesIDs.rock
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
GroundNodesIDs.rock : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
The rock found beneath the soil of a biome.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### GroundNodesIDs.bottom
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
GroundNodesIDs.bottom : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Covering the bottom of reservoirs.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,307 +0,0 @@
|
|||||||
# global MapGen.Biome
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## methods
|
|
||||||
---
|
|
||||||
|
|
||||||
### Biome.new
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Biome.new(
|
|
||||||
name: string,
|
|
||||||
def: MapGen.BiomeDef {
|
|
||||||
tempPoint = number,
|
|
||||||
humidityPoint = number,
|
|
||||||
minY = number,
|
|
||||||
maxY = number,
|
|
||||||
groundNodes = MapGen.Biome.GroundNodes,
|
|
||||||
soilHeight = number,
|
|
||||||
generateAir = generateFunc?,
|
|
||||||
generateCavernAir = generateFunc?,
|
|
||||||
generateWater = generateFunc?,
|
|
||||||
generateRock = generateFunc?,
|
|
||||||
generateTurf = generateFunc?,
|
|
||||||
generateSoil = generateFunc?,
|
|
||||||
generateBottom = generateFunc?,
|
|
||||||
}
|
|
||||||
) -> MapGen.Biome {
|
|
||||||
name = string,
|
|
||||||
tempPoint = number,
|
|
||||||
humidityPoint = number,
|
|
||||||
minY = number,
|
|
||||||
maxY = number,
|
|
||||||
groundNodes = MapGen.Biome.GroundNodes,
|
|
||||||
groundNodesIDs = MapGen.Biome.GroundNodesIDs,
|
|
||||||
soilHeight = number,
|
|
||||||
generateAir = generateFunc,
|
|
||||||
generateCavernAir = generateFunc,
|
|
||||||
generateWater = generateFunc,
|
|
||||||
generateRock = generateFunc,
|
|
||||||
generateTurf = generateFunc,
|
|
||||||
generateSoil = generateFunc,
|
|
||||||
generateBottom = generateFunc,
|
|
||||||
new = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### Biome.name
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.name : string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.tempPoint
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.tempPoint : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.humidityPoint
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.humidityPoint : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.minY
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.minY : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.maxY
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.maxY : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.groundNodes
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.groundNodes : MapGen.Biome.GroundNodes {
|
|
||||||
turf: string,
|
|
||||||
soil: string,
|
|
||||||
rock: string,
|
|
||||||
bottom: string,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.groundNodesIDs
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.groundNodesIDs : MapGen.Biome.GroundNodesIDs {
|
|
||||||
turf: number,
|
|
||||||
soil: number,
|
|
||||||
rock: number,
|
|
||||||
bottom: number,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.soilHeight
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.soilHeight : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.generateAir
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.generateAir : generateFunc
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.generateCavernAir
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.generateCavernAir : generateFunc
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.generateWater
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.generateWater : generateFunc
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.generateRock
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.generateRock : generateFunc
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.generateTurf
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.generateTurf : generateFunc
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.generateSoil
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.generateSoil : generateFunc
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.generateBottom
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.generateBottom : generateFunc
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,203 +0,0 @@
|
|||||||
# global MapGen.Cavern
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## methods
|
|
||||||
---
|
|
||||||
|
|
||||||
### Cavern.getNoise
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Cavern.getNoise()-> ValueNoise
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Cavern.initNoise
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Cavern.initNoise()-> nil
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Cavern.getGroups
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Cavern.getGroups()
|
|
||||||
-> table<string,number>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Cavern.new
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Cavern.new(
|
|
||||||
name: string,
|
|
||||||
def: MapGen.CavernDef {
|
|
||||||
minY = number,
|
|
||||||
maxY = number,
|
|
||||||
noiseParams = NoiseParams,
|
|
||||||
smoothDistance = number,
|
|
||||||
threshold = number?,
|
|
||||||
groups = table<string,number>?,
|
|
||||||
}
|
|
||||||
) -> MapGen.Cavern {
|
|
||||||
name = string,
|
|
||||||
minY = number,
|
|
||||||
maxY = number,
|
|
||||||
smoothDistance = number,
|
|
||||||
threshold = number,
|
|
||||||
getNoise = function,
|
|
||||||
initNoise = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
isCavern = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Cavern.isCavern
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Cavern.isCavern(
|
|
||||||
x: integer,
|
|
||||||
y: integer,
|
|
||||||
z: integer
|
|
||||||
) -> boolean
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns `true` if there is a cavern at the specified coordinates.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### Cavern.name
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Cavern.name : string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Cavern.minY
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Cavern.minY : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Cavern.maxY
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Cavern.maxY : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Cavern.smoothDistance
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Cavern.smoothDistance : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Cavern.threshold
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Cavern.threshold : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
# global MapGen.Decoration
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## methods
|
|
||||||
---
|
|
||||||
|
|
||||||
### Decoration.new
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Decoration.new() -> MapGen.Decoration {
|
|
||||||
new = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,673 +0,0 @@
|
|||||||
# global MapGen.Layer
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## methods
|
|
||||||
---
|
|
||||||
|
|
||||||
### Layer.calcTemp
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Layer.calcTemp(
|
|
||||||
self: MapGen.Layer {
|
|
||||||
name = string,
|
|
||||||
minY = integer,
|
|
||||||
maxY = integer,
|
|
||||||
minTemp = integer,
|
|
||||||
maxTemp = integer,
|
|
||||||
minHumidity = integer,
|
|
||||||
maxHumidity = integer,
|
|
||||||
waterLevel = integer,
|
|
||||||
peaksList = { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] },
|
|
||||||
noisesByColor = { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> },
|
|
||||||
noisesParamsByColor = { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> },
|
|
||||||
biomesByName = table<string,MapGen.Biome>,
|
|
||||||
biomesList = MapGen.Biome[],
|
|
||||||
biomesDiagram = table,
|
|
||||||
biomesGorizontalScattering = integer,
|
|
||||||
biomesVerticalScattering = integer,
|
|
||||||
cavernsByName = table<string,MapGen.Cavern>,
|
|
||||||
cavernsList = MapGen.Cavern[],
|
|
||||||
trianglesList = { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] },
|
|
||||||
tetrahedronsList = MapGen.Tetrahedron[],
|
|
||||||
calcTemp = function,
|
|
||||||
calcHumidity = function,
|
|
||||||
new = function,
|
|
||||||
addPeak = function,
|
|
||||||
addNoiseParamsColor = function,
|
|
||||||
getNoiseByColor = function,
|
|
||||||
addBiome = function,
|
|
||||||
addCavern = function,
|
|
||||||
initNoises = function,
|
|
||||||
initBiomesDiagram = function,
|
|
||||||
},
|
|
||||||
value: number,
|
|
||||||
height: number
|
|
||||||
)-> number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.calcHumidity
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Layer.calcHumidity(
|
|
||||||
self: MapGen.Layer {
|
|
||||||
name = string,
|
|
||||||
minY = integer,
|
|
||||||
maxY = integer,
|
|
||||||
minTemp = integer,
|
|
||||||
maxTemp = integer,
|
|
||||||
minHumidity = integer,
|
|
||||||
maxHumidity = integer,
|
|
||||||
waterLevel = integer,
|
|
||||||
peaksList = { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] },
|
|
||||||
noisesByColor = { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> },
|
|
||||||
noisesParamsByColor = { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> },
|
|
||||||
biomesByName = table<string,MapGen.Biome>,
|
|
||||||
biomesList = MapGen.Biome[],
|
|
||||||
biomesDiagram = table,
|
|
||||||
biomesGorizontalScattering = integer,
|
|
||||||
biomesVerticalScattering = integer,
|
|
||||||
cavernsByName = table<string,MapGen.Cavern>,
|
|
||||||
cavernsList = MapGen.Cavern[],
|
|
||||||
trianglesList = { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] },
|
|
||||||
tetrahedronsList = MapGen.Tetrahedron[],
|
|
||||||
calcTemp = function,
|
|
||||||
calcHumidity = function,
|
|
||||||
new = function,
|
|
||||||
addPeak = function,
|
|
||||||
addNoiseParamsColor = function,
|
|
||||||
getNoiseByColor = function,
|
|
||||||
addBiome = function,
|
|
||||||
addCavern = function,
|
|
||||||
initNoises = function,
|
|
||||||
initBiomesDiagram = function,
|
|
||||||
},
|
|
||||||
value: number,
|
|
||||||
height: number
|
|
||||||
)-> number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.new
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Layer.new(
|
|
||||||
name: string,
|
|
||||||
def: MapGen.LayerDef {
|
|
||||||
minY = number,
|
|
||||||
maxY = number,
|
|
||||||
minTemp = number,
|
|
||||||
maxTemp = number,
|
|
||||||
minHumidity = number,
|
|
||||||
maxHumidity = number,
|
|
||||||
waterLevel = number?,
|
|
||||||
calcTemp = (fun(self: MapGen.Layer, value: number, height: number) -> number)?,
|
|
||||||
calcHumidity = (fun(self: MapGen.Layer, value: number, height: number) -> number)?,
|
|
||||||
biomesGorizontalScattering = number?,
|
|
||||||
biomesVerticalScattering = number?,
|
|
||||||
}
|
|
||||||
) -> MapGen.Layer {
|
|
||||||
name = string,
|
|
||||||
minY = integer,
|
|
||||||
maxY = integer,
|
|
||||||
minTemp = integer,
|
|
||||||
maxTemp = integer,
|
|
||||||
minHumidity = integer,
|
|
||||||
maxHumidity = integer,
|
|
||||||
waterLevel = integer,
|
|
||||||
peaksList = { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] },
|
|
||||||
noisesByColor = { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> },
|
|
||||||
noisesParamsByColor = { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> },
|
|
||||||
biomesByName = table<string,MapGen.Biome>,
|
|
||||||
biomesList = MapGen.Biome[],
|
|
||||||
biomesDiagram = table,
|
|
||||||
biomesGorizontalScattering = integer,
|
|
||||||
biomesVerticalScattering = integer,
|
|
||||||
cavernsByName = table<string,MapGen.Cavern>,
|
|
||||||
cavernsList = MapGen.Cavern[],
|
|
||||||
trianglesList = { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] },
|
|
||||||
tetrahedronsList = MapGen.Tetrahedron[],
|
|
||||||
calcTemp = function,
|
|
||||||
calcHumidity = function,
|
|
||||||
new = function,
|
|
||||||
addPeak = function,
|
|
||||||
addNoiseParamsColor = function,
|
|
||||||
getNoiseByColor = function,
|
|
||||||
addBiome = function,
|
|
||||||
addCavern = function,
|
|
||||||
initNoises = function,
|
|
||||||
initBiomesDiagram = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.addPeak
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Layer.addPeak(
|
|
||||||
category: MapGen.Layer.Category,
|
|
||||||
peak: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
}
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Adds a peak to the `Layer.peaksList`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.addNoiseParamsColor
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Layer.addNoiseParamsColor(
|
|
||||||
category: MapGen.Layer.Category,
|
|
||||||
color: ColorString,
|
|
||||||
noiseParams: NoiseParams
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Adds a NoiseParams color to the `Layer.noisesParamsByColor`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.getNoiseByColor
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Layer.getNoiseByColor(
|
|
||||||
category: MapGen.Layer.Category,
|
|
||||||
color: ColorString
|
|
||||||
) -> ValueNoise
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns noise corresponding to a color.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.addBiome
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Layer.addBiome(
|
|
||||||
biomeName: string,
|
|
||||||
biome: MapGen.Biome {
|
|
||||||
name = string,
|
|
||||||
tempPoint = number,
|
|
||||||
humidityPoint = number,
|
|
||||||
minY = number,
|
|
||||||
maxY = number,
|
|
||||||
groundNodes = MapGen.Biome.GroundNodes,
|
|
||||||
groundNodesIDs = MapGen.Biome.GroundNodesIDs,
|
|
||||||
soilHeight = number,
|
|
||||||
generateAir = generateFunc,
|
|
||||||
generateCavernAir = generateFunc,
|
|
||||||
generateWater = generateFunc,
|
|
||||||
generateRock = generateFunc,
|
|
||||||
generateTurf = generateFunc,
|
|
||||||
generateSoil = generateFunc,
|
|
||||||
generateBottom = generateFunc,
|
|
||||||
new = function,
|
|
||||||
}
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Adds a biome to the `Layer.biomesByName` & `Layer.biomesList`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.addCavern
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Layer.addCavern(
|
|
||||||
cavernName: string,
|
|
||||||
cavern: MapGen.Cavern {
|
|
||||||
name = string,
|
|
||||||
minY = number,
|
|
||||||
maxY = number,
|
|
||||||
smoothDistance = number,
|
|
||||||
threshold = number,
|
|
||||||
getNoise = function,
|
|
||||||
initNoise = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
isCavern = function,
|
|
||||||
}
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Adds a cavern to the `Layer.cavernsByName` & `Layer.cavernsList`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.initNoises
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Layer.initNoises() -> nil
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Initializes noise for generation.
|
|
||||||
|
|
||||||
Should only be called after the mapgen object has been loaded.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.initBiomesDiagram
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Layer.initBiomesDiagram() -> nil
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Initialization of the biome diagram using the Voronoi method.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### Layer.name
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.name : string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.minY
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.minY : integer
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.maxY
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.maxY : integer
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.minTemp
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.minTemp : integer
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.maxTemp
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.maxTemp : integer
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.minHumidity
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.minHumidity : integer
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.maxHumidity
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.maxHumidity : integer
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.waterLevel
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.waterLevel : integer
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.peaksList
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.peaksList : { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] }
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.noisesByColor
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.noisesByColor : { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> }
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.noisesParamsByColor
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.noisesParamsByColor : { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> }
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.biomesByName
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.biomesByName : table<string,MapGen.Biome>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.biomesList
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.biomesList : MapGen.Biome[]
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.biomesDiagram
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.biomesDiagram : table
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.biomesGorizontalScattering
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.biomesGorizontalScattering : integer
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.biomesVerticalScattering
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.biomesVerticalScattering : integer
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.cavernsByName
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.cavernsByName : table<string,MapGen.Cavern>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.cavernsList
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.cavernsList : MapGen.Cavern[]
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.trianglesList
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.trianglesList : { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] }
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.tetrahedronsList
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.tetrahedronsList : MapGen.Tetrahedron[]
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
**Not supported**
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,157 +0,0 @@
|
|||||||
# global MapGen.Peak
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## methods
|
|
||||||
---
|
|
||||||
|
|
||||||
### Peak.getPeakPos
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Peak.getPeakPos(self)-> vector
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Peak.getColor
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Peak.getColor(self)-> ColorString
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Peak.getGroups
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Peak.getGroups(self)
|
|
||||||
-> table<string,number>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Peak.new
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Peak.new(def: MapGen.PeakDef {
|
|
||||||
pos = vector,
|
|
||||||
color = ColorString,
|
|
||||||
groups = table<string,number>?,
|
|
||||||
}) -> MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Peak.toString
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Peak.toString() -> string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns a string describing the object in a readable form.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Peak.eq
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Peak.eq(other: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
}) -> boolean
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns true if the peaks are equivalent.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### Peak.id
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Peak.id : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,144 +0,0 @@
|
|||||||
# global MapGen.StaticLayer
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## methods
|
|
||||||
---
|
|
||||||
|
|
||||||
### StaticLayer.new
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function StaticLayer.new(
|
|
||||||
name: string,
|
|
||||||
def: MapGen.StaticLayerDef {
|
|
||||||
minY = number,
|
|
||||||
maxY = number,
|
|
||||||
staticNode = string,
|
|
||||||
generateStaticNode = generateFunc,
|
|
||||||
}
|
|
||||||
) -> MapGen.StaticLayer {
|
|
||||||
name = string,
|
|
||||||
minY = number,
|
|
||||||
maxY = number,
|
|
||||||
staticNode = string,
|
|
||||||
staticNodeID = number,
|
|
||||||
generateStaticNode = generateFunc,
|
|
||||||
new = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### StaticLayer.name
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
StaticLayer.name : string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### StaticLayer.minY
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
StaticLayer.minY : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### StaticLayer.maxY
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
StaticLayer.maxY : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### StaticLayer.staticNode
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
StaticLayer.staticNode : string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### StaticLayer.staticNodeID
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
StaticLayer.staticNodeID : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### StaticLayer.generateStaticNode
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
StaticLayer.generateStaticNode : generateFunc
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,536 +0,0 @@
|
|||||||
# global MapGen.Tetrahedron
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## methods
|
|
||||||
---
|
|
||||||
|
|
||||||
### Tetrahedron.new
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Tetrahedron.new(
|
|
||||||
p1: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
},
|
|
||||||
p2: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
},
|
|
||||||
p3: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
},
|
|
||||||
p4: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
}
|
|
||||||
) -> MapGen.Tetrahedron {
|
|
||||||
p1 = MapGen.Peak,
|
|
||||||
p2 = MapGen.Peak,
|
|
||||||
p3 = MapGen.Peak,
|
|
||||||
p4 = MapGen.Peak,
|
|
||||||
h1 = MapGen.Triangulation.Edge,
|
|
||||||
h2 = MapGen.Triangulation.Edge,
|
|
||||||
h3 = MapGen.Triangulation.Edge,
|
|
||||||
h4 = MapGen.Triangulation.Edge,
|
|
||||||
f1 = MapGen.Triangle,
|
|
||||||
f2 = MapGen.Triangle,
|
|
||||||
f3 = MapGen.Triangle,
|
|
||||||
f4 = MapGen.Triangle,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
getHeight = function,
|
|
||||||
getCircumSphereCenter = function,
|
|
||||||
getCircumSphereRadius = function,
|
|
||||||
inCircumSphere = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.toString
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Tetrahedron.toString() -> string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns a string describing the object in a readable form.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.getHeight
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Tetrahedron.getHeight(
|
|
||||||
p1: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
},
|
|
||||||
p2: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
},
|
|
||||||
p3: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
},
|
|
||||||
p4: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
}
|
|
||||||
) -> MapGen.Triangulation.Edge?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.getCircumSphereCenter
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Tetrahedron.getCircumSphereCenter() -> vector
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns the center of the circumscribed sphere.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.getCircumSphereRadius
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Tetrahedron.getCircumSphereRadius() -> number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns the radius of the circumscribed sphere.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.inCircumSphere
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Tetrahedron.inCircumSphere(p: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
}) -> boolean
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Checks whether a given point lies within the circumscribed sphere of a tetrahedron.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### Tetrahedron.p1
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Tetrahedron.p1 : MapGen.Peak {
|
|
||||||
id: number,
|
|
||||||
getPeakPos: function,
|
|
||||||
getColor: function,
|
|
||||||
getGroups: function,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.p2
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Tetrahedron.p2 : MapGen.Peak {
|
|
||||||
id: number,
|
|
||||||
getPeakPos: function,
|
|
||||||
getColor: function,
|
|
||||||
getGroups: function,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.p3
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Tetrahedron.p3 : MapGen.Peak {
|
|
||||||
id: number,
|
|
||||||
getPeakPos: function,
|
|
||||||
getColor: function,
|
|
||||||
getGroups: function,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.p4
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Tetrahedron.p4 : MapGen.Peak {
|
|
||||||
id: number,
|
|
||||||
getPeakPos: function,
|
|
||||||
getColor: function,
|
|
||||||
getGroups: function,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.h1
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Tetrahedron.h1 : MapGen.Triangulation.Edge {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
same: function,
|
|
||||||
length: function,
|
|
||||||
getMidPoint: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.h2
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Tetrahedron.h2 : MapGen.Triangulation.Edge {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
same: function,
|
|
||||||
length: function,
|
|
||||||
getMidPoint: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.h3
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Tetrahedron.h3 : MapGen.Triangulation.Edge {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
same: function,
|
|
||||||
length: function,
|
|
||||||
getMidPoint: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.h4
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Tetrahedron.h4 : MapGen.Triangulation.Edge {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
same: function,
|
|
||||||
length: function,
|
|
||||||
getMidPoint: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.f1
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Tetrahedron.f1 : MapGen.Triangle {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
p3: MapGen.Peak,
|
|
||||||
e1: MapGen.Triangulation.Edge,
|
|
||||||
e2: MapGen.Triangulation.Edge,
|
|
||||||
e3: MapGen.Triangulation.Edge,
|
|
||||||
h1: MapGen.Triangulation.Edge,
|
|
||||||
h2: MapGen.Triangulation.Edge,
|
|
||||||
h3: MapGen.Triangulation.Edge,
|
|
||||||
neighbours: MapGen.Triangle.Neighbours,
|
|
||||||
color: ColorString?,
|
|
||||||
new: function,
|
|
||||||
...(+13)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.f2
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Tetrahedron.f2 : MapGen.Triangle {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
p3: MapGen.Peak,
|
|
||||||
e1: MapGen.Triangulation.Edge,
|
|
||||||
e2: MapGen.Triangulation.Edge,
|
|
||||||
e3: MapGen.Triangulation.Edge,
|
|
||||||
h1: MapGen.Triangulation.Edge,
|
|
||||||
h2: MapGen.Triangulation.Edge,
|
|
||||||
h3: MapGen.Triangulation.Edge,
|
|
||||||
neighbours: MapGen.Triangle.Neighbours,
|
|
||||||
color: ColorString?,
|
|
||||||
new: function,
|
|
||||||
...(+13)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.f3
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Tetrahedron.f3 : MapGen.Triangle {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
p3: MapGen.Peak,
|
|
||||||
e1: MapGen.Triangulation.Edge,
|
|
||||||
e2: MapGen.Triangulation.Edge,
|
|
||||||
e3: MapGen.Triangulation.Edge,
|
|
||||||
h1: MapGen.Triangulation.Edge,
|
|
||||||
h2: MapGen.Triangulation.Edge,
|
|
||||||
h3: MapGen.Triangulation.Edge,
|
|
||||||
neighbours: MapGen.Triangle.Neighbours,
|
|
||||||
color: ColorString?,
|
|
||||||
new: function,
|
|
||||||
...(+13)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.f4
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Tetrahedron.f4 : MapGen.Triangle {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
p3: MapGen.Peak,
|
|
||||||
e1: MapGen.Triangulation.Edge,
|
|
||||||
e2: MapGen.Triangulation.Edge,
|
|
||||||
e3: MapGen.Triangulation.Edge,
|
|
||||||
h1: MapGen.Triangulation.Edge,
|
|
||||||
h2: MapGen.Triangulation.Edge,
|
|
||||||
h3: MapGen.Triangulation.Edge,
|
|
||||||
neighbours: MapGen.Triangle.Neighbours,
|
|
||||||
color: ColorString?,
|
|
||||||
new: function,
|
|
||||||
...(+13)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,745 +0,0 @@
|
|||||||
# global MapGen.Triangle
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## methods
|
|
||||||
---
|
|
||||||
|
|
||||||
### Triangle.new
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.new(
|
|
||||||
p1: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
},
|
|
||||||
p2: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
},
|
|
||||||
p3: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
}
|
|
||||||
) -> MapGen.Triangle {
|
|
||||||
p1 = MapGen.Peak,
|
|
||||||
p2 = MapGen.Peak,
|
|
||||||
p3 = MapGen.Peak,
|
|
||||||
e1 = MapGen.Triangulation.Edge,
|
|
||||||
e2 = MapGen.Triangulation.Edge,
|
|
||||||
e3 = MapGen.Triangulation.Edge,
|
|
||||||
h1 = MapGen.Triangulation.Edge,
|
|
||||||
h2 = MapGen.Triangulation.Edge,
|
|
||||||
h3 = MapGen.Triangulation.Edge,
|
|
||||||
neighbours = MapGen.Triangle.Neighbours,
|
|
||||||
color = ColorString?,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
same = function,
|
|
||||||
getCenter = function,
|
|
||||||
getArea = function,
|
|
||||||
getHeight = function,
|
|
||||||
getHeight2D = function,
|
|
||||||
getSidesLength = function,
|
|
||||||
getSidesLength2D = function,
|
|
||||||
getCircumCenter2D = function,
|
|
||||||
getCircumRadius2D = function,
|
|
||||||
getCircumCircle2D = function,
|
|
||||||
inCircumCircle2D = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.toString
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.toString() -> string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns a string describing the object in a readable form.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.eq
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.eq(other: MapGen.Triangle {
|
|
||||||
p1 = MapGen.Peak,
|
|
||||||
p2 = MapGen.Peak,
|
|
||||||
p3 = MapGen.Peak,
|
|
||||||
e1 = MapGen.Triangulation.Edge,
|
|
||||||
e2 = MapGen.Triangulation.Edge,
|
|
||||||
e3 = MapGen.Triangulation.Edge,
|
|
||||||
h1 = MapGen.Triangulation.Edge,
|
|
||||||
h2 = MapGen.Triangulation.Edge,
|
|
||||||
h3 = MapGen.Triangulation.Edge,
|
|
||||||
neighbours = MapGen.Triangle.Neighbours,
|
|
||||||
color = ColorString?,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
same = function,
|
|
||||||
getCenter = function,
|
|
||||||
getArea = function,
|
|
||||||
getHeight = function,
|
|
||||||
getHeight2D = function,
|
|
||||||
getSidesLength = function,
|
|
||||||
getSidesLength2D = function,
|
|
||||||
getCircumCenter2D = function,
|
|
||||||
getCircumRadius2D = function,
|
|
||||||
getCircumCircle2D = function,
|
|
||||||
inCircumCircle2D = function,
|
|
||||||
}) -> boolean
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns true if the triangles are equivalent.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.same
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.same(other: MapGen.Triangle {
|
|
||||||
p1 = MapGen.Peak,
|
|
||||||
p2 = MapGen.Peak,
|
|
||||||
p3 = MapGen.Peak,
|
|
||||||
e1 = MapGen.Triangulation.Edge,
|
|
||||||
e2 = MapGen.Triangulation.Edge,
|
|
||||||
e3 = MapGen.Triangulation.Edge,
|
|
||||||
h1 = MapGen.Triangulation.Edge,
|
|
||||||
h2 = MapGen.Triangulation.Edge,
|
|
||||||
h3 = MapGen.Triangulation.Edge,
|
|
||||||
neighbours = MapGen.Triangle.Neighbours,
|
|
||||||
color = ColorString?,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
same = function,
|
|
||||||
getCenter = function,
|
|
||||||
getArea = function,
|
|
||||||
getHeight = function,
|
|
||||||
getHeight2D = function,
|
|
||||||
getSidesLength = function,
|
|
||||||
getSidesLength2D = function,
|
|
||||||
getCircumCenter2D = function,
|
|
||||||
getCircumRadius2D = function,
|
|
||||||
getCircumCircle2D = function,
|
|
||||||
inCircumCircle2D = function,
|
|
||||||
}) -> boolean
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns true if the triangles are similar.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.getCenter
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.getCenter() -> vector
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns the coordinates of the triangle's center.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.getArea
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.getArea() -> number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns the area of a triangle.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.getHeight
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.getHeight(
|
|
||||||
p1: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
},
|
|
||||||
p2: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
},
|
|
||||||
p3: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
}
|
|
||||||
) -> MapGen.Triangulation.Edge {
|
|
||||||
p1 = MapGen.Peak,
|
|
||||||
p2 = MapGen.Peak,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
same = function,
|
|
||||||
length = function,
|
|
||||||
getMidPoint = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns the perpendicular from the vertex Peak1 to the line Peak2-Peak3.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.getHeight2D
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.getHeight2D(
|
|
||||||
p1: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
},
|
|
||||||
p2: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
},
|
|
||||||
p3: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
}
|
|
||||||
) -> MapGen.Triangulation.Edge {
|
|
||||||
p1 = MapGen.Peak,
|
|
||||||
p2 = MapGen.Peak,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
same = function,
|
|
||||||
length = function,
|
|
||||||
getMidPoint = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns the perpendicular from the vertex Peak1 to the line Peak2-Peak3.
|
|
||||||
|
|
||||||
Note: This function does not take into account the Y-coordinate,
|
|
||||||
that is, the calculation is performed on the projection of the triangle XZ.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.getSidesLength
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.getSidesLength()
|
|
||||||
-> number
|
|
||||||
-> number
|
|
||||||
-> number
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns the length of the edges
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.getSidesLength2D
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.getSidesLength2D()
|
|
||||||
-> number
|
|
||||||
-> number
|
|
||||||
-> number
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns the length of the edges.
|
|
||||||
|
|
||||||
Note: This function does not take into account the Y-coordinate,
|
|
||||||
that is, the calculation is performed on the projection of the triangle XZ.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.getCircumCenter2D
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.getCircumCenter2D() -> vector
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns the coordinates of the circumcircle center.
|
|
||||||
|
|
||||||
Note: This function does not take into account the Y-coordinate,
|
|
||||||
that is, the calculation is performed on the projection of the triangle XZ.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.getCircumRadius2D
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.getCircumRadius2D() -> number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns the radius of the circumcircle.
|
|
||||||
|
|
||||||
Note: This function does not take into account the Y-coordinate,
|
|
||||||
that is, the calculation is performed on the projection of the triangle XZ.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.getCircumCircle2D
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.getCircumCircle2D()
|
|
||||||
-> vector
|
|
||||||
-> number
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns the coordinates of the circumcircle center and its radius.
|
|
||||||
|
|
||||||
Note: This function does not take into account the Y-coordinate,
|
|
||||||
that is, the calculation is performed on the projection of the triangle XZ.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.inCircumCircle2D
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.inCircumCircle2D(p: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
}) -> boolean
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Checks if a given point lies into the triangle circumcircle.
|
|
||||||
|
|
||||||
Note: This function does not take into account the Y-coordinate,
|
|
||||||
that is, the calculation is performed on the projection of the triangle XZ.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### Triangle.p1
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Triangle.p1 : MapGen.Peak {
|
|
||||||
id: number,
|
|
||||||
getPeakPos: function,
|
|
||||||
getColor: function,
|
|
||||||
getGroups: function,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.p2
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Triangle.p2 : MapGen.Peak {
|
|
||||||
id: number,
|
|
||||||
getPeakPos: function,
|
|
||||||
getColor: function,
|
|
||||||
getGroups: function,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.p3
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Triangle.p3 : MapGen.Peak {
|
|
||||||
id: number,
|
|
||||||
getPeakPos: function,
|
|
||||||
getColor: function,
|
|
||||||
getGroups: function,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.e1
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Triangle.e1 : MapGen.Triangulation.Edge {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
same: function,
|
|
||||||
length: function,
|
|
||||||
getMidPoint: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.e2
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Triangle.e2 : MapGen.Triangulation.Edge {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
same: function,
|
|
||||||
length: function,
|
|
||||||
getMidPoint: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.e3
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Triangle.e3 : MapGen.Triangulation.Edge {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
same: function,
|
|
||||||
length: function,
|
|
||||||
getMidPoint: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.h1
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Triangle.h1 : MapGen.Triangulation.Edge {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
same: function,
|
|
||||||
length: function,
|
|
||||||
getMidPoint: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.h2
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Triangle.h2 : MapGen.Triangulation.Edge {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
same: function,
|
|
||||||
length: function,
|
|
||||||
getMidPoint: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.h3
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Triangle.h3 : MapGen.Triangulation.Edge {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
same: function,
|
|
||||||
length: function,
|
|
||||||
getMidPoint: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.neighbours
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Triangle.neighbours : MapGen.Triangle.Neighbours
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.color
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Triangle.color : ColorString?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,225 +0,0 @@
|
|||||||
# global MapGen.Triangulation.Edge
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## methods
|
|
||||||
---
|
|
||||||
|
|
||||||
### Edge.new
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Edge.new(
|
|
||||||
p1: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
},
|
|
||||||
p2: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
}
|
|
||||||
) -> MapGen.Triangulation.Edge {
|
|
||||||
p1 = MapGen.Peak,
|
|
||||||
p2 = MapGen.Peak,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
same = function,
|
|
||||||
length = function,
|
|
||||||
getMidPoint = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Edge.toString
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Edge.toString() -> string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns a string describing the object in a readable form.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Edge.eq
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Edge.eq(other: MapGen.Triangulation.Edge {
|
|
||||||
p1 = MapGen.Peak,
|
|
||||||
p2 = MapGen.Peak,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
same = function,
|
|
||||||
length = function,
|
|
||||||
getMidPoint = function,
|
|
||||||
}) -> boolean
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns true if the edges are equivalent.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Edge.same
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Edge.same(other: MapGen.Triangulation.Edge {
|
|
||||||
p1 = MapGen.Peak,
|
|
||||||
p2 = MapGen.Peak,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
same = function,
|
|
||||||
length = function,
|
|
||||||
getMidPoint = function,
|
|
||||||
}) -> boolean
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns true if the edges are similar.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Edge.length
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Edge.length() -> number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns the length of an edge.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Edge.getMidPoint
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Edge.getMidPoint() -> vector
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns the vector of the point located in the middle of the edge.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### Edge.p1
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Edge.p1 : MapGen.Peak {
|
|
||||||
id: number,
|
|
||||||
getPeakPos: function,
|
|
||||||
getColor: function,
|
|
||||||
getGroups: function,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Edge.p2
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Edge.p2 : MapGen.Peak {
|
|
||||||
id: number,
|
|
||||||
getPeakPos: function,
|
|
||||||
getColor: function,
|
|
||||||
getGroups: function,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
# global MapGen.Triangulation.FakePeak
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## methods
|
|
||||||
---
|
|
||||||
|
|
||||||
### FakePeak.getPeakPos
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function FakePeak.getPeakPos()-> vector
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### FakePeak.new
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function FakePeak.new(peakPos: vector) -> MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns a fake `MapGen.Peak` that has no noise parameters.
|
|
||||||
Note that the initialized peak should not be used in generation.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### FakePeak.id
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
FakePeak.id : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
# global MapGen.Triangulation
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## methods
|
|
||||||
---
|
|
||||||
|
|
||||||
### Triangulation.triangulate
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangulation.triangulate(vertices: table<integer,MapGen.Peak>) -> ((MapGen.Triangle)|MapGen.Triangle[])
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
The Delaunay method divides a plane into triangles based on a list of their vertices.
|
|
||||||
|
|
||||||
Doesn't take into account the Y coordinate of the vertices.
|
|
||||||
That is, all triangles that don't lie in the XZ plane will be projected onto it.
|
|
||||||
|
|
||||||
Vertices that do not have a `is2d` group will not participate in the triangulation.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangulation.tetrahedralize
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangulation.tetrahedralize(vertices: table<integer,MapGen.Peak>) -> ((MapGen.Tetrahedron)|MapGen.Tetrahedron[])
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
The Delaunay method divides space into tetrahedra based on a list of their vertices.
|
|
||||||
|
|
||||||
Vertices that do not have a `is3d` group will not participate in the triangulation.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### Triangulation.convexMultiplier
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Triangulation.convexMultiplier : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
# global MapGen.ff2luat
|
|
||||||
|
|
||||||
|
|
||||||
Converts given farbfeld image to ColoredDotsTable.
|
|
||||||
Farbfeld format:
|
|
||||||
```
|
|
||||||
╔════════╤═════════════════════════════════════════════════════════╗
|
|
||||||
║ Bytes │ Description ║
|
|
||||||
╠════════╪═════════════════════════════════════════════════════════╣
|
|
||||||
║ 8 │ 'farbfeld' magic value ║
|
|
||||||
╟────────┼─────────────────────────────────────────────────────────╢
|
|
||||||
║ 4 │ 32-Bit BE unsigned integer (width) ║
|
|
||||||
╟────────┼─────────────────────────────────────────────────────────╢
|
|
||||||
║ 4 │ 32-Bit BE unsigned integer (height) ║
|
|
||||||
╟────────┼─────────────────────────────────────────────────────────╢
|
|
||||||
║ [2222] │ 4x16-Bit BE unsigned integers [RGBA] / pixel, row-major ║
|
|
||||||
╚════════╧═════════════════════════════════════════════════════════╝
|
|
||||||
```
|
|
||||||
[tools/farbfeld | suckless.org software that sucks less](https://tools.suckless.org/farbfeld/)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,738 +0,0 @@
|
|||||||
# global MapGen
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## methods
|
|
||||||
---
|
|
||||||
|
|
||||||
### MapGen.new
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.new(def: MapGenDef {
|
|
||||||
nodes = table<string,string>,
|
|
||||||
}) -> MapGen {
|
|
||||||
layersByName = table<string,MapGen.Layer>,
|
|
||||||
layersList = MapGen.Layer[],
|
|
||||||
staticsByName = table<string,MapGen.StaticLayer>,
|
|
||||||
staticsList = MapGen.StaticLayer[],
|
|
||||||
layersNoisesInitialized = boolean,
|
|
||||||
cavernsNoiseInitialized = boolean,
|
|
||||||
isRunning = boolean,
|
|
||||||
nodeIDs = table<string,number>,
|
|
||||||
new = function,
|
|
||||||
getLayerByHeight = function,
|
|
||||||
getStaticByHeight = function,
|
|
||||||
registerLayer = function,
|
|
||||||
registerLayerNoiseColor = function,
|
|
||||||
registerStaticLayer = function,
|
|
||||||
registerPeak = function,
|
|
||||||
register2DPeak = function,
|
|
||||||
register2DPeaks = function,
|
|
||||||
register2DPeaksFromFile = function,
|
|
||||||
registerBiome = function,
|
|
||||||
registerCavern = function,
|
|
||||||
initLayersTriangultaion = function,
|
|
||||||
initLayersNoises = function,
|
|
||||||
initBiomesDiagram = function,
|
|
||||||
initCavernsNoise = function,
|
|
||||||
getNoises2dValue = function,
|
|
||||||
onMapGenerated = function,
|
|
||||||
run = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.getLayerByHeight
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.getLayerByHeight(yPos: number) -> MapGen.Layer?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Determines which layer a node belongs to based on its height coordinate.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.getStaticByHeight
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.getStaticByHeight(yPos: number) -> MapGen.StaticLayer?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Determines which statics layer a node belongs to based on its height coordinate.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.registerLayer
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.registerLayer(
|
|
||||||
name: string,
|
|
||||||
def: MapGen.LayerDef {
|
|
||||||
minY = number,
|
|
||||||
maxY = number,
|
|
||||||
minTemp = number,
|
|
||||||
maxTemp = number,
|
|
||||||
minHumidity = number,
|
|
||||||
maxHumidity = number,
|
|
||||||
waterLevel = number?,
|
|
||||||
calcTemp = (fun(self: MapGen.Layer, value: number, height: number) -> number)?,
|
|
||||||
calcHumidity = (fun(self: MapGen.Layer, value: number, height: number) -> number)?,
|
|
||||||
biomesGorizontalScattering = number?,
|
|
||||||
biomesVerticalScattering = number?,
|
|
||||||
}
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
@param `name` - The name that will be assigned to the layer. The name must be unique for each layer.
|
|
||||||
|
|
||||||
@param `def` - Layer description table, see details `MapGen.LayerDef`.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Mark the world area between two heights as a `MapGen.Layer`.
|
|
||||||
|
|
||||||
Note: layers must not overlap.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.registerLayerNoiseColor
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.registerLayerNoiseColor(
|
|
||||||
layerName: string,
|
|
||||||
category: MapGen.Layer.Category,
|
|
||||||
color: ColorString,
|
|
||||||
noiseParams: NoiseParams
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
@param `layerName` - The name of the layer for which the color will be registered.
|
|
||||||
|
|
||||||
@param `category` - Category indicating what will be generated by noise.
|
|
||||||
|
|
||||||
@param `color` - Noise color. Must be unique.
|
|
||||||
|
|
||||||
@param `noiseParams` - Fractal noise parameters.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Register the color and the noise parameters that correspond to it.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.registerStaticLayer
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.registerStaticLayer(
|
|
||||||
name: string,
|
|
||||||
def: MapGen.StaticLayerDef {
|
|
||||||
minY = number,
|
|
||||||
maxY = number,
|
|
||||||
staticNode = string,
|
|
||||||
generateStaticNode = generateFunc,
|
|
||||||
}
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
@param `name` - The name that will be assigned to the static layer. The name must be unique for each layer.
|
|
||||||
|
|
||||||
@param `def` - Static layer description table, see details `MapGen.StaticLayerDef`.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Mark the world area between two heights as a `MapGen.StaticLayer`.
|
|
||||||
|
|
||||||
Note: layers must not overlap.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.registerPeak
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.registerPeak(
|
|
||||||
layerName: string,
|
|
||||||
category: MapGen.Layer.Category,
|
|
||||||
def: MapGen.PeakDef {
|
|
||||||
pos = vector,
|
|
||||||
color = ColorString,
|
|
||||||
groups = table<string,number>?,
|
|
||||||
}
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
@param `layerName` - The name of the layer in which the new peak will be included.
|
|
||||||
|
|
||||||
@param `category` - Category indicating what will be generated by peak.
|
|
||||||
|
|
||||||
@param `def` - Peak description table, see details `MapGen.PeakDef`.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Mark a world point as `MapGen.Peak` and assign it a specific color that will affect the generation.
|
|
||||||
|
|
||||||
Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.register2DPeak
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.register2DPeak(
|
|
||||||
layerName: string,
|
|
||||||
category: MapGen.Layer.Category,
|
|
||||||
def: MapGen.PeakDef {
|
|
||||||
pos = vector,
|
|
||||||
color = ColorString,
|
|
||||||
groups = table<string,number>?,
|
|
||||||
}
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
@param `layerName` - The name of the layer in which the new peak will be included.
|
|
||||||
|
|
||||||
@param `category` - Category indicating what will be generated by peak.
|
|
||||||
|
|
||||||
@param `def` - Peak description table, see details `MapGen.PeakDef`.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Mark a world point as `MapGen.Peak` and assign it a specific color that will affect the generation.
|
|
||||||
The Y coordinate will be forced to zero, and the `is2d` group will be added to the groups field.
|
|
||||||
|
|
||||||
Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.register2DPeaks
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.register2DPeaks(
|
|
||||||
layerName: string,
|
|
||||||
category: MapGen.Layer.Category,
|
|
||||||
defs: MapGen.PeakDef[]
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
@param `layerName` - The name of the layer in which the new peaks will be included.
|
|
||||||
|
|
||||||
@param `category` - Category indicating what will be generated by peaks.
|
|
||||||
|
|
||||||
@param `defs` - Peaks description table, see details `MapGen.PeakDef`.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Mark the world points as `MapGen.Peak` and assign them all a specific noise that will affect generation.
|
|
||||||
The Y coordinate will be forced to zero, and the `is2d` group will be added to the groups field.
|
|
||||||
|
|
||||||
Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.register2DPeaksFromFile
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.register2DPeaksFromFile(
|
|
||||||
layerName: string,
|
|
||||||
map: string,
|
|
||||||
scale: number,
|
|
||||||
zeroPos: Position2d,
|
|
||||||
category: MapGen.Layer.Category,
|
|
||||||
groups: table<string,number>?
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
@param `layerName` - The name of the layer in which the new peaks will be included.
|
|
||||||
|
|
||||||
@param `map` - The name of the image from which the peaks will be extracted. It should be located in the `<mod_name>/textures/maps` folder and have the following format `<image_name>.ff`
|
|
||||||
|
|
||||||
@param `scale` - Multiplier of how many blocks (nodes) will be between image pixels. It is not recommended to set the value below 50 for performance reasons.
|
|
||||||
|
|
||||||
@param `zeroPos` - The position in pixels where the zero world coordinate will be in the image.
|
|
||||||
|
|
||||||
@param `category` - Category indicating what will be generated by peaks.
|
|
||||||
|
|
||||||
@param `groups` - Groups that will be added to all peaks.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Extract the `MapGen.Peak` from the image and assign them all a specific color that will affect the generation.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.registerBiome
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.registerBiome(
|
|
||||||
layerName: string,
|
|
||||||
biomeName: string,
|
|
||||||
def: MapGen.BiomeDef {
|
|
||||||
tempPoint = number,
|
|
||||||
humidityPoint = number,
|
|
||||||
minY = number,
|
|
||||||
maxY = number,
|
|
||||||
groundNodes = MapGen.Biome.GroundNodes,
|
|
||||||
soilHeight = number,
|
|
||||||
generateAir = generateFunc?,
|
|
||||||
generateCavernAir = generateFunc?,
|
|
||||||
generateWater = generateFunc?,
|
|
||||||
generateRock = generateFunc?,
|
|
||||||
generateTurf = generateFunc?,
|
|
||||||
generateSoil = generateFunc?,
|
|
||||||
generateBottom = generateFunc?,
|
|
||||||
}
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
@param `layerName` - The name of the layer in which the new biome will be included.
|
|
||||||
|
|
||||||
@param `biomeName` - The name to be assigned to the biome. The name must be unique for each biome.
|
|
||||||
|
|
||||||
@param `def` - Biome description table, see details `MapGen.BiomeDef`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Mark a point on the biomes diagram and constrain the world area by height to mark it as `MapGen.Biome`.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.registerCavern
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.registerCavern(
|
|
||||||
layerName: string,
|
|
||||||
cavernName: string,
|
|
||||||
def: MapGen.CavernDef {
|
|
||||||
minY = number,
|
|
||||||
maxY = number,
|
|
||||||
noiseParams = NoiseParams,
|
|
||||||
smoothDistance = number,
|
|
||||||
threshold = number?,
|
|
||||||
groups = table<string,number>?,
|
|
||||||
}
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
@param `layerName` - The name of the layer in which the new cavern will be included.
|
|
||||||
|
|
||||||
@param `cavernName` - The name to be assigned to the cavern. The name must be unique for each cavern.
|
|
||||||
|
|
||||||
@param `def` - Cavern description table, see details `MapGen.CavernDef`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Mark the world area between two heights as a `MapGen.Cavern` and assign the noise that the cave will be generated from.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.initLayersTriangultaion
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.initLayersTriangultaion() -> nil
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Divide all layers into triangles whose vertices are the `Mapgen.Peak` belonging to these layers.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.initLayersNoises
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.initLayersNoises() -> nil
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Initialize all layer noises. This should be called after the map object is loaded.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.initBiomesDiagram
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.initBiomesDiagram() -> nil
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Initialization of the biome diagram using the Voronoi method.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.initCavernsNoise
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.initCavernsNoise() -> nil
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Initialize caverns's noises. This should be called after the map object is loaded.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.getNoises2dValue
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.getNoises2dValue(
|
|
||||||
category: MapGen.Layer.Category,
|
|
||||||
layer: MapGen.Layer {
|
|
||||||
name = string,
|
|
||||||
minY = integer,
|
|
||||||
maxY = integer,
|
|
||||||
minTemp = integer,
|
|
||||||
maxTemp = integer,
|
|
||||||
minHumidity = integer,
|
|
||||||
maxHumidity = integer,
|
|
||||||
waterLevel = integer,
|
|
||||||
peaksList = { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] },
|
|
||||||
noisesByColor = { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> },
|
|
||||||
noisesParamsByColor = { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> },
|
|
||||||
biomesByName = table<string,MapGen.Biome>,
|
|
||||||
biomesList = MapGen.Biome[],
|
|
||||||
biomesDiagram = table,
|
|
||||||
biomesGorizontalScattering = integer,
|
|
||||||
biomesVerticalScattering = integer,
|
|
||||||
cavernsByName = table<string,MapGen.Cavern>,
|
|
||||||
cavernsList = MapGen.Cavern[],
|
|
||||||
trianglesList = { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] },
|
|
||||||
tetrahedronsList = MapGen.Tetrahedron[],
|
|
||||||
calcTemp = function,
|
|
||||||
calcHumidity = function,
|
|
||||||
new = function,
|
|
||||||
addPeak = function,
|
|
||||||
addNoiseParamsColor = function,
|
|
||||||
getNoiseByColor = function,
|
|
||||||
addBiome = function,
|
|
||||||
addCavern = function,
|
|
||||||
initNoises = function,
|
|
||||||
initBiomesDiagram = function,
|
|
||||||
},
|
|
||||||
x: integer,
|
|
||||||
y: integer,
|
|
||||||
z: integer
|
|
||||||
) -> number?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Calculates a smoothed 2D noise value based on a preliminary space partitioning.
|
|
||||||
|
|
||||||
Returns `nil` if the point is not included in any triangle.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.onMapGenerated
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.onMapGenerated(
|
|
||||||
voxelManip: VoxelManip,
|
|
||||||
minPos: Position,
|
|
||||||
maxPos: Position,
|
|
||||||
blockseed: number
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Chunk generation handler.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.run
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.run() -> nil
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Run world generation through this mapgen object
|
|
||||||
|
|
||||||
Note: only one instance of a `MapGen` class can be running.
|
|
||||||
|
|
||||||
**FOR MAPGEN ENVIRONMENT ONLY**
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### MapGen.layersByName
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
MapGen.layersByName : table<string,MapGen.Layer>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.layersList
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
MapGen.layersList : MapGen.Layer[]
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.staticsByName
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
MapGen.staticsByName : table<string,MapGen.StaticLayer>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.staticsList
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
MapGen.staticsList : MapGen.StaticLayer[]
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.layersNoisesInitialized
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
MapGen.layersNoisesInitialized : boolean
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Is the fractal noise of the layer initialized? This is necessary for a one-time noise initialization.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.cavernsNoiseInitialized
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
MapGen.cavernsNoiseInitialized : boolean
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Is the fractal noise of the caverns initialized? This is necessary for a one-time noise initialization.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.isRunning
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
MapGen.isRunning : boolean
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
A static field that guarantees that only one instance of the `MapGen` class will work.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.nodeIDs
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
MapGen.nodeIDs : table<string,number>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
# alias ColoredDotsTable
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```lua
|
|
||||||
(alias) ColoredDotsTable = table<string,table>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Table with color as key and value is table with coordinates of dots. Note: coords begin from 1,1 (not 0,0).
|
|
||||||
Example of table:
|
|
||||||
```lua
|
|
||||||
{
|
|
||||||
'size': { h=256, w=256 },
|
|
||||||
'#fff': { {x=1,y=1}, {x=2,y=2}, ... },
|
|
||||||
'#ff0': { {x=3,y=3}, {x=4,y=4}, ... },
|
|
||||||
...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
# class GroundNodes
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- namespace: MapGen.Biome
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
**Only for EmmyLua.**
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### GroundNodes.turf
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
GroundNodes.turf : string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
The soil covering the surface of the biome
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### GroundNodes.soil
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
GroundNodes.soil : string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
The soil beneath the turf. The height of this layer depends on `Biome.soilHeight`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### GroundNodes.rock
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
GroundNodes.rock : string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
The rock found beneath the soil of a biome.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### GroundNodes.bottom
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
GroundNodes.bottom : string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Covering the bottom of reservoirs.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
# class GroundNodesIDs
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- namespace: MapGen.Biome
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
**Only for EmmyLua.**
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### GroundNodesIDs.turf
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
GroundNodesIDs.turf : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
The soil covering the surface of the biome
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### GroundNodesIDs.soil
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
GroundNodesIDs.soil : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
The soil beneath the turf. The height of this layer depends on `Biome.soilHeight`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### GroundNodesIDs.rock
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
GroundNodesIDs.rock : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
The rock found beneath the soil of a biome.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### GroundNodesIDs.bottom
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
GroundNodesIDs.bottom : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Covering the bottom of reservoirs.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,312 +0,0 @@
|
|||||||
# class Biome
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- namespace: MapGen
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## methods
|
|
||||||
---
|
|
||||||
|
|
||||||
### Biome.new
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Biome.new(
|
|
||||||
name: string,
|
|
||||||
def: MapGen.BiomeDef {
|
|
||||||
tempPoint = number,
|
|
||||||
humidityPoint = number,
|
|
||||||
minY = number,
|
|
||||||
maxY = number,
|
|
||||||
groundNodes = MapGen.Biome.GroundNodes,
|
|
||||||
soilHeight = number,
|
|
||||||
generateAir = generateFunc?,
|
|
||||||
generateCavernAir = generateFunc?,
|
|
||||||
generateWater = generateFunc?,
|
|
||||||
generateRock = generateFunc?,
|
|
||||||
generateTurf = generateFunc?,
|
|
||||||
generateSoil = generateFunc?,
|
|
||||||
generateBottom = generateFunc?,
|
|
||||||
}
|
|
||||||
) -> MapGen.Biome {
|
|
||||||
name = string,
|
|
||||||
tempPoint = number,
|
|
||||||
humidityPoint = number,
|
|
||||||
minY = number,
|
|
||||||
maxY = number,
|
|
||||||
groundNodes = MapGen.Biome.GroundNodes,
|
|
||||||
groundNodesIDs = MapGen.Biome.GroundNodesIDs,
|
|
||||||
soilHeight = number,
|
|
||||||
generateAir = generateFunc,
|
|
||||||
generateCavernAir = generateFunc,
|
|
||||||
generateWater = generateFunc,
|
|
||||||
generateRock = generateFunc,
|
|
||||||
generateTurf = generateFunc,
|
|
||||||
generateSoil = generateFunc,
|
|
||||||
generateBottom = generateFunc,
|
|
||||||
new = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### Biome.name
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.name : string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.tempPoint
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.tempPoint : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.humidityPoint
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.humidityPoint : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.minY
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.minY : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.maxY
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.maxY : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.groundNodes
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.groundNodes : MapGen.Biome.GroundNodes {
|
|
||||||
turf: string,
|
|
||||||
soil: string,
|
|
||||||
rock: string,
|
|
||||||
bottom: string,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.groundNodesIDs
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.groundNodesIDs : MapGen.Biome.GroundNodesIDs {
|
|
||||||
turf: number,
|
|
||||||
soil: number,
|
|
||||||
rock: number,
|
|
||||||
bottom: number,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.soilHeight
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.soilHeight : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.generateAir
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.generateAir : generateFunc
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.generateCavernAir
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.generateCavernAir : generateFunc
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.generateWater
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.generateWater : generateFunc
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.generateRock
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.generateRock : generateFunc
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.generateTurf
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.generateTurf : generateFunc
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.generateSoil
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.generateSoil : generateFunc
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Biome.generateBottom
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Biome.generateBottom : generateFunc
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,226 +0,0 @@
|
|||||||
# class BiomeDef
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- namespace: MapGen
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Definition table for the `MapGen.Biome`.
|
|
||||||
|
|
||||||
**Only for EmmyLua.**
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### BiomeDef.tempPoint
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
BiomeDef.tempPoint : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### BiomeDef.humidityPoint
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
BiomeDef.humidityPoint : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### BiomeDef.minY
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
BiomeDef.minY : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### BiomeDef.maxY
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
BiomeDef.maxY : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### BiomeDef.groundNodes
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
BiomeDef.groundNodes : MapGen.Biome.GroundNodes {
|
|
||||||
turf: string,
|
|
||||||
soil: string,
|
|
||||||
rock: string,
|
|
||||||
bottom: string,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### BiomeDef.soilHeight
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
BiomeDef.soilHeight : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### BiomeDef.generateAir
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
BiomeDef.generateAir : generateFunc?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### BiomeDef.generateCavernAir
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
BiomeDef.generateCavernAir : generateFunc?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### BiomeDef.generateWater
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
BiomeDef.generateWater : generateFunc?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### BiomeDef.generateRock
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
BiomeDef.generateRock : generateFunc?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### BiomeDef.generateTurf
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
BiomeDef.generateTurf : generateFunc?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### BiomeDef.generateSoil
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
BiomeDef.generateSoil : generateFunc?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### BiomeDef.generateBottom
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
BiomeDef.generateBottom : generateFunc?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,208 +0,0 @@
|
|||||||
# class Cavern
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- namespace: MapGen
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## methods
|
|
||||||
---
|
|
||||||
|
|
||||||
### Cavern.getNoise
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Cavern.getNoise()-> ValueNoise
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Cavern.initNoise
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Cavern.initNoise()-> nil
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Cavern.getGroups
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Cavern.getGroups()
|
|
||||||
-> table<string,number>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Cavern.new
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Cavern.new(
|
|
||||||
name: string,
|
|
||||||
def: MapGen.CavernDef {
|
|
||||||
minY = number,
|
|
||||||
maxY = number,
|
|
||||||
noiseParams = NoiseParams,
|
|
||||||
smoothDistance = number,
|
|
||||||
threshold = number?,
|
|
||||||
groups = table<string,number>?,
|
|
||||||
}
|
|
||||||
) -> MapGen.Cavern {
|
|
||||||
name = string,
|
|
||||||
minY = number,
|
|
||||||
maxY = number,
|
|
||||||
smoothDistance = number,
|
|
||||||
threshold = number,
|
|
||||||
getNoise = function,
|
|
||||||
initNoise = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
isCavern = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Cavern.isCavern
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Cavern.isCavern(
|
|
||||||
x: integer,
|
|
||||||
y: integer,
|
|
||||||
z: integer
|
|
||||||
) -> boolean
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns `true` if there is a cavern at the specified coordinates.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### Cavern.name
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Cavern.name : string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Cavern.minY
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Cavern.minY : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Cavern.maxY
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Cavern.maxY : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Cavern.smoothDistance
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Cavern.smoothDistance : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Cavern.threshold
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Cavern.threshold : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,116 +0,0 @@
|
|||||||
# class CavernDef
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- namespace: MapGen
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Definition table for the `MapGen.Cavern`.
|
|
||||||
|
|
||||||
**Only for EmmyLua.**
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### CavernDef.minY
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
CavernDef.minY : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### CavernDef.maxY
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
CavernDef.maxY : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### CavernDef.noiseParams
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
CavernDef.noiseParams : NoiseParams
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### CavernDef.smoothDistance
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
CavernDef.smoothDistance : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### CavernDef.threshold
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
CavernDef.threshold : number?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### CavernDef.groups
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
CavernDef.groups : table<string,number>?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
# class Decoration
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- namespace: MapGen
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
**NOT IMPLEMENTED**
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## methods
|
|
||||||
---
|
|
||||||
|
|
||||||
### Decoration.new
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Decoration.new() -> MapGen.Decoration {
|
|
||||||
new = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
# alias Category
|
|
||||||
---
|
|
||||||
|
|
||||||
- namespace: MapGen.Layer
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```lua
|
|
||||||
(alias) Category = ("landscape"|"temp"|"humidity")
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
A category of noise that affects specific map generation objects.
|
|
||||||
|
|
||||||
@@ -1,678 +0,0 @@
|
|||||||
# class Layer
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- namespace: MapGen
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## methods
|
|
||||||
---
|
|
||||||
|
|
||||||
### Layer.calcTemp
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Layer.calcTemp(
|
|
||||||
self: MapGen.Layer {
|
|
||||||
name = string,
|
|
||||||
minY = integer,
|
|
||||||
maxY = integer,
|
|
||||||
minTemp = integer,
|
|
||||||
maxTemp = integer,
|
|
||||||
minHumidity = integer,
|
|
||||||
maxHumidity = integer,
|
|
||||||
waterLevel = integer,
|
|
||||||
peaksList = { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] },
|
|
||||||
noisesByColor = { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> },
|
|
||||||
noisesParamsByColor = { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> },
|
|
||||||
biomesByName = table<string,MapGen.Biome>,
|
|
||||||
biomesList = MapGen.Biome[],
|
|
||||||
biomesDiagram = table,
|
|
||||||
biomesGorizontalScattering = integer,
|
|
||||||
biomesVerticalScattering = integer,
|
|
||||||
cavernsByName = table<string,MapGen.Cavern>,
|
|
||||||
cavernsList = MapGen.Cavern[],
|
|
||||||
trianglesList = { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] },
|
|
||||||
tetrahedronsList = MapGen.Tetrahedron[],
|
|
||||||
calcTemp = function,
|
|
||||||
calcHumidity = function,
|
|
||||||
new = function,
|
|
||||||
addPeak = function,
|
|
||||||
addNoiseParamsColor = function,
|
|
||||||
getNoiseByColor = function,
|
|
||||||
addBiome = function,
|
|
||||||
addCavern = function,
|
|
||||||
initNoises = function,
|
|
||||||
initBiomesDiagram = function,
|
|
||||||
},
|
|
||||||
value: number,
|
|
||||||
height: number
|
|
||||||
)-> number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.calcHumidity
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Layer.calcHumidity(
|
|
||||||
self: MapGen.Layer {
|
|
||||||
name = string,
|
|
||||||
minY = integer,
|
|
||||||
maxY = integer,
|
|
||||||
minTemp = integer,
|
|
||||||
maxTemp = integer,
|
|
||||||
minHumidity = integer,
|
|
||||||
maxHumidity = integer,
|
|
||||||
waterLevel = integer,
|
|
||||||
peaksList = { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] },
|
|
||||||
noisesByColor = { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> },
|
|
||||||
noisesParamsByColor = { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> },
|
|
||||||
biomesByName = table<string,MapGen.Biome>,
|
|
||||||
biomesList = MapGen.Biome[],
|
|
||||||
biomesDiagram = table,
|
|
||||||
biomesGorizontalScattering = integer,
|
|
||||||
biomesVerticalScattering = integer,
|
|
||||||
cavernsByName = table<string,MapGen.Cavern>,
|
|
||||||
cavernsList = MapGen.Cavern[],
|
|
||||||
trianglesList = { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] },
|
|
||||||
tetrahedronsList = MapGen.Tetrahedron[],
|
|
||||||
calcTemp = function,
|
|
||||||
calcHumidity = function,
|
|
||||||
new = function,
|
|
||||||
addPeak = function,
|
|
||||||
addNoiseParamsColor = function,
|
|
||||||
getNoiseByColor = function,
|
|
||||||
addBiome = function,
|
|
||||||
addCavern = function,
|
|
||||||
initNoises = function,
|
|
||||||
initBiomesDiagram = function,
|
|
||||||
},
|
|
||||||
value: number,
|
|
||||||
height: number
|
|
||||||
)-> number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.new
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Layer.new(
|
|
||||||
name: string,
|
|
||||||
def: MapGen.LayerDef {
|
|
||||||
minY = number,
|
|
||||||
maxY = number,
|
|
||||||
minTemp = number,
|
|
||||||
maxTemp = number,
|
|
||||||
minHumidity = number,
|
|
||||||
maxHumidity = number,
|
|
||||||
waterLevel = number?,
|
|
||||||
calcTemp = (fun(self: MapGen.Layer, value: number, height: number) -> number)?,
|
|
||||||
calcHumidity = (fun(self: MapGen.Layer, value: number, height: number) -> number)?,
|
|
||||||
biomesGorizontalScattering = number?,
|
|
||||||
biomesVerticalScattering = number?,
|
|
||||||
}
|
|
||||||
) -> MapGen.Layer {
|
|
||||||
name = string,
|
|
||||||
minY = integer,
|
|
||||||
maxY = integer,
|
|
||||||
minTemp = integer,
|
|
||||||
maxTemp = integer,
|
|
||||||
minHumidity = integer,
|
|
||||||
maxHumidity = integer,
|
|
||||||
waterLevel = integer,
|
|
||||||
peaksList = { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] },
|
|
||||||
noisesByColor = { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> },
|
|
||||||
noisesParamsByColor = { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> },
|
|
||||||
biomesByName = table<string,MapGen.Biome>,
|
|
||||||
biomesList = MapGen.Biome[],
|
|
||||||
biomesDiagram = table,
|
|
||||||
biomesGorizontalScattering = integer,
|
|
||||||
biomesVerticalScattering = integer,
|
|
||||||
cavernsByName = table<string,MapGen.Cavern>,
|
|
||||||
cavernsList = MapGen.Cavern[],
|
|
||||||
trianglesList = { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] },
|
|
||||||
tetrahedronsList = MapGen.Tetrahedron[],
|
|
||||||
calcTemp = function,
|
|
||||||
calcHumidity = function,
|
|
||||||
new = function,
|
|
||||||
addPeak = function,
|
|
||||||
addNoiseParamsColor = function,
|
|
||||||
getNoiseByColor = function,
|
|
||||||
addBiome = function,
|
|
||||||
addCavern = function,
|
|
||||||
initNoises = function,
|
|
||||||
initBiomesDiagram = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.addPeak
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Layer.addPeak(
|
|
||||||
category: MapGen.Layer.Category,
|
|
||||||
peak: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
}
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Adds a peak to the `Layer.peaksList`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.addNoiseParamsColor
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Layer.addNoiseParamsColor(
|
|
||||||
category: MapGen.Layer.Category,
|
|
||||||
color: ColorString,
|
|
||||||
noiseParams: NoiseParams
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Adds a NoiseParams color to the `Layer.noisesParamsByColor`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.getNoiseByColor
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Layer.getNoiseByColor(
|
|
||||||
category: MapGen.Layer.Category,
|
|
||||||
color: ColorString
|
|
||||||
) -> ValueNoise
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns noise corresponding to a color.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.addBiome
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Layer.addBiome(
|
|
||||||
biomeName: string,
|
|
||||||
biome: MapGen.Biome {
|
|
||||||
name = string,
|
|
||||||
tempPoint = number,
|
|
||||||
humidityPoint = number,
|
|
||||||
minY = number,
|
|
||||||
maxY = number,
|
|
||||||
groundNodes = MapGen.Biome.GroundNodes,
|
|
||||||
groundNodesIDs = MapGen.Biome.GroundNodesIDs,
|
|
||||||
soilHeight = number,
|
|
||||||
generateAir = generateFunc,
|
|
||||||
generateCavernAir = generateFunc,
|
|
||||||
generateWater = generateFunc,
|
|
||||||
generateRock = generateFunc,
|
|
||||||
generateTurf = generateFunc,
|
|
||||||
generateSoil = generateFunc,
|
|
||||||
generateBottom = generateFunc,
|
|
||||||
new = function,
|
|
||||||
}
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Adds a biome to the `Layer.biomesByName` & `Layer.biomesList`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.addCavern
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Layer.addCavern(
|
|
||||||
cavernName: string,
|
|
||||||
cavern: MapGen.Cavern {
|
|
||||||
name = string,
|
|
||||||
minY = number,
|
|
||||||
maxY = number,
|
|
||||||
smoothDistance = number,
|
|
||||||
threshold = number,
|
|
||||||
getNoise = function,
|
|
||||||
initNoise = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
isCavern = function,
|
|
||||||
}
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Adds a cavern to the `Layer.cavernsByName` & `Layer.cavernsList`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.initNoises
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Layer.initNoises() -> nil
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Initializes noise for generation.
|
|
||||||
|
|
||||||
Should only be called after the mapgen object has been loaded.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.initBiomesDiagram
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Layer.initBiomesDiagram() -> nil
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Initialization of the biome diagram using the Voronoi method.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### Layer.name
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.name : string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.minY
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.minY : integer
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.maxY
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.maxY : integer
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.minTemp
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.minTemp : integer
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.maxTemp
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.maxTemp : integer
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.minHumidity
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.minHumidity : integer
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.maxHumidity
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.maxHumidity : integer
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.waterLevel
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.waterLevel : integer
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.peaksList
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.peaksList : { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] }
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.noisesByColor
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.noisesByColor : { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> }
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.noisesParamsByColor
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.noisesParamsByColor : { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> }
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.biomesByName
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.biomesByName : table<string,MapGen.Biome>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.biomesList
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.biomesList : MapGen.Biome[]
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.biomesDiagram
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.biomesDiagram : table
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.biomesGorizontalScattering
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.biomesGorizontalScattering : integer
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.biomesVerticalScattering
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.biomesVerticalScattering : integer
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.cavernsByName
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.cavernsByName : table<string,MapGen.Cavern>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.cavernsList
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.cavernsList : MapGen.Cavern[]
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.trianglesList
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.trianglesList : { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] }
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Layer.tetrahedronsList
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Layer.tetrahedronsList : MapGen.Tetrahedron[]
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
**Not supported**
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,191 +0,0 @@
|
|||||||
# class LayerDef
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- namespace: MapGen
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Definition table for the `MapGen.Layer`.
|
|
||||||
|
|
||||||
**Only for EmmyLua.**
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### LayerDef.minY
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
LayerDef.minY : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### LayerDef.maxY
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
LayerDef.maxY : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### LayerDef.minTemp
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
LayerDef.minTemp : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### LayerDef.maxTemp
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
LayerDef.maxTemp : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### LayerDef.minHumidity
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
LayerDef.minHumidity : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### LayerDef.maxHumidity
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
LayerDef.maxHumidity : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### LayerDef.waterLevel
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
LayerDef.waterLevel : number?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### LayerDef.calcTemp
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
LayerDef.calcTemp : (fun(self: MapGen.Layer, value: number, height: number) -> number)?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### LayerDef.calcHumidity
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
LayerDef.calcHumidity : (fun(self: MapGen.Layer, value: number, height: number) -> number)?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### LayerDef.biomesGorizontalScattering
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
LayerDef.biomesGorizontalScattering : number?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### LayerDef.biomesVerticalScattering
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
LayerDef.biomesVerticalScattering : number?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
# alias PastCalcNoiseValue
|
|
||||||
---
|
|
||||||
|
|
||||||
- namespace: MapGen
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```lua
|
|
||||||
(alias) PastCalcNoiseValue = { noiseValue: number?, triangle: MapGen.Triangle?, x: integer?, z: integer? }
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,162 +0,0 @@
|
|||||||
# class Peak
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- namespace: MapGen
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## methods
|
|
||||||
---
|
|
||||||
|
|
||||||
### Peak.getPeakPos
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Peak.getPeakPos(self)-> vector
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Peak.getColor
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Peak.getColor(self)-> ColorString
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Peak.getGroups
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Peak.getGroups(self)
|
|
||||||
-> table<string,number>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Peak.new
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Peak.new(def: MapGen.PeakDef {
|
|
||||||
pos = vector,
|
|
||||||
color = ColorString,
|
|
||||||
groups = table<string,number>?,
|
|
||||||
}) -> MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Peak.toString
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Peak.toString() -> string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns a string describing the object in a readable form.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Peak.eq
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Peak.eq(other: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
}) -> boolean
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns true if the peaks are equivalent.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### Peak.id
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Peak.id : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
# class PeakDef
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- namespace: MapGen
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Definition table for the `MapGen.Peak`.
|
|
||||||
|
|
||||||
**Only for EmmyLua.**
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### PeakDef.pos
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
PeakDef.pos : vector
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### PeakDef.color
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
PeakDef.color : ColorString
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### PeakDef.groups
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
PeakDef.groups : table<string,number>?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,149 +0,0 @@
|
|||||||
# class StaticLayer
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- namespace: MapGen
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## methods
|
|
||||||
---
|
|
||||||
|
|
||||||
### StaticLayer.new
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function StaticLayer.new(
|
|
||||||
name: string,
|
|
||||||
def: MapGen.StaticLayerDef {
|
|
||||||
minY = number,
|
|
||||||
maxY = number,
|
|
||||||
staticNode = string,
|
|
||||||
generateStaticNode = generateFunc,
|
|
||||||
}
|
|
||||||
) -> MapGen.StaticLayer {
|
|
||||||
name = string,
|
|
||||||
minY = number,
|
|
||||||
maxY = number,
|
|
||||||
staticNode = string,
|
|
||||||
staticNodeID = number,
|
|
||||||
generateStaticNode = generateFunc,
|
|
||||||
new = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### StaticLayer.name
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
StaticLayer.name : string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### StaticLayer.minY
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
StaticLayer.minY : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### StaticLayer.maxY
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
StaticLayer.maxY : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### StaticLayer.staticNode
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
StaticLayer.staticNode : string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### StaticLayer.staticNodeID
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
StaticLayer.staticNodeID : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### StaticLayer.generateStaticNode
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
StaticLayer.generateStaticNode : generateFunc
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
# class StaticLayerDef
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- namespace: MapGen
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Definition table for the `MapGen.StaticLayer`.
|
|
||||||
|
|
||||||
**Only for EmmyLua.**
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### StaticLayerDef.minY
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
StaticLayerDef.minY : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### StaticLayerDef.maxY
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
StaticLayerDef.maxY : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### StaticLayerDef.staticNode
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
StaticLayerDef.staticNode : string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### StaticLayerDef.generateStaticNode
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
StaticLayerDef.generateStaticNode : generateFunc
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,541 +0,0 @@
|
|||||||
# class Tetrahedron
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- namespace: MapGen
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## methods
|
|
||||||
---
|
|
||||||
|
|
||||||
### Tetrahedron.new
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Tetrahedron.new(
|
|
||||||
p1: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
},
|
|
||||||
p2: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
},
|
|
||||||
p3: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
},
|
|
||||||
p4: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
}
|
|
||||||
) -> MapGen.Tetrahedron {
|
|
||||||
p1 = MapGen.Peak,
|
|
||||||
p2 = MapGen.Peak,
|
|
||||||
p3 = MapGen.Peak,
|
|
||||||
p4 = MapGen.Peak,
|
|
||||||
h1 = MapGen.Triangulation.Edge,
|
|
||||||
h2 = MapGen.Triangulation.Edge,
|
|
||||||
h3 = MapGen.Triangulation.Edge,
|
|
||||||
h4 = MapGen.Triangulation.Edge,
|
|
||||||
f1 = MapGen.Triangle,
|
|
||||||
f2 = MapGen.Triangle,
|
|
||||||
f3 = MapGen.Triangle,
|
|
||||||
f4 = MapGen.Triangle,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
getHeight = function,
|
|
||||||
getCircumSphereCenter = function,
|
|
||||||
getCircumSphereRadius = function,
|
|
||||||
inCircumSphere = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.toString
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Tetrahedron.toString() -> string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns a string describing the object in a readable form.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.getHeight
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Tetrahedron.getHeight(
|
|
||||||
p1: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
},
|
|
||||||
p2: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
},
|
|
||||||
p3: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
},
|
|
||||||
p4: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
}
|
|
||||||
) -> MapGen.Triangulation.Edge?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.getCircumSphereCenter
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Tetrahedron.getCircumSphereCenter() -> vector
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns the center of the circumscribed sphere.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.getCircumSphereRadius
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Tetrahedron.getCircumSphereRadius() -> number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns the radius of the circumscribed sphere.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.inCircumSphere
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Tetrahedron.inCircumSphere(p: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
}) -> boolean
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Checks whether a given point lies within the circumscribed sphere of a tetrahedron.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### Tetrahedron.p1
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Tetrahedron.p1 : MapGen.Peak {
|
|
||||||
id: number,
|
|
||||||
getPeakPos: function,
|
|
||||||
getColor: function,
|
|
||||||
getGroups: function,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.p2
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Tetrahedron.p2 : MapGen.Peak {
|
|
||||||
id: number,
|
|
||||||
getPeakPos: function,
|
|
||||||
getColor: function,
|
|
||||||
getGroups: function,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.p3
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Tetrahedron.p3 : MapGen.Peak {
|
|
||||||
id: number,
|
|
||||||
getPeakPos: function,
|
|
||||||
getColor: function,
|
|
||||||
getGroups: function,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.p4
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Tetrahedron.p4 : MapGen.Peak {
|
|
||||||
id: number,
|
|
||||||
getPeakPos: function,
|
|
||||||
getColor: function,
|
|
||||||
getGroups: function,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.h1
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Tetrahedron.h1 : MapGen.Triangulation.Edge {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
same: function,
|
|
||||||
length: function,
|
|
||||||
getMidPoint: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.h2
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Tetrahedron.h2 : MapGen.Triangulation.Edge {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
same: function,
|
|
||||||
length: function,
|
|
||||||
getMidPoint: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.h3
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Tetrahedron.h3 : MapGen.Triangulation.Edge {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
same: function,
|
|
||||||
length: function,
|
|
||||||
getMidPoint: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.h4
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Tetrahedron.h4 : MapGen.Triangulation.Edge {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
same: function,
|
|
||||||
length: function,
|
|
||||||
getMidPoint: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.f1
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Tetrahedron.f1 : MapGen.Triangle {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
p3: MapGen.Peak,
|
|
||||||
e1: MapGen.Triangulation.Edge,
|
|
||||||
e2: MapGen.Triangulation.Edge,
|
|
||||||
e3: MapGen.Triangulation.Edge,
|
|
||||||
h1: MapGen.Triangulation.Edge,
|
|
||||||
h2: MapGen.Triangulation.Edge,
|
|
||||||
h3: MapGen.Triangulation.Edge,
|
|
||||||
neighbours: MapGen.Triangle.Neighbours,
|
|
||||||
color: ColorString?,
|
|
||||||
new: function,
|
|
||||||
...(+13)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.f2
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Tetrahedron.f2 : MapGen.Triangle {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
p3: MapGen.Peak,
|
|
||||||
e1: MapGen.Triangulation.Edge,
|
|
||||||
e2: MapGen.Triangulation.Edge,
|
|
||||||
e3: MapGen.Triangulation.Edge,
|
|
||||||
h1: MapGen.Triangulation.Edge,
|
|
||||||
h2: MapGen.Triangulation.Edge,
|
|
||||||
h3: MapGen.Triangulation.Edge,
|
|
||||||
neighbours: MapGen.Triangle.Neighbours,
|
|
||||||
color: ColorString?,
|
|
||||||
new: function,
|
|
||||||
...(+13)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.f3
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Tetrahedron.f3 : MapGen.Triangle {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
p3: MapGen.Peak,
|
|
||||||
e1: MapGen.Triangulation.Edge,
|
|
||||||
e2: MapGen.Triangulation.Edge,
|
|
||||||
e3: MapGen.Triangulation.Edge,
|
|
||||||
h1: MapGen.Triangulation.Edge,
|
|
||||||
h2: MapGen.Triangulation.Edge,
|
|
||||||
h3: MapGen.Triangulation.Edge,
|
|
||||||
neighbours: MapGen.Triangle.Neighbours,
|
|
||||||
color: ColorString?,
|
|
||||||
new: function,
|
|
||||||
...(+13)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tetrahedron.f4
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Tetrahedron.f4 : MapGen.Triangle {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
p3: MapGen.Peak,
|
|
||||||
e1: MapGen.Triangulation.Edge,
|
|
||||||
e2: MapGen.Triangulation.Edge,
|
|
||||||
e3: MapGen.Triangulation.Edge,
|
|
||||||
h1: MapGen.Triangulation.Edge,
|
|
||||||
h2: MapGen.Triangulation.Edge,
|
|
||||||
h3: MapGen.Triangulation.Edge,
|
|
||||||
neighbours: MapGen.Triangle.Neighbours,
|
|
||||||
color: ColorString?,
|
|
||||||
new: function,
|
|
||||||
...(+13)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
# alias CircumCircleEnum
|
|
||||||
---
|
|
||||||
|
|
||||||
- namespace: MapGen.Triangle
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```lua
|
|
||||||
(alias) CircumCircleEnum = ("IN"|"BEHIND"|"ON")
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
# alias Neighbours
|
|
||||||
---
|
|
||||||
|
|
||||||
- namespace: MapGen.Triangle
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```lua
|
|
||||||
(alias) Neighbours = { t1: MapGen.Triangle?, t2: MapGen.Triangle?, t3: MapGen.Triangle? }
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Adjacent triangles:
|
|
||||||
* `t1` with a common side p1-p2
|
|
||||||
* `t2` with a common side p2-p3
|
|
||||||
* `t3` with a common side p3-p1
|
|
||||||
|
|
||||||
@@ -1,750 +0,0 @@
|
|||||||
# class Triangle
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- namespace: MapGen
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## methods
|
|
||||||
---
|
|
||||||
|
|
||||||
### Triangle.new
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.new(
|
|
||||||
p1: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
},
|
|
||||||
p2: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
},
|
|
||||||
p3: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
}
|
|
||||||
) -> MapGen.Triangle {
|
|
||||||
p1 = MapGen.Peak,
|
|
||||||
p2 = MapGen.Peak,
|
|
||||||
p3 = MapGen.Peak,
|
|
||||||
e1 = MapGen.Triangulation.Edge,
|
|
||||||
e2 = MapGen.Triangulation.Edge,
|
|
||||||
e3 = MapGen.Triangulation.Edge,
|
|
||||||
h1 = MapGen.Triangulation.Edge,
|
|
||||||
h2 = MapGen.Triangulation.Edge,
|
|
||||||
h3 = MapGen.Triangulation.Edge,
|
|
||||||
neighbours = MapGen.Triangle.Neighbours,
|
|
||||||
color = ColorString?,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
same = function,
|
|
||||||
getCenter = function,
|
|
||||||
getArea = function,
|
|
||||||
getHeight = function,
|
|
||||||
getHeight2D = function,
|
|
||||||
getSidesLength = function,
|
|
||||||
getSidesLength2D = function,
|
|
||||||
getCircumCenter2D = function,
|
|
||||||
getCircumRadius2D = function,
|
|
||||||
getCircumCircle2D = function,
|
|
||||||
inCircumCircle2D = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.toString
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.toString() -> string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns a string describing the object in a readable form.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.eq
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.eq(other: MapGen.Triangle {
|
|
||||||
p1 = MapGen.Peak,
|
|
||||||
p2 = MapGen.Peak,
|
|
||||||
p3 = MapGen.Peak,
|
|
||||||
e1 = MapGen.Triangulation.Edge,
|
|
||||||
e2 = MapGen.Triangulation.Edge,
|
|
||||||
e3 = MapGen.Triangulation.Edge,
|
|
||||||
h1 = MapGen.Triangulation.Edge,
|
|
||||||
h2 = MapGen.Triangulation.Edge,
|
|
||||||
h3 = MapGen.Triangulation.Edge,
|
|
||||||
neighbours = MapGen.Triangle.Neighbours,
|
|
||||||
color = ColorString?,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
same = function,
|
|
||||||
getCenter = function,
|
|
||||||
getArea = function,
|
|
||||||
getHeight = function,
|
|
||||||
getHeight2D = function,
|
|
||||||
getSidesLength = function,
|
|
||||||
getSidesLength2D = function,
|
|
||||||
getCircumCenter2D = function,
|
|
||||||
getCircumRadius2D = function,
|
|
||||||
getCircumCircle2D = function,
|
|
||||||
inCircumCircle2D = function,
|
|
||||||
}) -> boolean
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns true if the triangles are equivalent.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.same
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.same(other: MapGen.Triangle {
|
|
||||||
p1 = MapGen.Peak,
|
|
||||||
p2 = MapGen.Peak,
|
|
||||||
p3 = MapGen.Peak,
|
|
||||||
e1 = MapGen.Triangulation.Edge,
|
|
||||||
e2 = MapGen.Triangulation.Edge,
|
|
||||||
e3 = MapGen.Triangulation.Edge,
|
|
||||||
h1 = MapGen.Triangulation.Edge,
|
|
||||||
h2 = MapGen.Triangulation.Edge,
|
|
||||||
h3 = MapGen.Triangulation.Edge,
|
|
||||||
neighbours = MapGen.Triangle.Neighbours,
|
|
||||||
color = ColorString?,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
same = function,
|
|
||||||
getCenter = function,
|
|
||||||
getArea = function,
|
|
||||||
getHeight = function,
|
|
||||||
getHeight2D = function,
|
|
||||||
getSidesLength = function,
|
|
||||||
getSidesLength2D = function,
|
|
||||||
getCircumCenter2D = function,
|
|
||||||
getCircumRadius2D = function,
|
|
||||||
getCircumCircle2D = function,
|
|
||||||
inCircumCircle2D = function,
|
|
||||||
}) -> boolean
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns true if the triangles are similar.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.getCenter
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.getCenter() -> vector
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns the coordinates of the triangle's center.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.getArea
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.getArea() -> number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns the area of a triangle.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.getHeight
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.getHeight(
|
|
||||||
p1: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
},
|
|
||||||
p2: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
},
|
|
||||||
p3: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
}
|
|
||||||
) -> MapGen.Triangulation.Edge {
|
|
||||||
p1 = MapGen.Peak,
|
|
||||||
p2 = MapGen.Peak,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
same = function,
|
|
||||||
length = function,
|
|
||||||
getMidPoint = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns the perpendicular from the vertex Peak1 to the line Peak2-Peak3.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.getHeight2D
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.getHeight2D(
|
|
||||||
p1: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
},
|
|
||||||
p2: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
},
|
|
||||||
p3: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
}
|
|
||||||
) -> MapGen.Triangulation.Edge {
|
|
||||||
p1 = MapGen.Peak,
|
|
||||||
p2 = MapGen.Peak,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
same = function,
|
|
||||||
length = function,
|
|
||||||
getMidPoint = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns the perpendicular from the vertex Peak1 to the line Peak2-Peak3.
|
|
||||||
|
|
||||||
Note: This function does not take into account the Y-coordinate,
|
|
||||||
that is, the calculation is performed on the projection of the triangle XZ.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.getSidesLength
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.getSidesLength()
|
|
||||||
-> number
|
|
||||||
-> number
|
|
||||||
-> number
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns the length of the edges
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.getSidesLength2D
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.getSidesLength2D()
|
|
||||||
-> number
|
|
||||||
-> number
|
|
||||||
-> number
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns the length of the edges.
|
|
||||||
|
|
||||||
Note: This function does not take into account the Y-coordinate,
|
|
||||||
that is, the calculation is performed on the projection of the triangle XZ.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.getCircumCenter2D
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.getCircumCenter2D() -> vector
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns the coordinates of the circumcircle center.
|
|
||||||
|
|
||||||
Note: This function does not take into account the Y-coordinate,
|
|
||||||
that is, the calculation is performed on the projection of the triangle XZ.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.getCircumRadius2D
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.getCircumRadius2D() -> number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns the radius of the circumcircle.
|
|
||||||
|
|
||||||
Note: This function does not take into account the Y-coordinate,
|
|
||||||
that is, the calculation is performed on the projection of the triangle XZ.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.getCircumCircle2D
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.getCircumCircle2D()
|
|
||||||
-> vector
|
|
||||||
-> number
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns the coordinates of the circumcircle center and its radius.
|
|
||||||
|
|
||||||
Note: This function does not take into account the Y-coordinate,
|
|
||||||
that is, the calculation is performed on the projection of the triangle XZ.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.inCircumCircle2D
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangle.inCircumCircle2D(p: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
}) -> boolean
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Checks if a given point lies into the triangle circumcircle.
|
|
||||||
|
|
||||||
Note: This function does not take into account the Y-coordinate,
|
|
||||||
that is, the calculation is performed on the projection of the triangle XZ.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### Triangle.p1
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Triangle.p1 : MapGen.Peak {
|
|
||||||
id: number,
|
|
||||||
getPeakPos: function,
|
|
||||||
getColor: function,
|
|
||||||
getGroups: function,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.p2
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Triangle.p2 : MapGen.Peak {
|
|
||||||
id: number,
|
|
||||||
getPeakPos: function,
|
|
||||||
getColor: function,
|
|
||||||
getGroups: function,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.p3
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Triangle.p3 : MapGen.Peak {
|
|
||||||
id: number,
|
|
||||||
getPeakPos: function,
|
|
||||||
getColor: function,
|
|
||||||
getGroups: function,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.e1
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Triangle.e1 : MapGen.Triangulation.Edge {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
same: function,
|
|
||||||
length: function,
|
|
||||||
getMidPoint: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.e2
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Triangle.e2 : MapGen.Triangulation.Edge {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
same: function,
|
|
||||||
length: function,
|
|
||||||
getMidPoint: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.e3
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Triangle.e3 : MapGen.Triangulation.Edge {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
same: function,
|
|
||||||
length: function,
|
|
||||||
getMidPoint: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.h1
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Triangle.h1 : MapGen.Triangulation.Edge {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
same: function,
|
|
||||||
length: function,
|
|
||||||
getMidPoint: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.h2
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Triangle.h2 : MapGen.Triangulation.Edge {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
same: function,
|
|
||||||
length: function,
|
|
||||||
getMidPoint: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.h3
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Triangle.h3 : MapGen.Triangulation.Edge {
|
|
||||||
p1: MapGen.Peak,
|
|
||||||
p2: MapGen.Peak,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
same: function,
|
|
||||||
length: function,
|
|
||||||
getMidPoint: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.neighbours
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Triangle.neighbours : MapGen.Triangle.Neighbours
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangle.color
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Triangle.color : ColorString?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,230 +0,0 @@
|
|||||||
# class Edge
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- namespace: MapGen.Triangulation
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## methods
|
|
||||||
---
|
|
||||||
|
|
||||||
### Edge.new
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Edge.new(
|
|
||||||
p1: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
},
|
|
||||||
p2: MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
}
|
|
||||||
) -> MapGen.Triangulation.Edge {
|
|
||||||
p1 = MapGen.Peak,
|
|
||||||
p2 = MapGen.Peak,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
same = function,
|
|
||||||
length = function,
|
|
||||||
getMidPoint = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Edge.toString
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Edge.toString() -> string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns a string describing the object in a readable form.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Edge.eq
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Edge.eq(other: MapGen.Triangulation.Edge {
|
|
||||||
p1 = MapGen.Peak,
|
|
||||||
p2 = MapGen.Peak,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
same = function,
|
|
||||||
length = function,
|
|
||||||
getMidPoint = function,
|
|
||||||
}) -> boolean
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns true if the edges are equivalent.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Edge.same
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Edge.same(other: MapGen.Triangulation.Edge {
|
|
||||||
p1 = MapGen.Peak,
|
|
||||||
p2 = MapGen.Peak,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
same = function,
|
|
||||||
length = function,
|
|
||||||
getMidPoint = function,
|
|
||||||
}) -> boolean
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns true if the edges are similar.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Edge.length
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Edge.length() -> number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns the length of an edge.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Edge.getMidPoint
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Edge.getMidPoint() -> vector
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns the vector of the point located in the middle of the edge.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### Edge.p1
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Edge.p1 : MapGen.Peak {
|
|
||||||
id: number,
|
|
||||||
getPeakPos: function,
|
|
||||||
getColor: function,
|
|
||||||
getGroups: function,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Edge.p2
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Edge.p2 : MapGen.Peak {
|
|
||||||
id: number,
|
|
||||||
getPeakPos: function,
|
|
||||||
getColor: function,
|
|
||||||
getGroups: function,
|
|
||||||
new: function,
|
|
||||||
toString: function,
|
|
||||||
eq: function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
# class FakePeak
|
|
||||||
|
|
||||||
|
|
||||||
- supers: MapGen.Peak
|
|
||||||
|
|
||||||
|
|
||||||
- namespace: MapGen.Triangulation
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Allows you to create a `MapGen.Peak` without specifying a noise parameter.
|
|
||||||
|
|
||||||
**WARNING: MUST NOT BE PARTICIPATED IN GENERATION**
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## methods
|
|
||||||
---
|
|
||||||
|
|
||||||
### FakePeak.getPeakPos
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function FakePeak.getPeakPos()-> vector
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### FakePeak.new
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function FakePeak.new(peakPos: vector) -> MapGen.Peak {
|
|
||||||
id = number,
|
|
||||||
getPeakPos = function,
|
|
||||||
getColor = function,
|
|
||||||
getGroups = function,
|
|
||||||
new = function,
|
|
||||||
toString = function,
|
|
||||||
eq = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns a fake `MapGen.Peak` that has no noise parameters.
|
|
||||||
Note that the initialized peak should not be used in generation.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### FakePeak.id
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
FakePeak.id : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
# class Triangulation
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- namespace: MapGen
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## methods
|
|
||||||
---
|
|
||||||
|
|
||||||
### Triangulation.triangulate
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangulation.triangulate(vertices: table<integer,MapGen.Peak>) -> ((MapGen.Triangle)|MapGen.Triangle[])
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
The Delaunay method divides a plane into triangles based on a list of their vertices.
|
|
||||||
|
|
||||||
Doesn't take into account the Y coordinate of the vertices.
|
|
||||||
That is, all triangles that don't lie in the XZ plane will be projected onto it.
|
|
||||||
|
|
||||||
Vertices that do not have a `is2d` group will not participate in the triangulation.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Triangulation.tetrahedralize
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function Triangulation.tetrahedralize(vertices: table<integer,MapGen.Peak>) -> ((MapGen.Tetrahedron)|MapGen.Tetrahedron[])
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
The Delaunay method divides space into tetrahedra based on a list of their vertices.
|
|
||||||
|
|
||||||
Vertices that do not have a `is3d` group will not participate in the triangulation.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### Triangulation.convexMultiplier
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
Triangulation.convexMultiplier : number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,741 +0,0 @@
|
|||||||
# class MapGen
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## methods
|
|
||||||
---
|
|
||||||
|
|
||||||
### MapGen.new
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.new(def: MapGenDef {
|
|
||||||
nodes = table<string,string>,
|
|
||||||
}) -> MapGen {
|
|
||||||
layersByName = table<string,MapGen.Layer>,
|
|
||||||
layersList = MapGen.Layer[],
|
|
||||||
staticsByName = table<string,MapGen.StaticLayer>,
|
|
||||||
staticsList = MapGen.StaticLayer[],
|
|
||||||
layersNoisesInitialized = boolean,
|
|
||||||
cavernsNoiseInitialized = boolean,
|
|
||||||
isRunning = boolean,
|
|
||||||
nodeIDs = table<string,number>,
|
|
||||||
new = function,
|
|
||||||
getLayerByHeight = function,
|
|
||||||
getStaticByHeight = function,
|
|
||||||
registerLayer = function,
|
|
||||||
registerLayerNoiseColor = function,
|
|
||||||
registerStaticLayer = function,
|
|
||||||
registerPeak = function,
|
|
||||||
register2DPeak = function,
|
|
||||||
register2DPeaks = function,
|
|
||||||
register2DPeaksFromFile = function,
|
|
||||||
registerBiome = function,
|
|
||||||
registerCavern = function,
|
|
||||||
initLayersTriangultaion = function,
|
|
||||||
initLayersNoises = function,
|
|
||||||
initBiomesDiagram = function,
|
|
||||||
initCavernsNoise = function,
|
|
||||||
getNoises2dValue = function,
|
|
||||||
onMapGenerated = function,
|
|
||||||
run = function,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.getLayerByHeight
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.getLayerByHeight(yPos: number) -> MapGen.Layer?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Determines which layer a node belongs to based on its height coordinate.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.getStaticByHeight
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.getStaticByHeight(yPos: number) -> MapGen.StaticLayer?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Determines which statics layer a node belongs to based on its height coordinate.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.registerLayer
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.registerLayer(
|
|
||||||
name: string,
|
|
||||||
def: MapGen.LayerDef {
|
|
||||||
minY = number,
|
|
||||||
maxY = number,
|
|
||||||
minTemp = number,
|
|
||||||
maxTemp = number,
|
|
||||||
minHumidity = number,
|
|
||||||
maxHumidity = number,
|
|
||||||
waterLevel = number?,
|
|
||||||
calcTemp = (fun(self: MapGen.Layer, value: number, height: number) -> number)?,
|
|
||||||
calcHumidity = (fun(self: MapGen.Layer, value: number, height: number) -> number)?,
|
|
||||||
biomesGorizontalScattering = number?,
|
|
||||||
biomesVerticalScattering = number?,
|
|
||||||
}
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
@param `name` - The name that will be assigned to the layer. The name must be unique for each layer.
|
|
||||||
|
|
||||||
@param `def` - Layer description table, see details `MapGen.LayerDef`.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Mark the world area between two heights as a `MapGen.Layer`.
|
|
||||||
|
|
||||||
Note: layers must not overlap.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.registerLayerNoiseColor
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.registerLayerNoiseColor(
|
|
||||||
layerName: string,
|
|
||||||
category: MapGen.Layer.Category,
|
|
||||||
color: ColorString,
|
|
||||||
noiseParams: NoiseParams
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
@param `layerName` - The name of the layer for which the color will be registered.
|
|
||||||
|
|
||||||
@param `category` - Category indicating what will be generated by noise.
|
|
||||||
|
|
||||||
@param `color` - Noise color. Must be unique.
|
|
||||||
|
|
||||||
@param `noiseParams` - Fractal noise parameters.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Register the color and the noise parameters that correspond to it.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.registerStaticLayer
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.registerStaticLayer(
|
|
||||||
name: string,
|
|
||||||
def: MapGen.StaticLayerDef {
|
|
||||||
minY = number,
|
|
||||||
maxY = number,
|
|
||||||
staticNode = string,
|
|
||||||
generateStaticNode = generateFunc,
|
|
||||||
}
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
@param `name` - The name that will be assigned to the static layer. The name must be unique for each layer.
|
|
||||||
|
|
||||||
@param `def` - Static layer description table, see details `MapGen.StaticLayerDef`.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Mark the world area between two heights as a `MapGen.StaticLayer`.
|
|
||||||
|
|
||||||
Note: layers must not overlap.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.registerPeak
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.registerPeak(
|
|
||||||
layerName: string,
|
|
||||||
category: MapGen.Layer.Category,
|
|
||||||
def: MapGen.PeakDef {
|
|
||||||
pos = vector,
|
|
||||||
color = ColorString,
|
|
||||||
groups = table<string,number>?,
|
|
||||||
}
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
@param `layerName` - The name of the layer in which the new peak will be included.
|
|
||||||
|
|
||||||
@param `category` - Category indicating what will be generated by peak.
|
|
||||||
|
|
||||||
@param `def` - Peak description table, see details `MapGen.PeakDef`.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Mark a world point as `MapGen.Peak` and assign it a specific color that will affect the generation.
|
|
||||||
|
|
||||||
Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.register2DPeak
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.register2DPeak(
|
|
||||||
layerName: string,
|
|
||||||
category: MapGen.Layer.Category,
|
|
||||||
def: MapGen.PeakDef {
|
|
||||||
pos = vector,
|
|
||||||
color = ColorString,
|
|
||||||
groups = table<string,number>?,
|
|
||||||
}
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
@param `layerName` - The name of the layer in which the new peak will be included.
|
|
||||||
|
|
||||||
@param `category` - Category indicating what will be generated by peak.
|
|
||||||
|
|
||||||
@param `def` - Peak description table, see details `MapGen.PeakDef`.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Mark a world point as `MapGen.Peak` and assign it a specific color that will affect the generation.
|
|
||||||
The Y coordinate will be forced to zero, and the `is2d` group will be added to the groups field.
|
|
||||||
|
|
||||||
Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.register2DPeaks
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.register2DPeaks(
|
|
||||||
layerName: string,
|
|
||||||
category: MapGen.Layer.Category,
|
|
||||||
defs: MapGen.PeakDef[]
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
@param `layerName` - The name of the layer in which the new peaks will be included.
|
|
||||||
|
|
||||||
@param `category` - Category indicating what will be generated by peaks.
|
|
||||||
|
|
||||||
@param `defs` - Peaks description table, see details `MapGen.PeakDef`.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Mark the world points as `MapGen.Peak` and assign them all a specific noise that will affect generation.
|
|
||||||
The Y coordinate will be forced to zero, and the `is2d` group will be added to the groups field.
|
|
||||||
|
|
||||||
Note: The peaks shouldn't overlap. This won't cause any errors, but it might ruin the generation.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.register2DPeaksFromFile
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.register2DPeaksFromFile(
|
|
||||||
layerName: string,
|
|
||||||
map: string,
|
|
||||||
scale: number,
|
|
||||||
zeroPos: Position2d,
|
|
||||||
category: MapGen.Layer.Category,
|
|
||||||
groups: table<string,number>?
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
@param `layerName` - The name of the layer in which the new peaks will be included.
|
|
||||||
|
|
||||||
@param `map` - The name of the image from which the peaks will be extracted. It should be located in the `<mod_name>/textures/maps` folder and have the following format `<image_name>.ff`
|
|
||||||
|
|
||||||
@param `scale` - Multiplier of how many blocks (nodes) will be between image pixels. It is not recommended to set the value below 50 for performance reasons.
|
|
||||||
|
|
||||||
@param `zeroPos` - The position in pixels where the zero world coordinate will be in the image.
|
|
||||||
|
|
||||||
@param `category` - Category indicating what will be generated by peaks.
|
|
||||||
|
|
||||||
@param `groups` - Groups that will be added to all peaks.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Extract the `MapGen.Peak` from the image and assign them all a specific color that will affect the generation.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.registerBiome
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.registerBiome(
|
|
||||||
layerName: string,
|
|
||||||
biomeName: string,
|
|
||||||
def: MapGen.BiomeDef {
|
|
||||||
tempPoint = number,
|
|
||||||
humidityPoint = number,
|
|
||||||
minY = number,
|
|
||||||
maxY = number,
|
|
||||||
groundNodes = MapGen.Biome.GroundNodes,
|
|
||||||
soilHeight = number,
|
|
||||||
generateAir = generateFunc?,
|
|
||||||
generateCavernAir = generateFunc?,
|
|
||||||
generateWater = generateFunc?,
|
|
||||||
generateRock = generateFunc?,
|
|
||||||
generateTurf = generateFunc?,
|
|
||||||
generateSoil = generateFunc?,
|
|
||||||
generateBottom = generateFunc?,
|
|
||||||
}
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
@param `layerName` - The name of the layer in which the new biome will be included.
|
|
||||||
|
|
||||||
@param `biomeName` - The name to be assigned to the biome. The name must be unique for each biome.
|
|
||||||
|
|
||||||
@param `def` - Biome description table, see details `MapGen.BiomeDef`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Mark a point on the biomes diagram and constrain the world area by height to mark it as `MapGen.Biome`.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.registerCavern
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.registerCavern(
|
|
||||||
layerName: string,
|
|
||||||
cavernName: string,
|
|
||||||
def: MapGen.CavernDef {
|
|
||||||
minY = number,
|
|
||||||
maxY = number,
|
|
||||||
noiseParams = NoiseParams,
|
|
||||||
smoothDistance = number,
|
|
||||||
threshold = number?,
|
|
||||||
groups = table<string,number>?,
|
|
||||||
}
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
@param `layerName` - The name of the layer in which the new cavern will be included.
|
|
||||||
|
|
||||||
@param `cavernName` - The name to be assigned to the cavern. The name must be unique for each cavern.
|
|
||||||
|
|
||||||
@param `def` - Cavern description table, see details `MapGen.CavernDef`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Mark the world area between two heights as a `MapGen.Cavern` and assign the noise that the cave will be generated from.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.initLayersTriangultaion
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.initLayersTriangultaion() -> nil
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Divide all layers into triangles whose vertices are the `Mapgen.Peak` belonging to these layers.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.initLayersNoises
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.initLayersNoises() -> nil
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Initialize all layer noises. This should be called after the map object is loaded.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.initBiomesDiagram
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.initBiomesDiagram() -> nil
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Initialization of the biome diagram using the Voronoi method.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.initCavernsNoise
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.initCavernsNoise() -> nil
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Initialize caverns's noises. This should be called after the map object is loaded.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.getNoises2dValue
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.getNoises2dValue(
|
|
||||||
category: MapGen.Layer.Category,
|
|
||||||
layer: MapGen.Layer {
|
|
||||||
name = string,
|
|
||||||
minY = integer,
|
|
||||||
maxY = integer,
|
|
||||||
minTemp = integer,
|
|
||||||
maxTemp = integer,
|
|
||||||
minHumidity = integer,
|
|
||||||
maxHumidity = integer,
|
|
||||||
waterLevel = integer,
|
|
||||||
peaksList = { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] },
|
|
||||||
noisesByColor = { humidity: table<ColorString,ValueNoise>, landscape: table<ColorString,ValueNoise>, temp: table<ColorString,ValueNoise> },
|
|
||||||
noisesParamsByColor = { humidity: table<ColorString,NoiseParams>, landscape: table<ColorString,NoiseParams>, temp: table<ColorString,NoiseParams> },
|
|
||||||
biomesByName = table<string,MapGen.Biome>,
|
|
||||||
biomesList = MapGen.Biome[],
|
|
||||||
biomesDiagram = table,
|
|
||||||
biomesGorizontalScattering = integer,
|
|
||||||
biomesVerticalScattering = integer,
|
|
||||||
cavernsByName = table<string,MapGen.Cavern>,
|
|
||||||
cavernsList = MapGen.Cavern[],
|
|
||||||
trianglesList = { humidity: MapGen.Triangle[], landscape: MapGen.Triangle[], temp: MapGen.Triangle[] },
|
|
||||||
tetrahedronsList = MapGen.Tetrahedron[],
|
|
||||||
calcTemp = function,
|
|
||||||
calcHumidity = function,
|
|
||||||
new = function,
|
|
||||||
addPeak = function,
|
|
||||||
addNoiseParamsColor = function,
|
|
||||||
getNoiseByColor = function,
|
|
||||||
addBiome = function,
|
|
||||||
addCavern = function,
|
|
||||||
initNoises = function,
|
|
||||||
initBiomesDiagram = function,
|
|
||||||
},
|
|
||||||
x: integer,
|
|
||||||
y: integer,
|
|
||||||
z: integer
|
|
||||||
) -> number?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Calculates a smoothed 2D noise value based on a preliminary space partitioning.
|
|
||||||
|
|
||||||
Returns `nil` if the point is not included in any triangle.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.onMapGenerated
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.onMapGenerated(
|
|
||||||
voxelManip: VoxelManip,
|
|
||||||
minPos: Position,
|
|
||||||
maxPos: Position,
|
|
||||||
blockseed: number
|
|
||||||
) -> nil
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Chunk generation handler.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.run
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
function MapGen.run() -> nil
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Run world generation through this mapgen object
|
|
||||||
|
|
||||||
Note: only one instance of a `MapGen` class can be running.
|
|
||||||
|
|
||||||
**FOR MAPGEN ENVIRONMENT ONLY**
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### MapGen.layersByName
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
MapGen.layersByName : table<string,MapGen.Layer>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.layersList
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
MapGen.layersList : MapGen.Layer[]
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.staticsByName
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
MapGen.staticsByName : table<string,MapGen.StaticLayer>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.staticsList
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
MapGen.staticsList : MapGen.StaticLayer[]
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.layersNoisesInitialized
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
MapGen.layersNoisesInitialized : boolean
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Is the fractal noise of the layer initialized? This is necessary for a one-time noise initialization.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.cavernsNoiseInitialized
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
MapGen.cavernsNoiseInitialized : boolean
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Is the fractal noise of the caverns initialized? This is necessary for a one-time noise initialization.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.isRunning
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
MapGen.isRunning : boolean
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
A static field that guarantees that only one instance of the `MapGen` class will work.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### MapGen.nodeIDs
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
MapGen.nodeIDs : table<string,number>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
# class MapGenDef
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Definition table for the `MapGen`.
|
|
||||||
|
|
||||||
**Only for EmmyLua.**
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## fields
|
|
||||||
---
|
|
||||||
|
|
||||||
### MapGenDef.nodes
|
|
||||||
---
|
|
||||||
```lua
|
|
||||||
MapGenDef.nodes : table<string,string>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
# alias generateFunc
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```lua
|
|
||||||
(alias) generateFunc = fun(self, mapGenerator: MapGen, data: number[], index: number, x: number, y: number, z: number)
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
|
|
||||||
site_name: Docs
|
|
||||||
|
|
||||||
|
|
||||||
theme:
|
|
||||||
name: material
|
|
||||||
font:
|
|
||||||
text: Roboto
|
|
||||||
code: Roboto Mono
|
|
||||||
search: true
|
|
||||||
features:
|
|
||||||
- quick-links
|
|
||||||
- navigation
|
|
||||||
- search
|
|
||||||
- toc
|
|
||||||
- fullscreen
|
|
||||||
- bookmarks
|
|
||||||
- tabs
|
|
||||||
- code
|
|
||||||
- edit-on-github
|
|
||||||
- language-selector
|
|
||||||
- code
|
|
||||||
- cover
|
|
||||||
- footer
|
|
||||||
- social-share
|
|
||||||
- theme-switcher
|
|
||||||
nav:
|
|
||||||
- Home: index.md
|
|
||||||
|
|
||||||
- Types:
|
|
||||||
- alias Category : types/MapGen.Layer.Category.md
|
|
||||||
- alias CircumCircleEnum : types/MapGen.Triangle.CircumCircleEnum.md
|
|
||||||
- alias ColoredDotsTable : types/ColoredDotsTable.md
|
|
||||||
- alias Neighbours : types/MapGen.Triangle.Neighbours.md
|
|
||||||
- alias PastCalcNoiseValue : types/MapGen.PastCalcNoiseValue.md
|
|
||||||
- alias generateFunc : types/generateFunc.md
|
|
||||||
- class Biome : types/MapGen.Biome.md
|
|
||||||
- class BiomeDef : types/MapGen.BiomeDef.md
|
|
||||||
- class Cavern : types/MapGen.Cavern.md
|
|
||||||
- class CavernDef : types/MapGen.CavernDef.md
|
|
||||||
- class Decoration : types/MapGen.Decoration.md
|
|
||||||
- class Edge : types/MapGen.Triangulation.Edge.md
|
|
||||||
- class FakePeak : types/MapGen.Triangulation.FakePeak.md
|
|
||||||
- class GroundNodes : types/MapGen.Biome.GroundNodes.md
|
|
||||||
- class GroundNodesIDs : types/MapGen.Biome.GroundNodesIDs.md
|
|
||||||
- class Layer : types/MapGen.Layer.md
|
|
||||||
- class LayerDef : types/MapGen.LayerDef.md
|
|
||||||
- class MapGen : types/MapGen.md
|
|
||||||
- class MapGenDef : types/MapGenDef.md
|
|
||||||
- class Peak : types/MapGen.Peak.md
|
|
||||||
- class PeakDef : types/MapGen.PeakDef.md
|
|
||||||
- class StaticLayer : types/MapGen.StaticLayer.md
|
|
||||||
- class StaticLayerDef : types/MapGen.StaticLayerDef.md
|
|
||||||
- class Tetrahedron : types/MapGen.Tetrahedron.md
|
|
||||||
- class Triangle : types/MapGen.Triangle.md
|
|
||||||
- class Triangulation : types/MapGen.Triangulation.md
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- Modules:
|
|
||||||
- MapGen : modules/MapGen.md
|
|
||||||
- MapGen.Biome : modules/MapGen.Biome.md
|
|
||||||
- MapGen.Biome.GroundNodes : modules/MapGen.Biome.GroundNodes.md
|
|
||||||
- MapGen.Biome.GroundNodesIds : modules/MapGen.Biome.GroundNodesIds.md
|
|
||||||
- MapGen.Cavern : modules/MapGen.Cavern.md
|
|
||||||
- MapGen.Decoration : modules/MapGen.Decoration.md
|
|
||||||
- MapGen.Layer : modules/MapGen.Layer.md
|
|
||||||
- MapGen.Peak : modules/MapGen.Peak.md
|
|
||||||
- MapGen.StaticLayer : modules/MapGen.StaticLayer.md
|
|
||||||
- MapGen.Tetrahedron : modules/MapGen.Tetrahedron.md
|
|
||||||
- MapGen.Triangle : modules/MapGen.Triangle.md
|
|
||||||
- MapGen.Triangulation : modules/MapGen.Triangulation.md
|
|
||||||
- MapGen.Triangulation.Edge : modules/MapGen.Triangulation.Edge.md
|
|
||||||
- MapGen.Triangulation.FakePeak : modules/MapGen.Triangulation.FakePeak.md
|
|
||||||
- MapGen.ff2luat : modules/MapGen.ff2luat.md
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extra:
|
|
||||||
footer: ""
|
|
||||||
|
Before Width: | Height: | Size: 2.1 MiB After Width: | Height: | Size: 7.3 MiB |
@@ -10,17 +10,28 @@ local BaseUI = {
|
|||||||
contex = {}
|
contex = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
---@param name string
|
---@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 getFormSpecString fun(self:BaseUI,playerName:string,...):string
|
||||||
function BaseUI:new(name, getFormSpecString)
|
---@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
|
---@type BaseUI
|
||||||
local instance = getInstance(self, {})
|
local instance = getInstance(self, {})
|
||||||
instance.name = name
|
instance.name = name
|
||||||
instance.getFormSpecString = getFormSpecString
|
instance.getFormSpecString = getFormSpecString
|
||||||
|
|
||||||
-- Ensure that when the form is closed, the context is cleared.
|
if clearContex then
|
||||||
|
-- Ensure that when the form is closed, the context is cleared.
|
||||||
|
instance:registerOnFormQuit(function(player)
|
||||||
|
instance:clearContex(player)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
instance:registerOnFormQuit(function(player)
|
instance:registerOnFormQuit(function(player)
|
||||||
instance:clearContex(player)
|
Smc.clearActiveFormspec(player:get_player_name())
|
||||||
end)
|
end)
|
||||||
|
|
||||||
return instance
|
return instance
|
||||||
@@ -110,6 +121,7 @@ end
|
|||||||
---@param playerName string
|
---@param playerName string
|
||||||
function BaseUI:showForm(playerName, ...)
|
function BaseUI:showForm(playerName, ...)
|
||||||
core.show_formspec(playerName, self.name, self:getFormSpecString(playerName, ...))
|
core.show_formspec(playerName, self.name, self:getFormSpecString(playerName, ...))
|
||||||
|
Smc.setActiveFormspec(playerName, self.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
---Close the player the FormSpec registered by the instance of this UI.
|
---Close the player the FormSpec registered by the instance of this UI.
|
||||||
|
|||||||
@@ -8,6 +8,6 @@ local BaseCraft = {}
|
|||||||
---
|
---
|
||||||
---**Only for EmmyLua.**
|
---**Only for EmmyLua.**
|
||||||
---@class CraftSystem.BaseCraftDef
|
---@class CraftSystem.BaseCraftDef
|
||||||
---@field group CraftSystem.CraftGroup
|
---@field group CraftSystem.CraftGroup?
|
||||||
|
|
||||||
return BaseCraft
|
return BaseCraft
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
|
local PLAYERS_KNOW_ALL_RECIPES = true
|
||||||
|
|
||||||
---Abstract class for handling crafting.
|
---Abstract class for handling crafting.
|
||||||
---@class CraftSystem.BaseCraftHandler
|
---@class CraftSystem.BaseCraftHandler
|
||||||
---@field craftsByName table<string, CraftSystem.BaseCraft>
|
---@field craftsByName table<string, CraftSystem.BaseCraft>
|
||||||
---@field craftsByGroup table<CraftSystem.CraftGroup, CraftSystem.BaseCraft[]>
|
---@field craftsByGroup table<CraftSystem.CraftGroup, CraftSystem.BaseCraft[]>
|
||||||
---@field craftsList CraftSystem.BaseCraft[]
|
---@field craftsList CraftSystem.BaseCraft[]
|
||||||
---@field learnedCrafts table<string, table<string, CraftSystem.BaseCraft>>
|
---@field groupedCrafts (CraftSystem.BaseCraft[]|CraftSystem.BaseCraft)[]
|
||||||
|
---@field learnedCrafts table<string, (CraftSystem.BaseCraft[]|CraftSystem.BaseCraft)[]>
|
||||||
local BaseCraftHandler = {
|
local BaseCraftHandler = {
|
||||||
craftsByName = {},
|
craftsByName = {},
|
||||||
craftsByGroup = {},
|
craftsByGroup = {},
|
||||||
craftsList = {},
|
craftsList = {},
|
||||||
|
groupedCrafts = {},
|
||||||
learnedCrafts = {},
|
learnedCrafts = {},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,12 +38,18 @@ function BaseCraftHandler:getCraftsByGroup(craftGroup)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---@param playerName string
|
---@param playerName string
|
||||||
---@return table<string, CraftSystem.BaseCraft>
|
---@return (CraftSystem.BaseCraft[]|CraftSystem.BaseCraft)[]
|
||||||
function BaseCraftHandler:getLearnedCrafts(playerName)
|
function BaseCraftHandler:getLearnedCrafts(playerName)
|
||||||
|
if PLAYERS_KNOW_ALL_RECIPES then
|
||||||
|
return self.groupedCrafts
|
||||||
|
end
|
||||||
|
|
||||||
local crafts = self.learnedCrafts[playerName]
|
local crafts = self.learnedCrafts[playerName]
|
||||||
|
|
||||||
assert(crafts ~= nil, ('There is no primitive crafting data for a player named `%s`.'):format(
|
if crafts == nil then
|
||||||
playerName))
|
crafts = {}
|
||||||
|
self.learnedCrafts[playerName] = crafts
|
||||||
|
end
|
||||||
|
|
||||||
return crafts
|
return crafts
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ local stageTypes = {
|
|||||||
---Immersive crafting aimed at a more logical process of crafting items.
|
---Immersive crafting aimed at a more logical process of crafting items.
|
||||||
---@class CraftSystem.ImmersiveCraft : CraftSystem.BaseCraft
|
---@class CraftSystem.ImmersiveCraft : CraftSystem.BaseCraft
|
||||||
---@field startStageName string
|
---@field startStageName string
|
||||||
---@field triggerItem string
|
---@field triggerItem ItemStackString
|
||||||
---@field output ItemStackString
|
---@field output ItemStackString
|
||||||
---@field stagesByName table<string, CraftSystem.ImmersiveCraftStage>
|
---@field stagesByName table<string, CraftSystem.ImmersiveCraftStage>
|
||||||
local ImmersiveCraft = extend(BaseCraft, {})
|
local ImmersiveCraft = extend(BaseCraft, {})
|
||||||
@@ -28,8 +28,8 @@ local ImmersiveCraft = extend(BaseCraft, {})
|
|||||||
---**Only for EmmyLua.**
|
---**Only for EmmyLua.**
|
||||||
---@class CraftSystem.ImmersiveCraftDef : CraftSystem.BaseCraftDef
|
---@class CraftSystem.ImmersiveCraftDef : CraftSystem.BaseCraftDef
|
||||||
---@field startStageName string
|
---@field startStageName string
|
||||||
---@field triggerItem string
|
---@field triggerItem ItemStackString
|
||||||
---@field output string
|
---@field output ItemStackString
|
||||||
---@field stages CraftSystem.ImmersiveCraftStageDef[]
|
---@field stages CraftSystem.ImmersiveCraftStageDef[]
|
||||||
|
|
||||||
---@param name string
|
---@param name string
|
||||||
@@ -106,10 +106,10 @@ end
|
|||||||
function ImmersiveCraft:startCraft(pos, player, amount)
|
function ImmersiveCraft:startCraft(pos, player, amount)
|
||||||
-- Adding craft to the counter.
|
-- Adding craft to the counter.
|
||||||
-- If crafting has not been added...
|
-- If crafting has not been added...
|
||||||
if not ImmersiveCraftCounter:addCraft(pos, player) then
|
if not ImmersiveCraftCounter:addCraft(pos, player:get_player_name()) then
|
||||||
-- ...then we don't let the player start a new craft.
|
-- ...then we don't let the player start a new craft.
|
||||||
core.chat_send_player(player:get_player_name(),
|
core.chat_send_player(player:get_player_name(),
|
||||||
'The limit of simultaneously active crafts has been reached:'..
|
'The limit of simultaneously active crafts has been reached: '..
|
||||||
'complete or cancel active crafts to start a new one')
|
'complete or cancel active crafts to start a new one')
|
||||||
|
|
||||||
return false
|
return false
|
||||||
@@ -142,9 +142,10 @@ function ImmersiveCraft:startCraft(pos, player, amount)
|
|||||||
-- Create a temporary data table for crafting.
|
-- Create a temporary data table for crafting.
|
||||||
---@type ImmersiveCraftData
|
---@type ImmersiveCraftData
|
||||||
local craftData = {
|
local craftData = {
|
||||||
craftName = self.name,
|
playerName = player:get_player_name(), -- The name of the player who started the craft.
|
||||||
stageName = stage.name,
|
craftName = self.name,
|
||||||
amount = amount,
|
stageName = stage.name,
|
||||||
|
amount = amount,
|
||||||
}
|
}
|
||||||
-- We save it to the workstation metadata.
|
-- We save it to the workstation metadata.
|
||||||
Smc.setCraftDataByPos(pos, craftData)
|
Smc.setCraftDataByPos(pos, craftData)
|
||||||
@@ -157,8 +158,8 @@ end
|
|||||||
|
|
||||||
---Complete the immersive crafting process.
|
---Complete the immersive crafting process.
|
||||||
---@param pos MapPosition
|
---@param pos MapPosition
|
||||||
---@param Player Player
|
---@param player Player
|
||||||
function ImmersiveCraft:endCraft(pos, Player)
|
function ImmersiveCraft:endCraft(pos, player)
|
||||||
-- We get current data on crafting.
|
-- We get current data on crafting.
|
||||||
---@type ImmersiveCraftData?
|
---@type ImmersiveCraftData?
|
||||||
local craftData = Smc.getCraftDataByPos(pos)
|
local craftData = Smc.getCraftDataByPos(pos)
|
||||||
@@ -170,17 +171,16 @@ function ImmersiveCraft:endCraft(pos, Player)
|
|||||||
core.item_drop(ItemStack(self.output), nil, dropPos)
|
core.item_drop(ItemStack(self.output), nil, dropPos)
|
||||||
end
|
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.
|
-- Clearing the temporary data table for crafting, freeing up the work station for new crafts.
|
||||||
Smc.setCraftDataByPos(pos)
|
Smc.setCraftDataByPos(pos)
|
||||||
|
|
||||||
-- Remove craft from the counter.
|
|
||||||
ImmersiveCraftCounter:removeCraft(pos, Player)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
---Stop the crafting process and free up the workbench.
|
---Stop the crafting process and free up the workbench.
|
||||||
---@param pos MapPosition
|
---@param pos MapPosition
|
||||||
---@param Player Player
|
function ImmersiveCraft:abortCraft(pos)
|
||||||
function ImmersiveCraft:abortCraft(pos, Player)
|
|
||||||
-- We get current data on crafting.
|
-- We get current data on crafting.
|
||||||
---@type ImmersiveCraftData?
|
---@type ImmersiveCraftData?
|
||||||
local craftData = Smc.getCraftDataByPos(pos)
|
local craftData = Smc.getCraftDataByPos(pos)
|
||||||
@@ -188,13 +188,13 @@ function ImmersiveCraft:abortCraft(pos, Player)
|
|||||||
|
|
||||||
-- We get the current stage and start the abort process.
|
-- We get the current stage and start the abort process.
|
||||||
local stage = self.stagesByName[craftData.stageName]
|
local stage = self.stagesByName[craftData.stageName]
|
||||||
stage:abortHandler(pos, Player)
|
stage:abortHandler(pos)
|
||||||
|
|
||||||
-- Clearing the temporary data table for crafting, freeing up the work station for new crafts.
|
-- Clearing the temporary data table for crafting, freeing up the work station for new crafts.
|
||||||
Smc.setCraftDataByPos(pos)
|
Smc.setCraftDataByPos(pos)
|
||||||
|
|
||||||
-- Remove craft from the counter.
|
-- Remove craft from the counter.
|
||||||
ImmersiveCraftCounter:removeCraft(pos, Player)
|
ImmersiveCraftCounter:removeCraft(pos, craftData.playerName)
|
||||||
end
|
end
|
||||||
|
|
||||||
---Returns a human-readable description of the crafting process.
|
---Returns a human-readable description of the crafting process.
|
||||||
|
|||||||
@@ -3,6 +3,20 @@ local posToString, getSize = core.pos_to_string, table.get_size
|
|||||||
local CRAFT_LIMIT_PER_PLAYER = 2
|
local CRAFT_LIMIT_PER_PLAYER = 2
|
||||||
local CRAFT_LIMIT_PER_SERVER = 10
|
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
|
---Designed to keep track of active immersive
|
||||||
---crafts so as not to overload the server.
|
---crafts so as not to overload the server.
|
||||||
---
|
---
|
||||||
@@ -12,18 +26,17 @@ local CRAFT_LIMIT_PER_SERVER = 10
|
|||||||
---@field craftsCountForPlayers table<string, table<string, boolean>>
|
---@field craftsCountForPlayers table<string, table<string, boolean>>
|
||||||
---@field craftsCountForServer table<string, boolean>
|
---@field craftsCountForServer table<string, boolean>
|
||||||
local ImmersiveCraftCounter = {
|
local ImmersiveCraftCounter = {
|
||||||
craftsCountForPlayers = {},
|
craftsCountForPlayers = getStorageTable('crafts_count_for_players'),
|
||||||
craftsCountForServer = {}
|
craftsCountForServer = getStorageTable('crafts_count_for_serves')
|
||||||
}
|
}
|
||||||
|
|
||||||
---Add craft to the counter.
|
---Add craft to the counter.
|
||||||
---
|
---
|
||||||
---Returns `false` if the counter is already full.
|
---Returns `false` if the counter is already full.
|
||||||
---@param pos MapPosition
|
---@param pos MapPosition
|
||||||
---@param Player Player
|
---@param playerName string
|
||||||
---@return boolean
|
---@return boolean
|
||||||
function ImmersiveCraftCounter:addCraft(pos, Player)
|
function ImmersiveCraftCounter:addCraft(pos, playerName)
|
||||||
local playerName = Player:get_player_name()
|
|
||||||
if self.craftsCountForPlayers[playerName] == nil then
|
if self.craftsCountForPlayers[playerName] == nil then
|
||||||
self.craftsCountForPlayers[playerName] = {}
|
self.craftsCountForPlayers[playerName] = {}
|
||||||
end
|
end
|
||||||
@@ -44,10 +57,10 @@ function ImmersiveCraftCounter:addCraft(pos, Player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---Remove craft from the counter.
|
---Remove craft from the counter.
|
||||||
---@param pos MapPosition
|
---@param pos MapPosition
|
||||||
---@param Player Player
|
---@param playerName string
|
||||||
function ImmersiveCraftCounter:removeCraft(pos, Player)
|
function ImmersiveCraftCounter:removeCraft(pos, playerName)
|
||||||
local playerCrafts = self.craftsCountForPlayers[Player:get_player_name()]
|
local playerCrafts = self.craftsCountForPlayers[playerName]
|
||||||
if playerCrafts == nil then
|
if playerCrafts == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -57,6 +70,9 @@ function ImmersiveCraftCounter:removeCraft(pos, Player)
|
|||||||
self.craftsCountForServer[posString] = nil
|
self.craftsCountForServer[posString] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TODO: сделать сохранение данных во время перезагрузки сервера
|
core.register_on_shutdown(function()
|
||||||
|
setStorageTable('crafts_count_for_players', ImmersiveCraftCounter.craftsCountForPlayers)
|
||||||
|
setStorageTable('crafts_count_for_server', ImmersiveCraftCounter.craftsCountForServer)
|
||||||
|
end)
|
||||||
|
|
||||||
return ImmersiveCraftCounter
|
return ImmersiveCraftCounter
|
||||||
|
|||||||
@@ -29,12 +29,13 @@ function ImmersiveCraftHandler:registerCraft(craftName, def)
|
|||||||
assert(self.craftsByName[craftName] == nil, ('A craft named `%s` already exists.'):format(
|
assert(self.craftsByName[craftName] == nil, ('A craft named `%s` already exists.'):format(
|
||||||
craftName))
|
craftName))
|
||||||
|
|
||||||
|
-- The craft group to which the craft belongs.
|
||||||
|
local group = 'craft_group:' .. (def.group or 'UNDEFINED')
|
||||||
|
def.group = group
|
||||||
|
|
||||||
-- We obtain a crafting instance according to the given parameters.
|
-- We obtain a crafting instance according to the given parameters.
|
||||||
local craft = ImmersiveCraft:new(craftName, def)
|
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 no craft with this group has been registered before...
|
||||||
if self.craftsByGroup[group] == nil then
|
if self.craftsByGroup[group] == nil then
|
||||||
-- ...then we create a list for this group.
|
-- ...then we create a list for this group.
|
||||||
|
|||||||
@@ -22,10 +22,14 @@ local tappingNode = ImmersiveCraftNode:new({
|
|||||||
_name = 'craft_system:tapping_node',
|
_name = 'craft_system:tapping_node',
|
||||||
_add_mod_name = false,
|
_add_mod_name = false,
|
||||||
|
|
||||||
|
---@type ObjectProperties
|
||||||
initial_properties = {
|
initial_properties = {
|
||||||
visual = 'wielditem',
|
visual = 'wielditem',
|
||||||
visual_size = {x=0.4, y=0.4, z=0.4},
|
visual_size = {x=0.5, y=0.5, z=0.5},
|
||||||
--static_save = false,
|
collisionbox = {
|
||||||
|
-0.375, -0.375, -0.375,
|
||||||
|
0.375, 0.375, 0.375
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
_item_name = '',
|
_item_name = '',
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ local getInstance = Class.getInstance
|
|||||||
---@field name string
|
---@field name string
|
||||||
---@field type CraftSystem.ImmersiveCraftStage.Type
|
---@field type CraftSystem.ImmersiveCraftStage.Type
|
||||||
---@field craftName string
|
---@field craftName string
|
||||||
---@field startHandler fun(self, pos:Position, Player:Player)
|
---@field startHandler fun(self, pos:Position, player:Player)
|
||||||
---@field processHandler fun(self, pos:Position, Player:Player)
|
---@field processHandler fun(self, pos:Position, player:Player)
|
||||||
---@field endHandler fun(self, pos:Position, Player:Player)
|
---@field endHandler fun(self, pos:Position, player:Player)
|
||||||
---@field abortHandler fun(self, pos:Position, Player:Player)
|
---@field abortHandler fun(self, pos:Position)
|
||||||
---@field toString fun(self):string
|
---@field toString fun(self):string
|
||||||
---@field nextStage string?
|
---@field nextStage string?
|
||||||
---@field returnItems ItemStackString[]?
|
---@field returnItems ItemStackString[]?
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ local ImmersiveCraftStage = require('CraftSystem.ImmersiveCraftStage')
|
|||||||
---@class CraftSystem.ImmersiveCraftStage.TappingStage : CraftSystem.ImmersiveCraftStage
|
---@class CraftSystem.ImmersiveCraftStage.TappingStage : CraftSystem.ImmersiveCraftStage
|
||||||
---@field targetItem string
|
---@field targetItem string
|
||||||
---@field clicksNeed string
|
---@field clicksNeed string
|
||||||
|
---@field toolGroup string?
|
||||||
---@field startHandler fun(self:CraftSystem.ImmersiveCraftStage.TappingStage, pos:MapPosition, Player:Player)
|
---@field startHandler fun(self:CraftSystem.ImmersiveCraftStage.TappingStage, pos:MapPosition, Player:Player)
|
||||||
---@field processHandler 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 endHandler fun(self:CraftSystem.ImmersiveCraftStage.TappingStage, pos:MapPosition, Player:Player)
|
||||||
@@ -23,6 +24,7 @@ local TappingStage = extend(ImmersiveCraftStage, {})
|
|||||||
---@class CraftSystem.ImmersiveCraftStage.TappingStageDef : CraftSystem.ImmersiveCraftStageDef
|
---@class CraftSystem.ImmersiveCraftStage.TappingStageDef : CraftSystem.ImmersiveCraftStageDef
|
||||||
---@field targetItem string
|
---@field targetItem string
|
||||||
---@field clicksNeed string
|
---@field clicksNeed string
|
||||||
|
---@field toolGroup string?
|
||||||
|
|
||||||
---Data table for transferring various time parameters between calls.
|
---Data table for transferring various time parameters between calls.
|
||||||
---
|
---
|
||||||
@@ -39,11 +41,12 @@ function TappingStage:new(def)
|
|||||||
local instance = ImmersiveCraftStage:new(def)
|
local instance = ImmersiveCraftStage:new(def)
|
||||||
instance.targetItem = def.targetItem
|
instance.targetItem = def.targetItem
|
||||||
instance.clicksNeed = def.clicksNeed
|
instance.clicksNeed = def.clicksNeed
|
||||||
|
instance.toolGroup = def.toolGroup
|
||||||
|
|
||||||
-- Registering the crafting stage start handler.
|
-- Registering the crafting stage start handler.
|
||||||
instance.startHandler = function(tappingStage , pos, Player)
|
instance.startHandler = function(tappingStage , pos, player)
|
||||||
-- We determine the coordinate where we will create the crafting node (entity).
|
-- We determine the coordinate where we will create the crafting node (entity).
|
||||||
local entityPos = vector.new(pos) + vector.new(0,0.8,0)
|
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.
|
-- We create a table of initial parameters that we will pass to the entity.
|
||||||
---@class CraftSystem.ImmersiveCraftStage.TappingNode.InitParams
|
---@class CraftSystem.ImmersiveCraftStage.TappingNode.InitParams
|
||||||
@@ -75,7 +78,7 @@ function TappingStage:new(def)
|
|||||||
|
|
||||||
-- Registering the crafting stage process handler.
|
-- Registering the crafting stage process handler.
|
||||||
-- Called when a player clicks on a crafting node (entity).
|
-- Called when a player clicks on a crafting node (entity).
|
||||||
instance.processHandler = function(tappingStage, pos, Player)
|
instance.processHandler = function(tappingStage, pos, player)
|
||||||
-- Obtaining stage time data from work station metadata.
|
-- Obtaining stage time data from work station metadata.
|
||||||
---@type ImmersiveStageData.TappingStageData?
|
---@type ImmersiveStageData.TappingStageData?
|
||||||
local stageData = getStageDataByPos(pos)
|
local stageData = getStageDataByPos(pos)
|
||||||
@@ -88,7 +91,7 @@ function TappingStage:new(def)
|
|||||||
-- If the number of clicks is greater than required to complete the step...
|
-- If the number of clicks is greater than required to complete the step...
|
||||||
if clickCount >= tappingStage.clicksNeed then
|
if clickCount >= tappingStage.clicksNeed then
|
||||||
-- ...we are completing the stage.
|
-- ...we are completing the stage.
|
||||||
tappingStage:endHandler(pos, Player)
|
tappingStage:endHandler(pos, player)
|
||||||
else
|
else
|
||||||
-- ...else we save the number of clicks in the temporary data table.
|
-- ...else we save the number of clicks in the temporary data table.
|
||||||
stageData.clickCount = clickCount
|
stageData.clickCount = clickCount
|
||||||
@@ -97,7 +100,7 @@ function TappingStage:new(def)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Registering the crafting stage end handler.
|
-- Registering the crafting stage end handler.
|
||||||
instance.endHandler = function(tappingStage, pos, Player)
|
instance.endHandler = function(tappingStage, pos, player)
|
||||||
-- Obtaining stage time data from work station metadata.
|
-- Obtaining stage time data from work station metadata.
|
||||||
---@type ImmersiveStageData.TappingStageData?
|
---@type ImmersiveStageData.TappingStageData?
|
||||||
local stageData = getStageDataByPos(pos)
|
local stageData = getStageDataByPos(pos)
|
||||||
@@ -111,12 +114,12 @@ function TappingStage:new(def)
|
|||||||
entity:remove()
|
entity:remove()
|
||||||
|
|
||||||
-- We trigger an event that the crafting stage has been completed.
|
-- We trigger an event that the crafting stage has been completed.
|
||||||
Events.call('craft_system:next_immersive_stage:'..tappingStage.craftName, tappingStage, pos, Player)
|
Events.call('craft_system:next_immersive_stage:'..tappingStage.craftName, tappingStage, pos, player)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Registering the aborting the crafting process handler.
|
-- Registering the aborting the crafting process handler.
|
||||||
---@param tappingStage CraftSystem.ImmersiveCraftStage.TappingStage
|
---@param tappingStage CraftSystem.ImmersiveCraftStage.TappingStage
|
||||||
instance.abortHandler = function(tappingStage, pos, Player)
|
instance.abortHandler = function(tappingStage, pos)
|
||||||
-- We receive current data on crafting.
|
-- We receive current data on crafting.
|
||||||
---@type ImmersiveCraftData?
|
---@type ImmersiveCraftData?
|
||||||
local craftData = Smc.getCraftDataByPos(pos)
|
local craftData = Smc.getCraftDataByPos(pos)
|
||||||
@@ -143,7 +146,12 @@ function TappingStage:new(def)
|
|||||||
|
|
||||||
-- Returns a human-readable description of the crafting stage.
|
-- Returns a human-readable description of the crafting stage.
|
||||||
instance.toString = function(tappingStage)
|
instance.toString = function(tappingStage)
|
||||||
local stageDesc = ('Tapping x%s'):format(tappingStage.clicksNeed)
|
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
|
return stageDesc
|
||||||
end
|
end
|
||||||
@@ -151,7 +159,17 @@ function TappingStage:new(def)
|
|||||||
-- Subscribe to an event that means the player hit the entity.
|
-- 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),
|
Events.subscribe(('craft_system:punch_tapping_node:%s:%s'):format(instance.craftName, instance.name),
|
||||||
---@param craftNode LuaEntity
|
---@param craftNode LuaEntity
|
||||||
function(eventName, pos, Player, craftNode)
|
---@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:
|
-- DRAFT START:
|
||||||
-- Creating particles
|
-- Creating particles
|
||||||
for i=0, 10 do
|
for i=0, 10 do
|
||||||
@@ -172,7 +190,7 @@ function TappingStage:new(def)
|
|||||||
-- DRAFT END
|
-- DRAFT END
|
||||||
|
|
||||||
-- Calling the crafting stage process handler.
|
-- Calling the crafting stage process handler.
|
||||||
instance:processHandler(pos, Player)
|
instance:processHandler(pos, player)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
return instance
|
return instance
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ local require = modInfo.require
|
|||||||
local BaseCraft = require('CraftSystem.BaseCraft')
|
local BaseCraft = require('CraftSystem.BaseCraft')
|
||||||
|
|
||||||
---@class CraftSystem.PrimitiveCraft : CraftSystem.BaseCraft
|
---@class CraftSystem.PrimitiveCraft : CraftSystem.BaseCraft
|
||||||
---@field output string
|
---@field output ItemStackString
|
||||||
---@field recipe CraftSystem.CraftRecipe
|
---@field recipe CraftSystem.CraftRecipe
|
||||||
---@field returnItems ItemStackString[]
|
---@field returnItems ItemStackString[]
|
||||||
local PrimitiveCraft = extend(BaseCraft, {})
|
local PrimitiveCraft = extend(BaseCraft, {})
|
||||||
@@ -16,9 +16,9 @@ local PrimitiveCraft = extend(BaseCraft, {})
|
|||||||
---
|
---
|
||||||
---**Only for EmmyLua.**
|
---**Only for EmmyLua.**
|
||||||
---@class CraftSystem.PrimitiveCraftDef : CraftSystem.BaseCraftDef
|
---@class CraftSystem.PrimitiveCraftDef : CraftSystem.BaseCraftDef
|
||||||
---@field output string
|
---@field output ItemStackString
|
||||||
---@field recipe CraftSystem.CraftRecipe
|
---@field recipe CraftSystem.CraftRecipe
|
||||||
---@field returnItems ItemStackString[]
|
---@field returnItems ItemStackString[]?
|
||||||
|
|
||||||
---@param name string
|
---@param name string
|
||||||
---@param def CraftSystem.PrimitiveCraftDef
|
---@param def CraftSystem.PrimitiveCraftDef
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
local extend = Class.extend
|
local extend = Class.extend
|
||||||
|
|
||||||
local tableInsert = table.insert
|
local tableInsert, tableSort, tableJoin = table.insert, table.sort, table.join
|
||||||
|
|
||||||
local modInfo = Mod.getInfo('smc__core__craft_system')
|
local modInfo = Mod.getInfo('smc__core__craft_system')
|
||||||
local require = modInfo.require
|
local require = modInfo.require
|
||||||
@@ -14,9 +14,11 @@ local PrimitiveCraft = require('CraftSystem.PrimitiveCraft')
|
|||||||
---A primitive crafting processor that doesn't require much interaction and provides
|
---A primitive crafting processor that doesn't require much interaction and provides
|
||||||
---simple crafting based on a recipe-result scheme.
|
---simple crafting based on a recipe-result scheme.
|
||||||
---@class CraftSystem.PrimitiveCraftHandler : CraftSystem.BaseCraftHandler
|
---@class CraftSystem.PrimitiveCraftHandler : CraftSystem.BaseCraftHandler
|
||||||
|
---@field craftsByGroup table<CraftSystem.CraftGroup, CraftSystem.PrimitiveCraft[]>
|
||||||
|
---@field groupedCrafts (CraftSystem.PrimitiveCraft[]|CraftSystem.PrimitiveCraft)[]
|
||||||
---@field getCraftByName fun(self, craftName:string):CraftSystem.PrimitiveCraft
|
---@field getCraftByName fun(self, craftName:string):CraftSystem.PrimitiveCraft
|
||||||
---@field getCraftsByGroup fun(self, craftGroup):CraftSystem.PrimitiveCraft[]
|
---@field getCraftsByGroup fun(self, craftGroup:string):CraftSystem.PrimitiveCraft[]
|
||||||
---@field getLearnedCrafts fun(self, playerName):table<string, CraftSystem.PrimitiveCraft>
|
---@field getLearnedCrafts fun(self, playerName:string):(CraftSystem.PrimitiveCraft[]|CraftSystem.PrimitiveCraft)[]
|
||||||
local PrimitiveCraftHandler = extend(BaseCraftHandler, {})
|
local PrimitiveCraftHandler = extend(BaseCraftHandler, {})
|
||||||
|
|
||||||
---Register a primitive craft that does not require special interaction.
|
---Register a primitive craft that does not require special interaction.
|
||||||
@@ -26,9 +28,10 @@ function PrimitiveCraftHandler:registerCraft(craftName, def)
|
|||||||
assert(self.craftsByName[craftName] == nil, ('A craft named `%s` already exists.'):format(
|
assert(self.craftsByName[craftName] == nil, ('A craft named `%s` already exists.'):format(
|
||||||
craftName))
|
craftName))
|
||||||
|
|
||||||
local craft = PrimitiveCraft:new(craftName, def)
|
local group = 'craft_group:' .. (def.group or 'UNDEFINED')
|
||||||
|
def.group = group
|
||||||
|
|
||||||
local group = def.group
|
local craft = PrimitiveCraft:new(craftName, def)
|
||||||
|
|
||||||
if self.craftsByGroup[group] == nil then
|
if self.craftsByGroup[group] == nil then
|
||||||
self.craftsByGroup[group] = {}
|
self.craftsByGroup[group] = {}
|
||||||
@@ -39,4 +42,29 @@ function PrimitiveCraftHandler:registerCraft(craftName, def)
|
|||||||
tableInsert(self.craftsList, craft)
|
tableInsert(self.craftsList, craft)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
core.register_on_mods_loaded(function()
|
||||||
|
for groupName, crafts in pairs(PrimitiveCraftHandler.craftsByGroup) do
|
||||||
|
tableSort(crafts, function(a, b)
|
||||||
|
if a.output < b.output then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
if groupName ~= 'craft_group:UNDEFINED' then
|
||||||
|
tableInsert(PrimitiveCraftHandler.groupedCrafts, crafts)
|
||||||
|
else
|
||||||
|
PrimitiveCraftHandler.groupedCrafts = tableJoin(PrimitiveCraftHandler.groupedCrafts, crafts)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
tableSort(PrimitiveCraftHandler.groupedCrafts, function(a, b)
|
||||||
|
local outputA = (a[1] and a[1].output) or a.output
|
||||||
|
local outputB = (b[1] and b[1].output) or b.output
|
||||||
|
|
||||||
|
if outputA < outputB then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
return PrimitiveCraftHandler
|
return PrimitiveCraftHandler
|
||||||
|
|||||||
@@ -197,12 +197,30 @@ end
|
|||||||
---@return Formspec
|
---@return Formspec
|
||||||
function Formspec:list(inventoryLocation, listName, x, y, w, h, startingItemIndex)
|
function Formspec:list(inventoryLocation, listName, x, y, w, h, startingItemIndex)
|
||||||
local element = ('list[%s;%s;%s,%s;%s,%s;%s]'):format(
|
local element = ('list[%s;%s;%s,%s;%s,%s;%s]'):format(
|
||||||
inventoryLocation, listName, x, y, w, h,startingItemIndex or '')
|
inventoryLocation, listName, x, y, w, h, startingItemIndex or '')
|
||||||
|
|
||||||
self:addElement(element)
|
self:addElement(element)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---A wrapper around `Formspec:list` that allows access to the inventory of a node,
|
||||||
|
---specified by the coordinates of its position in the world.
|
||||||
|
---@param nodePos MapPosition
|
||||||
|
---@param listName string
|
||||||
|
---@param x number
|
||||||
|
---@param y number
|
||||||
|
---@param w number Are in inventory slots, not in coordinates.
|
||||||
|
---@param h number Are in inventory slots, not in coordinates.
|
||||||
|
---@param startingItemIndex number? The index of the first (upper-left) item to draw. Indices start at `0`. Default is `0`.
|
||||||
|
---@return Formspec
|
||||||
|
function Formspec:listNodeMetaLocation(nodePos, listName, x, y, w, h, startingItemIndex)
|
||||||
|
local inventoryLocation = ('nodemeta:%s,%s,%s'):format(nodePos.x, nodePos.y, nodePos.z)
|
||||||
|
|
||||||
|
self:list(inventoryLocation, listName, x, y, w, h, startingItemIndex)
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
---Creates and appends a list of `listring[<inventory location>;<list name>]` items based on the passed inventory list.
|
---Creates and appends a list of `listring[<inventory location>;<list name>]` items based on the passed inventory list.
|
||||||
---
|
---
|
||||||
---**Elements:** `listring[<inventory location>;<list name>]` or `listring[]`
|
---**Elements:** `listring[<inventory location>;<list name>]` or `listring[]`
|
||||||
@@ -296,7 +314,7 @@ end
|
|||||||
---@param w number
|
---@param w number
|
||||||
---@param h number
|
---@param h number
|
||||||
---@param textureName string
|
---@param textureName string
|
||||||
---@param middle boolean? Makes the image render in 9-sliced mode and defines the middle rect.
|
---@param middle string? Makes the image render in 9-sliced mode and defines the middle rect.
|
||||||
---@return Formspec
|
---@return Formspec
|
||||||
function Formspec:image(x, y, w, h, textureName, middle)
|
function Formspec:image(x, y, w, h, textureName, middle)
|
||||||
local element = ('image[%s,%s;%s,%s;%s;%s]'):format(
|
local element = ('image[%s,%s;%s,%s;%s;%s]'):format(
|
||||||
@@ -441,7 +459,7 @@ end
|
|||||||
--- * All numbers in middle are integers.
|
--- * All numbers in middle are integers.
|
||||||
---@return Formspec
|
---@return Formspec
|
||||||
function Formspec:background9(x, y, w, h, textureName, autoClip, middle)
|
function Formspec:background9(x, y, w, h, textureName, autoClip, middle)
|
||||||
local element = ('background9[%s,%s;%s,%s;%s;%s]'):format(
|
local element = ('background9[%s,%s;%s,%s;%s;%s;%s]'):format(
|
||||||
x, y, w, h, textureName, autoClip, middle)
|
x, y, w, h, textureName, autoClip, middle)
|
||||||
|
|
||||||
self:addElement(element)
|
self:addElement(element)
|
||||||
@@ -700,7 +718,7 @@ end
|
|||||||
---
|
---
|
||||||
---**Elements:** `image_button[<X>,<Y>;<W>,<H>;<texture name>;<name>;<label>]` or
|
---**Elements:** `image_button[<X>,<Y>;<W>,<H>;<texture name>;<name>;<label>]` or
|
||||||
---`image_button[<X>,<Y>;<W>,<H>;<texture name>;<name>;<label>;<noclip>;<drawborder>;<pressed texture name>]`
|
---`image_button[<X>,<Y>;<W>,<H>;<texture name>;<name>;<label>;<noclip>;<drawborder>;<pressed texture name>]`
|
||||||
---@overload fun(x:number, y:number, w:number, h:number, textureName:string, name:string, label:string)
|
---@overload fun(x:number, y:number, w:number, h:number, textureName:string, name:string, label:string?):Formspec
|
||||||
---@param x number
|
---@param x number
|
||||||
---@param y number
|
---@param y number
|
||||||
---@param w number
|
---@param w number
|
||||||
@@ -708,7 +726,7 @@ end
|
|||||||
---@param textureName string Is the filename of an image.
|
---@param textureName string Is the filename of an image.
|
||||||
---@param name string
|
---@param name string
|
||||||
---@param label string?
|
---@param label string?
|
||||||
---@param pressedTextureName string Is the filename of an image on pressed state.
|
---@param pressedTextureName string? Is the filename of an image on pressed state.
|
||||||
---@param noclip boolean? Means the image button doesn't need to be within specified formsize. Default: `true`
|
---@param noclip boolean? Means the image button doesn't need to be within specified formsize. Default: `true`
|
||||||
---@param drawborder boolean? Draw button border or not. Default `false`
|
---@param drawborder boolean? Draw button border or not. Default `false`
|
||||||
---@return Formspec
|
---@return Formspec
|
||||||
@@ -720,7 +738,7 @@ function Formspec:imageButton(x, y, w, h, textureName, name, label, pressedTextu
|
|||||||
x, y, w, h, textureName, name, label or '')
|
x, y, w, h, textureName, name, label or '')
|
||||||
else
|
else
|
||||||
element = ('image_button[%s,%s;%s,%s;%s;%s;%s;%s;%s;%s]'):format(
|
element = ('image_button[%s,%s;%s,%s;%s;%s;%s;%s;%s;%s]'):format(
|
||||||
x, y, w, h, textureName, name, label or '', pressedTextureName, noclip or true, drawborder or false)
|
x, y, w, h, textureName, name, label or '', noclip or true, drawborder or false, pressedTextureName)
|
||||||
end
|
end
|
||||||
|
|
||||||
self:addElement(element)
|
self:addElement(element)
|
||||||
|
|||||||
@@ -2,10 +2,15 @@ local getInstance, extend = Class.getInstance, Class.extend
|
|||||||
|
|
||||||
local tableCopy, tableMerge, colorize = table.copy, table.merge, core.colorize
|
local tableCopy, tableMerge, colorize = table.copy, table.merge, core.colorize
|
||||||
|
|
||||||
local modInfo = Mod.getInfo('smc__core__item')
|
local ItemFactory = Smc.requireItemFactory()
|
||||||
local require = modInfo.require
|
|
||||||
|
|
||||||
local ItemFactory = Mod.getInfo('smc__core__item_factory').require('ItemFactory')
|
---Colors the title according to the rarity of the item.
|
||||||
|
---
|
||||||
|
---Note: that if `true`, the `_title_color` will be ignored.
|
||||||
|
local TITLE_RARITY_COLOR = true
|
||||||
|
|
||||||
|
---Shows rarity on a separate line.
|
||||||
|
local SHOW_RARITY = false
|
||||||
|
|
||||||
---Determines whether common rarity will be shown in item descriptions or not.
|
---Determines whether common rarity will be shown in item descriptions or not.
|
||||||
local SHOW_COMMON_RARITY = true
|
local SHOW_COMMON_RARITY = true
|
||||||
@@ -37,7 +42,7 @@ local RARITY_INDEX = {
|
|||||||
---@class Item
|
---@class Item
|
||||||
---@field itemDef Item.ItemDefinition
|
---@field itemDef Item.ItemDefinition
|
||||||
---@field luantiDef ItemDefinition
|
---@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 = {
|
||||||
@@ -46,9 +51,10 @@ local Item = {
|
|||||||
_title = '',
|
_title = '',
|
||||||
_description = '',
|
_description = '',
|
||||||
_title_color = '#FFFFFF',
|
_title_color = '#FFFFFF',
|
||||||
_description_color = '#C0C0C0',
|
_description_color = '#838383',
|
||||||
_rarity = 'common',
|
_rarity = 'common',
|
||||||
_add_mod_name = true,
|
_add_mod_name = true,
|
||||||
|
stack_max = 128,
|
||||||
},
|
},
|
||||||
callbacks = {}
|
callbacks = {}
|
||||||
}
|
}
|
||||||
@@ -59,6 +65,10 @@ local Item = {
|
|||||||
---@param desc string
|
---@param desc string
|
||||||
---@return string
|
---@return string
|
||||||
local function addRarityToDesc(rarity, desc)
|
local function addRarityToDesc(rarity, desc)
|
||||||
|
if not SHOW_RARITY then
|
||||||
|
return desc
|
||||||
|
end
|
||||||
|
|
||||||
if not SHOW_COMMON_RARITY and rarity == 'common' then
|
if not SHOW_COMMON_RARITY and rarity == 'common' then
|
||||||
return desc
|
return desc
|
||||||
end
|
end
|
||||||
@@ -87,12 +97,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 = tableCopy(itemDef)
|
|
||||||
local s = itemDef.settings
|
local s = itemDef.settings
|
||||||
local c = itemDef.callbacks
|
local c = itemDef.callbacks
|
||||||
|
|
||||||
local title = s._title
|
local title, description = s._title, s._description
|
||||||
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'
|
||||||
@@ -102,28 +110,32 @@ local function itemDefToLuantiDef(itemDef)
|
|||||||
description = string.match(s.name, '%S:(%S+)')..'-desc'
|
description = string.match(s.name, '%S:(%S+)')..'-desc'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
assert(s._rarity ~= nil, 'The rarity of an item cannot be empty.')
|
||||||
|
|
||||||
if s._title_color ~= nil and s._description_color ~= nil then
|
if s._title_color ~= nil and s._description_color ~= nil then
|
||||||
title = colorize(s._title_color ,S(title))
|
if TITLE_RARITY_COLOR then
|
||||||
|
title = colorize(RARITY_COLORS[s._rarity], S(title))
|
||||||
|
else
|
||||||
|
title = colorize(s._title_color, S(title))
|
||||||
|
end
|
||||||
description = colorize(s._description_color, 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
|
||||||
|
|
||||||
assert(s._rarity ~= nil, 'The rarity of an item cannot be empty.')
|
local luantiDescription = addRarityToDesc(s._rarity, title..'\n '..description)
|
||||||
|
|
||||||
local luantiDescription = addRarityToDesc(s._rarity, title..'\n'..description)
|
|
||||||
|
|
||||||
s._title = title
|
s._title = title
|
||||||
s._description = description
|
s._description = description
|
||||||
s.description = luantiDescription..core.get_background_escape_sequence('#110F13')
|
s.description = luantiDescription..core.get_background_escape_sequence('#110F13')
|
||||||
|
|
||||||
local luantiDef = defMerge(s, c)
|
local luantiDef = defMerge(s, c, true)
|
||||||
|
|
||||||
return luantiDef
|
return luantiDef
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param luantiDef NodeDefinition
|
---@param luantiDef NodeDefinition
|
||||||
local function register3dItem(luantiDef)
|
local function registerNode(luantiDef)
|
||||||
local name = luantiDef.name
|
local name = luantiDef.name
|
||||||
luantiDef.name = nil
|
luantiDef.name = nil
|
||||||
|
|
||||||
@@ -131,13 +143,21 @@ local function register3dItem(luantiDef)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---@param luantiDef ItemDefinition
|
---@param luantiDef ItemDefinition
|
||||||
local function registerFlatItem(luantiDef)
|
local function registerCraftitem(luantiDef)
|
||||||
local name = luantiDef.name
|
local name = luantiDef.name
|
||||||
luantiDef.name = nil
|
luantiDef.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(...)
|
||||||
@@ -152,40 +172,48 @@ function Item:new(itemDef)
|
|||||||
'Please note that the `description` field should not be used when registering an item. '..
|
'Please note that the `description` field should not be used when registering an item. '..
|
||||||
'Use `_title` and `_description` instead.')
|
'Use `_title` and `_description` instead.')
|
||||||
|
|
||||||
|
itemDef = tableCopy(itemDef)
|
||||||
|
|
||||||
-- Adding default parameters
|
-- Adding default parameters
|
||||||
itemDef = defMerge(itemDef, self.defaultDef, true)
|
itemDef = defMerge(itemDef, self.defaultDef, true)
|
||||||
local s = itemDef.settings
|
local s = itemDef.settings
|
||||||
|
|
||||||
|
local shortModName = Mod.getInfo().shortName
|
||||||
|
|
||||||
if s._add_mod_name then
|
if s._add_mod_name then
|
||||||
s.name = Mod.getInfo().shortName .. ':' .. s.name
|
s.name = shortModName .. ':' .. s.name
|
||||||
end
|
end
|
||||||
|
|
||||||
---@type Item
|
---@type Item
|
||||||
local instance = getInstance(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
|
||||||
|
|
||||||
@@ -195,7 +223,7 @@ 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)
|
defaultDef = defMerge(defaultDef, self.defaultDef, true)
|
||||||
|
|
||||||
---@type Item
|
---@type Item
|
||||||
local ChildClass = extend(self, {
|
local ChildClass = extend(self, {
|
||||||
@@ -212,7 +240,7 @@ function Item:getFactory(defaultDef)
|
|||||||
if defaultDef == nil then
|
if defaultDef == nil then
|
||||||
defaultDef = self.defaultDef
|
defaultDef = self.defaultDef
|
||||||
else
|
else
|
||||||
defaultDef = defMerge(self.defaultDef, defaultDef)
|
defaultDef = defMerge(self.defaultDef, defaultDef, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
---@type ItemFactory
|
---@type ItemFactory
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ Settings._title_color = nil
|
|||||||
Settings._description_color = nil
|
Settings._description_color = nil
|
||||||
|
|
||||||
---Visual node type.
|
---Visual node type.
|
||||||
---@type Item.Visual?
|
---@type Item.Type?
|
||||||
Settings._visual = nil
|
Settings._type = nil
|
||||||
|
|
||||||
---Formal (lore) rarity of an item. Default `common`.
|
---Formal (lore) rarity of an item. Default `common`.
|
||||||
---@type Item.Rarity?
|
---@type Item.Rarity?
|
||||||
|
|||||||
1
mods/CORE/Item/src/Item/Type.lua
Normal file
@@ -0,0 +1 @@
|
|||||||
|
---@alias Item.Type 'craftitem'|'node'|'tool'
|
||||||
@@ -1 +0,0 @@
|
|||||||
---@alias Item.Visual 'item_2d'|'item_3d'
|
|
||||||
@@ -18,9 +18,10 @@ local getInstance = Class.getInstance
|
|||||||
---@field generateTurf generateFunc
|
---@field generateTurf generateFunc
|
||||||
---@field generateSoil generateFunc
|
---@field generateSoil generateFunc
|
||||||
---@field generateBottom generateFunc
|
---@field generateBottom generateFunc
|
||||||
|
---@field postProcessing fun(self, mapGenerator:MapGen, factors:MapGen.factors, data:number[], index:number, x:number, y:number, z:number, nodeType:MapGen.nodeType, area:VoxelArea)?
|
||||||
local Biome = {}
|
local Biome = {}
|
||||||
|
|
||||||
---@alias generateFunc fun(self, mapGenerator:MapGen, data:number[], index:number, x:number, y:number, z:number)
|
---@alias generateFunc fun(self, mapGenerator:MapGen, factors:MapGen.factors, data:number[], index:number, x:number, y:number, z:number)
|
||||||
|
|
||||||
---Definition table for the `MapGen.Biome`.
|
---Definition table for the `MapGen.Biome`.
|
||||||
---
|
---
|
||||||
@@ -39,84 +40,91 @@ local Biome = {}
|
|||||||
---@field generateTurf generateFunc?
|
---@field generateTurf generateFunc?
|
||||||
---@field generateSoil generateFunc?
|
---@field generateSoil generateFunc?
|
||||||
---@field generateBottom generateFunc?
|
---@field generateBottom generateFunc?
|
||||||
|
---@field postProcessing fun(self, mapGenerator:MapGen, factors:MapGen.factors, data:number[], index:number, x:number, y:number, z:number, nodeType:MapGen.nodeType, area:VoxelArea)?
|
||||||
|
|
||||||
-- Default generate functions
|
-- Default generate functions
|
||||||
|
|
||||||
---@param self MapGen.Biome
|
---@param self MapGen.Biome
|
||||||
---@param mapGenerator MapGen
|
---@param mapGenerator MapGen
|
||||||
|
---@param factors MapGen.factors
|
||||||
---@param data number[]
|
---@param data number[]
|
||||||
---@param index number
|
---@param index number
|
||||||
---@param x number
|
---@param x number
|
||||||
---@param y number
|
---@param y number
|
||||||
---@param z number
|
---@param z number
|
||||||
local defaultGenerateAir = function(self, mapGenerator, data, index, x, y, z)
|
local defaultGenerateAir = function(self, mapGenerator, factors, data, index, x, y, z)
|
||||||
data[index] = mapGenerator.nodeIDs.air
|
data[index] = mapGenerator.nodeIDs.air
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param self MapGen.Biome
|
---@param self MapGen.Biome
|
||||||
---@param mapGenerator MapGen
|
---@param mapGenerator MapGen
|
||||||
|
---@param factors MapGen.factors
|
||||||
---@param data number[]
|
---@param data number[]
|
||||||
---@param index number
|
---@param index number
|
||||||
---@param x number
|
---@param x number
|
||||||
---@param y number
|
---@param y number
|
||||||
---@param z number
|
---@param z number
|
||||||
local defaultGenerateCavernAir = function(self, mapGenerator, data, index, x, y, z)
|
local defaultGenerateCavernAir = function(self, mapGenerator, factors, data, index, x, y, z)
|
||||||
self:generateAir(mapGenerator, data, index, x, y, z)
|
self:generateAir(mapGenerator, factors, data, index, x, y, z)
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param self MapGen.Biome
|
---@param self MapGen.Biome
|
||||||
---@param mapGenerator MapGen
|
---@param mapGenerator MapGen
|
||||||
|
---@param factors MapGen.factors
|
||||||
---@param data number[]
|
---@param data number[]
|
||||||
---@param index number
|
---@param index number
|
||||||
---@param x number
|
---@param x number
|
||||||
---@param y number
|
---@param y number
|
||||||
---@param z number
|
---@param z number
|
||||||
local defaultGenerateWater = function(self, mapGenerator, data, index, x, y, z)
|
local defaultGenerateWater = function(self, mapGenerator, factors, data, index, x, y, z)
|
||||||
data[index] = mapGenerator.nodeIDs.water
|
data[index] = mapGenerator.nodeIDs.water
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param self MapGen.Biome
|
---@param self MapGen.Biome
|
||||||
---@param mapGenerator MapGen
|
---@param mapGenerator MapGen
|
||||||
|
---@param factors MapGen.factors
|
||||||
---@param data number[]
|
---@param data number[]
|
||||||
---@param index number
|
---@param index number
|
||||||
---@param x number
|
---@param x number
|
||||||
---@param y number
|
---@param y number
|
||||||
---@param z number
|
---@param z number
|
||||||
local defaultGenerateRock = function(self, mapGenerator, data, index, x, y, z)
|
local defaultGenerateRock = function(self, mapGenerator, factors, data, index, x, y, z)
|
||||||
data[index] = self.groundNodesIDs.rock
|
data[index] = self.groundNodesIDs.rock
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param self MapGen.Biome
|
---@param self MapGen.Biome
|
||||||
---@param mapGenerator MapGen
|
---@param mapGenerator MapGen
|
||||||
|
---@param factors MapGen.factors
|
||||||
---@param data number[]
|
---@param data number[]
|
||||||
---@param index number
|
---@param index number
|
||||||
---@param x number
|
---@param x number
|
||||||
---@param y number
|
---@param y number
|
||||||
---@param z number
|
---@param z number
|
||||||
local defaultGenerateTurf = function(self, mapGenerator, data, index, x, y, z)
|
local defaultGenerateTurf = function(self, mapGenerator, factors, data, index, x, y, z)
|
||||||
data[index] = self.groundNodesIDs.turf
|
data[index] = self.groundNodesIDs.turf
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param self MapGen.Biome
|
---@param self MapGen.Biome
|
||||||
---@param mapGenerator MapGen
|
---@param mapGenerator MapGen
|
||||||
|
---@param factors MapGen.factors
|
||||||
---@param data number[]
|
---@param data number[]
|
||||||
---@param index number
|
---@param index number
|
||||||
---@param x number
|
---@param x number
|
||||||
---@param y number
|
---@param y number
|
||||||
---@param z number
|
---@param z number
|
||||||
local defaultGenerateSoil = function(self, mapGenerator,data, index, x, y, z)
|
local defaultGenerateSoil = function(self, mapGenerator, factors, data, index, x, y, z)
|
||||||
data[index] = self.groundNodesIDs.soil
|
data[index] = self.groundNodesIDs.soil
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param self MapGen.Biome
|
---@param self MapGen.Biome
|
||||||
---@param mapGenerator MapGen
|
---@param mapGenerator MapGen
|
||||||
|
---@param factors MapGen.factors
|
||||||
---@param data number[]
|
---@param data number[]
|
||||||
---@param index number
|
---@param index number
|
||||||
---@param x number
|
---@param x number
|
||||||
---@param y number
|
---@param y number
|
||||||
---@param z number
|
---@param z number
|
||||||
local defaultGenerateBottom = function(self, mapGenerator, data, index, x, y, z)
|
local defaultGenerateBottom = function(self, mapGenerator, factors, data, index, x, y, z)
|
||||||
data[index] = self.groundNodesIDs.bottom
|
data[index] = self.groundNodesIDs.bottom
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -167,23 +175,23 @@ function Biome:new(name, def)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---@type MapGen.Biome
|
---@type MapGen.Biome
|
||||||
local instance = getInstance(self, {
|
local instance = getInstance(self, {})
|
||||||
name = name,
|
instance.name = name
|
||||||
tempPoint = def.tempPoint,
|
instance.tempPoint = def.tempPoint
|
||||||
humidityPoint = def.humidityPoint,
|
instance.humidityPoint = def.humidityPoint
|
||||||
minY = def.minY,
|
instance.minY = def.minY
|
||||||
maxY = def.maxY,
|
instance.maxY = def.maxY
|
||||||
groundNodes = def.groundNodes,
|
instance.groundNodes = def.groundNodes
|
||||||
groundNodesIDs = groundNodesIDs,
|
instance.groundNodesIDs = groundNodesIDs
|
||||||
soilHeight = def.soilHeight,
|
instance.soilHeight = def.soilHeight
|
||||||
generateAir = def.generateAir,
|
instance.generateAir = def.generateAir
|
||||||
generateCavernAir = def.generateCavernAir,
|
instance.generateCavernAir = def.generateCavernAir
|
||||||
generateWater = def.generateWater,
|
instance.generateWater = def.generateWater
|
||||||
generateRock = def.generateRock,
|
instance.generateRock = def.generateRock
|
||||||
generateSoil = def.generateSoil,
|
instance.generateSoil = def.generateSoil
|
||||||
generateTurf = def.generateTurf,
|
instance.generateTurf = def.generateTurf
|
||||||
generateBottom = def.generateBottom,
|
instance.generateBottom = def.generateBottom
|
||||||
})
|
instance.postProcessing = def.postProcessing
|
||||||
|
|
||||||
return instance
|
return instance
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,18 +1,20 @@
|
|||||||
local getInstance = Class.getInstance
|
local getInstance = Class.getInstance
|
||||||
|
|
||||||
---@class MapGen.Triangulation.Edge
|
---@class MapGen.Edge
|
||||||
---@field p1 MapGen.Peak
|
---@field p1 MapGen.Peak
|
||||||
---@field p2 MapGen.Peak
|
---@field p2 MapGen.Peak
|
||||||
|
---@field vec vector
|
||||||
local Edge = {}
|
local Edge = {}
|
||||||
|
|
||||||
---@param p1 MapGen.Peak
|
---@param p1 MapGen.Peak
|
||||||
---@param p2 MapGen.Peak
|
---@param p2 MapGen.Peak
|
||||||
---@return MapGen.Triangulation.Edge
|
---@return MapGen.Edge
|
||||||
function Edge:new( p1, p2 )
|
function Edge:new( p1, p2 )
|
||||||
---@type MapGen.Triangulation.Edge
|
---@type MapGen.Edge
|
||||||
local instance = getInstance(self, {
|
local instance = getInstance(self, {
|
||||||
p1 = p1,
|
p1 = p1,
|
||||||
p2 = p2
|
p2 = p2,
|
||||||
|
vec = p2.pos - p1.pos
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
__tostring = self.toString,
|
__tostring = self.toString,
|
||||||
@@ -29,14 +31,14 @@ function Edge:toString()
|
|||||||
end
|
end
|
||||||
|
|
||||||
---Returns true if the edges are equivalent.
|
---Returns true if the edges are equivalent.
|
||||||
---@param other MapGen.Triangulation.Edge
|
---@param other MapGen.Edge
|
||||||
---@return boolean
|
---@return boolean
|
||||||
function Edge:eq(other)
|
function Edge:eq(other)
|
||||||
return self.p1 == other.p1 and self.p2 == other.p2
|
return self.p1 == other.p1 and self.p2 == other.p2
|
||||||
end
|
end
|
||||||
|
|
||||||
---Returns true if the edges are similar.
|
---Returns true if the edges are similar.
|
||||||
---@param other MapGen.Triangulation.Edge
|
---@param other MapGen.Edge
|
||||||
---@return boolean
|
---@return boolean
|
||||||
function Edge:same(other)
|
function Edge:same(other)
|
||||||
return (self.p1 == other.p1 and self.p2 == other.p2)
|
return (self.p1 == other.p1 and self.p2 == other.p2)
|
||||||
@@ -46,14 +48,14 @@ end
|
|||||||
---Returns the length of an edge.
|
---Returns the length of an edge.
|
||||||
---@return number
|
---@return number
|
||||||
function Edge:length()
|
function Edge:length()
|
||||||
return (self.p1.getPeakPos() - self.p2.getPeakPos()):length()
|
return (self.p1.pos - self.p2.pos):length()
|
||||||
end
|
end
|
||||||
|
|
||||||
---Returns the vector of the point located in the middle of the edge.
|
---Returns the vector of the point located in the middle of the edge.
|
||||||
---@return vector
|
---@return vector
|
||||||
function Edge:getMidPoint()
|
function Edge:getMidPoint()
|
||||||
local pos1 = self.p1:getPeakPos()
|
local pos1 = self.p1.pos
|
||||||
local pos2 = self.p2:getPeakPos()
|
local pos2 = self.p2.pos
|
||||||
|
|
||||||
return (pos1 + pos2 )/2
|
return (pos1 + pos2 )/2
|
||||||
end
|
end
|
||||||
@@ -7,7 +7,7 @@ local Peak = require('MapGen.Peak')
|
|||||||
---Allows you to create a `MapGen.Peak` without specifying a noise parameter.
|
---Allows you to create a `MapGen.Peak` without specifying a noise parameter.
|
||||||
---
|
---
|
||||||
---**WARNING: MUST NOT BE PARTICIPATED IN GENERATION**
|
---**WARNING: MUST NOT BE PARTICIPATED IN GENERATION**
|
||||||
---@class MapGen.Triangulation.FakePeak : MapGen.Peak
|
---@class MapGen.FakePeak : MapGen.Peak
|
||||||
---@field id number
|
---@field id number
|
||||||
---@field getPeakPos fun():vector
|
---@field getPeakPos fun():vector
|
||||||
local FakePeak = Class.extend(Peak, {})
|
local FakePeak = Class.extend(Peak, {})
|
||||||
@@ -1,5 +1,13 @@
|
|||||||
local getInstance = Class.getInstance
|
local getInstance = Class.getInstance
|
||||||
|
|
||||||
|
local modInfo = Mod.getInfo('smc__core__map_gen')
|
||||||
|
local require = modInfo.require
|
||||||
|
|
||||||
|
---@type MapGen.Peak
|
||||||
|
local Peak = require('MapGen.Peak')
|
||||||
|
---@type MapGen.Triangle
|
||||||
|
local Triangle = require('MapGen.Triangle')
|
||||||
|
|
||||||
---@class MapGen.Layer
|
---@class MapGen.Layer
|
||||||
---@field name string
|
---@field name string
|
||||||
---@field minY integer
|
---@field minY integer
|
||||||
@@ -11,9 +19,10 @@ local getInstance = Class.getInstance
|
|||||||
---@field waterLevel integer
|
---@field waterLevel integer
|
||||||
---@field calcTemp fun(self:MapGen.Layer, value:number, height:number):number
|
---@field calcTemp fun(self:MapGen.Layer, value:number, height:number):number
|
||||||
---@field calcHumidity fun(self:MapGen.Layer, value:number, height:number):number
|
---@field calcHumidity fun(self:MapGen.Layer, value:number, height:number):number
|
||||||
---@field peaksList {['landscape']:MapGen.Peak[],['temp']:MapGen.Peak[],['humidity']:MapGen.Peak[]}
|
---@field peaksList MapGen.Peak[]
|
||||||
---@field noisesByColor {['landscape']:table<ColorString, ValueNoise>,['temp']:table<ColorString, ValueNoise>,['humidity']:table<ColorString, ValueNoise>}
|
---@field peaksByPos table<string, MapGen.Peak>
|
||||||
---@field noisesParamsByColor {['landscape']:table<ColorString, NoiseParams>,['temp']:table<ColorString, NoiseParams>,['humidity']:table<ColorString, NoiseParams>}
|
---@field noisesByColor table<MapGen.Layer.Category, table<ColorString, ValueNoise>>
|
||||||
|
---@field noisesParamsByColor table<MapGen.Layer.Category, table<ColorString, NoiseParams>>
|
||||||
---@field biomesByName table<string, MapGen.Biome>
|
---@field biomesByName table<string, MapGen.Biome>
|
||||||
---@field biomesList MapGen.Biome[]
|
---@field biomesList MapGen.Biome[]
|
||||||
---@field biomesDiagram table
|
---@field biomesDiagram table
|
||||||
@@ -22,14 +31,10 @@ local getInstance = Class.getInstance
|
|||||||
---@field cavernsByName table<string, MapGen.Cavern>
|
---@field cavernsByName table<string, MapGen.Cavern>
|
||||||
---@field cavernsList MapGen.Cavern[]
|
---@field cavernsList MapGen.Cavern[]
|
||||||
---@field regionsByName table<string, MapGen.Region>
|
---@field regionsByName table<string, MapGen.Region>
|
||||||
---@field trianglesList {['landscape']:MapGen.Triangle[],['temp']:MapGen.Triangle[],['humidity']:MapGen.Triangle[]}
|
---@field trianglesList MapGen.Triangle[]
|
||||||
---@field tetrahedronsList MapGen.Tetrahedron[] **Not supported**
|
|
||||||
local Layer = {
|
local Layer = {
|
||||||
peaksList = {
|
peaksList = {},
|
||||||
landscape = {},
|
peaksByPos = {},
|
||||||
temp = {},
|
|
||||||
humidity = {},
|
|
||||||
},
|
|
||||||
noisesByColor = {
|
noisesByColor = {
|
||||||
landscape = {},
|
landscape = {},
|
||||||
temp = {},
|
temp = {},
|
||||||
@@ -46,11 +51,7 @@ local Layer = {
|
|||||||
cavernsByName = {},
|
cavernsByName = {},
|
||||||
cavernsList = {},
|
cavernsList = {},
|
||||||
regionsByName = {},
|
regionsByName = {},
|
||||||
trianglesList = {
|
trianglesList = {},
|
||||||
landscape = {},
|
|
||||||
temp = {},
|
|
||||||
humidity = {},
|
|
||||||
},
|
|
||||||
tetrahedronsList = {},
|
tetrahedronsList = {},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,17 +59,23 @@ local Layer = {
|
|||||||
---
|
---
|
||||||
---**Only for EmmyLua.**
|
---**Only for EmmyLua.**
|
||||||
---@class MapGen.LayerDef
|
---@class MapGen.LayerDef
|
||||||
---@field minY number
|
---@field minY integer
|
||||||
---@field maxY number
|
---@field maxY integer
|
||||||
---@field minTemp number
|
---@field minTemp integer
|
||||||
---@field maxTemp number
|
---@field maxTemp integer
|
||||||
---@field minHumidity number
|
---@field minHumidity integer
|
||||||
---@field maxHumidity number
|
---@field maxHumidity integer
|
||||||
---@field waterLevel? number
|
---@field waterLevel? integer
|
||||||
---@field calcTemp (fun(self:MapGen.Layer, value:number, height:number):number)?
|
---@field calcTemp (fun(self:MapGen.Layer, value:number, height:number):number)?
|
||||||
---@field calcHumidity (fun(self:MapGen.Layer, value:number, height:number):number)?
|
---@field calcHumidity (fun(self:MapGen.Layer, value:number, height:number):number)?
|
||||||
---@field biomesGorizontalScattering number?
|
---@field biomesGorizontalScattering integer?
|
||||||
---@field biomesVerticalScattering number?
|
---@field biomesVerticalScattering integer?
|
||||||
|
---@field triangulationLandscapeFile string
|
||||||
|
---@field triangulationTempFile string
|
||||||
|
---@field triangulationHumidityFile string
|
||||||
|
---@field landscapeMapScale number
|
||||||
|
---@field tempMapScale number
|
||||||
|
---@field humidityMapScale number
|
||||||
|
|
||||||
---@param self MapGen.Layer
|
---@param self MapGen.Layer
|
||||||
---@param value number
|
---@param value number
|
||||||
@@ -78,6 +85,73 @@ local function defaultCalcFunc(self, value, height)
|
|||||||
return value
|
return value
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---Checks `def` for compliance with `MapGen.PeakDef` and creates a new peak
|
||||||
|
---if a peak with such coordinates has not yet been registered or returns an existing one.
|
||||||
|
---
|
||||||
|
---**Note:** If the colors of the new peak and the existing one at the same coordinates
|
||||||
|
---are different, an error will be called.
|
||||||
|
---@param def MapGen.PeakDef
|
||||||
|
---@param scale number
|
||||||
|
---@return MapGen.Peak
|
||||||
|
function Layer:registerPeak(def, scale)
|
||||||
|
assert(def.pos ~= nil)
|
||||||
|
assert(def.pos.x ~= nil)
|
||||||
|
assert(def.pos.z ~= nil)
|
||||||
|
assert(def.color ~= nil)
|
||||||
|
assert(type(def.color) == 'string')
|
||||||
|
|
||||||
|
def.pos.x = def.pos.x * scale
|
||||||
|
def.pos.z = def.pos.z * scale
|
||||||
|
def.pos.y = 0
|
||||||
|
|
||||||
|
local positionStr = core.pos_to_string(def.pos)
|
||||||
|
|
||||||
|
local peak = self.peaksByPos[positionStr]
|
||||||
|
|
||||||
|
if peak == nil then
|
||||||
|
peak = Peak:new(def)
|
||||||
|
self.peaksByPos[positionStr] = peak
|
||||||
|
elseif peak.color ~= def.color then
|
||||||
|
error('There cannot be two peaks with the same coordinates but different colors.')
|
||||||
|
end
|
||||||
|
|
||||||
|
return peak
|
||||||
|
end
|
||||||
|
|
||||||
|
function Layer:initTrianglesNeighbours()
|
||||||
|
local triangles = self.trianglesList
|
||||||
|
|
||||||
|
for _, triangle in pairs(triangles) do
|
||||||
|
for _, id in ipairs(triangle.neighboursIDs) do
|
||||||
|
table.insert(triangle.neighbours, triangles[id])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param fileName string
|
||||||
|
---@param category MapGen.Layer.Category
|
||||||
|
---@param scale number
|
||||||
|
function Layer:getTriaglesFromFile(fileName, category, scale)
|
||||||
|
local file = io.open(core.get_modpath(core.get_current_modname())..'/maps/'..fileName, 'r')
|
||||||
|
assert(file ~= nil)
|
||||||
|
|
||||||
|
local json = core.parse_json(file:read('*a')) or {}
|
||||||
|
file:close()
|
||||||
|
|
||||||
|
local triangles = json.triangles
|
||||||
|
assert(triangles ~= nil)
|
||||||
|
|
||||||
|
for _, tr in ipairs(triangles) do
|
||||||
|
local p1 = self:registerPeak( tr.vertices[1], scale)
|
||||||
|
local p2 = self:registerPeak( tr.vertices[2], scale)
|
||||||
|
local p3 = self:registerPeak( tr.vertices[3], scale)
|
||||||
|
|
||||||
|
local triangle = Triangle:new(tr.id,p1, p2, p3, tr.adjacent_triangle_ids)
|
||||||
|
|
||||||
|
self:addTriangle(category, triangle)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
---@param name string
|
---@param name string
|
||||||
---@param def MapGen.LayerDef
|
---@param def MapGen.LayerDef
|
||||||
---@return MapGen.Layer
|
---@return MapGen.Layer
|
||||||
@@ -93,20 +167,34 @@ function Layer:new(name, def)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---@type MapGen.Layer
|
---@type MapGen.Layer
|
||||||
local instance = getInstance(self, {
|
local instance = getInstance(self, {})
|
||||||
name = name,
|
instance.name = name
|
||||||
minY = def.minY,
|
instance.minY = def.minY
|
||||||
maxY = def.maxY,
|
instance.maxY = def.maxY
|
||||||
minTemp = def.minTemp,
|
instance.minTemp = def.minTemp
|
||||||
maxTemp = def.maxTemp,
|
instance.maxTemp = def.maxTemp
|
||||||
minHumidity = def.minHumidity,
|
instance.minHumidity = def.minHumidity
|
||||||
maxHumidity = def.maxHumidity,
|
instance.maxHumidity = def.maxHumidity
|
||||||
waterLevel = def.waterLevel or 0,
|
instance.waterLevel = def.waterLevel or 0
|
||||||
calcTemp = def.calcTemp,
|
instance.calcTemp = def.calcTemp
|
||||||
calcHumidity = def.calcHumidity,
|
instance.calcHumidity = def.calcHumidity
|
||||||
biomesGorizontalScattering = def.biomesGorizontalScattering or 0,
|
instance.biomesGorizontalScattering = def.biomesGorizontalScattering or 0
|
||||||
biomesVerticalScattering = def.biomesVerticalScattering or 0,
|
instance.biomesVerticalScattering = def.biomesVerticalScattering or 0
|
||||||
})
|
|
||||||
|
instance:getTriaglesFromFile(
|
||||||
|
def.triangulationLandscapeFile,
|
||||||
|
'landscape',
|
||||||
|
def.landscapeMapScale)
|
||||||
|
instance:getTriaglesFromFile(
|
||||||
|
def.triangulationTempFile,
|
||||||
|
'temp',
|
||||||
|
def.tempMapScale)
|
||||||
|
instance:getTriaglesFromFile(
|
||||||
|
def.triangulationHumidityFile,
|
||||||
|
'humidity',
|
||||||
|
def.humidityMapScale)
|
||||||
|
|
||||||
|
instance:initTrianglesNeighbours()
|
||||||
|
|
||||||
return instance
|
return instance
|
||||||
end
|
end
|
||||||
@@ -114,34 +202,34 @@ end
|
|||||||
---A category of noise that affects specific map generation objects.
|
---A category of noise that affects specific map generation objects.
|
||||||
---@alias MapGen.Layer.Category 'landscape'|'temp'|'humidity'
|
---@alias MapGen.Layer.Category 'landscape'|'temp'|'humidity'
|
||||||
|
|
||||||
---Adds a peak to the `Layer.peaksList`
|
---Adds a triangle to the `Layer.trianglesList`
|
||||||
---@param category MapGen.Layer.Category
|
---@param category MapGen.Layer.Category
|
||||||
---@param peak MapGen.Peak
|
---@param triangle MapGen.Triangle
|
||||||
function Layer:addPeak(category, peak)
|
function Layer:addTriangle(category, triangle)
|
||||||
if category == 'landscape' then
|
local triangles = self.trianglesList
|
||||||
table.insert(self.peaksList.landscape, peak)
|
if triangles ~= nil then
|
||||||
elseif category == 'temp' then
|
triangles[triangle.id] = triangle
|
||||||
table.insert(self.peaksList.temp, peak)
|
|
||||||
elseif category == 'humidity' then
|
|
||||||
table.insert(self.peaksList.humidity, peak)
|
|
||||||
else
|
else
|
||||||
error(('There is no peak category named %s.'):format(category))
|
error(('There is no peak category named %s.'):format(category))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---Adds a peak to the `Layer.peaksList`
|
||||||
|
---@param category MapGen.Layer.Category
|
||||||
|
---@param peak MapGen.Peak
|
||||||
|
function Layer:addPeak(category, peak)
|
||||||
|
table.insert(self.peaksList, peak)
|
||||||
|
end
|
||||||
|
|
||||||
---Returns the `MapGen.Peak` at the coordinates. If there is no peak at these coordinates, it returns `nil`.
|
---Returns the `MapGen.Peak` at the coordinates. If there is no peak at these coordinates, it returns `nil`.
|
||||||
---@param category MapGen.Layer.Category The category in which the peak is located.
|
|
||||||
---@param pos Position Coordinate of the desired peak.
|
---@param pos Position Coordinate of the desired peak.
|
||||||
---@return MapGen.Peak?
|
---@return MapGen.Peak?
|
||||||
function Layer:getPeakByPos(category, pos)
|
function Layer:getPeakByPos(pos)
|
||||||
pos = vector.new(pos)
|
local positionStr = core.pos_to_string(pos)
|
||||||
|
|
||||||
---@param peak MapGen.Peak
|
local peak = self.peaksByPos[positionStr]
|
||||||
for _, peak in ipairs(self.peaksList[category]) do
|
|
||||||
if peak:getPeakPos() == pos then
|
return peak
|
||||||
return peak
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
---Adds a NoiseParams color to the `Layer.noisesParamsByColor`
|
---Adds a NoiseParams color to the `Layer.noisesParamsByColor`
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ local getInstance = Class.getInstance
|
|||||||
|
|
||||||
---@class MapGen.Peak
|
---@class MapGen.Peak
|
||||||
---@field id number
|
---@field id number
|
||||||
---@field getPeakPos fun(self):vector
|
---@field pos vector
|
||||||
---@field getColor fun(self):ColorString
|
---@field color ColorString
|
||||||
---@field getGroups fun(self):table<string, number>
|
---@field getGroups fun(self):table<string, number>
|
||||||
---@field addGroups fun(self, groups:table<string, number>)
|
---@field addGroups fun(self, groups:table<string, number>)
|
||||||
local Peak = {
|
local Peak = {
|
||||||
@@ -23,7 +23,6 @@ local Peak = {
|
|||||||
---@param def MapGen.PeakDef
|
---@param def MapGen.PeakDef
|
||||||
---@return MapGen.Peak
|
---@return MapGen.Peak
|
||||||
function Peak:new(def)
|
function Peak:new(def)
|
||||||
local _pos = vector.new(def.pos)
|
|
||||||
local _color = def.color
|
local _color = def.color
|
||||||
local _groups
|
local _groups
|
||||||
|
|
||||||
@@ -39,14 +38,8 @@ function Peak:new(def)
|
|||||||
__tostring = self.toString,
|
__tostring = self.toString,
|
||||||
__eq = self.eq
|
__eq = self.eq
|
||||||
})
|
})
|
||||||
|
instance.pos = vector.new(def.pos)
|
||||||
function instance:getPeakPos()
|
instance.color = def.color
|
||||||
return _pos:copy()
|
|
||||||
end
|
|
||||||
|
|
||||||
function instance:getColor()
|
|
||||||
return _color
|
|
||||||
end
|
|
||||||
|
|
||||||
function instance:getGroups()
|
function instance:getGroups()
|
||||||
return table.copy_with_metatables(_groups)
|
return table.copy_with_metatables(_groups)
|
||||||
@@ -66,7 +59,7 @@ end
|
|||||||
---Returns a string describing the object in a readable form.
|
---Returns a string describing the object in a readable form.
|
||||||
---@return string
|
---@return string
|
||||||
function Peak:toString()
|
function Peak:toString()
|
||||||
local pos = self:getPeakPos()
|
local pos = self.pos
|
||||||
return ('Peak (%s) x: %.2f y: %.2f z: %.2f'):format( self.id, pos.x, pos.y, pos.z)
|
return ('Peak (%s) x: %.2f y: %.2f z: %.2f'):format( self.id, pos.x, pos.y, pos.z)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -74,8 +67,8 @@ end
|
|||||||
---@param other MapGen.Peak
|
---@param other MapGen.Peak
|
||||||
---@return boolean
|
---@return boolean
|
||||||
function Peak:eq(other)
|
function Peak:eq(other)
|
||||||
local pos1 = self:getPeakPos()
|
local pos1 = self.pos
|
||||||
local pos2 = other:getPeakPos()
|
local pos2 = other.pos
|
||||||
|
|
||||||
return pos1.x == pos2.x and pos1.z == pos2.z
|
return pos1.x == pos2.x and pos1.z == pos2.z
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ local getInstance = Class.getInstance
|
|||||||
---@field maxY number
|
---@field maxY number
|
||||||
---@field staticNode string
|
---@field staticNode string
|
||||||
---@field staticNodeID number
|
---@field staticNodeID number
|
||||||
---@field generateStaticNode generateFunc
|
---@field generateStaticNode fun(self, mapGenerator:MapGen, data:number[], index:number, x:number, y:number, z:number)
|
||||||
local StaticLayer = {}
|
local StaticLayer = {}
|
||||||
|
|
||||||
---Definition table for the `MapGen.StaticLayer`.
|
---Definition table for the `MapGen.StaticLayer`.
|
||||||
@@ -18,7 +18,7 @@ local StaticLayer = {}
|
|||||||
---@field minY number
|
---@field minY number
|
||||||
---@field maxY number
|
---@field maxY number
|
||||||
---@field staticNode string
|
---@field staticNode string
|
||||||
---@field generateStaticNode generateFunc
|
---@field generateStaticNode fun(self, mapGenerator:MapGen, data:number[], index:number, x:number, y:number, z:number)
|
||||||
|
|
||||||
---@param self MapGen.StaticLayer
|
---@param self MapGen.StaticLayer
|
||||||
---@param mapGenerator MapGen
|
---@param mapGenerator MapGen
|
||||||
|
|||||||
@@ -1,155 +0,0 @@
|
|||||||
---@diagnostic disable: param-type-not-match
|
|
||||||
local mathAbs = math.abs
|
|
||||||
|
|
||||||
local getInstance = Class.getInstance
|
|
||||||
|
|
||||||
local modInfo = Mod.getInfo('smc__core__map_gen')
|
|
||||||
local require = modInfo.require
|
|
||||||
|
|
||||||
---@type MapGen.Triangle
|
|
||||||
local Triangle = require('MapGen.Triangle')
|
|
||||||
---@type MapGen.Triangulation.Edge
|
|
||||||
local Edge = require('MapGen.Triangulation.Edge')
|
|
||||||
---@type MapGen.Triangulation.FakePeak
|
|
||||||
local FakePeak = require('MapGen.Triangulation.FakePeak')
|
|
||||||
|
|
||||||
---@class MapGen.Tetrahedron
|
|
||||||
---@field p1 MapGen.Peak
|
|
||||||
---@field p2 MapGen.Peak
|
|
||||||
---@field p3 MapGen.Peak
|
|
||||||
---@field p4 MapGen.Peak
|
|
||||||
---@field h1 MapGen.Triangulation.Edge
|
|
||||||
---@field h2 MapGen.Triangulation.Edge
|
|
||||||
---@field h3 MapGen.Triangulation.Edge
|
|
||||||
---@field h4 MapGen.Triangulation.Edge
|
|
||||||
---@field f1 MapGen.Triangle
|
|
||||||
---@field f2 MapGen.Triangle
|
|
||||||
---@field f3 MapGen.Triangle
|
|
||||||
---@field f4 MapGen.Triangle
|
|
||||||
local Tetrahedron = {}
|
|
||||||
|
|
||||||
---@param p1 MapGen.Peak
|
|
||||||
---@param p2 MapGen.Peak
|
|
||||||
---@param p3 MapGen.Peak
|
|
||||||
---@param p4 MapGen.Peak
|
|
||||||
---@return MapGen.Tetrahedron
|
|
||||||
function Tetrahedron:new(p1, p2, p3, p4)
|
|
||||||
local instance = getInstance(self, {
|
|
||||||
p1 = p1,
|
|
||||||
p2 = p2,
|
|
||||||
p3 = p3,
|
|
||||||
p4 = p4,
|
|
||||||
h1 = self:getHeight(p1, p2, p3, p4),
|
|
||||||
h2 = self:getHeight(p2, p3, p4, p1),
|
|
||||||
h3 = self:getHeight(p3, p4, p1, p2),
|
|
||||||
h4 = self:getHeight(p4, p1, p2, p3),
|
|
||||||
f1 = Triangle:new(p1, p2, p3),
|
|
||||||
f2 = Triangle:new(p1, p2, p4),
|
|
||||||
f3 = Triangle:new(p1, p3, p4),
|
|
||||||
f4 = Triangle:new(p2, p3, p4),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
__tostring = self.toString
|
|
||||||
})
|
|
||||||
|
|
||||||
return instance
|
|
||||||
end
|
|
||||||
|
|
||||||
---Returns a string describing the object in a readable form.
|
|
||||||
---@return string
|
|
||||||
function Tetrahedron:toString()
|
|
||||||
return ('Tetrahedron: \n %s\n %s\n %s\n %s'):format(
|
|
||||||
tostring(self.p1.getPeakPos()),
|
|
||||||
tostring(self.p2.getPeakPos()),
|
|
||||||
tostring(self.p3.getPeakPos()),
|
|
||||||
tostring(self.p4.getPeakPos())
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
---@param p1 MapGen.Peak
|
|
||||||
---@param p2 MapGen.Peak
|
|
||||||
---@param p3 MapGen.Peak
|
|
||||||
---@param p4 MapGen.Peak
|
|
||||||
function Tetrahedron:getHeight(p1, p2, p3, p4)
|
|
||||||
local pos1 = p1:getPeakPos()
|
|
||||||
local pos2 = p2:getPeakPos()
|
|
||||||
local pos3 = p3:getPeakPos()
|
|
||||||
local pos4 = p4:getPeakPos()
|
|
||||||
|
|
||||||
-- Векторы, лежащие в плоскости
|
|
||||||
local AB = pos3 - pos2
|
|
||||||
local AC = pos4 - pos2
|
|
||||||
|
|
||||||
-- Нормаль к плоскости
|
|
||||||
local normal = AB:cross(AC)
|
|
||||||
local normal_length = normal:length()
|
|
||||||
|
|
||||||
-- Если плоскость вырождена (точки на одной прямой)
|
|
||||||
if normal_length < 1e-10 then
|
|
||||||
return nil -- или другая обработка ошибки
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Вектор от точки на плоскости к нашей точке
|
|
||||||
local AP = pos1 - pos2
|
|
||||||
|
|
||||||
-- Расстояние от точки до плоскости
|
|
||||||
local distance = AP:dot(normal) / normal_length
|
|
||||||
|
|
||||||
-- Проекция точки на плоскость (вектор!)
|
|
||||||
local projection = pos1 - (normal * (distance / normal_length))
|
|
||||||
|
|
||||||
return Edge:new(p1, FakePeak:new(projection))
|
|
||||||
end
|
|
||||||
|
|
||||||
---Returns the center of the circumscribed sphere.
|
|
||||||
---@return vector
|
|
||||||
function Tetrahedron:getCircumSphereCenter()
|
|
||||||
local pos1 = self.p1.getPeakPos()
|
|
||||||
local pos2 = self.p2.getPeakPos()
|
|
||||||
local pos3 = self.p3.getPeakPos()
|
|
||||||
local pos4 = self.p4.getPeakPos()
|
|
||||||
|
|
||||||
local a = pos2 - pos1
|
|
||||||
local b = pos3 - pos1
|
|
||||||
local c = pos4 - pos1
|
|
||||||
|
|
||||||
local a2 = a:dot(a)
|
|
||||||
local b2 = b:dot(b)
|
|
||||||
local c2 = c:dot(c)
|
|
||||||
|
|
||||||
local cross_bc = b:cross(c)
|
|
||||||
local cross_ca = c:cross(a)
|
|
||||||
local cross_ab = a:cross(b)
|
|
||||||
|
|
||||||
local det = a:dot(b:cross(c)) * 2
|
|
||||||
|
|
||||||
if mathAbs(det) < 0 then
|
|
||||||
return (pos1 + pos2 + pos3 + pos4) / 4
|
|
||||||
end
|
|
||||||
|
|
||||||
local center = pos1 + (cross_bc * a2 + cross_ca * b2 + cross_ab * c2) / det
|
|
||||||
|
|
||||||
return center
|
|
||||||
end
|
|
||||||
|
|
||||||
---Returns the radius of the circumscribed sphere.
|
|
||||||
---@return number
|
|
||||||
function Tetrahedron:getCircumSphereRadius()
|
|
||||||
local center = self:getCircumSphereCenter()
|
|
||||||
local pos1 = self.p1.getPeakPos()
|
|
||||||
return (pos1 - center):length()
|
|
||||||
end
|
|
||||||
|
|
||||||
---Checks whether a given point lies within the circumscribed sphere of a tetrahedron.
|
|
||||||
---@param p MapGen.Peak
|
|
||||||
function Tetrahedron:inCircumSphere(p)
|
|
||||||
local pos = p.getPeakPos()
|
|
||||||
local c = self:getCircumSphereCenter()
|
|
||||||
local r = self:getCircumSphereRadius()
|
|
||||||
|
|
||||||
local distance = (pos - c):length()
|
|
||||||
|
|
||||||
return distance <= r
|
|
||||||
end
|
|
||||||
|
|
||||||
return Tetrahedron
|
|
||||||
@@ -6,10 +6,10 @@ local getInstance = Class.getInstance
|
|||||||
local modInfo = Mod.getInfo('smc__core__map_gen')
|
local modInfo = Mod.getInfo('smc__core__map_gen')
|
||||||
local require = modInfo.require
|
local require = modInfo.require
|
||||||
|
|
||||||
---@type MapGen.Triangulation.Edge
|
---@type MapGen.Edge
|
||||||
local Edge = require('MapGen.Triangulation.Edge')
|
local Edge = require('MapGen.Edge')
|
||||||
---@type MapGen.Triangulation.FakePeak
|
---@type MapGen.FakePeak
|
||||||
local FakePeak = require('MapGen.Triangulation.FakePeak')
|
local FakePeak = require('MapGen.FakePeak')
|
||||||
|
|
||||||
-- --- Helpers functions ---
|
-- --- Helpers functions ---
|
||||||
|
|
||||||
@@ -29,9 +29,9 @@ end
|
|||||||
---@param p3 MapGen.Peak
|
---@param p3 MapGen.Peak
|
||||||
---@return boolean
|
---@return boolean
|
||||||
local function isFlatAngle(p1, p2, p3)
|
local function isFlatAngle(p1, p2, p3)
|
||||||
local pos1 = p1:getPeakPos()
|
local pos1 = p1.pos
|
||||||
local pos2 = p2:getPeakPos()
|
local pos2 = p2.pos
|
||||||
local pos3 = p3:getPeakPos()
|
local pos3 = p3.pos
|
||||||
|
|
||||||
local vec1 = pos1 - pos2 -- Vector from p2 to p1
|
local vec1 = pos1 - pos2 -- Vector from p2 to p1
|
||||||
local vec2 = pos3 - pos2 -- Vector from p2 to p3
|
local vec2 = pos3 - pos2 -- Vector from p2 to p3
|
||||||
@@ -63,17 +63,19 @@ end
|
|||||||
---@alias MapGen.Triangle.Neighbours {t1:MapGen.Triangle?,t2:MapGen.Triangle?,t3:MapGen.Triangle?}
|
---@alias MapGen.Triangle.Neighbours {t1:MapGen.Triangle?,t2:MapGen.Triangle?,t3:MapGen.Triangle?}
|
||||||
|
|
||||||
---@class MapGen.Triangle
|
---@class MapGen.Triangle
|
||||||
|
---@field id integer
|
||||||
---@field p1 MapGen.Peak
|
---@field p1 MapGen.Peak
|
||||||
---@field p2 MapGen.Peak
|
---@field p2 MapGen.Peak
|
||||||
---@field p3 MapGen.Peak
|
---@field p3 MapGen.Peak
|
||||||
---@field e1 MapGen.Triangulation.Edge
|
---@field e1 MapGen.Edge
|
||||||
---@field e2 MapGen.Triangulation.Edge
|
---@field e2 MapGen.Edge
|
||||||
---@field e3 MapGen.Triangulation.Edge
|
---@field e3 MapGen.Edge
|
||||||
---@field h1 MapGen.Triangulation.Edge
|
---@field h1 MapGen.Edge
|
||||||
---@field h2 MapGen.Triangulation.Edge
|
---@field h2 MapGen.Edge
|
||||||
---@field h3 MapGen.Triangulation.Edge
|
---@field h3 MapGen.Edge
|
||||||
---@field neighbours MapGen.Triangle.Neighbours
|
---@field neighboursIDs integer[]
|
||||||
---@field color ColorString?
|
---@field neighbours MapGen.Triangle[]
|
||||||
|
---@field color ColorString?
|
||||||
local Triangle = {
|
local Triangle = {
|
||||||
neighbours = {}
|
neighbours = {}
|
||||||
}
|
}
|
||||||
@@ -82,20 +84,21 @@ local Triangle = {
|
|||||||
---@param p2 MapGen.Peak
|
---@param p2 MapGen.Peak
|
||||||
---@param p3 MapGen.Peak
|
---@param p3 MapGen.Peak
|
||||||
---@return MapGen.Triangle
|
---@return MapGen.Triangle
|
||||||
function Triangle:new(p1, p2, p3)
|
function Triangle:new(id, p1, p2, p3, neighboursIDs)
|
||||||
assert(not isFlatAngle(p1, p2, p3), ("angle (p1, p2, p3) is flat:\n %s\n %s\n %s")
|
assert(not isFlatAngle(p1, p2, p3), ("angle (p1, p2, p3) is flat:\n %s\n %s\n %s")
|
||||||
:format(tostring(p1), tostring(p2), tostring(p3)))
|
:format(tostring(p1), tostring(p2), tostring(p3)))
|
||||||
|
|
||||||
---@type ColorString?
|
---@type ColorString?
|
||||||
local color = nil
|
local color = nil
|
||||||
|
|
||||||
local c1, c2, c3 = p1.getColor(), p2.getColor(), p3.getColor()
|
local c1, c2, c3 = p1.color, p2.color, p3.color
|
||||||
|
|
||||||
if c1 == c2 and c2 == c3 and c3 == c1 then
|
if c1 == c2 and c2 == c3 and c3 == c1 then
|
||||||
color = c1
|
color = c1
|
||||||
end
|
end
|
||||||
|
|
||||||
local instance = getInstance(self, {
|
local instance = getInstance(self, {
|
||||||
|
id = id,
|
||||||
p1 = p1,
|
p1 = p1,
|
||||||
p2 = p2,
|
p2 = p2,
|
||||||
p3 = p3,
|
p3 = p3,
|
||||||
@@ -105,7 +108,8 @@ function Triangle:new(p1, p2, p3)
|
|||||||
e1 = Edge:new(p1, p2),
|
e1 = Edge:new(p1, p2),
|
||||||
e2 = Edge:new(p2, p3),
|
e2 = Edge:new(p2, p3),
|
||||||
e3 = Edge:new(p3, p1),
|
e3 = Edge:new(p3, p1),
|
||||||
color = color
|
neighboursIDs = neighboursIDs,
|
||||||
|
color = color,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
__tostring = self.toString,
|
__tostring = self.toString,
|
||||||
@@ -119,9 +123,9 @@ end
|
|||||||
---@return string
|
---@return string
|
||||||
function Triangle:toString()
|
function Triangle:toString()
|
||||||
return ('Triangle: \n %s\n %s\n %s'):format(
|
return ('Triangle: \n %s\n %s\n %s'):format(
|
||||||
tostring(self.p1.getPeakPos()),
|
tostring(self.p1.pos),
|
||||||
tostring(self.p2.getPeakPos()),
|
tostring(self.p2.pos),
|
||||||
tostring(self.p3.getPeakPos())
|
tostring(self.p3.pos)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -144,9 +148,9 @@ end
|
|||||||
---Returns the coordinates of the triangle's center.
|
---Returns the coordinates of the triangle's center.
|
||||||
---@return vector
|
---@return vector
|
||||||
function Triangle:getCenter()
|
function Triangle:getCenter()
|
||||||
local pos1 = self.p1:getPeakPos()
|
local pos1 = self.p1.pos
|
||||||
local pos2 = self.p2:getPeakPos()
|
local pos2 = self.p2.pos
|
||||||
local pos3 = self.p3:getPeakPos()
|
local pos3 = self.p3.pos
|
||||||
|
|
||||||
return (pos1 + pos2 + pos3) / 3
|
return (pos1 + pos2 + pos3) / 3
|
||||||
end
|
end
|
||||||
@@ -163,11 +167,11 @@ end
|
|||||||
---@param p1 MapGen.Peak
|
---@param p1 MapGen.Peak
|
||||||
---@param p2 MapGen.Peak
|
---@param p2 MapGen.Peak
|
||||||
---@param p3 MapGen.Peak
|
---@param p3 MapGen.Peak
|
||||||
---@return MapGen.Triangulation.Edge
|
---@return MapGen.Edge
|
||||||
function Triangle:getHeight(p1, p2, p3)
|
function Triangle:getHeight(p1, p2, p3)
|
||||||
local pos1 = p1:getPeakPos()
|
local pos1 = p1.pos
|
||||||
local pos2 = p2:getPeakPos()
|
local pos2 = p2.pos
|
||||||
local pos3 = p3:getPeakPos()
|
local pos3 = p3.pos
|
||||||
|
|
||||||
local v = pos3 - pos2
|
local v = pos3 - pos2
|
||||||
---@type vector
|
---@type vector
|
||||||
@@ -189,11 +193,11 @@ end
|
|||||||
---@param p1 MapGen.Peak
|
---@param p1 MapGen.Peak
|
||||||
---@param p2 MapGen.Peak
|
---@param p2 MapGen.Peak
|
||||||
---@param p3 MapGen.Peak
|
---@param p3 MapGen.Peak
|
||||||
---@return MapGen.Triangulation.Edge
|
---@return MapGen.Edge
|
||||||
function Triangle:getHeight2D(p1, p2, p3)
|
function Triangle:getHeight2D(p1, p2, p3)
|
||||||
local pos1 = p1:getPeakPos()
|
local pos1 = p1.pos
|
||||||
local pos2 = p2:getPeakPos()
|
local pos2 = p2.pos
|
||||||
local pos3 = p3:getPeakPos()
|
local pos3 = p3.pos
|
||||||
|
|
||||||
pos1.y = 0
|
pos1.y = 0
|
||||||
pos2.y = 0
|
pos2.y = 0
|
||||||
@@ -224,9 +228,9 @@ end
|
|||||||
---that is, the calculation is performed on the projection of the triangle XZ.
|
---that is, the calculation is performed on the projection of the triangle XZ.
|
||||||
---@return number, number, number
|
---@return number, number, number
|
||||||
function Triangle:getSidesLength2D()
|
function Triangle:getSidesLength2D()
|
||||||
local pos1 = self.p1:getPeakPos()
|
local pos1 = self.p1.pos
|
||||||
local pos2 = self.p2:getPeakPos()
|
local pos2 = self.p2.pos
|
||||||
local pos3 = self.p3:getPeakPos()
|
local pos3 = self.p3.pos
|
||||||
|
|
||||||
pos1.y = 0
|
pos1.y = 0
|
||||||
pos2.y = 0
|
pos2.y = 0
|
||||||
@@ -241,9 +245,9 @@ end
|
|||||||
---that is, the calculation is performed on the projection of the triangle XZ.
|
---that is, the calculation is performed on the projection of the triangle XZ.
|
||||||
---@return vector
|
---@return vector
|
||||||
function Triangle:getCircumCenter2D()
|
function Triangle:getCircumCenter2D()
|
||||||
local pos1 = self.p1:getPeakPos()
|
local pos1 = self.p1.pos
|
||||||
local pos2 = self.p2:getPeakPos()
|
local pos2 = self.p2.pos
|
||||||
local pos3 = self.p3:getPeakPos()
|
local pos3 = self.p3.pos
|
||||||
|
|
||||||
local D = ( pos1.x * (pos2.z - pos3.z) +
|
local D = ( pos1.x * (pos2.z - pos3.z) +
|
||||||
pos2.x * (pos3.z - pos1.z) +
|
pos2.x * (pos3.z - pos1.z) +
|
||||||
@@ -290,7 +294,7 @@ end
|
|||||||
---@param p MapGen.Peak
|
---@param p MapGen.Peak
|
||||||
---@return boolean
|
---@return boolean
|
||||||
function Triangle:inCircumCircle2D(p)
|
function Triangle:inCircumCircle2D(p)
|
||||||
local pos = p:getPeakPos()
|
local pos = p.pos
|
||||||
|
|
||||||
local c, r = self:getCircumCircle2D()
|
local c, r = self:getCircumCircle2D()
|
||||||
|
|
||||||
|
|||||||
@@ -1,327 +0,0 @@
|
|||||||
---@diagnostic disable: param-type-not-match
|
|
||||||
-- Tringulation lib
|
|
||||||
-- Original code: https://github.com/iskolbin/Triangulation/blob/master/Triangulation.lua
|
|
||||||
-- Date of copying: 07.11.2025
|
|
||||||
-- Commit: e8d26241767cd6af377b5eda0c1e27122b6afe8a
|
|
||||||
|
|
||||||
-- Main changes:
|
|
||||||
-- * refactoring code to our standard;
|
|
||||||
-- * splitting code into different files (classes);
|
|
||||||
-- * Adapting the code to the mapgen concept;
|
|
||||||
-- * Adding tetrahedralization;
|
|
||||||
-- * Fixed non-determinism by sorting vertices before processing;
|
|
||||||
|
|
||||||
local assert, mathMax, tableRemove, tableSort
|
|
||||||
= assert, math.max, table.remove, table.sort
|
|
||||||
|
|
||||||
local modInfo = Mod.getInfo('smc__core__map_gen')
|
|
||||||
local require = modInfo.require
|
|
||||||
|
|
||||||
---@type MapGen.Triangle
|
|
||||||
local Triangle = require('MapGen.Triangle')
|
|
||||||
---@type MapGen.Tetrahedron
|
|
||||||
local Tetrahedron = require('MapGen.Tetrahedron')
|
|
||||||
---@type MapGen.Triangulation.FakePeak
|
|
||||||
local FakePeak = require('MapGen.Triangulation.FakePeak')
|
|
||||||
|
|
||||||
---@class MapGen.Triangulation
|
|
||||||
---@field convexMultiplier number
|
|
||||||
local Triangulation = {
|
|
||||||
convexMultiplier = 1e3,
|
|
||||||
}
|
|
||||||
|
|
||||||
---Finds and writes adjacent triangles into triangles.
|
|
||||||
---@param triangles MapGen.Triangle[]
|
|
||||||
local function findTrianglesNeighbours(triangles)
|
|
||||||
for _, triangle in ipairs(triangles) do
|
|
||||||
for _, t in ipairs(triangles) do
|
|
||||||
if triangle.e1 == t.e1 and triangle.p3 ~= t.p3 then
|
|
||||||
triangle.neighbours.t1 = t
|
|
||||||
elseif triangle.e2 == t.e2 and triangle.p3 ~= t.p1 then
|
|
||||||
triangle.neighbours.t2 = t
|
|
||||||
elseif triangle.e3 == t.e3 and triangle.p3 ~= t.p2 then
|
|
||||||
triangle.neighbours.t3 = t
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
---Filter vertices by group and return a new table
|
|
||||||
---@param vertices table<integer, MapGen.Peak>
|
|
||||||
---@param groupKey string
|
|
||||||
---@return table<integer, MapGen.Peak>
|
|
||||||
local function filterVerticesByGroup(vertices, groupKey)
|
|
||||||
local result = {}
|
|
||||||
for i = 1, #vertices do
|
|
||||||
local vertex = vertices[i]
|
|
||||||
if vertex:getGroups()[groupKey] ~= nil then
|
|
||||||
result[#result + 1] = vertex
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return result
|
|
||||||
end
|
|
||||||
|
|
||||||
---Sort vertices deterministically by position to ensure consistent triangulation
|
|
||||||
---@param vertices table<integer, MapGen.Peak>
|
|
||||||
local function sortVerticesDeterministically(vertices)
|
|
||||||
tableSort(vertices, function(a, b)
|
|
||||||
local posA = a:getPeakPos()
|
|
||||||
local posB = b:getPeakPos()
|
|
||||||
|
|
||||||
-- Sort by X first
|
|
||||||
if posA.x ~= posB.x then
|
|
||||||
return posA.x < posB.x
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Then by Z
|
|
||||||
if posA.z ~= posB.z then
|
|
||||||
return posA.z < posB.z
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Then by Y
|
|
||||||
if posA.y ~= posB.y then
|
|
||||||
return posA.y < posB.y
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Fallback to unique identifier if positions are identical
|
|
||||||
-- This handles potential duplicate positions
|
|
||||||
local nameA = a.getName and a:getName() or ""
|
|
||||||
local nameB = b.getName and b:getName() or ""
|
|
||||||
return nameA < nameB
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
---The Delaunay method divides a plane into triangles based on a list of their vertices.
|
|
||||||
---
|
|
||||||
---Doesn't take into account the Y coordinate of the vertices.
|
|
||||||
---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.
|
|
||||||
---@param vertices table<integer, MapGen.Peak>
|
|
||||||
function Triangulation.triangulate(vertices)
|
|
||||||
-- Filter vertices with is2d group (creates a new table)
|
|
||||||
vertices = filterVerticesByGroup(vertices, "is2d")
|
|
||||||
|
|
||||||
-- Sort deterministically to ensure consistent results across sessions
|
|
||||||
sortVerticesDeterministically(vertices)
|
|
||||||
|
|
||||||
local nvertices = #vertices
|
|
||||||
|
|
||||||
assert(nvertices > 2, "Cannot triangulate, needs more than 3 vertices")
|
|
||||||
|
|
||||||
if nvertices == 3 then
|
|
||||||
return {Triangle:new(vertices[1], vertices[2], vertices[3])}
|
|
||||||
end
|
|
||||||
|
|
||||||
local minPos = vertices[1]:getPeakPos()
|
|
||||||
local minX, minY = minPos.x, minPos.z
|
|
||||||
local maxX, maxY = minX, minY
|
|
||||||
|
|
||||||
for i = 1, nvertices do
|
|
||||||
local vertex = vertices[i]
|
|
||||||
local vertexPos = vertex:getPeakPos()
|
|
||||||
vertex.id = i
|
|
||||||
|
|
||||||
if vertexPos.x < minX then
|
|
||||||
minX = vertexPos.x
|
|
||||||
end
|
|
||||||
|
|
||||||
if vertexPos.z < minY then
|
|
||||||
minY = vertexPos.z
|
|
||||||
end
|
|
||||||
|
|
||||||
if vertexPos.x > maxX then
|
|
||||||
maxX = vertexPos.x
|
|
||||||
end
|
|
||||||
|
|
||||||
if vertexPos.z > maxY then
|
|
||||||
maxY = vertexPos.z
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Finding the vertices of a supertriangle
|
|
||||||
local convex_mult = Triangulation.convexMultiplier
|
|
||||||
local dx, dy = (maxX - minX) * convex_mult, (maxY - minY) * convex_mult
|
|
||||||
local deltaMax = mathMax(dx, dy)
|
|
||||||
local midx, midy = (minX + maxX) * 0.5, (minY + maxY) * 0.5
|
|
||||||
|
|
||||||
local p1 = FakePeak:new(vector.new(midx - 2 * deltaMax, 0, midy - deltaMax))
|
|
||||||
local p2 = FakePeak:new(vector.new(midx, 0, midy + 2 * deltaMax))
|
|
||||||
local p3 = FakePeak:new(vector.new(midx + 2 * deltaMax, 0, midy - deltaMax))
|
|
||||||
|
|
||||||
p1.id, p2.id, p3.id = nvertices + 1, nvertices + 2, nvertices + 3
|
|
||||||
vertices[p1.id], vertices[p2.id], vertices[p3.id] = p1, p2, p3
|
|
||||||
|
|
||||||
---@type MapGen.Triangle[]
|
|
||||||
local triangles = {Triangle:new(vertices[nvertices + 1], vertices[nvertices + 2], vertices[nvertices + 3])}
|
|
||||||
|
|
||||||
for i = 1, nvertices do
|
|
||||||
---@type MapGen.Triangulation.Edge[]
|
|
||||||
local edges = {}
|
|
||||||
|
|
||||||
-- Finding bad triangles.
|
|
||||||
for j = #triangles, 1, -1 do
|
|
||||||
local curTriangle = triangles[j]
|
|
||||||
|
|
||||||
if curTriangle:inCircumCircle2D(vertices[i]) then
|
|
||||||
edges[#edges + 1] = curTriangle.e1
|
|
||||||
edges[#edges + 1] = curTriangle.e2
|
|
||||||
edges[#edges + 1] = curTriangle.e3
|
|
||||||
tableRemove(triangles, j)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Removing duplicate edges.
|
|
||||||
for j = #edges - 1, 1, -1 do
|
|
||||||
for k = #edges, j + 1, -1 do
|
|
||||||
if edges[j] and edges[k] and edges[j]:same(edges[k]) then
|
|
||||||
tableRemove(edges, j)
|
|
||||||
tableRemove(edges, k - 1)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Create new triangles.
|
|
||||||
for j = 1, #edges do
|
|
||||||
triangles[#triangles + 1] = Triangle:new(edges[j].p1, edges[j].p2, vertices[i])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Remove triangles associated with the vertices of a supertriangle.
|
|
||||||
for i = #triangles, 1, -1 do
|
|
||||||
local triangle = triangles[i]
|
|
||||||
if triangle.p1.id > nvertices or triangle.p2.id > nvertices or triangle.p3.id > nvertices then
|
|
||||||
tableRemove(triangles, i)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Removing the vertices of a supertriangle.
|
|
||||||
for _ = 1, 3 do
|
|
||||||
tableRemove(vertices)
|
|
||||||
end
|
|
||||||
|
|
||||||
findTrianglesNeighbours(triangles)
|
|
||||||
|
|
||||||
return triangles
|
|
||||||
end
|
|
||||||
|
|
||||||
---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.
|
|
||||||
---@param vertices table<integer, MapGen.Peak>
|
|
||||||
function Triangulation.tetrahedralize(vertices)
|
|
||||||
-- Filter vertices with is3d group (creates a new table)
|
|
||||||
vertices = filterVerticesByGroup(vertices, "is3d")
|
|
||||||
|
|
||||||
-- Sort deterministically to ensure consistent results across sessions
|
|
||||||
sortVerticesDeterministically(vertices)
|
|
||||||
|
|
||||||
local nvertices = #vertices
|
|
||||||
|
|
||||||
assert(nvertices > 3, "Cannot tetrahedralize, needs more than 4 vertices")
|
|
||||||
|
|
||||||
if nvertices == 4 then
|
|
||||||
return {Tetrahedron:new(vertices[1], vertices[2], vertices[3], vertices[4])}
|
|
||||||
end
|
|
||||||
|
|
||||||
local minPos = vertices[1]:getPeakPos()
|
|
||||||
local minX, minY, minZ = minPos.x, minPos.y, minPos.z
|
|
||||||
local maxX, maxY, maxZ = minX, minY, minZ
|
|
||||||
|
|
||||||
for i = 1, nvertices do
|
|
||||||
local vertex = vertices[i]
|
|
||||||
local vertexPos = vertex:getPeakPos()
|
|
||||||
vertex.id = i
|
|
||||||
|
|
||||||
if vertexPos.x < minX then
|
|
||||||
minX = vertexPos.x
|
|
||||||
end
|
|
||||||
|
|
||||||
if vertexPos.y < minY then
|
|
||||||
minY = vertexPos.y
|
|
||||||
end
|
|
||||||
|
|
||||||
if vertexPos.z < minZ then
|
|
||||||
minZ = vertexPos.z
|
|
||||||
end
|
|
||||||
|
|
||||||
if vertexPos.x > maxX then
|
|
||||||
maxX = vertexPos.x
|
|
||||||
end
|
|
||||||
|
|
||||||
if vertexPos.y > maxY then
|
|
||||||
maxY = vertexPos.y
|
|
||||||
end
|
|
||||||
|
|
||||||
if vertexPos.z > maxZ then
|
|
||||||
maxZ = vertexPos.z
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Finding the vertices of a supertetrahedron
|
|
||||||
local convex_mult = Triangulation.convexMultiplier
|
|
||||||
local dx, dy, dz = (maxX - minX) * convex_mult, (maxY - minY) * convex_mult, (maxZ - minZ) * convex_mult
|
|
||||||
local deltaMax = mathMax(dx, dy, dz)
|
|
||||||
local midx, midy, midz = (minX + maxX) * 0.5, (minY + maxY) * 0.5, (minZ + maxZ) * 0.5
|
|
||||||
|
|
||||||
local p1 = FakePeak:new(vector.new(midx - 2 * deltaMax, midy - deltaMax, midz - deltaMax))
|
|
||||||
local p2 = FakePeak:new(vector.new(midx + 2 * deltaMax, midy - deltaMax, midz - deltaMax))
|
|
||||||
local p3 = FakePeak:new(vector.new(midx, midy + 2 * deltaMax, midz - deltaMax))
|
|
||||||
local p4 = FakePeak:new(vector.new(midx, midy, midz + 2 * deltaMax))
|
|
||||||
|
|
||||||
p1.id, p2.id, p3.id, p4.id = nvertices + 1, nvertices + 2, nvertices + 3, nvertices + 4
|
|
||||||
vertices[p1.id], vertices[p2.id], vertices[p3.id], vertices[p4.id] = p1, p2, p3, p4
|
|
||||||
|
|
||||||
---@type MapGen.Tetrahedron[]
|
|
||||||
local tetrahedrons = {Tetrahedron:new(p1, p2, p3, p4)}
|
|
||||||
|
|
||||||
for i = 1, nvertices do
|
|
||||||
---@type MapGen.Triangle[]
|
|
||||||
local faces = {}
|
|
||||||
|
|
||||||
-- Finding bad tetrahedrons.
|
|
||||||
for j = #tetrahedrons, 1, -1 do
|
|
||||||
local curTetrahedron = tetrahedrons[j]
|
|
||||||
|
|
||||||
if curTetrahedron:inCircumSphere(vertices[i]) then
|
|
||||||
faces[#faces + 1] = curTetrahedron.f1
|
|
||||||
faces[#faces + 1] = curTetrahedron.f2
|
|
||||||
faces[#faces + 1] = curTetrahedron.f3
|
|
||||||
faces[#faces + 1] = curTetrahedron.f4
|
|
||||||
tableRemove(tetrahedrons, j)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Removing duplicate faces.
|
|
||||||
for j = #faces - 1, 1, -1 do
|
|
||||||
for k = #faces, j + 1, -1 do
|
|
||||||
if faces[j] and faces[k] and faces[j]:same(faces[k]) then
|
|
||||||
tableRemove(faces, j)
|
|
||||||
tableRemove(faces, k - 1)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Create new tetrahedrons.
|
|
||||||
for j = 1, #faces do
|
|
||||||
tetrahedrons[#tetrahedrons + 1] = Tetrahedron:new(faces[j].p1, faces[j].p2, faces[j].p3, vertices[i])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Remove tetrahedra associated with the vertices of a supertetrahedron.
|
|
||||||
for i = #tetrahedrons, 1, -1 do
|
|
||||||
local tetrahedron = tetrahedrons[i]
|
|
||||||
if tetrahedron.p1.id > nvertices or tetrahedron.p2.id > nvertices or tetrahedron.p3.id > nvertices or tetrahedron.p4.id > nvertices then
|
|
||||||
tableRemove(tetrahedrons, i)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Removing the vertices of a supertetrahedron.
|
|
||||||
for _ = 1, 4 do
|
|
||||||
tableRemove(vertices)
|
|
||||||
end
|
|
||||||
|
|
||||||
return tetrahedrons
|
|
||||||
end
|
|
||||||
|
|
||||||
return Triangulation
|
|
||||||
@@ -1,10 +1,4 @@
|
|||||||
local itemRequire = Mod.getInfo('smc__core__item').require
|
local Item, ItemFactory = Smc.requireItem(), Smc.requireItemFactory()
|
||||||
|
|
||||||
---@type Item
|
|
||||||
local Item = itemRequire('Item')
|
|
||||||
|
|
||||||
---@type ItemFactory
|
|
||||||
local ItemFactory = Mod.getInfo('smc__core__item_factory').require('ItemFactory')
|
|
||||||
|
|
||||||
---@class Node : Item
|
---@class Node : Item
|
||||||
---@field defaultDef Node.NodeDefinition
|
---@field defaultDef Node.NodeDefinition
|
||||||
@@ -22,7 +16,7 @@ function Node:new(nodeDef)
|
|||||||
---Adding default parameters
|
---Adding default parameters
|
||||||
nodeDef = defMerge(nodeDef, self.defaultDef, true)
|
nodeDef = defMerge(nodeDef, self.defaultDef, true)
|
||||||
|
|
||||||
nodeDef.settings._visual = 'item_3d'
|
nodeDef.settings._type = 'node'
|
||||||
|
|
||||||
---@type Node
|
---@type Node
|
||||||
local instance = Item:new(nodeDef)
|
local instance = Item:new(nodeDef)
|
||||||
@@ -35,7 +29,7 @@ end
|
|||||||
---@param defaultDef Node.NodeDefinition
|
---@param defaultDef Node.NodeDefinition
|
||||||
---@return Node
|
---@return Node
|
||||||
function Node:getExtended(defaultDef)
|
function Node:getExtended(defaultDef)
|
||||||
defaultDef = defMerge(defaultDef, self.defaultDef)
|
defaultDef = defMerge(defaultDef, self.defaultDef, true)
|
||||||
|
|
||||||
---@type Node
|
---@type Node
|
||||||
local ChildClass = Class.extend(self, {
|
local ChildClass = Class.extend(self, {
|
||||||
@@ -52,7 +46,7 @@ function Node:getFactory(defaultDef)
|
|||||||
if defaultDef == nil then
|
if defaultDef == nil then
|
||||||
defaultDef = self.defaultDef
|
defaultDef = self.defaultDef
|
||||||
else
|
else
|
||||||
defaultDef = defMerge(self.defaultDef, defaultDef)
|
defaultDef = defMerge(self.defaultDef, defaultDef, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
---@type ItemFactory
|
---@type ItemFactory
|
||||||
|
|||||||
@@ -1,10 +1,4 @@
|
|||||||
local nodeRequire = Mod.getInfo('smc__core__node').require
|
local Node = Smc.requireNode()
|
||||||
|
|
||||||
---@type Node
|
|
||||||
local Node = nodeRequire('Node')
|
|
||||||
|
|
||||||
-- -@type ItemFactory
|
|
||||||
---local ItemFactory = Mod.getInfo('smc__core__item_factory').require('ItemFactory')
|
|
||||||
|
|
||||||
---@class Plant : Node
|
---@class Plant : Node
|
||||||
local Plant = Node:getExtended({
|
local Plant = Node:getExtended({
|
||||||
|
|||||||
@@ -1,4 +1,32 @@
|
|||||||
---@class Player
|
---@class Player
|
||||||
local Player = {}
|
local Player = {}
|
||||||
|
|
||||||
|
---@type PlayerInventoryUI
|
||||||
|
local PlayerInventoryUI = Mod.getInfo('smc__ui__player_inventory').require('PlayerInventoryUI')
|
||||||
|
|
||||||
|
core.register_on_joinplayer(function(player)
|
||||||
|
player:set_inventory_formspec(PlayerInventoryUI:getFormSpecString(player:get_player_name()))
|
||||||
|
player:hud_set_hotbar_itemcount(9)
|
||||||
|
local inv = player:get_inventory()
|
||||||
|
inv:set_size('main', 18)
|
||||||
|
-- Player equipment slots:
|
||||||
|
inv:set_size('equip_head', 2)
|
||||||
|
inv:set_size('equip_torso', 2)
|
||||||
|
inv:set_size('equip_legs', 2)
|
||||||
|
inv:set_size('equip_feet', 2)
|
||||||
|
end)
|
||||||
|
|
||||||
|
core.register_chatcommand('show_inv',
|
||||||
|
{
|
||||||
|
func = function(name, param)
|
||||||
|
PlayerInventoryUI:showForm(name)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
local require = Mod.getInfo('smc__core__player').require
|
||||||
|
|
||||||
|
require('Player.inventory')
|
||||||
|
|
||||||
return Player
|
return Player
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
---@class Player.GUI
|
|
||||||
local GUI = {}
|
|
||||||
|
|
||||||
return GUI
|
|
||||||
6
mods/CORE/Player/src/Player/inventory.lua
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
---@type PlayerInventoryUI
|
||||||
|
local PlayerInventoryUI = Mod.getInfo('smc__ui__player_inventory').require('PlayerInventoryUI')
|
||||||
|
|
||||||
|
-- TODO: перенести обработки в PlayerUI
|
||||||
|
|
||||||
4
mods/CORE/Tool/init.lua
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
local modInfo = Mod.getInfo('smc__core__tool')
|
||||||
|
local require = modInfo.require
|
||||||
|
|
||||||
|
return require('Tool')
|
||||||
2
mods/CORE/Tool/mod.conf
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
name = smc__core__tool
|
||||||
|
depends = smc__core__item
|
||||||
58
mods/CORE/Tool/src/Tool.lua
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
local Item, ItemFactory = Smc.requireItem(), Smc.requireItemFactory()
|
||||||
|
|
||||||
|
---@class Tool : Item
|
||||||
|
---@field defaultDef Item.ItemDefinition
|
||||||
|
local Tool = Class.extend(Item, {})
|
||||||
|
|
||||||
|
---The alias `table.merge` for EmmyLua
|
||||||
|
---@type fun(...):(Item.ItemDefinition)
|
||||||
|
local defMerge = function(...)
|
||||||
|
return table.merge(...)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param ToolDef Item.ItemDefinition
|
||||||
|
---@return Tool
|
||||||
|
function Tool:new(ToolDef)
|
||||||
|
---Adding default parameters
|
||||||
|
ToolDef = defMerge(ToolDef, self.defaultDef, true)
|
||||||
|
|
||||||
|
ToolDef.settings._type = 'tool'
|
||||||
|
|
||||||
|
---@type Tool
|
||||||
|
local instance = Item:new(ToolDef)
|
||||||
|
return instance
|
||||||
|
end
|
||||||
|
|
||||||
|
---Allows you to create a child class of an tool by specifying
|
||||||
|
---default parameters that will be added to the tool's parameters
|
||||||
|
---when an instance is received.
|
||||||
|
---@param defaultDef Item.ItemDefinition
|
||||||
|
---@return Tool
|
||||||
|
function Tool:getExtended(defaultDef)
|
||||||
|
defaultDef = defMerge(defaultDef, self.defaultDef, true)
|
||||||
|
|
||||||
|
---@type Tool
|
||||||
|
local ChildClass = Class.extend(self, {
|
||||||
|
defaultDef = defaultDef,
|
||||||
|
})
|
||||||
|
|
||||||
|
return ChildClass
|
||||||
|
end
|
||||||
|
|
||||||
|
---Returns an instance of the `ItemFactory` class that can be used to mass-register identical items.
|
||||||
|
---@param defaultDef? Item.ItemDefinition
|
||||||
|
---@return ItemFactory
|
||||||
|
function Tool:getFactory(defaultDef)
|
||||||
|
if defaultDef == nil then
|
||||||
|
defaultDef = self.defaultDef
|
||||||
|
else
|
||||||
|
defaultDef = defMerge(self.defaultDef, defaultDef, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@type ItemFactory
|
||||||
|
local instance = ItemFactory:new(self, defaultDef)
|
||||||
|
|
||||||
|
return instance
|
||||||
|
end
|
||||||
|
|
||||||
|
return Tool
|
||||||
@@ -6,8 +6,7 @@ local ImmersiveCraftHandler = Mod.getInfo('smc__core__craft_system').require('Cr
|
|||||||
---@type WorkStationUI
|
---@type WorkStationUI
|
||||||
local WorkStationUI = Mod.getInfo('smc__ui__work_station').require('WorkStationUI')
|
local WorkStationUI = Mod.getInfo('smc__ui__work_station').require('WorkStationUI')
|
||||||
|
|
||||||
---@type Node
|
local Node = Smc.requireNode()
|
||||||
local Node = Mod.getInfo('smc__core__node').require('Node')
|
|
||||||
|
|
||||||
-- Default settings that a work station node should have.
|
-- Default settings that a work station node should have.
|
||||||
local WorkStationNode = Node:getExtended({
|
local WorkStationNode = Node:getExtended({
|
||||||
@@ -79,6 +78,18 @@ function WorkStation:new(name, def)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
callbacks.on_punch = function(pos, node, puncher, pointed_thing)
|
||||||
|
if Smc.workStationIsFree(pos) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local craftData = Smc.getCraftDataByPos(pos)
|
||||||
|
assert(craftData ~= nil, 'Immersive crafting data is empty.')
|
||||||
|
|
||||||
|
local craft = ImmersiveCraftHandler:getCraftByName(craftData.craftName)
|
||||||
|
craft:abortCraft(pos)
|
||||||
|
end
|
||||||
|
|
||||||
callbacks.on_dig = function(pos, node, digger)
|
callbacks.on_dig = function(pos, node, digger)
|
||||||
if Smc.workStationIsFree(pos) then
|
if Smc.workStationIsFree(pos) then
|
||||||
return core.node_dig(pos, node, digger)
|
return core.node_dig(pos, node, digger)
|
||||||
@@ -107,6 +118,7 @@ function WorkStation:showSelectionCraftForm(player, crafts, pos)
|
|||||||
-- Create a table in the format craft result - craft name.
|
-- Create a table in the format craft result - craft name.
|
||||||
local outputs = {}
|
local outputs = {}
|
||||||
for _, craft in ipairs(crafts) do
|
for _, craft in ipairs(crafts) do
|
||||||
|
-- TODO: добавить проверку только на известные игроку рецепты
|
||||||
outputs[craft.output] = craft.name
|
outputs[craft.output] = craft.name
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -190,6 +202,23 @@ ImmersiveCraftHandler:registerCraft('bricks', {
|
|||||||
targetItem = 'rocks:sylite',
|
targetItem = 'rocks:sylite',
|
||||||
type = 'tapping',
|
type = 'tapping',
|
||||||
clicksNeed = 3,
|
clicksNeed = 3,
|
||||||
|
nextStage = 'tapping_2',
|
||||||
|
},
|
||||||
|
---@type CraftSystem.ImmersiveCraftStage.TappingStageDef
|
||||||
|
{
|
||||||
|
name = 'tapping_2',
|
||||||
|
toolGroup = 'crushing',
|
||||||
|
targetItem = 'rocks:sylite_block',
|
||||||
|
type = 'tapping',
|
||||||
|
clicksNeed = 5,
|
||||||
|
nextStage = 'tapping_3',
|
||||||
|
},
|
||||||
|
---@type CraftSystem.ImmersiveCraftStage.TappingStageDef
|
||||||
|
{
|
||||||
|
name = 'tapping_3',
|
||||||
|
targetItem = 'rocks:sylite_bricks',
|
||||||
|
type = 'tapping',
|
||||||
|
clicksNeed = 1,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,73 +0,0 @@
|
|||||||
local modInfo = Mod.getInfo('smc__core__formspec')
|
|
||||||
local require = modInfo.require
|
|
||||||
|
|
||||||
---@type Formspec
|
|
||||||
local Formspec = require('Formspec')
|
|
||||||
|
|
||||||
local listForm = Formspec:new({
|
|
||||||
size = {x=21, y=12},
|
|
||||||
})
|
|
||||||
|
|
||||||
listForm:list('current_player', 'main', 10.5, 6.5, 8, 4)
|
|
||||||
|
|
||||||
local listFormItems = Formspec:new()
|
|
||||||
|
|
||||||
local items = table.get_keys(core.registered_nodes)
|
|
||||||
table.sort(items)
|
|
||||||
local w, h = 0, 0
|
|
||||||
|
|
||||||
---@param name string
|
|
||||||
for _, name in ipairs(items) do
|
|
||||||
listFormItems:itemImageButton(w, h, 1, 1, name, name..'::item_button')
|
|
||||||
|
|
||||||
w = w + 1
|
|
||||||
|
|
||||||
if w > 9 then
|
|
||||||
w = 0
|
|
||||||
h = h + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--listFormItems:list('current_player', 'main', 0, 0, 1, 32)
|
|
||||||
|
|
||||||
listForm:
|
|
||||||
scrollContainer(listFormItems, 0.5, 0.5, 9, 11, 'admin_commands:list_items', 'vertical'):
|
|
||||||
scrollbar(10, 0.5, 0.25, 10, 'vertical', 'admin_commands:list_items')
|
|
||||||
|
|
||||||
core.register_chatcommand('list', {
|
|
||||||
privs = {server = true},
|
|
||||||
|
|
||||||
func = function(name, param)
|
|
||||||
local player = core.get_player_by_name(name)
|
|
||||||
|
|
||||||
core.show_formspec(name, 'admin_commands:list_form', listForm:toString())
|
|
||||||
|
|
||||||
return true, ''
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
core.register_on_player_receive_fields(function(player, formname, fields)
|
|
||||||
if formname ~= 'admin_commands:list_form' then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
for key, value in pairs(fields) do
|
|
||||||
if string.ends_with(key, '::item_button') then
|
|
||||||
---@type ItemStackString?
|
|
||||||
local stack = string.match(key, '(%S+)::item_button')
|
|
||||||
|
|
||||||
if stack == nil then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
core.log(tostring(stack))
|
|
||||||
|
|
||||||
---@type InvRef
|
|
||||||
local inv = player:get_inventory()
|
|
||||||
|
|
||||||
if inv:room_for_item("main", stack) then
|
|
||||||
inv:add_item("main", stack)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
name = smc__core__admin_commands
|
|
||||||
depends = smc__system__system_loader, smc__core__formspec, smc__core__item
|
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
-- World generation occurs in a separate thread (MapGen Environment).
|
-- World generation occurs in a separate thread (MapGen Environment).
|
||||||
-- But for the main thread, the mapgenerator object is also initialized.
|
-- But for the main thread, the mapgenerator object is also initialized.
|
||||||
|
|
||||||
|
--core.set_mapgen_setting('chunksize', '{x=2,y=10,z=2}', true)
|
||||||
|
|
||||||
local mapGeneneratorRequire = Mod.getInfo('smc__core__map_generator').require
|
local mapGeneneratorRequire = Mod.getInfo('smc__core__map_generator').require
|
||||||
|
|
||||||
-- Main env init
|
-- Main env init
|
||||||
|
|||||||
10171
mods/ENVIRONMENT/mapGenerator/maps/tarion.json
Normal file
@@ -17,6 +17,9 @@ dofile(core.get_modpath('smc__system__logger')..'/init.lua')
|
|||||||
-- Math
|
-- Math
|
||||||
dofile(core.get_modpath('smc__system__math')..'/init.lua')
|
dofile(core.get_modpath('smc__system__math')..'/init.lua')
|
||||||
|
|
||||||
|
-- Profile
|
||||||
|
dofile(core.get_modpath('smc__system__profiler')..'/init.lua')
|
||||||
|
|
||||||
-- Require
|
-- Require
|
||||||
dofile(core.get_modpath('smc__system__require')..'/init.lua')
|
dofile(core.get_modpath('smc__system__require')..'/init.lua')
|
||||||
|
|
||||||
|
|||||||
@@ -49,9 +49,396 @@ mapGenerator:registerLayer('midgard', {
|
|||||||
calcTemp = calcTemp,
|
calcTemp = calcTemp,
|
||||||
calcHumidity = calcHumidity,
|
calcHumidity = calcHumidity,
|
||||||
biomesVerticalScattering = 5,
|
biomesVerticalScattering = 5,
|
||||||
biomesGorizontalScattering = 5
|
biomesGorizontalScattering = 5,
|
||||||
|
triangulationLandscapeFile = 'tarion.json',
|
||||||
|
triangulationTempFile = 'tarion.json',
|
||||||
|
triangulationHumidityFile = 'tarion.json',
|
||||||
|
landscapeMapScale = 100,
|
||||||
|
tempMapScale = 100,
|
||||||
|
humidityMapScale = 100,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- TODO: Config should be imported from .json file in the world's folder
|
||||||
|
local ocean = {
|
||||||
|
['landscape'] = {
|
||||||
|
offset = -10,
|
||||||
|
scale = 3,
|
||||||
|
spread = {x = 10, y = 10, z = 10},
|
||||||
|
seed = 420,
|
||||||
|
octaves = 2,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
['temp'] = {
|
||||||
|
offset = -10,
|
||||||
|
scale = 5,
|
||||||
|
spread = {x = 10, y = 10, z = 10},
|
||||||
|
seed = 47,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
['humidity'] = {
|
||||||
|
offset = -10,
|
||||||
|
scale = 5,
|
||||||
|
spread = {x = 10, y = 10, z = 10},
|
||||||
|
seed = 47,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local common_lands = {
|
||||||
|
['landscape'] = {
|
||||||
|
offset = 0,
|
||||||
|
scale = 5,
|
||||||
|
spread = {x = 10, y = 10, z = 10},
|
||||||
|
seed = 88005553535,
|
||||||
|
octaves = 2,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
['temp'] = {
|
||||||
|
offset = -10,
|
||||||
|
scale = 5,
|
||||||
|
spread = {x = 10, y = 10, z = 10},
|
||||||
|
seed = 47,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
['humidity'] = {
|
||||||
|
offset = -10,
|
||||||
|
scale = 5,
|
||||||
|
spread = {x = 10, y = 10, z = 10},
|
||||||
|
seed = 47,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local foresty_lands = {
|
||||||
|
['landscape'] = {
|
||||||
|
offset = 5,
|
||||||
|
scale = 8,
|
||||||
|
spread = {x = 15, y = 15, z = 15},
|
||||||
|
seed = 12345,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.5,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
['temp'] = {
|
||||||
|
offset = 20,
|
||||||
|
scale = 10,
|
||||||
|
spread = {x = 20, y = 20, z = 20},
|
||||||
|
seed = 48,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
['humidity'] = {
|
||||||
|
offset = 60,
|
||||||
|
scale = 15,
|
||||||
|
spread = {x = 15, y = 15, z = 15},
|
||||||
|
seed = 49,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local hilly_lands = {
|
||||||
|
['landscape'] = {
|
||||||
|
offset = 15,
|
||||||
|
scale = 12,
|
||||||
|
spread = {x = 20, y = 20, z = 20},
|
||||||
|
seed = 54321,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.5,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
['temp'] = {
|
||||||
|
offset = 15,
|
||||||
|
scale = 10,
|
||||||
|
spread = {x = 25, y = 25, z = 25},
|
||||||
|
seed = 50,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
['humidity'] = {
|
||||||
|
offset = 40,
|
||||||
|
scale = 15,
|
||||||
|
spread = {x = 20, y = 20, z = 20},
|
||||||
|
seed = 51,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local low_mountains = {
|
||||||
|
['landscape'] = {
|
||||||
|
offset = 30,
|
||||||
|
scale = 20,
|
||||||
|
spread = {x = 25, y = 25, z = 25},
|
||||||
|
seed = 11111,
|
||||||
|
octaves = 4,
|
||||||
|
persistence = 0.5,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
['temp'] = {
|
||||||
|
offset = 5,
|
||||||
|
scale = 15,
|
||||||
|
spread = {x = 30, y = 30, z = 30},
|
||||||
|
seed = 52,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
['humidity'] = {
|
||||||
|
offset = 30,
|
||||||
|
scale = 15,
|
||||||
|
spread = {x = 25, y = 25, z = 25},
|
||||||
|
seed = 53,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local high_mountains = {
|
||||||
|
['landscape'] = {
|
||||||
|
offset = 60,
|
||||||
|
scale = 35,
|
||||||
|
spread = {x = 30, y = 30, z = 30},
|
||||||
|
seed = 22222,
|
||||||
|
octaves = 4,
|
||||||
|
persistence = 0.55,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
['temp'] = {
|
||||||
|
offset = -10,
|
||||||
|
scale = 15,
|
||||||
|
spread = {x = 35, y = 35, z = 35},
|
||||||
|
seed = 54,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
['humidity'] = {
|
||||||
|
offset = 20,
|
||||||
|
scale = 10,
|
||||||
|
spread = {x = 30, y = 30, z = 30},
|
||||||
|
seed = 55,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local highest_peaks = {
|
||||||
|
['landscape'] = {
|
||||||
|
offset = 100,
|
||||||
|
scale = 50,
|
||||||
|
spread = {x = 40, y = 40, z = 40},
|
||||||
|
seed = 33333,
|
||||||
|
octaves = 5,
|
||||||
|
persistence = 0.6,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
['temp'] = {
|
||||||
|
offset = -30,
|
||||||
|
scale = 10,
|
||||||
|
spread = {x = 50, y = 50, z = 50},
|
||||||
|
seed = 56,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
['humidity'] = {
|
||||||
|
offset = 10,
|
||||||
|
scale = 10,
|
||||||
|
spread = {x = 40, y = 40, z = 40},
|
||||||
|
seed = 57,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local rivers = {
|
||||||
|
['landscape'] = {
|
||||||
|
offset = -5,
|
||||||
|
scale = 2,
|
||||||
|
spread = {x = 5, y = 5, z = 100},
|
||||||
|
seed = 44444,
|
||||||
|
octaves = 2,
|
||||||
|
persistence = 0.3,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
['temp'] = {
|
||||||
|
offset = 10,
|
||||||
|
scale = 5,
|
||||||
|
spread = {x = 50, y = 50, z = 50},
|
||||||
|
seed = 58,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
['humidity'] = {
|
||||||
|
offset = 80,
|
||||||
|
scale = 10,
|
||||||
|
spread = {x = 20, y = 20, z = 20},
|
||||||
|
seed = 59,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local lakes = {
|
||||||
|
['landscape'] = {
|
||||||
|
offset = -8,
|
||||||
|
scale = 2,
|
||||||
|
spread = {x = 15, y = 15, z = 15},
|
||||||
|
seed = 55555,
|
||||||
|
octaves = 2,
|
||||||
|
persistence = 0.3,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
['temp'] = {
|
||||||
|
offset = 10,
|
||||||
|
scale = 5,
|
||||||
|
spread = {x = 30, y = 30, z = 30},
|
||||||
|
seed = 60,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
['humidity'] = {
|
||||||
|
offset = 90,
|
||||||
|
scale = 5,
|
||||||
|
spread = {x = 20, y = 20, z = 20},
|
||||||
|
seed = 61,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local rocky_shores = {
|
||||||
|
['landscape'] = {
|
||||||
|
offset = 2,
|
||||||
|
scale = 4,
|
||||||
|
spread = {x = 8, y = 8, z = 8},
|
||||||
|
seed = 66666,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.5,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
['temp'] = {
|
||||||
|
offset = 15,
|
||||||
|
scale = 8,
|
||||||
|
spread = {x = 15, y = 15, z = 15},
|
||||||
|
seed = 62,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
['humidity'] = {
|
||||||
|
offset = 70,
|
||||||
|
scale = 10,
|
||||||
|
spread = {x = 15, y = 15, z = 15},
|
||||||
|
seed = 63,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local rocky_islands = {
|
||||||
|
['landscape'] = {
|
||||||
|
offset = 8,
|
||||||
|
scale = 10,
|
||||||
|
spread = {x = 12, y = 12, z = 12},
|
||||||
|
seed = 77777,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.5,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
['temp'] = {
|
||||||
|
offset = 20,
|
||||||
|
scale = 8,
|
||||||
|
spread = {x = 20, y = 20, z = 20},
|
||||||
|
seed = 64,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
['humidity'] = {
|
||||||
|
offset = 60,
|
||||||
|
scale = 15,
|
||||||
|
spread = {x = 20, y = 20, z = 20},
|
||||||
|
seed = 65,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local swamp_land = {
|
||||||
|
['landscape'] = {
|
||||||
|
offset = 1,
|
||||||
|
scale = 2,
|
||||||
|
spread = {x = 12, y = 12, z = 12},
|
||||||
|
seed = 88888,
|
||||||
|
octaves = 2,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
['temp'] = {
|
||||||
|
offset = 25,
|
||||||
|
scale = 5,
|
||||||
|
spread = {x = 15, y = 15, z = 15},
|
||||||
|
seed = 66,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
['humidity'] = {
|
||||||
|
offset = 85,
|
||||||
|
scale = 10,
|
||||||
|
spread = {x = 15, y = 15, z = 15},
|
||||||
|
seed = 67,
|
||||||
|
octaves = 3,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
local v = vector.new
|
||||||
|
|
||||||
|
for _, c in ipairs({'landscape', 'temp', 'humidity'}) do
|
||||||
|
mapGenerator:registerLayerNoiseColor('midgard', c, '#4978c6', ocean[c])
|
||||||
|
mapGenerator:registerLayerNoiseColor('midgard', c, '#81c948', common_lands[c])
|
||||||
|
mapGenerator:registerLayerNoiseColor('midgard', c, '#187726', foresty_lands[c])
|
||||||
|
mapGenerator:registerLayerNoiseColor('midgard', c, '#357a60', hilly_lands[c])
|
||||||
|
mapGenerator:registerLayerNoiseColor('midgard', c, '#5a7269', low_mountains[c])
|
||||||
|
mapGenerator:registerLayerNoiseColor('midgard', c, '#773b18', high_mountains[c])
|
||||||
|
mapGenerator:registerLayerNoiseColor('midgard', c, '#a3a3a3', highest_peaks[c])
|
||||||
|
mapGenerator:registerLayerNoiseColor('midgard', c, '#182077', rivers[c])
|
||||||
|
mapGenerator:registerLayerNoiseColor('midgard', c, '#06f5ff', lakes[c])
|
||||||
|
mapGenerator:registerLayerNoiseColor('midgard', c, '#677a48', rocky_shores[c])
|
||||||
|
mapGenerator:registerLayerNoiseColor('midgard', c, '#e4dc36', rocky_islands[c])
|
||||||
|
mapGenerator:registerLayerNoiseColor('midgard', c, '#3b7718', swamp_land[c])
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--[[
|
||||||
local land1 = {
|
local land1 = {
|
||||||
offset = -10,
|
offset = -10,
|
||||||
scale = 5,
|
scale = 5,
|
||||||
@@ -145,7 +532,7 @@ mapGenerator:register2DPeaks('midgard',
|
|||||||
v(200, 0, 100),
|
v(200, 0, 100),
|
||||||
v(-300, 0, -200),
|
v(-300, 0, -200),
|
||||||
})--]]
|
})--]]
|
||||||
|
--[[
|
||||||
for _, c in ipairs({'landscape', 'temp', 'humidity'}) do
|
for _, c in ipairs({'landscape', 'temp', 'humidity'}) do
|
||||||
mapGenerator:registerLayerNoiseColor('midgard', c, '#4978c6', land1)
|
mapGenerator:registerLayerNoiseColor('midgard', c, '#4978c6', land1)
|
||||||
mapGenerator:registerLayerNoiseColor('midgard', c, '#77ea72', land2)
|
mapGenerator:registerLayerNoiseColor('midgard', c, '#77ea72', land2)
|
||||||
@@ -168,13 +555,9 @@ for _, c in ipairs({'landscape', 'temp', 'humidity'}) do
|
|||||||
color = '#4978c6',
|
color = '#4978c6',
|
||||||
pos = vector.new(-512, 0, 512)
|
pos = vector.new(-512, 0, 512)
|
||||||
},
|
},
|
||||||
})--]]
|
})
|
||||||
end
|
end
|
||||||
|
--]]
|
||||||
mapGenerator:register2DPeaksFromFile('midgard', 'map.ff', 100,{x=0, y=0}, 'landscape')
|
|
||||||
mapGenerator:register2DPeaksFromFile('midgard', 'map.ff', 150,{x=0, y=0}, 'temp')
|
|
||||||
mapGenerator:register2DPeaksFromFile('midgard', 'map.ff', 200,{x=0, y=0}, 'humidity')
|
|
||||||
|
|
||||||
-- [[
|
-- [[
|
||||||
mapGenerator:registerCavern('midgard', 'cavern1', {
|
mapGenerator:registerCavern('midgard', 'cavern1', {
|
||||||
minY = -48,
|
minY = -48,
|
||||||
@@ -214,7 +597,7 @@ local rocksNoiseParams ={
|
|||||||
lacunarity = 4,
|
lacunarity = 4,
|
||||||
}
|
}
|
||||||
|
|
||||||
local function generateRock(biome, mapGenerator, data, index, x, y, z)
|
local function generateRock(biome, mapGenerator, factors, data, index, x, y, z)
|
||||||
local ids = mapGenerator.nodeIDs
|
local ids = mapGenerator.nodeIDs
|
||||||
|
|
||||||
if rocksNoise == nil then
|
if rocksNoise == nil then
|
||||||
@@ -249,7 +632,7 @@ local function generateRock(biome, mapGenerator, data, index, x, y, z)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---@param biome MapGen.Biome
|
---@param biome MapGen.Biome
|
||||||
local function generateSoil(biome, mapGenerator, data, index, x, y, z)
|
local function generateSoil(biome, mapGenerator, factors, data, index, x, y, z)
|
||||||
local ids = mapGenerator.nodeIDs
|
local ids = mapGenerator.nodeIDs
|
||||||
if rocksNoise == nil then
|
if rocksNoise == nil then
|
||||||
rocksNoise = core.get_value_noise(rocksNoiseParams)
|
rocksNoise = core.get_value_noise(rocksNoiseParams)
|
||||||
@@ -269,7 +652,7 @@ local function generateSoil(biome, mapGenerator, data, index, x, y, z)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---@param biome MapGen.Biome
|
---@param biome MapGen.Biome
|
||||||
local function generateTurf(biome, mapGenerator, data, index, x, y, z)
|
local function generateTurf(biome, mapGenerator, factors, data, index, x, y, z)
|
||||||
local ids = mapGenerator.nodeIDs
|
local ids = mapGenerator.nodeIDs
|
||||||
if rocksNoise == nil then
|
if rocksNoise == nil then
|
||||||
rocksNoise = core.get_value_noise(rocksNoiseParams)
|
rocksNoise = core.get_value_noise(rocksNoiseParams)
|
||||||
@@ -288,6 +671,22 @@ local function generateTurf(biome, mapGenerator, data, index, x, y, z)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param area VoxelArea
|
||||||
|
local function postProcessing(biome, mapGenerator, factors, data, index, x, y, z, nodeType, area)
|
||||||
|
local trufID = biome.groundNodesIDs.turf
|
||||||
|
local waterID = mapGenerator.nodeIDs.water
|
||||||
|
if data[index] ~= trufID then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if (data[area:index(x+1, y, z)] == trufID or data[area:index(x+1, y, z)] == waterID) and
|
||||||
|
(data[area:index(x-1, y, z)] == trufID or data[area:index(x-1, y, z)] == waterID) and
|
||||||
|
(data[area:index(x, y, z+1)] == trufID or data[area:index(x, y, z+1)] == waterID) and
|
||||||
|
(data[area:index(x, y, z-1)] == trufID or data[area:index(x, y, z-1)] == waterID) then
|
||||||
|
data[index] = mapGenerator.nodeIDs.water
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
mapGenerator:registerBiome('midgard', 'swamp', {
|
mapGenerator:registerBiome('midgard', 'swamp', {
|
||||||
tempPoint = 0,
|
tempPoint = 0,
|
||||||
humidityPoint = 80,
|
humidityPoint = 80,
|
||||||
@@ -303,6 +702,7 @@ mapGenerator:registerBiome('midgard', 'swamp', {
|
|||||||
generateRock = generateRock,
|
generateRock = generateRock,
|
||||||
generateTurf = generateTurf,
|
generateTurf = generateTurf,
|
||||||
generateSoil = generateSoil,
|
generateSoil = generateSoil,
|
||||||
|
postProcessing = postProcessing
|
||||||
})
|
})
|
||||||
|
|
||||||
return mapGenerator
|
return mapGenerator
|
||||||
BIN
mods/ENVIRONMENT/mapGenerator/textures/maps/map.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
@@ -1,3 +1,3 @@
|
|||||||
name = smc__game__items__items_loader
|
name = smc__game__items__items_loader
|
||||||
description = Include this mod in your `depends` to ensure all items are registered
|
description = Include this mod in your `depends` to ensure all items are registered
|
||||||
depends = smc__game__items__rocks, smc__game__items__wood, smc__game__items__soils, smc__game__items__liquids
|
depends = smc__game__items__rocks, smc__game__items__wood, smc__game__items__soils, smc__game__items__liquids, smc__game__items__plants
|
||||||
|
|||||||
23
mods/GAME/ITEMS/equipment/init.lua
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
local Item, TileSheet = Smc.requireItem(), Smc.requireTileSheet()
|
||||||
|
|
||||||
|
local EquipTileSheet = TileSheet:new('equipment_sheet.png', 16, 16)
|
||||||
|
|
||||||
|
Item:new({
|
||||||
|
settings = {
|
||||||
|
name = 'test_helmet',
|
||||||
|
inventory_image = EquipTileSheet:t(0, 0),
|
||||||
|
groups = {
|
||||||
|
equip_head = 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
Item:new({
|
||||||
|
settings = {
|
||||||
|
name = 'test_armor',
|
||||||
|
inventory_image = EquipTileSheet:t(1, 0),
|
||||||
|
groups = {
|
||||||
|
equip_torso = 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
2
mods/GAME/ITEMS/equipment/mod.conf
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
name = smc__game__items__equipment
|
||||||
|
depends = smc__core__item
|
||||||
BIN
mods/GAME/ITEMS/equipment/textures/sheets/equipment_sheet.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
35
mods/GAME/ITEMS/essences/init.lua
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
local Item, TileSheet = Smc.requireItem(), Smc.requireTileSheet()
|
||||||
|
|
||||||
|
---@type Item.ItemDefinition
|
||||||
|
local defaultEssenceDef = {
|
||||||
|
settings = {
|
||||||
|
name = '',
|
||||||
|
_rarity = 'uncommon',
|
||||||
|
stack_max = 32,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
local defaultEssence = Item:getExtended(defaultEssenceDef)
|
||||||
|
|
||||||
|
local ts = TileSheet:new('essences_sheet.png', 16, 16)
|
||||||
|
|
||||||
|
defaultEssence:new({
|
||||||
|
settings = {
|
||||||
|
name = 'essence_experience',
|
||||||
|
inventory_image = ts:t(0, 0)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
defaultEssence:new({
|
||||||
|
settings = {
|
||||||
|
name = 'essence_spell',
|
||||||
|
inventory_image = ts:t(1, 0)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
defaultEssence:new({
|
||||||
|
settings = {
|
||||||
|
name = 'essence_life',
|
||||||
|
inventory_image = ts:t(2, 0)
|
||||||
|
}
|
||||||
|
})
|
||||||
10
mods/GAME/ITEMS/essences/locale/essences.ru.tr
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# textdomain: essences
|
||||||
|
|
||||||
|
essence_experience-title=Эссенция опыта
|
||||||
|
essence_experience-desc=Сгусток желеобразной материи,@nзаключающий в себе ремесленный опыт.
|
||||||
|
|
||||||
|
essence_spell-title=Эссенция заклятия
|
||||||
|
essence_spell-desc=Сгусток желеобразной материи,@nзаключающий в себе мистическую силу.
|
||||||
|
|
||||||
|
essence_life-title=Эссенция жизни
|
||||||
|
essence_life-desc=Сгусток желеобразной материи,@nзаключающий в себе жизненную энергию.
|
||||||
2
mods/GAME/ITEMS/essences/mod.conf
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
name = smc__game__items__essences
|
||||||
|
depends = smc__core__item
|
||||||
BIN
mods/GAME/ITEMS/essences/textures/sheets/essences_sheet.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
@@ -1,5 +1,4 @@
|
|||||||
---@type Node
|
local Node = Smc.requireNode()
|
||||||
local Node = Mod.getInfo('smc__core__node').require('Node')
|
|
||||||
|
|
||||||
---@type Node.NodeDefinition
|
---@type Node.NodeDefinition
|
||||||
local defaultLiquidDef = {
|
local defaultLiquidDef = {
|
||||||
|
|||||||
@@ -1,10 +1,4 @@
|
|||||||
local modInfo = Mod.getInfo('smc__core__plant')
|
local Plant, TileSheet = Smc.requirePlant(), Smc.requireTileSheet()
|
||||||
|
|
||||||
---@type TileSheet
|
|
||||||
local TileSheet = Mod.getInfo('smc__core__tilesheet').require('TileSheet')
|
|
||||||
|
|
||||||
---@type Plant
|
|
||||||
local Plant = modInfo.require('Plant')
|
|
||||||
|
|
||||||
Plant:new({
|
Plant:new({
|
||||||
settings = {
|
settings = {
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |