@@ -5,8 +5,11 @@ Luanti Lua Modding API Reference
5
5
it's now called ` core ` due to the renaming of Luanti (formerly Minetest).
6
6
` minetest ` will keep existing as an alias, so that old code won't break.
7
7
8
+ Note that ` core ` has already existed since version 0.4.10, so you can use it
9
+ safely without breaking backwards compatibility.
10
+
8
11
* More information at < http://www.luanti.org/ >
9
- * Developer Wiki : < https://dev .luanti.org/ >
12
+ * Additional documentation : < https://docs .luanti.org/ >
10
13
* (Unofficial) Minetest Modding Book by rubenwardy: < https://rubenwardy.com/minetest_modding_book/ >
11
14
* Modding tools: < https://github.com/luanti-org/modtools >
12
15
@@ -4581,11 +4584,13 @@ and offset the noise variation.
4581
4584
4582
4585
The final fractal value noise variation is created as follows:
4583
4586
4587
+ ```
4584
4588
noise = offset + scale * (octave1 +
4585
4589
octave2 * persistence +
4586
4590
octave3 * persistence ^ 2 +
4587
4591
octave4 * persistence ^ 3 +
4588
4592
...)
4593
+ ```
4589
4594
4590
4595
Noise Parameters
4591
4596
----------------
@@ -4699,11 +4704,13 @@ with restraint.
4699
4704
The absolute value of each octave's noise variation is used when combining the
4700
4705
octaves. The final value noise variation is created as follows:
4701
4706
4707
+ ```
4702
4708
noise = offset + scale * (abs(octave1) +
4703
4709
abs(octave2) * persistence +
4704
4710
abs(octave3) * persistence ^ 2 +
4705
4711
abs(octave4) * persistence ^ 3 +
4706
4712
...)
4713
+ ```
4707
4714
4708
4715
### Format example
4709
4716
@@ -6562,13 +6569,10 @@ Environment access
6562
6569
* The actual seed used is the noiseparams seed plus the world seed.
6563
6570
* ` core.get_value_noise(seeddiff, octaves, persistence, spread) `
6564
6571
* Deprecated: use ` core.get_value_noise(noiseparams) ` instead.
6565
- * Return world-specific value noise
6566
6572
* ` core.get_perlin(noiseparams) `
6567
- * Deprecated: use ` core.get_value_noise(noiseparams) ` instead.
6568
- * Return world-specific value noise (was not Perlin noise)
6573
+ * Deprecated: renamed to ` core.get_value_noise ` in version 5.12.0.
6569
6574
* ` core.get_perlin(seeddiff, octaves, persistence, spread) `
6570
- * Deprecated: use ` core.get_value_noise(noiseparams) ` instead.
6571
- * Return world-specific value noise (was not Perlin noise)
6575
+ * Deprecated: renamed to ` core.get_value_noise ` in version 5.12.0.
6572
6576
* ` core.get_voxel_manip([pos1, pos2]) `
6573
6577
* Return voxel manipulator object.
6574
6578
* Loads the manipulator from the map if positions are passed.
@@ -9061,78 +9065,6 @@ offering very strong randomness.
9061
9065
* ` get_state()` : return generator state encoded in string
9062
9066
* ` set_state(state_string)` : restore generator state from encoded string
9063
9067
9064
- ` ValueNoise`
9065
- ---- ---------
9066
-
9067
- A value noise generator .
9068
- It can be created via ` ValueNoise()` or ` core.get_value_noise()` .
9069
- For legacy reasons , it can also be created via ` PerlinNoise()` or ` core.get_perlin()` ,
9070
- but the implemented noise is not Perlin noise .
9071
- For ` core.get_value_noise()` , the actual seed used is the noiseparams seed
9072
- plus the world seed , to create world - specific noise .
9073
-
9074
- * ` ValueNoise(noiseparams)
9075
- * ` ValueNoise(seed, octaves, persistence, spread)` (Deprecated )
9076
- * ` PerlinNoise(noiseparams)` (Deprecated )
9077
- * ` PerlinNoise(seed, octaves, persistence, spread)` (Deprecated )
9078
-
9079
- * ` core.get_value_noise(noiseparams)`
9080
- * ` core.get_value_noise(seeddiff, octaves, persistence, spread)` (Deprecated )
9081
- * ` core.get_perlin(noiseparams)` (Deprecated )
9082
- * ` core.get_perlin(seeddiff, octaves, persistence, spread)` (Deprecated )
9083
-
9084
- ### Methods
9085
-
9086
- * ` get_2d(pos)` : returns 2 D noise value at ` pos={x=,y=}`
9087
- * ` get_3d(pos)` : returns 3 D noise value at ` pos={x=,y=,z=}`
9088
-
9089
- ` ValueNoiseMap`
9090
- ---- ------------
9091
-
9092
- A fast , bulk noise generator .
9093
-
9094
- It can be created via ` ValueNoiseMap(noiseparams, size)` or
9095
- ` core.get_value_noise_map(noiseparams, size)` .
9096
- For legacy reasons , it can also be created via ` PerlinNoiseMap(noiseparams, size)`
9097
- or ` core.get_perlin_map(noiseparams, size)` , but it is not Perlin noise .
9098
- For ` core.get_value_noise_map()` , the actual seed used is the noiseparams seed
9099
- plus the world seed , to create world - specific noise .
9100
-
9101
- Format of ` size` is ` {x=dimx, y=dimy, z=dimz}` . The ` z` component is omitted
9102
- for 2 D noise , and it must be larger than 1 for 3 D noise (otherwise
9103
- ` nil` is returned ).
9104
-
9105
- For each of the functions with an optional ` buffer` parameter : If ` buffer` is
9106
- not nil , this table will be used to store the result instead of creating a new
9107
- table .
9108
-
9109
- ### Methods
9110
-
9111
- * ` get_2d_map(pos)` : returns a ` <size.x>` times ` <size.y>` 2 D array of 2 D noise
9112
- with values starting at ` pos={x=,y=}`
9113
- * ` get_3d_map(pos)` : returns a ` <size.x>` times ` <size.y>` times ` <size.z>`
9114
- 3 D array of 3 D noise with values starting at ` pos={x=,y=,z=}` .
9115
- * ` get_2d_map_flat(pos, buffer)` : returns a flat ` <size.x * size.y>` element
9116
- array of 2 D noise with values starting at ` pos={x=,y=}`
9117
- * ` get_3d_map_flat(pos, buffer)` : Same as ` get2dMap_flat` , but 3 D noise
9118
- * ` calc_2d_map(pos)` : Calculates the 2 d noise map starting at ` pos` . The result
9119
- is stored internally .
9120
- * ` calc_3d_map(pos)` : Calculates the 3 d noise map starting at ` pos` . The result
9121
- is stored internally .
9122
- * ` get_map_slice(slice_offset, slice_size, buffer)` : In the form of an array ,
9123
- returns a slice of the most recently computed noise results . The result slice
9124
- begins at coordinates ` slice_offset` and takes a chunk of ` slice_size` .
9125
- E .g ., to grab a 2 - slice high horizontal 2 d plane of noise starting at buffer
9126
- offset y = 20 :
9127
- ` noisevals = noise:get_map_slice({y=20}, {y=2})`
9128
- It is important to note that ` slice_offset` offset coordinates begin at 1 ,
9129
- and are relative to the starting position of the most recently calculated
9130
- noise .
9131
- To grab a single vertical column of noise starting at map coordinates
9132
- x = 1023 , y = 1000 , z = 1000 :
9133
- ` noise:calc_3d_map({x=1000, y=1000, z=1000})`
9134
- ` noisevals = noise:get_map_slice({x=24, z=1}, {x=1, z=1})`
9135
-
9136
9068
` PlayerMetaRef`
9137
9069
---- -----------
9138
9070
@@ -9184,14 +9116,17 @@ end
9184
9116
The map is loaded as the ray advances. If the map is modified after the
9185
9117
` Raycast ` is created, the changes may or may not have an effect on the object.
9186
9118
9187
- It can be created via ` Raycast(pos1, pos2, objects, liquids) ` or
9188
- ` core.raycast(pos1, pos2, objects, liquids) ` where:
9119
+ It can be created via ` Raycast(pos1, pos2, objects, liquids, pointabilities) `
9120
+ or ` core.raycast(pos1, pos2, objects, liquids, pointabilities ) ` where:
9189
9121
9190
9122
* ` pos1 ` : start of the ray
9191
9123
* ` pos2 ` : end of the ray
9192
- * ` objects ` : if false, only nodes will be returned. Default is true.
9124
+ * ` objects ` : if false, only nodes will be returned. Default is ` true ` .
9193
9125
* ` liquids ` : if false, liquid nodes (` liquidtype ~= "none" ` ) won't be
9194
- returned. Default is false.
9126
+ returned. Default is ` false ` .
9127
+ * ` pointabilities ` : Allows overriding the ` pointable ` property of
9128
+ nodes and objects. Uses the same format as the ` pointabilities ` property
9129
+ of item definitions. Default is ` nil ` .
9195
9130
9196
9131
### Limitations
9197
9132
@@ -9307,6 +9242,81 @@ to restrictions of JSON.
9307
9242
9308
9243
* All methods in MetaDataRef
9309
9244
9245
+ ` ValueNoise `
9246
+ -------------
9247
+
9248
+ A value noise generator.
9249
+ It can be created via ` ValueNoise() ` or ` core.get_value_noise() ` .
9250
+ For ` core.get_value_noise() ` , the actual seed used is the noiseparams seed
9251
+ plus the world seed, to create world-specific noise.
9252
+
9253
+ * ` ValueNoise(noiseparams) `
9254
+ * ` ValueNoise(seed, octaves, persistence, spread) ` (deprecated)
9255
+ * ` core.get_value_noise(noiseparams) `
9256
+ * ` core.get_value_noise(seeddiff, octaves, persistence, spread) ` (deprecated)
9257
+
9258
+ These were previously called ` PerlinNoise() ` and ` core.get_perlin() ` , but the
9259
+ implemented noise was not Perlin noise. They were renamed in 5.12.0. The old
9260
+ names still exist as aliases.
9261
+
9262
+ ### Methods
9263
+
9264
+ * ` get_2d(pos) ` : returns 2D noise value at ` pos={x=,y=} `
9265
+ * ` get_3d(pos) ` : returns 3D noise value at ` pos={x=,y=,z=} `
9266
+
9267
+ ` ValueNoiseMap `
9268
+ ----------------
9269
+
9270
+ A fast, bulk noise generator.
9271
+
9272
+ It can be created via ` ValueNoiseMap(noiseparams, size) ` or
9273
+ ` core.get_value_noise_map(noiseparams, size) ` .
9274
+ For ` core.get_value_noise_map() ` , the actual seed used is the noiseparams seed
9275
+ plus the world seed, to create world-specific noise.
9276
+
9277
+ These were previously called ` PerlinNoiseMap() ` and ` core.get_perlin_map() ` ,
9278
+ but the implemented noise was not Perlin noise. They were renamed in 5.12.0.
9279
+ The old names still exist as aliases.
9280
+
9281
+ Format of ` size ` is ` {x=dimx, y=dimy, z=dimz} ` . The ` z ` component is omitted
9282
+ for 2D noise, and it must be larger than 1 for 3D noise (otherwise
9283
+ ` nil ` is returned).
9284
+
9285
+ For each of the functions with an optional ` buffer ` parameter: If ` buffer ` is
9286
+ not nil, this table will be used to store the result instead of creating a new
9287
+ table.
9288
+
9289
+ ### Methods
9290
+
9291
+ * ` get_2d_map(pos) ` : returns a ` <size.x> ` times ` <size.y> ` 2D array of 2D noise
9292
+ with values starting at ` pos={x=,y=} `
9293
+ * ` get_3d_map(pos) ` : returns a ` <size.x> ` times ` <size.y> ` times ` <size.z> `
9294
+ 3D array of 3D noise with values starting at ` pos={x=,y=,z=} ` .
9295
+ * ` get_2d_map_flat(pos, buffer) ` : returns a flat ` <size.x * size.y> ` element
9296
+ array of 2D noise with values starting at ` pos={x=,y=} `
9297
+ * ` get_3d_map_flat(pos, buffer) ` : Same as ` get2dMap_flat ` , but 3D noise
9298
+ * ` calc_2d_map(pos) ` : Calculates the 2d noise map starting at ` pos ` . The result
9299
+ is stored internally.
9300
+ * ` calc_3d_map(pos) ` : Calculates the 3d noise map starting at ` pos ` . The result
9301
+ is stored internally.
9302
+ * ` get_map_slice(slice_offset, slice_size, buffer) ` : In the form of an array,
9303
+ returns a slice of the most recently computed noise results. The result slice
9304
+ begins at coordinates ` slice_offset ` and takes a chunk of ` slice_size ` .
9305
+ E.g., to grab a 2-slice high horizontal 2d plane of noise starting at buffer
9306
+ offset ` y = 20 ` :
9307
+ ``` lua
9308
+ noisevals = noise :get_map_slice ({y = 20 }, {y = 2 })
9309
+ ```
9310
+ It is important to note that ` slice_offset ` offset coordinates begin at 1,
9311
+ and are relative to the starting position of the most recently calculated
9312
+ noise.
9313
+ To grab a single vertical column of noise starting at map coordinates
9314
+ ` x = 1023, y=1000, z = 1000 ` :
9315
+ ``` lua
9316
+ noise :calc_3d_map ({x = 1000 , y = 1000 , z = 1000 })
9317
+ noisevals = noise :get_map_slice ({x = 24 , z = 1 }, {x = 1 , z = 1 })
9318
+ ```
9319
+
9310
9320
9311
9321
9312
9322
0 commit comments