-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdecor.lua
123 lines (118 loc) · 5.62 KB
/
decor.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
---@meta
---Decoration definition
------------------------
---@alias mt.DecorType
-- Creates a 1 times `H` times 1 column of a specified node (or a random node from
-- a list, if a decoration list is specified). Can specify a certain node it must
-- spawn next to, such as water or lava, for example. Can also generate a
-- decoration of random height between a specified lower and upper bound.
-- This type of decoration is intended for placement of grass, flowers, cacti,
-- papyri, waterlilies and so on.
---|"simple"
-- Copies a box of `MapNodes` from a specified schematic file (or raw description).
-- Can specify a probability of a node randomly appearing when placed.
-- This decoration type is intended to be used for multi-node sized discrete
-- structures, such as trees, cave spikes, rocks, and so on.
---|"schematic"
-- Used by `minetest.register_decoration`.
---@alias mt.DecorDef mt.DecorDefSimple|mt.DecorDefSchematic
---@class mt.DecorDefCommon
---@field deco_type mt.DecorType
-- Node (or list of nodes) that the decoration can be placed on.
---@field place_on string|string[]
-- Size of the square divisions of the mapchunk being generated.
-- Determines the resolution of noise variation if used.
-- If the chunk size is not evenly divisible by sidelen, sidelen is made
-- equal to the chunk size.
---@field sidelen number
-- The value determines `decorations per surface node`.
-- Used only if noise_params is not specified.
-- If >= 10.0 complete coverage is enabled and decoration placement uses
-- a different and much faster method.
---@field fill_ratio number
-- NoiseParams structure describing the perlin noise used for decoration
-- distribution.
-- A noise value is calculated for each square division and determines
-- `decorations per surface node` within each division.
-- If the noise value >= 10.0 complete coverage is enabled and
-- decoration placement uses a different and much faster method.
---@field noise_params mt.NoiseParams
-- List of biomes in which this decoration occurs. Occurs in all biomes
-- if this is omitted, and ignored if the Mapgen being used does not
-- support biomes.
-- Can be a list of (or a single) biome names, IDs, or definitions.
---@field biomes string[]
-- Lower limits for decoration.
-- These parameters refer to the Y co-ordinate of the `place_on` node.
---@field y_min number
-- Upper limits for decoration.
-- These parameters refer to the Y co-ordinate of the `place_on` node.
---@field y_max number
-- Node (or list of nodes) that the decoration only spawns next to.
-- Checks the 8 neighbor nodes on the same Y, and also the ones
-- at Y+1, excluding both center nodes.
---@field spawn_by string|string[]
-- Number of spawn_by nodes that must be surrounding the decoration
-- position to occur.
-- If absent or -1, decorations occur next to any nodes.
---@field num_spawn_by number
-- * Comma separated values.
-- * Flags for all decoration types.
-- * "liquid_surface": Instead of placement on the highest solid surface
-- in a mapchunk column, placement is on the highest liquid surface.
-- Placement is disabled if solid nodes are found above the liquid
-- surface.
-- * "force_placement": Nodes other than "air" and "ignore" are replaced
-- by the decoration.
-- * "all_floors", "all_ceilings": Instead of placement on the highest
-- surface in a mapchunk the decoration is placed on all floor and/or
-- ceiling surfaces, for example in caves and dungeons.
-- Ceiling decorations act as an inversion of floor decorations so the
-- effect of `place_offset_y` is inverted.
-- Y-slice probabilities do not function correctly for ceiling
-- schematic decorations as the behavior is unchanged.
-- If a single decoration registration has both flags the floor and
-- ceiling decorations will be aligned vertically.
---@field flags string
---@class mt.DecorDefSimple:mt.DecorDefCommon
-- The node name used as the decoration.
-- If instead a list of strings, a randomly selected node from the list
-- is placed as the decoration.
---@field decoration string|string[]
-- Decoration height in nodes.
-- If height_max is not 0, this is the lower limit of a randomly
-- selected height.
---@field height number
-- Upper limit of the randomly selected height.
-- If absent, the parameter `height` is used as a constant.
---@field height_max number
-- Param2 value of decoration nodes.
-- If param2_max is not 0, this is the lower limit of a randomly
-- selected param2.
---@field param2 number
-- Upper limit of the randomly selected param2.
-- If absent, the parameter `param2` is used as a constant.
---@field param2_max number
-- Y offset of the decoration base node relative to the standard base
-- node position.
-- Can be positive or negative. Default is 0.
-- Effect is inverted for "all_ceilings" decorations.
-- Ignored by `y_min`, `y_max` and `spawn_by` checks, which always refer
-- to the `place_on` node.
---@field place_offset_y number
---@class mt.DecorDefSchematic:mt.DecorDefCommon
-- If schematic is a string, it is the filepath relative to the current
-- working directory of the specified Minetest schematic file.
-- Could also be the ID of a previously registered schematic.
---@field schematic string|mt.SchematicSpec
---@field replacements table
-- Flags for schematic decorations.
---@field flags string
---@field rotation "0"|"90"|"180"|"270"|"random"
-- If the flag `place_center_y` is set this parameter is ignored.
-- Y offset of the schematic base node layer relative to the `place_on` node.
-- Can be positive or negative. Default is 0.
-- Effect is inverted for "all_ceilings" decorations.
-- Ignored by `y_min`, `y_max` and `spawn_by` checks, which always refer
-- to the `place_on` node.
---@field place_offset_y number