-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathregister.lua
160 lines (133 loc) · 6.25 KB
/
register.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
---@meta
---Registration functions
-------------------------
---Anything added using certain registration functions gets added to one or more
---of the global registered definition tables.
---
---Note that in some cases you will stumble upon things that are not contained
---in these tables (e.g. when a mod has been removed). Always check for
---existence before trying to access the fields.
---
---Example:
---
---All nodes registered with `minetest.register_node` get added to the table
---`minetest.registered_nodes`.
---
---If you want to check the drawtype of a node, you could do it like this:
---
--- local def = minetest.registered_nodes[nodename]
--- local drawtype = def and def.drawtype
---@param name string
---@param definition mt.NodeDef
function minetest.register_node(name, definition) end
---@param name string
---@param item mt.ItemDef
function minetest.register_craftitem(name, item) end
---@param name string
---@param item mt.ItemDef
function minetest.register_tool(name, item) end
---* Overrides fields of an item registered with register_node/tool/craftitem.
---* Note: Item must already be defined, (opt)depend on the mod defining it.
---* Example: `minetest.override_item("default:mese",
--- {light_source=minetest.LIGHT_MAX})`
---@param name string
---@param item mt.ItemDef
function minetest.override_item(name, item) end
---* Unregister the item from the engine, and deletes the entry with key
--- `name` from `minetest.registered_items` and from the associated item table
--- according to its nature: `minetest.registered_nodes`, etc.
---@param name string
function minetest.unregister_item(name) end
---@param name string
---@param entity mt.EntityDef
function minetest.register_entity(name, entity) end
---@param abm mt.ABMDef
function minetest.register_abm(abm) end
---@param lbm mt.LBMDef
function minetest.register_lbm(lbm) end
---This adds an alias `alias` for the item called `original_name`.
---From now on, you can use `alias` to refer to the item `original_name`.
---@param alias string
---@param original_name string
function minetest.register_alias(alias, original_name) end
---The only difference between `minetest.register_alias` and
---`minetest.register_alias_force` is that if an item named `alias` already exists,
---`minetest.register_alias` will do nothing while
---`minetest.register_alias_force` will unregister it.
---@param alias string
---@param original_name string
function minetest.register_alias_force(alias, original_name) end
---The order of ore registrations determines the order of ore generation.
---@param ore mt.OreDef
---@return integer handle Uniquely identifying the registered ore on success.
function minetest.register_ore(ore) end
---To get the biome ID, use `minetest.get_biome_id`.
---@param biome mt.BiomeDef
---@return integer handle Uniquely identifying the registered biome on success.
function minetest.register_biome(biome) end
---* Unregister the biome from the engine, and deletes the entry with key
--- `name` from `minetest.registered_biomes`.
---* Warning: This alters the biome to biome ID correspondences, so any
--- decorations or ores using the 'biomes' field must afterwards be cleared
--- and re-registered.
---@param name string
function minetest.unregister_biome(name) end
---* To get the decoration ID, use `minetest.get_decoration_id`.
---* The order of decoration registrations determines the order of decoration
--- generation.
---@param decoration mt.DecorDef
---@return integer handle Uniquely identifying the registered biome on success.
function minetest.register_decoration(decoration) end
---* If the schematic is loaded from a file, the `name` field is set to the filename.
---* If the function is called when loading the mod, and `name` is a relative
--- path, then the current mod path will be prepended to the schematic filename.
---@param schematic mt.SchematicSpec
---@return integer handle Uniquely identifying the registered biome on success.
function minetest.register_schematic(schematic) end
---* Clears all biomes currently registered.
---* Warning: Clearing and re-registering biomes alters the biome to biome ID
--- correspondences, so any decorations or ores using the 'biomes' field must
--- afterwards be cleared and re-registered.
function minetest.clear_registered_biomes() end
---Clears all decorations currently registered.
function minetest.clear_registered_decorations() end
---Clears all ores currently registered.
function minetest.clear_registered_ores() end
---Clears all schematics currently registered.
function minetest.clear_registered_schematics() end
---### Gameplay
---@param recipe mt.CraftRecipe
function minetest.register_craft(recipe) end
---* Will erase existing craft based either on output item or on input recipe.
---* Specify either output or input only. If you specify both, input will be
--- ignored. For input use the same recipe table syntax as for
--- `minetest.register_craft(recipe)`. For output specify only the item,
--- without a quantity.
---* Returns false if no erase candidate could be found, otherwise returns true.
---* **Warning**! The type field ("shaped", "cooking" or any other) will be
--- ignored if the recipe contains output. Erasing is then done independently
--- from the crafting method.
---@param recipe mt.CraftRecipe
function minetest.clear_craft(recipe) end
---@param name string
---@param cmd mt.ChatCmdDef
function minetest.register_chatcommand(name, cmd) end
---Overrides fields of a chatcommand registered with `register_chatcommand`.
---@param name string
---@param cmd mt.ChatCmdDef
function minetest.override_chatcommand(name, cmd) end
---Unregister a chatcommands registered with `register_chatcommand`.
---@param name string
function minetest.unregister_chatcommand(name) end
---* `priv` can be a description or a definition table.
---* If it is a description, the priv will be granted to singleplayer and admin
--- by default.
---* To allow players with `basic_privs` to grant, see the `basic_privs`
--- minetest.conf setting.
---@param name string
---@param priv unknown|mt.PrivDef
function minetest.register_privilege(name, priv) end
---* Registers an auth handler that overrides the builtin one.
---* This function can be called by a single mod once only.
---@param handler mt.AuthHandlerDef
function minetest.register_authentication_handler(handler) end