diff --git a/docs/docs/index.md b/docs/docs/index.md new file mode 100644 index 0000000..ffb2dd9 --- /dev/null +++ b/docs/docs/index.md @@ -0,0 +1,54 @@ +# index + + +## Types + +- [alias Category](types/MapGen.Layer.Category.md) +- [alias CircumCircleEnum](types/MapGen.Triangle.CircumCircleEnum.md) +- [alias ColoredDotsTable](types/ColoredDotsTable.md) +- [alias Neighbours](types/MapGen.Triangle.Neighbours.md) +- [alias PastCalcNoiseValue](types/MapGen.PastCalcNoiseValue.md) +- [alias generateFunc](types/generateFunc.md) +- [class Biome](types/MapGen.Biome.md) +- [class BiomeDef](types/MapGen.BiomeDef.md) +- [class Cavern](types/MapGen.Cavern.md) +- [class CavernDef](types/MapGen.CavernDef.md) +- [class Decoration](types/MapGen.Decoration.md) +- [class Edge](types/MapGen.Triangulation.Edge.md) +- [class FakePeak](types/MapGen.Triangulation.FakePeak.md) +- [class GroundNodes](types/MapGen.Biome.GroundNodes.md) +- [class GroundNodesIDs](types/MapGen.Biome.GroundNodesIDs.md) +- [class Layer](types/MapGen.Layer.md) +- [class LayerDef](types/MapGen.LayerDef.md) +- [class MapGen](types/MapGen.md) +- [class MapGenDef](types/MapGenDef.md) +- [class Peak](types/MapGen.Peak.md) +- [class PeakDef](types/MapGen.PeakDef.md) +- [class StaticLayer](types/MapGen.StaticLayer.md) +- [class StaticLayerDef](types/MapGen.StaticLayerDef.md) +- [class Tetrahedron](types/MapGen.Tetrahedron.md) +- [class Triangle](types/MapGen.Triangle.md) +- [class Triangulation](types/MapGen.Triangulation.md) + + + +## Modules +- [MapGen](modules/MapGen.md) +- [MapGen.Biome](modules/MapGen.Biome.md) +- [MapGen.Biome.GroundNodes](modules/MapGen.Biome.GroundNodes.md) +- [MapGen.Biome.GroundNodesIds](modules/MapGen.Biome.GroundNodesIds.md) +- [MapGen.Cavern](modules/MapGen.Cavern.md) +- [MapGen.Decoration](modules/MapGen.Decoration.md) +- [MapGen.Layer](modules/MapGen.Layer.md) +- [MapGen.Peak](modules/MapGen.Peak.md) +- [MapGen.StaticLayer](modules/MapGen.StaticLayer.md) +- [MapGen.Tetrahedron](modules/MapGen.Tetrahedron.md) +- [MapGen.Triangle](modules/MapGen.Triangle.md) +- [MapGen.Triangulation](modules/MapGen.Triangulation.md) +- [MapGen.Triangulation.Edge](modules/MapGen.Triangulation.Edge.md) +- [MapGen.Triangulation.FakePeak](modules/MapGen.Triangulation.FakePeak.md) +- [MapGen.ff2luat](modules/MapGen.ff2luat.md) + + + + diff --git a/docs/docs/modules/MapGen.Biome.GroundNodes.md b/docs/docs/modules/MapGen.Biome.GroundNodes.md new file mode 100644 index 0000000..f8f4a64 --- /dev/null +++ b/docs/docs/modules/MapGen.Biome.GroundNodes.md @@ -0,0 +1,85 @@ +# global MapGen.Biome.GroundNodes + + + + + + + + +--- + + + +## fields +--- + +### GroundNodes.turf +--- +```lua +GroundNodes.turf : string +``` + + + +The soil covering the surface of the biome + + + + + + + + +### GroundNodes.soil +--- +```lua +GroundNodes.soil : string +``` + + + +The soil beneath the turf. The height of this layer depends on `Biome.soilHeight` + + + + + + + + +### GroundNodes.rock +--- +```lua +GroundNodes.rock : string +``` + + + +The rock found beneath the soil of a biome. + + + + + + + + +### GroundNodes.bottom +--- +```lua +GroundNodes.bottom : string +``` + + + +Covering the bottom of reservoirs. + + + + + + + + + diff --git a/docs/docs/modules/MapGen.Biome.GroundNodesIds.md b/docs/docs/modules/MapGen.Biome.GroundNodesIds.md new file mode 100644 index 0000000..04459a2 --- /dev/null +++ b/docs/docs/modules/MapGen.Biome.GroundNodesIds.md @@ -0,0 +1,85 @@ +# global MapGen.Biome.GroundNodesIds + + + + + + + + +--- + + + +## fields +--- + +### GroundNodesIDs.turf +--- +```lua +GroundNodesIDs.turf : number +``` + + + +The soil covering the surface of the biome + + + + + + + + +### GroundNodesIDs.soil +--- +```lua +GroundNodesIDs.soil : number +``` + + + +The soil beneath the turf. The height of this layer depends on `Biome.soilHeight` + + + + + + + + +### GroundNodesIDs.rock +--- +```lua +GroundNodesIDs.rock : number +``` + + + +The rock found beneath the soil of a biome. + + + + + + + + +### GroundNodesIDs.bottom +--- +```lua +GroundNodesIDs.bottom : number +``` + + + +Covering the bottom of reservoirs. + + + + + + + + + diff --git a/docs/docs/modules/MapGen.Biome.md b/docs/docs/modules/MapGen.Biome.md new file mode 100644 index 0000000..81c7056 --- /dev/null +++ b/docs/docs/modules/MapGen.Biome.md @@ -0,0 +1,307 @@ +# global MapGen.Biome + + + + + + + + +--- + +## methods +--- + +### Biome.new +--- +```lua +function Biome.new( + name: string, + def: MapGen.BiomeDef { + tempPoint = number, + humidityPoint = number, + minY = number, + maxY = number, + groundNodes = MapGen.Biome.GroundNodes, + soilHeight = number, + generateAir = generateFunc?, + generateCavernAir = generateFunc?, + generateWater = generateFunc?, + generateRock = generateFunc?, + generateTurf = generateFunc?, + generateSoil = generateFunc?, + generateBottom = generateFunc?, +} +) -> MapGen.Biome { + name = string, + tempPoint = number, + humidityPoint = number, + minY = number, + maxY = number, + groundNodes = MapGen.Biome.GroundNodes, + groundNodesIDs = MapGen.Biome.GroundNodesIDs, + soilHeight = number, + generateAir = generateFunc, + generateCavernAir = generateFunc, + generateWater = generateFunc, + generateRock = generateFunc, + generateTurf = generateFunc, + generateSoil = generateFunc, + generateBottom = generateFunc, + new = function, +} +``` + + + + + + + + + + + + + + + +## fields +--- + +### Biome.name +--- +```lua +Biome.name : string +``` + + + + + + + + + + +### Biome.tempPoint +--- +```lua +Biome.tempPoint : number +``` + + + + + + + + + + +### Biome.humidityPoint +--- +```lua +Biome.humidityPoint : number +``` + + + + + + + + + + +### Biome.minY +--- +```lua +Biome.minY : number +``` + + + + + + + + + + +### Biome.maxY +--- +```lua +Biome.maxY : number +``` + + + + + + + + + + +### Biome.groundNodes +--- +```lua +Biome.groundNodes : MapGen.Biome.GroundNodes { + turf: string, + soil: string, + rock: string, + bottom: string, +} +``` + + + + + + + + + + +### Biome.groundNodesIDs +--- +```lua +Biome.groundNodesIDs : MapGen.Biome.GroundNodesIDs { + turf: number, + soil: number, + rock: number, + bottom: number, +} +``` + + + + + + + + + + +### Biome.soilHeight +--- +```lua +Biome.soilHeight : number +``` + + + + + + + + + + +### Biome.generateAir +--- +```lua +Biome.generateAir : generateFunc +``` + + + + + + + + + + +### Biome.generateCavernAir +--- +```lua +Biome.generateCavernAir : generateFunc +``` + + + + + + + + + + +### Biome.generateWater +--- +```lua +Biome.generateWater : generateFunc +``` + + + + + + + + + + +### Biome.generateRock +--- +```lua +Biome.generateRock : generateFunc +``` + + + + + + + + + + +### Biome.generateTurf +--- +```lua +Biome.generateTurf : generateFunc +``` + + + + + + + + + + +### Biome.generateSoil +--- +```lua +Biome.generateSoil : generateFunc +``` + + + + + + + + + + +### Biome.generateBottom +--- +```lua +Biome.generateBottom : generateFunc +``` + + + + + + + + + + + diff --git a/docs/docs/modules/MapGen.Cavern.md b/docs/docs/modules/MapGen.Cavern.md new file mode 100644 index 0000000..5005de3 --- /dev/null +++ b/docs/docs/modules/MapGen.Cavern.md @@ -0,0 +1,203 @@ +# global MapGen.Cavern + + + + + + + + +--- + +## methods +--- + +### Cavern.getNoise +--- +```lua +function Cavern.getNoise()-> ValueNoise +``` + + + + + + + + + + +### Cavern.initNoise +--- +```lua +function Cavern.initNoise()-> nil +``` + + + + + + + + + + +### Cavern.getGroups +--- +```lua +function Cavern.getGroups() +-> table +``` + + + + + + + + + + +### Cavern.new +--- +```lua +function Cavern.new( + name: string, + def: MapGen.CavernDef { + minY = number, + maxY = number, + noiseParams = NoiseParams, + smoothDistance = number, + threshold = number?, + groups = table?, +} +) -> 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 +``` + + + + + + + + + + + diff --git a/docs/docs/modules/MapGen.Decoration.md b/docs/docs/modules/MapGen.Decoration.md new file mode 100644 index 0000000..d35f494 --- /dev/null +++ b/docs/docs/modules/MapGen.Decoration.md @@ -0,0 +1,36 @@ +# global MapGen.Decoration + + + + + + + + +--- + +## methods +--- + +### Decoration.new +--- +```lua +function Decoration.new() -> MapGen.Decoration { + new = function, +} +``` + + + + + + + + + + + + + + + diff --git a/docs/docs/modules/MapGen.Layer.md b/docs/docs/modules/MapGen.Layer.md new file mode 100644 index 0000000..d961e29 --- /dev/null +++ b/docs/docs/modules/MapGen.Layer.md @@ -0,0 +1,673 @@ +# global MapGen.Layer + + + + + + + + +--- + +## methods +--- + +### Layer.calcTemp +--- +```lua +function Layer.calcTemp( + self: MapGen.Layer { + name = string, + minY = integer, + maxY = integer, + minTemp = integer, + maxTemp = integer, + minHumidity = integer, + maxHumidity = integer, + waterLevel = integer, + peaksList = { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] }, + noisesByColor = { humidity: table, landscape: table, temp: table }, + noisesParamsByColor = { humidity: table, landscape: table, temp: table }, + biomesByName = table, + biomesList = MapGen.Biome[], + biomesDiagram = table, + biomesGorizontalScattering = integer, + biomesVerticalScattering = integer, + cavernsByName = table, + 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, landscape: table, temp: table }, + noisesParamsByColor = { humidity: table, landscape: table, temp: table }, + biomesByName = table, + biomesList = MapGen.Biome[], + biomesDiagram = table, + biomesGorizontalScattering = integer, + biomesVerticalScattering = integer, + cavernsByName = table, + 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, landscape: table, temp: table }, + noisesParamsByColor = { humidity: table, landscape: table, temp: table }, + biomesByName = table, + biomesList = MapGen.Biome[], + biomesDiagram = table, + biomesGorizontalScattering = integer, + biomesVerticalScattering = integer, + cavernsByName = table, + 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, landscape: table, temp: table } +``` + + + + + + + + + + +### Layer.noisesParamsByColor +--- +```lua +Layer.noisesParamsByColor : { humidity: table, landscape: table, temp: table } +``` + + + + + + + + + + +### Layer.biomesByName +--- +```lua +Layer.biomesByName : table +``` + + + + + + + + + + +### 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 +``` + + + + + + + + + + +### 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** + + + + + + + + + diff --git a/docs/docs/modules/MapGen.Peak.md b/docs/docs/modules/MapGen.Peak.md new file mode 100644 index 0000000..ffad179 --- /dev/null +++ b/docs/docs/modules/MapGen.Peak.md @@ -0,0 +1,157 @@ +# global MapGen.Peak + + + + + + + + +--- + +## methods +--- + +### Peak.getPeakPos +--- +```lua +function Peak.getPeakPos(self)-> vector +``` + + + + + + + + + + +### Peak.getColor +--- +```lua +function Peak.getColor(self)-> ColorString +``` + + + + + + + + + + +### Peak.getGroups +--- +```lua +function Peak.getGroups(self) +-> table +``` + + + + + + + + + + +### Peak.new +--- +```lua +function Peak.new(def: MapGen.PeakDef { + pos = vector, + color = ColorString, + groups = table?, +}) -> 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 +``` + + + + + + + + + + + diff --git a/docs/docs/modules/MapGen.StaticLayer.md b/docs/docs/modules/MapGen.StaticLayer.md new file mode 100644 index 0000000..4081d6e --- /dev/null +++ b/docs/docs/modules/MapGen.StaticLayer.md @@ -0,0 +1,144 @@ +# global MapGen.StaticLayer + + + + + + + + +--- + +## methods +--- + +### StaticLayer.new +--- +```lua +function StaticLayer.new( + name: string, + def: MapGen.StaticLayerDef { + minY = number, + maxY = number, + staticNode = string, + generateStaticNode = generateFunc, +} +) -> MapGen.StaticLayer { + name = string, + minY = number, + maxY = number, + staticNode = string, + staticNodeID = number, + generateStaticNode = generateFunc, + new = function, +} +``` + + + + + + + + + + + + + + + +## fields +--- + +### StaticLayer.name +--- +```lua +StaticLayer.name : string +``` + + + + + + + + + + +### StaticLayer.minY +--- +```lua +StaticLayer.minY : number +``` + + + + + + + + + + +### StaticLayer.maxY +--- +```lua +StaticLayer.maxY : number +``` + + + + + + + + + + +### StaticLayer.staticNode +--- +```lua +StaticLayer.staticNode : string +``` + + + + + + + + + + +### StaticLayer.staticNodeID +--- +```lua +StaticLayer.staticNodeID : number +``` + + + + + + + + + + +### StaticLayer.generateStaticNode +--- +```lua +StaticLayer.generateStaticNode : generateFunc +``` + + + + + + + + + + + diff --git a/docs/docs/modules/MapGen.Tetrahedron.md b/docs/docs/modules/MapGen.Tetrahedron.md new file mode 100644 index 0000000..cf1e0c2 --- /dev/null +++ b/docs/docs/modules/MapGen.Tetrahedron.md @@ -0,0 +1,536 @@ +# global MapGen.Tetrahedron + + + + + + + + +--- + +## methods +--- + +### Tetrahedron.new +--- +```lua +function Tetrahedron.new( + p1: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}, + p2: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}, + p3: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}, + p4: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +} +) -> MapGen.Tetrahedron { + p1 = MapGen.Peak, + p2 = MapGen.Peak, + p3 = MapGen.Peak, + p4 = MapGen.Peak, + h1 = MapGen.Triangulation.Edge, + h2 = MapGen.Triangulation.Edge, + h3 = MapGen.Triangulation.Edge, + h4 = MapGen.Triangulation.Edge, + f1 = MapGen.Triangle, + f2 = MapGen.Triangle, + f3 = MapGen.Triangle, + f4 = MapGen.Triangle, + new = function, + toString = function, + getHeight = function, + getCircumSphereCenter = function, + getCircumSphereRadius = function, + inCircumSphere = function, +} +``` + + + + + + + + + + + + +### Tetrahedron.toString +--- +```lua +function Tetrahedron.toString() -> string +``` + + + + + +Returns a string describing the object in a readable form. + + + + + + + + +### Tetrahedron.getHeight +--- +```lua +function Tetrahedron.getHeight( + p1: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}, + p2: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}, + p3: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}, + p4: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +} +) -> MapGen.Triangulation.Edge? +``` + + + + + + + + + + + + +### Tetrahedron.getCircumSphereCenter +--- +```lua +function Tetrahedron.getCircumSphereCenter() -> vector +``` + + + + + +Returns the center of the circumscribed sphere. + + + + + + + + +### Tetrahedron.getCircumSphereRadius +--- +```lua +function Tetrahedron.getCircumSphereRadius() -> number +``` + + + + + +Returns the radius of the circumscribed sphere. + + + + + + + + +### Tetrahedron.inCircumSphere +--- +```lua +function Tetrahedron.inCircumSphere(p: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}) -> boolean +``` + + + + + +Checks whether a given point lies within the circumscribed sphere of a tetrahedron. + + + + + + + + + + + +## fields +--- + +### Tetrahedron.p1 +--- +```lua +Tetrahedron.p1 : MapGen.Peak { + id: number, + getPeakPos: function, + getColor: function, + getGroups: function, + new: function, + toString: function, + eq: function, +} +``` + + + + + + + + + + +### Tetrahedron.p2 +--- +```lua +Tetrahedron.p2 : MapGen.Peak { + id: number, + getPeakPos: function, + getColor: function, + getGroups: function, + new: function, + toString: function, + eq: function, +} +``` + + + + + + + + + + +### Tetrahedron.p3 +--- +```lua +Tetrahedron.p3 : MapGen.Peak { + id: number, + getPeakPos: function, + getColor: function, + getGroups: function, + new: function, + toString: function, + eq: function, +} +``` + + + + + + + + + + +### Tetrahedron.p4 +--- +```lua +Tetrahedron.p4 : MapGen.Peak { + id: number, + getPeakPos: function, + getColor: function, + getGroups: function, + new: function, + toString: function, + eq: function, +} +``` + + + + + + + + + + +### Tetrahedron.h1 +--- +```lua +Tetrahedron.h1 : MapGen.Triangulation.Edge { + p1: MapGen.Peak, + p2: MapGen.Peak, + new: function, + toString: function, + eq: function, + same: function, + length: function, + getMidPoint: function, +} +``` + + + + + + + + + + +### Tetrahedron.h2 +--- +```lua +Tetrahedron.h2 : MapGen.Triangulation.Edge { + p1: MapGen.Peak, + p2: MapGen.Peak, + new: function, + toString: function, + eq: function, + same: function, + length: function, + getMidPoint: function, +} +``` + + + + + + + + + + +### Tetrahedron.h3 +--- +```lua +Tetrahedron.h3 : MapGen.Triangulation.Edge { + p1: MapGen.Peak, + p2: MapGen.Peak, + new: function, + toString: function, + eq: function, + same: function, + length: function, + getMidPoint: function, +} +``` + + + + + + + + + + +### Tetrahedron.h4 +--- +```lua +Tetrahedron.h4 : MapGen.Triangulation.Edge { + p1: MapGen.Peak, + p2: MapGen.Peak, + new: function, + toString: function, + eq: function, + same: function, + length: function, + getMidPoint: function, +} +``` + + + + + + + + + + +### Tetrahedron.f1 +--- +```lua +Tetrahedron.f1 : MapGen.Triangle { + p1: MapGen.Peak, + p2: MapGen.Peak, + p3: MapGen.Peak, + e1: MapGen.Triangulation.Edge, + e2: MapGen.Triangulation.Edge, + e3: MapGen.Triangulation.Edge, + h1: MapGen.Triangulation.Edge, + h2: MapGen.Triangulation.Edge, + h3: MapGen.Triangulation.Edge, + neighbours: MapGen.Triangle.Neighbours, + color: ColorString?, + new: function, + ...(+13) +} +``` + + + + + + + + + + +### Tetrahedron.f2 +--- +```lua +Tetrahedron.f2 : MapGen.Triangle { + p1: MapGen.Peak, + p2: MapGen.Peak, + p3: MapGen.Peak, + e1: MapGen.Triangulation.Edge, + e2: MapGen.Triangulation.Edge, + e3: MapGen.Triangulation.Edge, + h1: MapGen.Triangulation.Edge, + h2: MapGen.Triangulation.Edge, + h3: MapGen.Triangulation.Edge, + neighbours: MapGen.Triangle.Neighbours, + color: ColorString?, + new: function, + ...(+13) +} +``` + + + + + + + + + + +### Tetrahedron.f3 +--- +```lua +Tetrahedron.f3 : MapGen.Triangle { + p1: MapGen.Peak, + p2: MapGen.Peak, + p3: MapGen.Peak, + e1: MapGen.Triangulation.Edge, + e2: MapGen.Triangulation.Edge, + e3: MapGen.Triangulation.Edge, + h1: MapGen.Triangulation.Edge, + h2: MapGen.Triangulation.Edge, + h3: MapGen.Triangulation.Edge, + neighbours: MapGen.Triangle.Neighbours, + color: ColorString?, + new: function, + ...(+13) +} +``` + + + + + + + + + + +### Tetrahedron.f4 +--- +```lua +Tetrahedron.f4 : MapGen.Triangle { + p1: MapGen.Peak, + p2: MapGen.Peak, + p3: MapGen.Peak, + e1: MapGen.Triangulation.Edge, + e2: MapGen.Triangulation.Edge, + e3: MapGen.Triangulation.Edge, + h1: MapGen.Triangulation.Edge, + h2: MapGen.Triangulation.Edge, + h3: MapGen.Triangulation.Edge, + neighbours: MapGen.Triangle.Neighbours, + color: ColorString?, + new: function, + ...(+13) +} +``` + + + + + + + + + + + diff --git a/docs/docs/modules/MapGen.Triangle.md b/docs/docs/modules/MapGen.Triangle.md new file mode 100644 index 0000000..9e883ec --- /dev/null +++ b/docs/docs/modules/MapGen.Triangle.md @@ -0,0 +1,745 @@ +# global MapGen.Triangle + + + + + + + + +--- + +## methods +--- + +### Triangle.new +--- +```lua +function Triangle.new( + p1: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}, + p2: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}, + p3: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +} +) -> MapGen.Triangle { + p1 = MapGen.Peak, + p2 = MapGen.Peak, + p3 = MapGen.Peak, + e1 = MapGen.Triangulation.Edge, + e2 = MapGen.Triangulation.Edge, + e3 = MapGen.Triangulation.Edge, + h1 = MapGen.Triangulation.Edge, + h2 = MapGen.Triangulation.Edge, + h3 = MapGen.Triangulation.Edge, + neighbours = MapGen.Triangle.Neighbours, + color = ColorString?, + new = function, + toString = function, + eq = function, + same = function, + getCenter = function, + getArea = function, + getHeight = function, + getHeight2D = function, + getSidesLength = function, + getSidesLength2D = function, + getCircumCenter2D = function, + getCircumRadius2D = function, + getCircumCircle2D = function, + inCircumCircle2D = function, +} +``` + + + + + + + + + + + + +### Triangle.toString +--- +```lua +function Triangle.toString() -> string +``` + + + + + +Returns a string describing the object in a readable form. + + + + + + + + +### Triangle.eq +--- +```lua +function Triangle.eq(other: MapGen.Triangle { + p1 = MapGen.Peak, + p2 = MapGen.Peak, + p3 = MapGen.Peak, + e1 = MapGen.Triangulation.Edge, + e2 = MapGen.Triangulation.Edge, + e3 = MapGen.Triangulation.Edge, + h1 = MapGen.Triangulation.Edge, + h2 = MapGen.Triangulation.Edge, + h3 = MapGen.Triangulation.Edge, + neighbours = MapGen.Triangle.Neighbours, + color = ColorString?, + new = function, + toString = function, + eq = function, + same = function, + getCenter = function, + getArea = function, + getHeight = function, + getHeight2D = function, + getSidesLength = function, + getSidesLength2D = function, + getCircumCenter2D = function, + getCircumRadius2D = function, + getCircumCircle2D = function, + inCircumCircle2D = function, +}) -> boolean +``` + + + + + +Returns true if the triangles are equivalent. + + + + + + + + +### Triangle.same +--- +```lua +function Triangle.same(other: MapGen.Triangle { + p1 = MapGen.Peak, + p2 = MapGen.Peak, + p3 = MapGen.Peak, + e1 = MapGen.Triangulation.Edge, + e2 = MapGen.Triangulation.Edge, + e3 = MapGen.Triangulation.Edge, + h1 = MapGen.Triangulation.Edge, + h2 = MapGen.Triangulation.Edge, + h3 = MapGen.Triangulation.Edge, + neighbours = MapGen.Triangle.Neighbours, + color = ColorString?, + new = function, + toString = function, + eq = function, + same = function, + getCenter = function, + getArea = function, + getHeight = function, + getHeight2D = function, + getSidesLength = function, + getSidesLength2D = function, + getCircumCenter2D = function, + getCircumRadius2D = function, + getCircumCircle2D = function, + inCircumCircle2D = function, +}) -> boolean +``` + + + + + +Returns true if the triangles are similar. + + + + + + + + +### Triangle.getCenter +--- +```lua +function Triangle.getCenter() -> vector +``` + + + + + +Returns the coordinates of the triangle's center. + + + + + + + + +### Triangle.getArea +--- +```lua +function Triangle.getArea() -> number +``` + + + + + +Returns the area of a triangle. + + + + + + + + +### Triangle.getHeight +--- +```lua +function Triangle.getHeight( + p1: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}, + p2: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}, + p3: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +} +) -> MapGen.Triangulation.Edge { + p1 = MapGen.Peak, + p2 = MapGen.Peak, + new = function, + toString = function, + eq = function, + same = function, + length = function, + getMidPoint = function, +} +``` + + + + + +Returns the perpendicular from the vertex Peak1 to the line Peak2-Peak3. + + + + + + + + +### Triangle.getHeight2D +--- +```lua +function Triangle.getHeight2D( + p1: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}, + p2: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}, + p3: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +} +) -> MapGen.Triangulation.Edge { + p1 = MapGen.Peak, + p2 = MapGen.Peak, + new = function, + toString = function, + eq = function, + same = function, + length = function, + getMidPoint = function, +} +``` + + + + + +Returns the perpendicular from the vertex Peak1 to the line Peak2-Peak3. + +Note: This function does not take into account the Y-coordinate, +that is, the calculation is performed on the projection of the triangle XZ. + + + + + + + + +### Triangle.getSidesLength +--- +```lua +function Triangle.getSidesLength() + -> number + -> number + -> number + +``` + + + + + +Returns the length of the edges + + + + + + + + +### Triangle.getSidesLength2D +--- +```lua +function Triangle.getSidesLength2D() + -> number + -> number + -> number + +``` + + + + + +Returns the length of the edges. + +Note: This function does not take into account the Y-coordinate, +that is, the calculation is performed on the projection of the triangle XZ. + + + + + + + + +### Triangle.getCircumCenter2D +--- +```lua +function Triangle.getCircumCenter2D() -> vector +``` + + + + + +Returns the coordinates of the circumcircle center. + +Note: This function does not take into account the Y-coordinate, +that is, the calculation is performed on the projection of the triangle XZ. + + + + + + + + +### Triangle.getCircumRadius2D +--- +```lua +function Triangle.getCircumRadius2D() -> number +``` + + + + + +Returns the radius of the circumcircle. + +Note: This function does not take into account the Y-coordinate, +that is, the calculation is performed on the projection of the triangle XZ. + + + + + + + + +### Triangle.getCircumCircle2D +--- +```lua +function Triangle.getCircumCircle2D() + -> vector + -> number + +``` + + + + + +Returns the coordinates of the circumcircle center and its radius. + +Note: This function does not take into account the Y-coordinate, +that is, the calculation is performed on the projection of the triangle XZ. + + + + + + + + +### Triangle.inCircumCircle2D +--- +```lua +function Triangle.inCircumCircle2D(p: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}) -> boolean +``` + + + + + +Checks if a given point lies into the triangle circumcircle. + +Note: This function does not take into account the Y-coordinate, +that is, the calculation is performed on the projection of the triangle XZ. + + + + + + + + + + + +## fields +--- + +### Triangle.p1 +--- +```lua +Triangle.p1 : MapGen.Peak { + id: number, + getPeakPos: function, + getColor: function, + getGroups: function, + new: function, + toString: function, + eq: function, +} +``` + + + + + + + + + + +### Triangle.p2 +--- +```lua +Triangle.p2 : MapGen.Peak { + id: number, + getPeakPos: function, + getColor: function, + getGroups: function, + new: function, + toString: function, + eq: function, +} +``` + + + + + + + + + + +### Triangle.p3 +--- +```lua +Triangle.p3 : MapGen.Peak { + id: number, + getPeakPos: function, + getColor: function, + getGroups: function, + new: function, + toString: function, + eq: function, +} +``` + + + + + + + + + + +### Triangle.e1 +--- +```lua +Triangle.e1 : MapGen.Triangulation.Edge { + p1: MapGen.Peak, + p2: MapGen.Peak, + new: function, + toString: function, + eq: function, + same: function, + length: function, + getMidPoint: function, +} +``` + + + + + + + + + + +### Triangle.e2 +--- +```lua +Triangle.e2 : MapGen.Triangulation.Edge { + p1: MapGen.Peak, + p2: MapGen.Peak, + new: function, + toString: function, + eq: function, + same: function, + length: function, + getMidPoint: function, +} +``` + + + + + + + + + + +### Triangle.e3 +--- +```lua +Triangle.e3 : MapGen.Triangulation.Edge { + p1: MapGen.Peak, + p2: MapGen.Peak, + new: function, + toString: function, + eq: function, + same: function, + length: function, + getMidPoint: function, +} +``` + + + + + + + + + + +### Triangle.h1 +--- +```lua +Triangle.h1 : MapGen.Triangulation.Edge { + p1: MapGen.Peak, + p2: MapGen.Peak, + new: function, + toString: function, + eq: function, + same: function, + length: function, + getMidPoint: function, +} +``` + + + + + + + + + + +### Triangle.h2 +--- +```lua +Triangle.h2 : MapGen.Triangulation.Edge { + p1: MapGen.Peak, + p2: MapGen.Peak, + new: function, + toString: function, + eq: function, + same: function, + length: function, + getMidPoint: function, +} +``` + + + + + + + + + + +### Triangle.h3 +--- +```lua +Triangle.h3 : MapGen.Triangulation.Edge { + p1: MapGen.Peak, + p2: MapGen.Peak, + new: function, + toString: function, + eq: function, + same: function, + length: function, + getMidPoint: function, +} +``` + + + + + + + + + + +### Triangle.neighbours +--- +```lua +Triangle.neighbours : MapGen.Triangle.Neighbours +``` + + + + + + + + + + +### Triangle.color +--- +```lua +Triangle.color : ColorString? +``` + + + + + + + + + + + diff --git a/docs/docs/modules/MapGen.Triangulation.Edge.md b/docs/docs/modules/MapGen.Triangulation.Edge.md new file mode 100644 index 0000000..ad9a728 --- /dev/null +++ b/docs/docs/modules/MapGen.Triangulation.Edge.md @@ -0,0 +1,225 @@ +# global MapGen.Triangulation.Edge + + + + + + + + +--- + +## methods +--- + +### Edge.new +--- +```lua +function Edge.new( + p1: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}, + p2: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +} +) -> MapGen.Triangulation.Edge { + p1 = MapGen.Peak, + p2 = MapGen.Peak, + new = function, + toString = function, + eq = function, + same = function, + length = function, + getMidPoint = function, +} +``` + + + + + + + + + + + + +### Edge.toString +--- +```lua +function Edge.toString() -> string +``` + + + + + +Returns a string describing the object in a readable form. + + + + + + + + +### Edge.eq +--- +```lua +function Edge.eq(other: MapGen.Triangulation.Edge { + p1 = MapGen.Peak, + p2 = MapGen.Peak, + new = function, + toString = function, + eq = function, + same = function, + length = function, + getMidPoint = function, +}) -> boolean +``` + + + + + +Returns true if the edges are equivalent. + + + + + + + + +### Edge.same +--- +```lua +function Edge.same(other: MapGen.Triangulation.Edge { + p1 = MapGen.Peak, + p2 = MapGen.Peak, + new = function, + toString = function, + eq = function, + same = function, + length = function, + getMidPoint = function, +}) -> boolean +``` + + + + + +Returns true if the edges are similar. + + + + + + + + +### Edge.length +--- +```lua +function Edge.length() -> number +``` + + + + + +Returns the length of an edge. + + + + + + + + +### Edge.getMidPoint +--- +```lua +function Edge.getMidPoint() -> vector +``` + + + + + +Returns the vector of the point located in the middle of the edge. + + + + + + + + + + + +## fields +--- + +### Edge.p1 +--- +```lua +Edge.p1 : MapGen.Peak { + id: number, + getPeakPos: function, + getColor: function, + getGroups: function, + new: function, + toString: function, + eq: function, +} +``` + + + + + + + + + + +### Edge.p2 +--- +```lua +Edge.p2 : MapGen.Peak { + id: number, + getPeakPos: function, + getColor: function, + getGroups: function, + new: function, + toString: function, + eq: function, +} +``` + + + + + + + + + + + diff --git a/docs/docs/modules/MapGen.Triangulation.FakePeak.md b/docs/docs/modules/MapGen.Triangulation.FakePeak.md new file mode 100644 index 0000000..92a982d --- /dev/null +++ b/docs/docs/modules/MapGen.Triangulation.FakePeak.md @@ -0,0 +1,79 @@ +# global MapGen.Triangulation.FakePeak + + + + + + + + +--- + +## methods +--- + +### FakePeak.getPeakPos +--- +```lua +function FakePeak.getPeakPos()-> vector +``` + + + + + + + + + + +### FakePeak.new +--- +```lua +function FakePeak.new(peakPos: vector) -> MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +} +``` + + + + + +Returns a fake `MapGen.Peak` that has no noise parameters. +Note that the initialized peak should not be used in generation. + + + + + + + + + + + +## fields +--- + +### FakePeak.id +--- +```lua +FakePeak.id : number +``` + + + + + + + + + + + diff --git a/docs/docs/modules/MapGen.Triangulation.md b/docs/docs/modules/MapGen.Triangulation.md new file mode 100644 index 0000000..f0d0ca4 --- /dev/null +++ b/docs/docs/modules/MapGen.Triangulation.md @@ -0,0 +1,81 @@ +# global MapGen.Triangulation + + + + + + + + +--- + +## methods +--- + +### Triangulation.triangulate +--- +```lua +function Triangulation.triangulate(vertices: table) -> ((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) -> ((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 +``` + + + + + + + + + + + diff --git a/docs/docs/modules/MapGen.ff2luat.md b/docs/docs/modules/MapGen.ff2luat.md new file mode 100644 index 0000000..a1acbf6 --- /dev/null +++ b/docs/docs/modules/MapGen.ff2luat.md @@ -0,0 +1,30 @@ +# global MapGen.ff2luat + + +Converts given farbfeld image to ColoredDotsTable. +Farbfeld format: +``` +╔════════╤═════════════════════════════════════════════════════════╗ +║ Bytes │ Description ║ +╠════════╪═════════════════════════════════════════════════════════╣ +║ 8 │ 'farbfeld' magic value ║ +╟────────┼─────────────────────────────────────────────────────────╢ +║ 4 │ 32-Bit BE unsigned integer (width) ║ +╟────────┼─────────────────────────────────────────────────────────╢ +║ 4 │ 32-Bit BE unsigned integer (height) ║ +╟────────┼─────────────────────────────────────────────────────────╢ +║ [2222] │ 4x16-Bit BE unsigned integers [RGBA] / pixel, row-major ║ +╚════════╧═════════════════════════════════════════════════════════╝ +``` +[tools/farbfeld | suckless.org software that sucks less](https://tools.suckless.org/farbfeld/) + + + + + + + +--- + + + diff --git a/docs/docs/modules/MapGen.md b/docs/docs/modules/MapGen.md new file mode 100644 index 0000000..4fa9b07 --- /dev/null +++ b/docs/docs/modules/MapGen.md @@ -0,0 +1,738 @@ +# global MapGen + + + + + + + + +--- + +## methods +--- + +### MapGen.new +--- +```lua +function MapGen.new(def: MapGenDef { + nodes = table, +}) -> MapGen { + layersByName = table, + layersList = MapGen.Layer[], + staticsByName = table, + staticsList = MapGen.StaticLayer[], + layersNoisesInitialized = boolean, + cavernsNoiseInitialized = boolean, + isRunning = boolean, + nodeIDs = table, + 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?, +} +) -> 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?, +} +) -> 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? +) -> 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 `/textures/maps` folder and have the following format `.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?, +} +) -> 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, landscape: table, temp: table }, + noisesParamsByColor = { humidity: table, landscape: table, temp: table }, + biomesByName = table, + biomesList = MapGen.Biome[], + biomesDiagram = table, + biomesGorizontalScattering = integer, + biomesVerticalScattering = integer, + cavernsByName = table, + 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 +``` + + + + + + + + + + +### MapGen.layersList +--- +```lua +MapGen.layersList : MapGen.Layer[] +``` + + + + + + + + + + +### MapGen.staticsByName +--- +```lua +MapGen.staticsByName : table +``` + + + + + + + + + + +### 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 +``` + + + + + + + + + + + diff --git a/docs/docs/types/ColoredDotsTable.md b/docs/docs/types/ColoredDotsTable.md new file mode 100644 index 0000000..65c01b6 --- /dev/null +++ b/docs/docs/types/ColoredDotsTable.md @@ -0,0 +1,23 @@ +# alias ColoredDotsTable +--- + + + +```lua +(alias) ColoredDotsTable = 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}, ... }, + ... +} +``` + diff --git a/docs/docs/types/MapGen.Biome.GroundNodes.md b/docs/docs/types/MapGen.Biome.GroundNodes.md new file mode 100644 index 0000000..460cb2f --- /dev/null +++ b/docs/docs/types/MapGen.Biome.GroundNodes.md @@ -0,0 +1,92 @@ +# class GroundNodes + + + +- namespace: MapGen.Biome + + + +**Only for EmmyLua.** + + + + + + + +--- + + + +## fields +--- + +### GroundNodes.turf +--- +```lua +GroundNodes.turf : string +``` + + + +The soil covering the surface of the biome + + + + + + + + +### GroundNodes.soil +--- +```lua +GroundNodes.soil : string +``` + + + +The soil beneath the turf. The height of this layer depends on `Biome.soilHeight` + + + + + + + + +### GroundNodes.rock +--- +```lua +GroundNodes.rock : string +``` + + + +The rock found beneath the soil of a biome. + + + + + + + + +### GroundNodes.bottom +--- +```lua +GroundNodes.bottom : string +``` + + + +Covering the bottom of reservoirs. + + + + + + + + + diff --git a/docs/docs/types/MapGen.Biome.GroundNodesIDs.md b/docs/docs/types/MapGen.Biome.GroundNodesIDs.md new file mode 100644 index 0000000..add09f8 --- /dev/null +++ b/docs/docs/types/MapGen.Biome.GroundNodesIDs.md @@ -0,0 +1,92 @@ +# class GroundNodesIDs + + + +- namespace: MapGen.Biome + + + +**Only for EmmyLua.** + + + + + + + +--- + + + +## fields +--- + +### GroundNodesIDs.turf +--- +```lua +GroundNodesIDs.turf : number +``` + + + +The soil covering the surface of the biome + + + + + + + + +### GroundNodesIDs.soil +--- +```lua +GroundNodesIDs.soil : number +``` + + + +The soil beneath the turf. The height of this layer depends on `Biome.soilHeight` + + + + + + + + +### GroundNodesIDs.rock +--- +```lua +GroundNodesIDs.rock : number +``` + + + +The rock found beneath the soil of a biome. + + + + + + + + +### GroundNodesIDs.bottom +--- +```lua +GroundNodesIDs.bottom : number +``` + + + +Covering the bottom of reservoirs. + + + + + + + + + diff --git a/docs/docs/types/MapGen.Biome.md b/docs/docs/types/MapGen.Biome.md new file mode 100644 index 0000000..968c41e --- /dev/null +++ b/docs/docs/types/MapGen.Biome.md @@ -0,0 +1,312 @@ +# class Biome + + + +- namespace: MapGen + + + + + + + + + +--- + +## methods +--- + +### Biome.new +--- +```lua +function Biome.new( + name: string, + def: MapGen.BiomeDef { + tempPoint = number, + humidityPoint = number, + minY = number, + maxY = number, + groundNodes = MapGen.Biome.GroundNodes, + soilHeight = number, + generateAir = generateFunc?, + generateCavernAir = generateFunc?, + generateWater = generateFunc?, + generateRock = generateFunc?, + generateTurf = generateFunc?, + generateSoil = generateFunc?, + generateBottom = generateFunc?, +} +) -> MapGen.Biome { + name = string, + tempPoint = number, + humidityPoint = number, + minY = number, + maxY = number, + groundNodes = MapGen.Biome.GroundNodes, + groundNodesIDs = MapGen.Biome.GroundNodesIDs, + soilHeight = number, + generateAir = generateFunc, + generateCavernAir = generateFunc, + generateWater = generateFunc, + generateRock = generateFunc, + generateTurf = generateFunc, + generateSoil = generateFunc, + generateBottom = generateFunc, + new = function, +} +``` + + + + + + + + + + + + + + + +## fields +--- + +### Biome.name +--- +```lua +Biome.name : string +``` + + + + + + + + + + +### Biome.tempPoint +--- +```lua +Biome.tempPoint : number +``` + + + + + + + + + + +### Biome.humidityPoint +--- +```lua +Biome.humidityPoint : number +``` + + + + + + + + + + +### Biome.minY +--- +```lua +Biome.minY : number +``` + + + + + + + + + + +### Biome.maxY +--- +```lua +Biome.maxY : number +``` + + + + + + + + + + +### Biome.groundNodes +--- +```lua +Biome.groundNodes : MapGen.Biome.GroundNodes { + turf: string, + soil: string, + rock: string, + bottom: string, +} +``` + + + + + + + + + + +### Biome.groundNodesIDs +--- +```lua +Biome.groundNodesIDs : MapGen.Biome.GroundNodesIDs { + turf: number, + soil: number, + rock: number, + bottom: number, +} +``` + + + + + + + + + + +### Biome.soilHeight +--- +```lua +Biome.soilHeight : number +``` + + + + + + + + + + +### Biome.generateAir +--- +```lua +Biome.generateAir : generateFunc +``` + + + + + + + + + + +### Biome.generateCavernAir +--- +```lua +Biome.generateCavernAir : generateFunc +``` + + + + + + + + + + +### Biome.generateWater +--- +```lua +Biome.generateWater : generateFunc +``` + + + + + + + + + + +### Biome.generateRock +--- +```lua +Biome.generateRock : generateFunc +``` + + + + + + + + + + +### Biome.generateTurf +--- +```lua +Biome.generateTurf : generateFunc +``` + + + + + + + + + + +### Biome.generateSoil +--- +```lua +Biome.generateSoil : generateFunc +``` + + + + + + + + + + +### Biome.generateBottom +--- +```lua +Biome.generateBottom : generateFunc +``` + + + + + + + + + + + diff --git a/docs/docs/types/MapGen.BiomeDef.md b/docs/docs/types/MapGen.BiomeDef.md new file mode 100644 index 0000000..92e956e --- /dev/null +++ b/docs/docs/types/MapGen.BiomeDef.md @@ -0,0 +1,226 @@ +# class BiomeDef + + + +- namespace: MapGen + + + +Definition table for the `MapGen.Biome`. + +**Only for EmmyLua.** + + + + + + + +--- + + + +## fields +--- + +### BiomeDef.tempPoint +--- +```lua +BiomeDef.tempPoint : number +``` + + + + + + + + + + +### BiomeDef.humidityPoint +--- +```lua +BiomeDef.humidityPoint : number +``` + + + + + + + + + + +### BiomeDef.minY +--- +```lua +BiomeDef.minY : number +``` + + + + + + + + + + +### BiomeDef.maxY +--- +```lua +BiomeDef.maxY : number +``` + + + + + + + + + + +### BiomeDef.groundNodes +--- +```lua +BiomeDef.groundNodes : MapGen.Biome.GroundNodes { + turf: string, + soil: string, + rock: string, + bottom: string, +} +``` + + + + + + + + + + +### BiomeDef.soilHeight +--- +```lua +BiomeDef.soilHeight : number +``` + + + + + + + + + + +### BiomeDef.generateAir +--- +```lua +BiomeDef.generateAir : generateFunc? +``` + + + + + + + + + + +### BiomeDef.generateCavernAir +--- +```lua +BiomeDef.generateCavernAir : generateFunc? +``` + + + + + + + + + + +### BiomeDef.generateWater +--- +```lua +BiomeDef.generateWater : generateFunc? +``` + + + + + + + + + + +### BiomeDef.generateRock +--- +```lua +BiomeDef.generateRock : generateFunc? +``` + + + + + + + + + + +### BiomeDef.generateTurf +--- +```lua +BiomeDef.generateTurf : generateFunc? +``` + + + + + + + + + + +### BiomeDef.generateSoil +--- +```lua +BiomeDef.generateSoil : generateFunc? +``` + + + + + + + + + + +### BiomeDef.generateBottom +--- +```lua +BiomeDef.generateBottom : generateFunc? +``` + + + + + + + + + + + diff --git a/docs/docs/types/MapGen.Cavern.md b/docs/docs/types/MapGen.Cavern.md new file mode 100644 index 0000000..9705c65 --- /dev/null +++ b/docs/docs/types/MapGen.Cavern.md @@ -0,0 +1,208 @@ +# class Cavern + + + +- namespace: MapGen + + + + + + + + + +--- + +## methods +--- + +### Cavern.getNoise +--- +```lua +function Cavern.getNoise()-> ValueNoise +``` + + + + + + + + + + +### Cavern.initNoise +--- +```lua +function Cavern.initNoise()-> nil +``` + + + + + + + + + + +### Cavern.getGroups +--- +```lua +function Cavern.getGroups() +-> table +``` + + + + + + + + + + +### Cavern.new +--- +```lua +function Cavern.new( + name: string, + def: MapGen.CavernDef { + minY = number, + maxY = number, + noiseParams = NoiseParams, + smoothDistance = number, + threshold = number?, + groups = table?, +} +) -> 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 +``` + + + + + + + + + + + diff --git a/docs/docs/types/MapGen.CavernDef.md b/docs/docs/types/MapGen.CavernDef.md new file mode 100644 index 0000000..0c247d3 --- /dev/null +++ b/docs/docs/types/MapGen.CavernDef.md @@ -0,0 +1,116 @@ +# class CavernDef + + + +- namespace: MapGen + + + +Definition table for the `MapGen.Cavern`. + +**Only for EmmyLua.** + + + + + + + +--- + + + +## fields +--- + +### CavernDef.minY +--- +```lua +CavernDef.minY : number +``` + + + + + + + + + + +### CavernDef.maxY +--- +```lua +CavernDef.maxY : number +``` + + + + + + + + + + +### CavernDef.noiseParams +--- +```lua +CavernDef.noiseParams : NoiseParams +``` + + + + + + + + + + +### CavernDef.smoothDistance +--- +```lua +CavernDef.smoothDistance : number +``` + + + + + + + + + + +### CavernDef.threshold +--- +```lua +CavernDef.threshold : number? +``` + + + + + + + + + + +### CavernDef.groups +--- +```lua +CavernDef.groups : table? +``` + + + + + + + + + + + diff --git a/docs/docs/types/MapGen.Decoration.md b/docs/docs/types/MapGen.Decoration.md new file mode 100644 index 0000000..e1a1211 --- /dev/null +++ b/docs/docs/types/MapGen.Decoration.md @@ -0,0 +1,43 @@ +# class Decoration + + + +- namespace: MapGen + + + +**NOT IMPLEMENTED** + + + + + + + +--- + +## methods +--- + +### Decoration.new +--- +```lua +function Decoration.new() -> MapGen.Decoration { + new = function, +} +``` + + + + + + + + + + + + + + + diff --git a/docs/docs/types/MapGen.Layer.Category.md b/docs/docs/types/MapGen.Layer.Category.md new file mode 100644 index 0000000..a1e98c2 --- /dev/null +++ b/docs/docs/types/MapGen.Layer.Category.md @@ -0,0 +1,16 @@ +# alias Category +--- + +- namespace: MapGen.Layer + + + +```lua +(alias) Category = ("landscape"|"temp"|"humidity") +``` + + + + +A category of noise that affects specific map generation objects. + diff --git a/docs/docs/types/MapGen.Layer.md b/docs/docs/types/MapGen.Layer.md new file mode 100644 index 0000000..6afe057 --- /dev/null +++ b/docs/docs/types/MapGen.Layer.md @@ -0,0 +1,678 @@ +# class Layer + + + +- namespace: MapGen + + + + + + + + + +--- + +## methods +--- + +### Layer.calcTemp +--- +```lua +function Layer.calcTemp( + self: MapGen.Layer { + name = string, + minY = integer, + maxY = integer, + minTemp = integer, + maxTemp = integer, + minHumidity = integer, + maxHumidity = integer, + waterLevel = integer, + peaksList = { humidity: MapGen.Peak[], landscape: MapGen.Peak[], temp: MapGen.Peak[] }, + noisesByColor = { humidity: table, landscape: table, temp: table }, + noisesParamsByColor = { humidity: table, landscape: table, temp: table }, + biomesByName = table, + biomesList = MapGen.Biome[], + biomesDiagram = table, + biomesGorizontalScattering = integer, + biomesVerticalScattering = integer, + cavernsByName = table, + 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, landscape: table, temp: table }, + noisesParamsByColor = { humidity: table, landscape: table, temp: table }, + biomesByName = table, + biomesList = MapGen.Biome[], + biomesDiagram = table, + biomesGorizontalScattering = integer, + biomesVerticalScattering = integer, + cavernsByName = table, + 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, landscape: table, temp: table }, + noisesParamsByColor = { humidity: table, landscape: table, temp: table }, + biomesByName = table, + biomesList = MapGen.Biome[], + biomesDiagram = table, + biomesGorizontalScattering = integer, + biomesVerticalScattering = integer, + cavernsByName = table, + 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, landscape: table, temp: table } +``` + + + + + + + + + + +### Layer.noisesParamsByColor +--- +```lua +Layer.noisesParamsByColor : { humidity: table, landscape: table, temp: table } +``` + + + + + + + + + + +### Layer.biomesByName +--- +```lua +Layer.biomesByName : table +``` + + + + + + + + + + +### 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 +``` + + + + + + + + + + +### 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** + + + + + + + + + diff --git a/docs/docs/types/MapGen.LayerDef.md b/docs/docs/types/MapGen.LayerDef.md new file mode 100644 index 0000000..6823d95 --- /dev/null +++ b/docs/docs/types/MapGen.LayerDef.md @@ -0,0 +1,191 @@ +# class LayerDef + + + +- namespace: MapGen + + + +Definition table for the `MapGen.Layer`. + +**Only for EmmyLua.** + + + + + + + +--- + + + +## fields +--- + +### LayerDef.minY +--- +```lua +LayerDef.minY : number +``` + + + + + + + + + + +### LayerDef.maxY +--- +```lua +LayerDef.maxY : number +``` + + + + + + + + + + +### LayerDef.minTemp +--- +```lua +LayerDef.minTemp : number +``` + + + + + + + + + + +### LayerDef.maxTemp +--- +```lua +LayerDef.maxTemp : number +``` + + + + + + + + + + +### LayerDef.minHumidity +--- +```lua +LayerDef.minHumidity : number +``` + + + + + + + + + + +### LayerDef.maxHumidity +--- +```lua +LayerDef.maxHumidity : number +``` + + + + + + + + + + +### LayerDef.waterLevel +--- +```lua +LayerDef.waterLevel : number? +``` + + + + + + + + + + +### LayerDef.calcTemp +--- +```lua +LayerDef.calcTemp : (fun(self: MapGen.Layer, value: number, height: number) -> number)? +``` + + + + + + + + + + +### LayerDef.calcHumidity +--- +```lua +LayerDef.calcHumidity : (fun(self: MapGen.Layer, value: number, height: number) -> number)? +``` + + + + + + + + + + +### LayerDef.biomesGorizontalScattering +--- +```lua +LayerDef.biomesGorizontalScattering : number? +``` + + + + + + + + + + +### LayerDef.biomesVerticalScattering +--- +```lua +LayerDef.biomesVerticalScattering : number? +``` + + + + + + + + + + + diff --git a/docs/docs/types/MapGen.PastCalcNoiseValue.md b/docs/docs/types/MapGen.PastCalcNoiseValue.md new file mode 100644 index 0000000..590a064 --- /dev/null +++ b/docs/docs/types/MapGen.PastCalcNoiseValue.md @@ -0,0 +1,14 @@ +# alias PastCalcNoiseValue +--- + +- namespace: MapGen + + + +```lua +(alias) PastCalcNoiseValue = { noiseValue: number?, triangle: MapGen.Triangle?, x: integer?, z: integer? } +``` + + + + diff --git a/docs/docs/types/MapGen.Peak.md b/docs/docs/types/MapGen.Peak.md new file mode 100644 index 0000000..7e0b0da --- /dev/null +++ b/docs/docs/types/MapGen.Peak.md @@ -0,0 +1,162 @@ +# class Peak + + + +- namespace: MapGen + + + + + + + + + +--- + +## methods +--- + +### Peak.getPeakPos +--- +```lua +function Peak.getPeakPos(self)-> vector +``` + + + + + + + + + + +### Peak.getColor +--- +```lua +function Peak.getColor(self)-> ColorString +``` + + + + + + + + + + +### Peak.getGroups +--- +```lua +function Peak.getGroups(self) +-> table +``` + + + + + + + + + + +### Peak.new +--- +```lua +function Peak.new(def: MapGen.PeakDef { + pos = vector, + color = ColorString, + groups = table?, +}) -> 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 +``` + + + + + + + + + + + diff --git a/docs/docs/types/MapGen.PeakDef.md b/docs/docs/types/MapGen.PeakDef.md new file mode 100644 index 0000000..e40b7b8 --- /dev/null +++ b/docs/docs/types/MapGen.PeakDef.md @@ -0,0 +1,71 @@ +# class PeakDef + + + +- namespace: MapGen + + + +Definition table for the `MapGen.Peak`. + +**Only for EmmyLua.** + + + + + + + +--- + + + +## fields +--- + +### PeakDef.pos +--- +```lua +PeakDef.pos : vector +``` + + + + + + + + + + +### PeakDef.color +--- +```lua +PeakDef.color : ColorString +``` + + + + + + + + + + +### PeakDef.groups +--- +```lua +PeakDef.groups : table? +``` + + + + + + + + + + + diff --git a/docs/docs/types/MapGen.StaticLayer.md b/docs/docs/types/MapGen.StaticLayer.md new file mode 100644 index 0000000..0316126 --- /dev/null +++ b/docs/docs/types/MapGen.StaticLayer.md @@ -0,0 +1,149 @@ +# class StaticLayer + + + +- namespace: MapGen + + + + + + + + + +--- + +## methods +--- + +### StaticLayer.new +--- +```lua +function StaticLayer.new( + name: string, + def: MapGen.StaticLayerDef { + minY = number, + maxY = number, + staticNode = string, + generateStaticNode = generateFunc, +} +) -> MapGen.StaticLayer { + name = string, + minY = number, + maxY = number, + staticNode = string, + staticNodeID = number, + generateStaticNode = generateFunc, + new = function, +} +``` + + + + + + + + + + + + + + + +## fields +--- + +### StaticLayer.name +--- +```lua +StaticLayer.name : string +``` + + + + + + + + + + +### StaticLayer.minY +--- +```lua +StaticLayer.minY : number +``` + + + + + + + + + + +### StaticLayer.maxY +--- +```lua +StaticLayer.maxY : number +``` + + + + + + + + + + +### StaticLayer.staticNode +--- +```lua +StaticLayer.staticNode : string +``` + + + + + + + + + + +### StaticLayer.staticNodeID +--- +```lua +StaticLayer.staticNodeID : number +``` + + + + + + + + + + +### StaticLayer.generateStaticNode +--- +```lua +StaticLayer.generateStaticNode : generateFunc +``` + + + + + + + + + + + diff --git a/docs/docs/types/MapGen.StaticLayerDef.md b/docs/docs/types/MapGen.StaticLayerDef.md new file mode 100644 index 0000000..c4331ad --- /dev/null +++ b/docs/docs/types/MapGen.StaticLayerDef.md @@ -0,0 +1,86 @@ +# class StaticLayerDef + + + +- namespace: MapGen + + + +Definition table for the `MapGen.StaticLayer`. + +**Only for EmmyLua.** + + + + + + + +--- + + + +## fields +--- + +### StaticLayerDef.minY +--- +```lua +StaticLayerDef.minY : number +``` + + + + + + + + + + +### StaticLayerDef.maxY +--- +```lua +StaticLayerDef.maxY : number +``` + + + + + + + + + + +### StaticLayerDef.staticNode +--- +```lua +StaticLayerDef.staticNode : string +``` + + + + + + + + + + +### StaticLayerDef.generateStaticNode +--- +```lua +StaticLayerDef.generateStaticNode : generateFunc +``` + + + + + + + + + + + diff --git a/docs/docs/types/MapGen.Tetrahedron.md b/docs/docs/types/MapGen.Tetrahedron.md new file mode 100644 index 0000000..4961df2 --- /dev/null +++ b/docs/docs/types/MapGen.Tetrahedron.md @@ -0,0 +1,541 @@ +# class Tetrahedron + + + +- namespace: MapGen + + + + + + + + + +--- + +## methods +--- + +### Tetrahedron.new +--- +```lua +function Tetrahedron.new( + p1: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}, + p2: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}, + p3: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}, + p4: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +} +) -> MapGen.Tetrahedron { + p1 = MapGen.Peak, + p2 = MapGen.Peak, + p3 = MapGen.Peak, + p4 = MapGen.Peak, + h1 = MapGen.Triangulation.Edge, + h2 = MapGen.Triangulation.Edge, + h3 = MapGen.Triangulation.Edge, + h4 = MapGen.Triangulation.Edge, + f1 = MapGen.Triangle, + f2 = MapGen.Triangle, + f3 = MapGen.Triangle, + f4 = MapGen.Triangle, + new = function, + toString = function, + getHeight = function, + getCircumSphereCenter = function, + getCircumSphereRadius = function, + inCircumSphere = function, +} +``` + + + + + + + + + + + + +### Tetrahedron.toString +--- +```lua +function Tetrahedron.toString() -> string +``` + + + + + +Returns a string describing the object in a readable form. + + + + + + + + +### Tetrahedron.getHeight +--- +```lua +function Tetrahedron.getHeight( + p1: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}, + p2: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}, + p3: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}, + p4: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +} +) -> MapGen.Triangulation.Edge? +``` + + + + + + + + + + + + +### Tetrahedron.getCircumSphereCenter +--- +```lua +function Tetrahedron.getCircumSphereCenter() -> vector +``` + + + + + +Returns the center of the circumscribed sphere. + + + + + + + + +### Tetrahedron.getCircumSphereRadius +--- +```lua +function Tetrahedron.getCircumSphereRadius() -> number +``` + + + + + +Returns the radius of the circumscribed sphere. + + + + + + + + +### Tetrahedron.inCircumSphere +--- +```lua +function Tetrahedron.inCircumSphere(p: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}) -> boolean +``` + + + + + +Checks whether a given point lies within the circumscribed sphere of a tetrahedron. + + + + + + + + + + + +## fields +--- + +### Tetrahedron.p1 +--- +```lua +Tetrahedron.p1 : MapGen.Peak { + id: number, + getPeakPos: function, + getColor: function, + getGroups: function, + new: function, + toString: function, + eq: function, +} +``` + + + + + + + + + + +### Tetrahedron.p2 +--- +```lua +Tetrahedron.p2 : MapGen.Peak { + id: number, + getPeakPos: function, + getColor: function, + getGroups: function, + new: function, + toString: function, + eq: function, +} +``` + + + + + + + + + + +### Tetrahedron.p3 +--- +```lua +Tetrahedron.p3 : MapGen.Peak { + id: number, + getPeakPos: function, + getColor: function, + getGroups: function, + new: function, + toString: function, + eq: function, +} +``` + + + + + + + + + + +### Tetrahedron.p4 +--- +```lua +Tetrahedron.p4 : MapGen.Peak { + id: number, + getPeakPos: function, + getColor: function, + getGroups: function, + new: function, + toString: function, + eq: function, +} +``` + + + + + + + + + + +### Tetrahedron.h1 +--- +```lua +Tetrahedron.h1 : MapGen.Triangulation.Edge { + p1: MapGen.Peak, + p2: MapGen.Peak, + new: function, + toString: function, + eq: function, + same: function, + length: function, + getMidPoint: function, +} +``` + + + + + + + + + + +### Tetrahedron.h2 +--- +```lua +Tetrahedron.h2 : MapGen.Triangulation.Edge { + p1: MapGen.Peak, + p2: MapGen.Peak, + new: function, + toString: function, + eq: function, + same: function, + length: function, + getMidPoint: function, +} +``` + + + + + + + + + + +### Tetrahedron.h3 +--- +```lua +Tetrahedron.h3 : MapGen.Triangulation.Edge { + p1: MapGen.Peak, + p2: MapGen.Peak, + new: function, + toString: function, + eq: function, + same: function, + length: function, + getMidPoint: function, +} +``` + + + + + + + + + + +### Tetrahedron.h4 +--- +```lua +Tetrahedron.h4 : MapGen.Triangulation.Edge { + p1: MapGen.Peak, + p2: MapGen.Peak, + new: function, + toString: function, + eq: function, + same: function, + length: function, + getMidPoint: function, +} +``` + + + + + + + + + + +### Tetrahedron.f1 +--- +```lua +Tetrahedron.f1 : MapGen.Triangle { + p1: MapGen.Peak, + p2: MapGen.Peak, + p3: MapGen.Peak, + e1: MapGen.Triangulation.Edge, + e2: MapGen.Triangulation.Edge, + e3: MapGen.Triangulation.Edge, + h1: MapGen.Triangulation.Edge, + h2: MapGen.Triangulation.Edge, + h3: MapGen.Triangulation.Edge, + neighbours: MapGen.Triangle.Neighbours, + color: ColorString?, + new: function, + ...(+13) +} +``` + + + + + + + + + + +### Tetrahedron.f2 +--- +```lua +Tetrahedron.f2 : MapGen.Triangle { + p1: MapGen.Peak, + p2: MapGen.Peak, + p3: MapGen.Peak, + e1: MapGen.Triangulation.Edge, + e2: MapGen.Triangulation.Edge, + e3: MapGen.Triangulation.Edge, + h1: MapGen.Triangulation.Edge, + h2: MapGen.Triangulation.Edge, + h3: MapGen.Triangulation.Edge, + neighbours: MapGen.Triangle.Neighbours, + color: ColorString?, + new: function, + ...(+13) +} +``` + + + + + + + + + + +### Tetrahedron.f3 +--- +```lua +Tetrahedron.f3 : MapGen.Triangle { + p1: MapGen.Peak, + p2: MapGen.Peak, + p3: MapGen.Peak, + e1: MapGen.Triangulation.Edge, + e2: MapGen.Triangulation.Edge, + e3: MapGen.Triangulation.Edge, + h1: MapGen.Triangulation.Edge, + h2: MapGen.Triangulation.Edge, + h3: MapGen.Triangulation.Edge, + neighbours: MapGen.Triangle.Neighbours, + color: ColorString?, + new: function, + ...(+13) +} +``` + + + + + + + + + + +### Tetrahedron.f4 +--- +```lua +Tetrahedron.f4 : MapGen.Triangle { + p1: MapGen.Peak, + p2: MapGen.Peak, + p3: MapGen.Peak, + e1: MapGen.Triangulation.Edge, + e2: MapGen.Triangulation.Edge, + e3: MapGen.Triangulation.Edge, + h1: MapGen.Triangulation.Edge, + h2: MapGen.Triangulation.Edge, + h3: MapGen.Triangulation.Edge, + neighbours: MapGen.Triangle.Neighbours, + color: ColorString?, + new: function, + ...(+13) +} +``` + + + + + + + + + + + diff --git a/docs/docs/types/MapGen.Triangle.CircumCircleEnum.md b/docs/docs/types/MapGen.Triangle.CircumCircleEnum.md new file mode 100644 index 0000000..7949d3a --- /dev/null +++ b/docs/docs/types/MapGen.Triangle.CircumCircleEnum.md @@ -0,0 +1,14 @@ +# alias CircumCircleEnum +--- + +- namespace: MapGen.Triangle + + + +```lua +(alias) CircumCircleEnum = ("IN"|"BEHIND"|"ON") +``` + + + + diff --git a/docs/docs/types/MapGen.Triangle.Neighbours.md b/docs/docs/types/MapGen.Triangle.Neighbours.md new file mode 100644 index 0000000..1fb6d6a --- /dev/null +++ b/docs/docs/types/MapGen.Triangle.Neighbours.md @@ -0,0 +1,19 @@ +# alias Neighbours +--- + +- namespace: MapGen.Triangle + + + +```lua +(alias) Neighbours = { t1: MapGen.Triangle?, t2: MapGen.Triangle?, t3: MapGen.Triangle? } +``` + + + + +Adjacent triangles: + * `t1` with a common side p1-p2 + * `t2` with a common side p2-p3 + * `t3` with a common side p3-p1 + diff --git a/docs/docs/types/MapGen.Triangle.md b/docs/docs/types/MapGen.Triangle.md new file mode 100644 index 0000000..4ab23d8 --- /dev/null +++ b/docs/docs/types/MapGen.Triangle.md @@ -0,0 +1,750 @@ +# class Triangle + + + +- namespace: MapGen + + + + + + + + + +--- + +## methods +--- + +### Triangle.new +--- +```lua +function Triangle.new( + p1: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}, + p2: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}, + p3: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +} +) -> MapGen.Triangle { + p1 = MapGen.Peak, + p2 = MapGen.Peak, + p3 = MapGen.Peak, + e1 = MapGen.Triangulation.Edge, + e2 = MapGen.Triangulation.Edge, + e3 = MapGen.Triangulation.Edge, + h1 = MapGen.Triangulation.Edge, + h2 = MapGen.Triangulation.Edge, + h3 = MapGen.Triangulation.Edge, + neighbours = MapGen.Triangle.Neighbours, + color = ColorString?, + new = function, + toString = function, + eq = function, + same = function, + getCenter = function, + getArea = function, + getHeight = function, + getHeight2D = function, + getSidesLength = function, + getSidesLength2D = function, + getCircumCenter2D = function, + getCircumRadius2D = function, + getCircumCircle2D = function, + inCircumCircle2D = function, +} +``` + + + + + + + + + + + + +### Triangle.toString +--- +```lua +function Triangle.toString() -> string +``` + + + + + +Returns a string describing the object in a readable form. + + + + + + + + +### Triangle.eq +--- +```lua +function Triangle.eq(other: MapGen.Triangle { + p1 = MapGen.Peak, + p2 = MapGen.Peak, + p3 = MapGen.Peak, + e1 = MapGen.Triangulation.Edge, + e2 = MapGen.Triangulation.Edge, + e3 = MapGen.Triangulation.Edge, + h1 = MapGen.Triangulation.Edge, + h2 = MapGen.Triangulation.Edge, + h3 = MapGen.Triangulation.Edge, + neighbours = MapGen.Triangle.Neighbours, + color = ColorString?, + new = function, + toString = function, + eq = function, + same = function, + getCenter = function, + getArea = function, + getHeight = function, + getHeight2D = function, + getSidesLength = function, + getSidesLength2D = function, + getCircumCenter2D = function, + getCircumRadius2D = function, + getCircumCircle2D = function, + inCircumCircle2D = function, +}) -> boolean +``` + + + + + +Returns true if the triangles are equivalent. + + + + + + + + +### Triangle.same +--- +```lua +function Triangle.same(other: MapGen.Triangle { + p1 = MapGen.Peak, + p2 = MapGen.Peak, + p3 = MapGen.Peak, + e1 = MapGen.Triangulation.Edge, + e2 = MapGen.Triangulation.Edge, + e3 = MapGen.Triangulation.Edge, + h1 = MapGen.Triangulation.Edge, + h2 = MapGen.Triangulation.Edge, + h3 = MapGen.Triangulation.Edge, + neighbours = MapGen.Triangle.Neighbours, + color = ColorString?, + new = function, + toString = function, + eq = function, + same = function, + getCenter = function, + getArea = function, + getHeight = function, + getHeight2D = function, + getSidesLength = function, + getSidesLength2D = function, + getCircumCenter2D = function, + getCircumRadius2D = function, + getCircumCircle2D = function, + inCircumCircle2D = function, +}) -> boolean +``` + + + + + +Returns true if the triangles are similar. + + + + + + + + +### Triangle.getCenter +--- +```lua +function Triangle.getCenter() -> vector +``` + + + + + +Returns the coordinates of the triangle's center. + + + + + + + + +### Triangle.getArea +--- +```lua +function Triangle.getArea() -> number +``` + + + + + +Returns the area of a triangle. + + + + + + + + +### Triangle.getHeight +--- +```lua +function Triangle.getHeight( + p1: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}, + p2: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}, + p3: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +} +) -> MapGen.Triangulation.Edge { + p1 = MapGen.Peak, + p2 = MapGen.Peak, + new = function, + toString = function, + eq = function, + same = function, + length = function, + getMidPoint = function, +} +``` + + + + + +Returns the perpendicular from the vertex Peak1 to the line Peak2-Peak3. + + + + + + + + +### Triangle.getHeight2D +--- +```lua +function Triangle.getHeight2D( + p1: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}, + p2: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}, + p3: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +} +) -> MapGen.Triangulation.Edge { + p1 = MapGen.Peak, + p2 = MapGen.Peak, + new = function, + toString = function, + eq = function, + same = function, + length = function, + getMidPoint = function, +} +``` + + + + + +Returns the perpendicular from the vertex Peak1 to the line Peak2-Peak3. + +Note: This function does not take into account the Y-coordinate, +that is, the calculation is performed on the projection of the triangle XZ. + + + + + + + + +### Triangle.getSidesLength +--- +```lua +function Triangle.getSidesLength() + -> number + -> number + -> number + +``` + + + + + +Returns the length of the edges + + + + + + + + +### Triangle.getSidesLength2D +--- +```lua +function Triangle.getSidesLength2D() + -> number + -> number + -> number + +``` + + + + + +Returns the length of the edges. + +Note: This function does not take into account the Y-coordinate, +that is, the calculation is performed on the projection of the triangle XZ. + + + + + + + + +### Triangle.getCircumCenter2D +--- +```lua +function Triangle.getCircumCenter2D() -> vector +``` + + + + + +Returns the coordinates of the circumcircle center. + +Note: This function does not take into account the Y-coordinate, +that is, the calculation is performed on the projection of the triangle XZ. + + + + + + + + +### Triangle.getCircumRadius2D +--- +```lua +function Triangle.getCircumRadius2D() -> number +``` + + + + + +Returns the radius of the circumcircle. + +Note: This function does not take into account the Y-coordinate, +that is, the calculation is performed on the projection of the triangle XZ. + + + + + + + + +### Triangle.getCircumCircle2D +--- +```lua +function Triangle.getCircumCircle2D() + -> vector + -> number + +``` + + + + + +Returns the coordinates of the circumcircle center and its radius. + +Note: This function does not take into account the Y-coordinate, +that is, the calculation is performed on the projection of the triangle XZ. + + + + + + + + +### Triangle.inCircumCircle2D +--- +```lua +function Triangle.inCircumCircle2D(p: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}) -> boolean +``` + + + + + +Checks if a given point lies into the triangle circumcircle. + +Note: This function does not take into account the Y-coordinate, +that is, the calculation is performed on the projection of the triangle XZ. + + + + + + + + + + + +## fields +--- + +### Triangle.p1 +--- +```lua +Triangle.p1 : MapGen.Peak { + id: number, + getPeakPos: function, + getColor: function, + getGroups: function, + new: function, + toString: function, + eq: function, +} +``` + + + + + + + + + + +### Triangle.p2 +--- +```lua +Triangle.p2 : MapGen.Peak { + id: number, + getPeakPos: function, + getColor: function, + getGroups: function, + new: function, + toString: function, + eq: function, +} +``` + + + + + + + + + + +### Triangle.p3 +--- +```lua +Triangle.p3 : MapGen.Peak { + id: number, + getPeakPos: function, + getColor: function, + getGroups: function, + new: function, + toString: function, + eq: function, +} +``` + + + + + + + + + + +### Triangle.e1 +--- +```lua +Triangle.e1 : MapGen.Triangulation.Edge { + p1: MapGen.Peak, + p2: MapGen.Peak, + new: function, + toString: function, + eq: function, + same: function, + length: function, + getMidPoint: function, +} +``` + + + + + + + + + + +### Triangle.e2 +--- +```lua +Triangle.e2 : MapGen.Triangulation.Edge { + p1: MapGen.Peak, + p2: MapGen.Peak, + new: function, + toString: function, + eq: function, + same: function, + length: function, + getMidPoint: function, +} +``` + + + + + + + + + + +### Triangle.e3 +--- +```lua +Triangle.e3 : MapGen.Triangulation.Edge { + p1: MapGen.Peak, + p2: MapGen.Peak, + new: function, + toString: function, + eq: function, + same: function, + length: function, + getMidPoint: function, +} +``` + + + + + + + + + + +### Triangle.h1 +--- +```lua +Triangle.h1 : MapGen.Triangulation.Edge { + p1: MapGen.Peak, + p2: MapGen.Peak, + new: function, + toString: function, + eq: function, + same: function, + length: function, + getMidPoint: function, +} +``` + + + + + + + + + + +### Triangle.h2 +--- +```lua +Triangle.h2 : MapGen.Triangulation.Edge { + p1: MapGen.Peak, + p2: MapGen.Peak, + new: function, + toString: function, + eq: function, + same: function, + length: function, + getMidPoint: function, +} +``` + + + + + + + + + + +### Triangle.h3 +--- +```lua +Triangle.h3 : MapGen.Triangulation.Edge { + p1: MapGen.Peak, + p2: MapGen.Peak, + new: function, + toString: function, + eq: function, + same: function, + length: function, + getMidPoint: function, +} +``` + + + + + + + + + + +### Triangle.neighbours +--- +```lua +Triangle.neighbours : MapGen.Triangle.Neighbours +``` + + + + + + + + + + +### Triangle.color +--- +```lua +Triangle.color : ColorString? +``` + + + + + + + + + + + diff --git a/docs/docs/types/MapGen.Triangulation.Edge.md b/docs/docs/types/MapGen.Triangulation.Edge.md new file mode 100644 index 0000000..ec3f581 --- /dev/null +++ b/docs/docs/types/MapGen.Triangulation.Edge.md @@ -0,0 +1,230 @@ +# class Edge + + + +- namespace: MapGen.Triangulation + + + + + + + + + +--- + +## methods +--- + +### Edge.new +--- +```lua +function Edge.new( + p1: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +}, + p2: MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +} +) -> MapGen.Triangulation.Edge { + p1 = MapGen.Peak, + p2 = MapGen.Peak, + new = function, + toString = function, + eq = function, + same = function, + length = function, + getMidPoint = function, +} +``` + + + + + + + + + + + + +### Edge.toString +--- +```lua +function Edge.toString() -> string +``` + + + + + +Returns a string describing the object in a readable form. + + + + + + + + +### Edge.eq +--- +```lua +function Edge.eq(other: MapGen.Triangulation.Edge { + p1 = MapGen.Peak, + p2 = MapGen.Peak, + new = function, + toString = function, + eq = function, + same = function, + length = function, + getMidPoint = function, +}) -> boolean +``` + + + + + +Returns true if the edges are equivalent. + + + + + + + + +### Edge.same +--- +```lua +function Edge.same(other: MapGen.Triangulation.Edge { + p1 = MapGen.Peak, + p2 = MapGen.Peak, + new = function, + toString = function, + eq = function, + same = function, + length = function, + getMidPoint = function, +}) -> boolean +``` + + + + + +Returns true if the edges are similar. + + + + + + + + +### Edge.length +--- +```lua +function Edge.length() -> number +``` + + + + + +Returns the length of an edge. + + + + + + + + +### Edge.getMidPoint +--- +```lua +function Edge.getMidPoint() -> vector +``` + + + + + +Returns the vector of the point located in the middle of the edge. + + + + + + + + + + + +## fields +--- + +### Edge.p1 +--- +```lua +Edge.p1 : MapGen.Peak { + id: number, + getPeakPos: function, + getColor: function, + getGroups: function, + new: function, + toString: function, + eq: function, +} +``` + + + + + + + + + + +### Edge.p2 +--- +```lua +Edge.p2 : MapGen.Peak { + id: number, + getPeakPos: function, + getColor: function, + getGroups: function, + new: function, + toString: function, + eq: function, +} +``` + + + + + + + + + + + diff --git a/docs/docs/types/MapGen.Triangulation.FakePeak.md b/docs/docs/types/MapGen.Triangulation.FakePeak.md new file mode 100644 index 0000000..24111db --- /dev/null +++ b/docs/docs/types/MapGen.Triangulation.FakePeak.md @@ -0,0 +1,90 @@ +# class FakePeak + + +- supers: MapGen.Peak + + +- namespace: MapGen.Triangulation + + + +Allows you to create a `MapGen.Peak` without specifying a noise parameter. + +**WARNING: MUST NOT BE PARTICIPATED IN GENERATION** + + + + + + + +--- + +## methods +--- + +### FakePeak.getPeakPos +--- +```lua +function FakePeak.getPeakPos()-> vector +``` + + + + + + + + + + +### FakePeak.new +--- +```lua +function FakePeak.new(peakPos: vector) -> MapGen.Peak { + id = number, + getPeakPos = function, + getColor = function, + getGroups = function, + new = function, + toString = function, + eq = function, +} +``` + + + + + +Returns a fake `MapGen.Peak` that has no noise parameters. +Note that the initialized peak should not be used in generation. + + + + + + + + + + + +## fields +--- + +### FakePeak.id +--- +```lua +FakePeak.id : number +``` + + + + + + + + + + + diff --git a/docs/docs/types/MapGen.Triangulation.md b/docs/docs/types/MapGen.Triangulation.md new file mode 100644 index 0000000..7b7c326 --- /dev/null +++ b/docs/docs/types/MapGen.Triangulation.md @@ -0,0 +1,86 @@ +# class Triangulation + + + +- namespace: MapGen + + + + + + + + + +--- + +## methods +--- + +### Triangulation.triangulate +--- +```lua +function Triangulation.triangulate(vertices: table) -> ((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) -> ((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 +``` + + + + + + + + + + + diff --git a/docs/docs/types/MapGen.md b/docs/docs/types/MapGen.md new file mode 100644 index 0000000..9cca401 --- /dev/null +++ b/docs/docs/types/MapGen.md @@ -0,0 +1,741 @@ +# class MapGen + + + + + + + + + + + +--- + +## methods +--- + +### MapGen.new +--- +```lua +function MapGen.new(def: MapGenDef { + nodes = table, +}) -> MapGen { + layersByName = table, + layersList = MapGen.Layer[], + staticsByName = table, + staticsList = MapGen.StaticLayer[], + layersNoisesInitialized = boolean, + cavernsNoiseInitialized = boolean, + isRunning = boolean, + nodeIDs = table, + 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?, +} +) -> 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?, +} +) -> 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? +) -> 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 `/textures/maps` folder and have the following format `.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?, +} +) -> 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, landscape: table, temp: table }, + noisesParamsByColor = { humidity: table, landscape: table, temp: table }, + biomesByName = table, + biomesList = MapGen.Biome[], + biomesDiagram = table, + biomesGorizontalScattering = integer, + biomesVerticalScattering = integer, + cavernsByName = table, + 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 +``` + + + + + + + + + + +### MapGen.layersList +--- +```lua +MapGen.layersList : MapGen.Layer[] +``` + + + + + + + + + + +### MapGen.staticsByName +--- +```lua +MapGen.staticsByName : table +``` + + + + + + + + + + +### 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 +``` + + + + + + + + + + + diff --git a/docs/docs/types/MapGenDef.md b/docs/docs/types/MapGenDef.md new file mode 100644 index 0000000..47a7c29 --- /dev/null +++ b/docs/docs/types/MapGenDef.md @@ -0,0 +1,39 @@ +# class MapGenDef + + + + + +Definition table for the `MapGen`. + +**Only for EmmyLua.** + + + + + + + +--- + + + +## fields +--- + +### MapGenDef.nodes +--- +```lua +MapGenDef.nodes : table +``` + + + + + + + + + + + diff --git a/docs/docs/types/generateFunc.md b/docs/docs/types/generateFunc.md new file mode 100644 index 0000000..fd2d48e --- /dev/null +++ b/docs/docs/types/generateFunc.md @@ -0,0 +1,12 @@ +# alias generateFunc +--- + + + +```lua +(alias) generateFunc = fun(self, mapGenerator: MapGen, data: number[], index: number, x: number, y: number, z: number) +``` + + + + diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml new file mode 100644 index 0000000..ce16203 --- /dev/null +++ b/docs/mkdocs.yml @@ -0,0 +1,80 @@ + +site_name: Docs + + +theme: + name: material + font: + text: Roboto + code: Roboto Mono + search: true + features: + - quick-links + - navigation + - search + - toc + - fullscreen + - bookmarks + - tabs + - code + - edit-on-github + - language-selector + - code + - cover + - footer + - social-share + - theme-switcher +nav: + - Home: index.md + + - Types: + - alias Category : types/MapGen.Layer.Category.md + - alias CircumCircleEnum : types/MapGen.Triangle.CircumCircleEnum.md + - alias ColoredDotsTable : types/ColoredDotsTable.md + - alias Neighbours : types/MapGen.Triangle.Neighbours.md + - alias PastCalcNoiseValue : types/MapGen.PastCalcNoiseValue.md + - alias generateFunc : types/generateFunc.md + - class Biome : types/MapGen.Biome.md + - class BiomeDef : types/MapGen.BiomeDef.md + - class Cavern : types/MapGen.Cavern.md + - class CavernDef : types/MapGen.CavernDef.md + - class Decoration : types/MapGen.Decoration.md + - class Edge : types/MapGen.Triangulation.Edge.md + - class FakePeak : types/MapGen.Triangulation.FakePeak.md + - class GroundNodes : types/MapGen.Biome.GroundNodes.md + - class GroundNodesIDs : types/MapGen.Biome.GroundNodesIDs.md + - class Layer : types/MapGen.Layer.md + - class LayerDef : types/MapGen.LayerDef.md + - class MapGen : types/MapGen.md + - class MapGenDef : types/MapGenDef.md + - class Peak : types/MapGen.Peak.md + - class PeakDef : types/MapGen.PeakDef.md + - class StaticLayer : types/MapGen.StaticLayer.md + - class StaticLayerDef : types/MapGen.StaticLayerDef.md + - class Tetrahedron : types/MapGen.Tetrahedron.md + - class Triangle : types/MapGen.Triangle.md + - class Triangulation : types/MapGen.Triangulation.md + + + + - Modules: + - MapGen : modules/MapGen.md + - MapGen.Biome : modules/MapGen.Biome.md + - MapGen.Biome.GroundNodes : modules/MapGen.Biome.GroundNodes.md + - MapGen.Biome.GroundNodesIds : modules/MapGen.Biome.GroundNodesIds.md + - MapGen.Cavern : modules/MapGen.Cavern.md + - MapGen.Decoration : modules/MapGen.Decoration.md + - MapGen.Layer : modules/MapGen.Layer.md + - MapGen.Peak : modules/MapGen.Peak.md + - MapGen.StaticLayer : modules/MapGen.StaticLayer.md + - MapGen.Tetrahedron : modules/MapGen.Tetrahedron.md + - MapGen.Triangle : modules/MapGen.Triangle.md + - MapGen.Triangulation : modules/MapGen.Triangulation.md + - MapGen.Triangulation.Edge : modules/MapGen.Triangulation.Edge.md + - MapGen.Triangulation.FakePeak : modules/MapGen.Triangulation.FakePeak.md + - MapGen.ff2luat : modules/MapGen.ff2luat.md + + + +extra: + footer: ""