· 6 years ago · Mar 25, 2020, 10:04 PM
1--- @alias integer number
2--- @alias float number
3
4
5
6
7-- Sounds
8-- ======
9
10-- SimpleSoundSpec
11-- ---------------
12
13--- @class SimpleSoundSpec @ Specifies a sound name, gain (=volume) and pitch. `gain` and `pitch` are optional and default to `1.0`.
14--- @field name string Sound name or the empty string for no sound
15--- @field gain float Volume (`1.0` = 100%)
16--- @field pitch float Pitch (`1.0` = 100%)
17local cls = {}
18
19
20
21
22-- Nodes
23-- =====
24
25-- Node boxes
26-- ----------
27
28--- @class NodeBox
29--- @field type string | '"regular"' | '"fixed"' | '"leveled"' | '"wallmounted"' | '"connected"'
30--- @field fixed box|box[]
31--- @field wall_top box
32--- @field wall_bottom box
33--- @field wall_side box
34--- @field connect_top box|box[]
35--- @field connect_bottom box|box[]
36--- @field connect_front box|box[]
37--- @field connect_left box|box[]
38--- @field connect_back box|box[]
39--- @field connect_right box|box[]
40--- @field disconnected_top box|box[]
41--- @field disconnected_bottom box|box[]
42--- @field disconnected_front box|box[]
43--- @field disconnected_left box|box[]
44--- @field disconnected_back box|box[]
45--- @field disconnected_right box|box[]
46--- @field disconnected box|box[] @ when there is *no* neighbour
47--- @field disconnected_sides box|box[] @ when there are *no* neighbours to the sides
48local cls = {}
49
50
51
52
53-- Representations of simple things
54-- ================================
55
56-- Position/vector
57-- ---------------
58
59--- @alias Position Vector
60
61--- @class Vector @ `{x=num, y=num, z=num}`
62--- @field x number
63--- @field y number
64--- @field z number
65local cls = {}
66
67--- @class Vec2 @ `{x=num, y=num}`
68--- @field x number
69--- @field y number
70local cls = {}
71
72-- pointed_thing
73-- -------------
74
75--- @class PointedThing
76--- @field type string @ e.g. `"nothing"`, `"node"`, `"object"`
77--- @field under Position
78--- @field above Position
79--- @field ref ObjectRef
80local cls = {}
81
82
83
84
85-- Tools
86-- =====
87
88-- Tools definition
89-- ----------------
90
91--- @class ToolCapabilities
92--- @field full_punch_interval float
93--- @field max_drop_level integer
94--- @field groupcaps table<string, GroupCap>
95--- @field damage_groups table<string, integer> @ Damage values must be between -32768 and 32767 (2^15)
96--- @field punch_attack_uses integer @ Amount of uses this tool has for attacking players and entities by punching them (0 = infinite uses).
97local cls = {}
98
99--- @class GroupCap
100--- @field times float[]
101--- @field maxlevel integer
102--- @field uses integer
103local cls = {}
104
105
106
107
108-- Colors
109-- ======
110
111-- ColorSpec
112-- ---------
113
114--- @alias box float[]
115
116--- @alias ColorSpec ColorSpecification|integer|string
117
118--- @class ColorSpecification @ A ColorSpec specifies a 32-bit color. Each element ranging from 0..255 (a, if absent, defaults to 255).
119--- @field a integer
120--- @field r integer
121--- @field g integer
122--- @field b integer
123local cls = {}
124
125
126
127
128-- 'minetest' namespace reference
129-- ==============================
130
131--- @class Minetest
132--- @field CONTENT_UNKNOWN integer @ Content ID for "unknown" nodes
133--- @field CONTENT_AIR integer @ Content ID for "air" nodes
134--- @field CONTENT_IGNORE integer @ Content ID for "ignore" nodes
135minetest = {}
136
137-- Utilities
138-- ---------
139
140--- @return string @ the currently loading mod's name, when loading a mod
141function minetest.get_current_modname() end
142
143--- Useful for loading additional `.lua` modules or static data from mod
144--- @param modname string
145--- @return string @ e.g. `"/home/user/.minetest/usermods/modname"`
146function minetest.get_modpath(modname) end
147
148--- @return string[] @ a list of installed mods, sorted alphabetically
149function minetest.get_modnames() end
150
151--- Useful for storing custom data
152--- @return string @ e.g. `"/home/user/.minetest/world"`
153function minetest.get_worldpath() end
154
155--- @return boolean
156function minetest.is_singleplayer() end
157
158--- @class Features
159--- @field glasslike_framed boolean @ 0.4.7
160--- @field nodebox_as_selectionbox boolean @ 0.4.7
161--- @field get_all_craft_recipes_works boolean @ 0.4.7
162--- @field use_texture_alpha boolean @ The transparency channel of textures can optionally be used on nodes (0.4.7)
163--- @field no_legacy_abms boolean @ Tree and grass ABMs are no longer done from C++ (0.4.8)
164--- @field texture_names_parens boolean @ Texture grouping is possible using parentheses (0.4.11)
165--- @field area_store_custom_ids boolean @ Unique Area ID for AreaStore:insert_area (0.4.14)
166--- @field add_entity_with_staticdata boolean @ add_entity supports passing initial staticdata to on_activate (0.4.16)
167--- @field no_chat_message_prediction boolean @ Chat messages are no longer predicted (0.4.16)
168--- @field object_use_texture_alpha boolean @ The transparency channel of textures can optionally be used on objects (ie: players and lua entities) (5.0.0)
169--- @field object_independent_selectionbox boolean @ Object selectionbox is settable independently from collisionbox (5.0.0)
170--- @field httpfetch_binary_data boolean @ Specifies whether binary data can be uploaded or downloaded using the HTTP API (5.1.0)
171--- @field formspec_version_element boolean @ Whether `formspec_version[<version>]` may be used (5.1.0)
172--- @field area_store_persistent_ids boolean @ Whether AreaStore's IDs are kept on save/load (5.1.0)
173--- @field pathfinder_works boolean @ Whether `minetest.find_path` is functional (5.2.0)
174local cls = {}
175
176--- @type Features
177minetest.features = {}
178
179--- @param arg string|table<string, boolean> @ string or table in format `{foo=true, bar=true}`
180--- @return boolean, table<string, boolean> @ `boolean, missing_features`
181function minetest.has_feature(arg) end
182
183--- @class PlayerInformation
184--- @field address string @ IP address of client
185--- @field ip_version integer @ IPv4 / IPv6
186--- @field min_rtt float @ minimum round trip time
187--- @field max_rtt float @ maximum round trip time
188--- @field avg_rtt float @ average round trip time
189--- @field min_jitter float @ minimum packet time jitter
190--- @field max_jitter float @ maximum packet time jitter
191--- @field avg_jitter float @ average packet time jitter
192--- @field connection_uptime integer @ seconds since client connected
193--- @field protocol_version integer @ protocol version used by client
194--- @field formspec_version integer @ supported formspec version
195local cls = {}
196
197--- @param player_name string
198--- @return PlayerInformation Table containing information about a player
199function minetest.get_player_information(player_name) end
200
201--- Creates a directory specified by `path`, creating parent directories
202--- if they don't exist.
203--- @param path string
204--- @return boolean success
205function minetest.mkdir(path) end
206
207--- @overload fun(path: string): string[]
208--- @param path string
209--- @param is_dir boolean @ `nil`: return all entries, `true`: return only subdirectory names, or `false`: return only file names
210--- @return string[] @ list of entry names
211function minetest.get_dir_list(path, is_dir) end
212
213--- Replaces contents of file at path with new contents in a safe (atomic)
214--- way. Use this instead of below code when writing e.g. database files:
215---
216--- `local f = io.open(path, "wb"); f:write(content); f:close()`
217---
218--- @param path string
219--- @param content string
220--- @return boolean @ boolean indicating success
221function minetest.safe_file_write(path, content) end
222
223--- @class Version
224--- @field project string @ Name of the project, eg, "Minetest"
225--- @field string string @ Simple version, eg, "1.2.3-dev"
226--- @field hash string @ Full git version (only set if available), eg, "1.2.3-dev-01234567-dirty"
227local cls = {}
228
229--- Use this for informational purposes only. The information in the returned
230--- table does not represent the capabilities of the engine, nor is it
231--- reliable or verifiable. Compatible forks will have a different name and
232--- version entirely. To check for the presence of engine features, test
233--- whether the functions exported by the wanted features exist. For example:
234--- `if minetest.check_for_falling then ... end`
235---
236--- @return Version @ a table containing components of the engine version
237function minetest.get_version() end
238
239--- @overload fun(data: string): string|integer[]
240--- @param data string @ string of data to hash
241--- @param raw boolean @ return raw bytes instead of hex digits, default: `false`
242--- @return string|integer[] @ the sha1 hash of `data`
243function minetest.sha1(data, raw) end
244
245-- Logging
246-- -------
247
248--- Equivalent to `minetest.log(table.concat({...}, "\t"))`
249--- @vararg any
250function minetest.debug(...) end
251
252--- @overload fun(text: string)
253--- @param level string | '"none"' | '"error"' | '"warning"' | '"action"' | '"info"' | '"verbose"' @ Default is `"none"`
254--- @param text string
255function minetest.log(level, text) end
256
257-- Registration functions
258-- ----------------------
259
260-- Environment
261
262--- @param name string
263--- @param node_definition NodeDefinition
264function minetest.register_node(name, node_definition) end
265
266--- @param name string
267--- @param item_definition ItemDefinition
268function minetest.register_craftitem(name, item_definition) end
269
270--- @param name string
271--- @param item_definition ItemDefinition
272function minetest.register_tool(name, item_definition) end
273
274--- * Overrides fields of an item registered with register_node/tool/craftitem
275--- * Note: Item must already be defined, (opt)depend on the mod defining it.
276--- * Example: `minetest.override_item("default:mese",
277--- {light_source=minetest.LIGHT_MAX})`
278--- @param name string
279--- @param redefinition NodeDefinition|ItemDefinition
280function minetest.override_item(name, redefinition) end
281
282--- @param name string
283function minetest.unregister_item(name) end
284
285function minetest.register_entity(name, entity_definition) end
286
287function minetest.register_abm(abm_definition) end
288
289function minetest.register_lbm(lbm_definition) end
290
291function minetest.register_alias(alias, original_name) end
292
293function minetest.register_alias_force(alias, original_name) end
294
295function minetest.register_ore(ore_definition) end
296
297function minetest.register_biome(biome_definition) end
298
299function minetest.unregister_biome(name) end
300
301function minetest.register_decoration(decoration_definition) end
302
303function minetest.register_schematic(schematic_definition) end
304
305function minetest.clear_registered_biomes() end
306
307function minetest.clear_registered_decorations() end
308
309function minetest.clear_registered_ores() end
310
311function minetest.clear_registered_schematics() end
312
313-- Gameplay
314
315function minetest.register_craft(recipe) end
316
317function minetest.clear_craft(recipe) end
318
319function minetest.register_chatcommand(cmd, chatcommand_definition) end
320
321function minetest.override_chatcommand(name, redefinition) end
322
323function minetest.unregister_chatcommand(name) end
324
325function minetest.register_privilege(name, definition) end
326
327function minetest.register_authentication_handler(authentication_handler_definition) end
328
329-- Global callback registration functions
330-- --------------------------------------
331
332--- @param callback fun(dtime)
333function minetest.register_globalstep(callback) end
334
335--- @param callback fun()
336function minetest.register_on_mods_loaded(callback) end
337
338--- @param callback fun()
339function minetest.register_on_shutdown(callback) end
340
341--- @param callback fun(pos, newnode, placer, oldnode, itemstack, pointed_thing)
342function minetest.register_on_placenode(callback) end
343
344--- @param callback fun(pos, oldnode, digger)
345function minetest.register_on_dignode(callback) end
346
347--- @param callback fun(pos, node, puncher, pointed_thing)
348function minetest.register_on_punchnode(callback) end
349
350--- @param callback fun(minp, maxp, blockseed)
351function minetest.register_on_generated(callback) end
352
353--- @param callback fun(ObjectRef)
354function minetest.register_on_newplayer(callback) end
355
356--- @param callback fun(player, hitter, time_from_last_punch, tool_capabilities, dir, damage)
357function minetest.register_on_punchplayer(callback) end
358
359--- @param callback fun(player, hp_change, reason)
360function minetest.register_on_player_hpchange(callback, modifier) end
361
362--- @param callback fun(ObjectRef, reason)
363function minetest.register_on_dieplayer(callback) end
364
365--- @param callback fun(ObjectRef)
366function minetest.register_on_respawnplayer(callback) end
367
368--- @param callback fun(name, ip)
369function minetest.register_on_prejoinplayer(callback) end
370
371--- @param callback fun(ObjectRef)
372function minetest.register_on_joinplayer(callback) end
373
374--- @param callback fun(ObjectRef, timed_out)
375function minetest.register_on_leaveplayer(callback) end
376
377--- @param callback fun(name, ip)
378function minetest.register_on_auth_fail(callback) end
379
380--- @param callback fun(ObjectRef, cheat)
381function minetest.register_on_cheat(callback) end
382
383--- @param callback fun(name, message)
384function minetest.register_on_chat_message(callback) end
385
386--- @param callback fun(player, formname, fields)
387function minetest.register_on_player_receive_fields(callback) end
388
389--- @param callback fun(itemstack, player, old_craft_grid, craft_inv)
390function minetest.register_on_craft(callback) end
391
392--- @param callback fun(itemstack, player, old_craft_grid, craft_inv)
393function minetest.register_craft_predict(callback) end
394
395--- @param callback fun(player, action, inventory, inventory_info)
396function minetest.register_allow_player_inventory_action(callback) end
397
398--- @param callback fun(player, action, inventory, inventory_info)
399function minetest.register_on_player_inventory_action(callback) end
400
401--- @param callback fun(pos, name)
402function minetest.register_on_protection_violation(callback) end
403
404--- @param callback fun(hp_change, replace_with_item, itemstack, user, pointed_thing)
405function minetest.register_on_item_eat(callback) end
406
407--- @param callback fun(name, granter, priv)
408function minetest.register_on_priv_grant(callback) end
409
410--- @param callback fun(name, revoker, priv)
411function minetest.register_on_priv_revoke(callback) end
412
413--- @param callback fun(name, ip)
414function minetest.register_can_bypass_userlimit(callback) end
415
416--- @param callback fun(channel_name, sender, message)
417function minetest.register_on_modchannel_message(callback) end
418
419-- Setting-related
420-- ---------------
421
422minetest.settings = {}
423
424function minetest.setting_get_pos(name) end
425
426-- Authentication
427-- --------------
428
429--- @overload fun(str)
430function minetest.string_to_privs(str, delim) end
431
432--- @overload fun(privs)
433function minetest.privs_to_string(privs, delim) end
434
435--- @return table<string, boolean>
436function minetest.get_player_privs(name) end
437
438function minetest.check_player_privs(player_or_name, ...) end
439
440function minetest.check_password_entry(name, entry, password) end
441
442function minetest.get_password_hash(name, raw_password) end
443
444function minetest.get_player_ip(name) end
445
446function minetest.get_auth_handler() end
447
448function minetest.notify_authentication_modified(name) end
449
450function minetest.set_player_password(name, password_hash) end
451
452--- @param privs table<string, boolean>
453function minetest.set_player_privs(name, privs) end
454
455function minetest.auth_reload() end
456
457-- Chat
458-- ----
459
460function minetest.chat_send_all(text) end
461
462function minetest.chat_send_player(name, text) end
463
464function minetest.format_chat_message(name, message) end
465
466-- Environment access
467-- ------------------
468
469function minetest.set_node(pos, node) end
470
471function minetest.add_node(pos, node) end
472
473--- @param positions table[]
474function minetest.bulk_set_node(positions, node) end
475
476function minetest.swap_node(pos, node) end
477
478function minetest.remove_node(pos) end
479
480function minetest.get_node(pos) end
481
482function minetest.get_node_or_nil(pos) end
483
484function minetest.get_node_light(pos, timeofday) end
485
486function minetest.place_node(pos, node) end
487
488function minetest.dig_node(pos) end
489
490function minetest.punch_node(pos) end
491
492function minetest.spawn_falling_node(pos) end
493
494function minetest.find_nodes_with_meta(pos1, pos2) end
495
496function minetest.get_meta(pos) end
497
498function minetest.get_node_timer(pos) end
499
500--- @overload fun(pos, name)
501function minetest.add_entity(pos, name, staticdata) end
502
503function minetest.add_item(pos, item) end
504
505function minetest.get_player_by_name(name) end
506
507function minetest.get_objects_inside_radius(pos, radius) end
508
509function minetest.set_timeofday(val) end
510
511function minetest.get_timeofday() end
512
513function minetest.get_gametime() end
514
515function minetest.get_day_count() end
516
517--- @overload fun(pos, radius, nodenames)
518function minetest.find_node_near(pos, radius, nodenames, search_center) end
519
520function minetest.find_nodes_in_area(pos1, pos2, nodenames) end
521
522function minetest.find_nodes_in_area_under_air(pos1, pos2, nodenames) end
523
524function minetest.get_perlin(noiseparams) end
525
526function minetest.get_perlin(seeddiff, octaves, persistence, spread) end
527
528--- @overload fun()
529function minetest.get_voxel_manip(pos1, pos2) end
530
531--- @param deco_ids integer[]
532function minetest.set_gen_notify(flags, deco_ids) end
533
534function minetest.get_gen_notify() end
535
536function minetest.get_decoration_id(decoration_name) end
537
538function minetest.get_mapgen_object(objectname) end
539
540function minetest.get_heat(pos) end
541
542function minetest.get_humidity(pos) end
543
544function minetest.get_biome_data(pos) end
545
546function minetest.get_biome_id(biome_name) end
547
548function minetest.get_biome_name(biome_id) end
549
550function minetest.get_mapgen_params() end
551
552function minetest.set_mapgen_params(MapgenParams) end
553
554function minetest.get_mapgen_setting(name) end
555
556function minetest.get_mapgen_setting_noiseparams(name) end
557
558--- @overload fun(name, value)
559function minetest.set_mapgen_setting(name, value, override_meta) end
560
561--- @overload fun(name, value)
562function minetest.set_mapgen_setting_noiseparams(name, value, override_meta) end
563
564function minetest.set_noiseparams(name, noiseparams, set_default) end
565
566function minetest.get_noiseparams(name) end
567
568function minetest.generate_ores(vm, pos1, pos2) end
569
570function minetest.generate_decorations(vm, pos1, pos2) end
571
572--- @overload fun()
573function minetest.clear_objects(options) end
574
575--- @overload fun(pos1)
576function minetest.load_area(pos1, pos2) end
577
578--- @overload fun(pos1, pos2)
579--- @overload fun(pos1, pos2, callback)
580function minetest.emerge_area(pos1, pos2, callback, param) end
581
582function minetest.delete_area(pos1, pos2) end
583
584function minetest.line_of_sight(pos1, pos2) end
585
586function minetest.raycast(pos1, pos2, objects, liquids) end
587
588function minetest.find_path(pos1,pos2,searchdistance,max_jump,max_drop,algorithm) end
589
590--- @param treedef table
591function minetest.spawn_tree (pos, treedef) end
592
593function minetest.transforming_liquid_add(pos) end
594
595function minetest.get_node_max_level(pos) end
596
597function minetest.get_node_level(pos) end
598
599function minetest.set_node_level(pos, level) end
600
601function minetest.add_node_level(pos, level) end
602
603function minetest.fix_light(pos1, pos2) end
604
605function minetest.check_single_for_falling(pos) end
606
607function minetest.check_for_falling(pos) end
608
609function minetest.get_spawn_level(x, z) end
610
611-- Mod channels
612-- ------------
613
614function minetest.mod_channel_join(channel_name) end
615
616-- Inventory
617-- ---------
618
619function minetest.get_inventory(location) end
620
621--- @overload fun(name, callbacks)
622function minetest.create_detached_inventory(name, callbacks, player_name) end
623
624function minetest.remove_detached_inventory(name) end
625
626function minetest.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed_thing) end
627
628-- Formspec
629-- --------
630
631function minetest.show_formspec(playername, formname, formspec) end
632
633function minetest.close_formspec(playername, formname) end
634
635function minetest.formspec_escape(string) end
636
637function minetest.explode_table_event(string) end
638
639function minetest.explode_textlist_event(string) end
640
641function minetest.explode_scrollbar_event(string) end
642
643-- Item handling
644-- -------------
645
646function minetest.inventorycube(img1, img2, img3) end
647
648function minetest.get_pointed_thing_position(pointed_thing, above) end
649
650function minetest.dir_to_facedir(dir, is6d) end
651
652function minetest.facedir_to_dir(facedir) end
653
654function minetest.dir_to_wallmounted(dir) end
655
656function minetest.wallmounted_to_dir(wallmounted) end
657
658function minetest.dir_to_yaw(dir) end
659
660function minetest.yaw_to_dir(yaw) end
661
662function minetest.is_colored_paramtype(ptype) end
663
664function minetest.strip_param2_color(param2, paramtype2) end
665
666function minetest.get_node_drops(nodename, toolname) end
667
668function minetest.get_craft_result(input) end
669
670function minetest.get_craft_recipe(output) end
671
672function minetest.get_all_craft_recipes(query_item) end
673
674function minetest.handle_node_drops(pos, drops, digger) end
675
676function minetest.itemstring_with_palette(item, palette_index) end
677
678function minetest.itemstring_with_color(item, colorstring) end
679
680-- Rollback
681-- --------
682
683function minetest.rollback_get_node_actions(pos, range, seconds, limit) end
684
685function minetest.rollback_revert_actions_by(actor, seconds) end
686
687-- Defaults for the `on_place` and `on_drop` item definition functions
688-- -------------------------------------------------------------------
689
690--- @overload fun(itemstack, placer, pointed_thing)
691--- @overload fun(itemstack, placer, pointed_thing, param2)
692function minetest.item_place_node(itemstack, placer, pointed_thing, param2, prevent_after_place) end
693
694function minetest.item_place_object(itemstack, placer, pointed_thing) end
695
696--- @overload fun(itemstack, placer, pointed_thing)
697function minetest.item_place(itemstack, placer, pointed_thing, param2) end
698
699function minetest.item_drop(itemstack, dropper, pos) end
700
701--- @overload fun(hp_change)
702function minetest.item_eat(hp_change, replace_with_item) end
703
704-- Defaults for the `on_punch` and `on_dig` node definition callbacks
705-- ------------------------------------------------------------------
706
707function minetest.node_punch(pos, node, puncher, pointed_thing) end
708
709function minetest.node_dig(pos, node, digger) end
710
711-- Sounds
712-- ------
713
714--- @overload fun(spec, parameters)
715function minetest.sound_play(spec, parameters, ephemeral) end
716
717function minetest.sound_stop(handle) end
718
719function minetest.sound_fade(handle, step, gain) end
720
721-- Timing
722-- ------
723
724function minetest.after(time, func, ...) end
725
726-- Server
727-- ------
728
729--- @overload fun()
730--- @overload fun(message)
731--- @overload fun(message,reconnect)
732function minetest.request_shutdown(message,reconnect,delay) end
733
734function minetest.cancel_shutdown_requests() end
735
736function minetest.get_server_status(name, joined) end
737
738function minetest.get_server_uptime() end
739
740function minetest.remove_player(name) end
741
742function minetest.remove_player_auth(name) end
743
744-- Bans
745-- ----
746
747function minetest.get_ban_list() end
748
749function minetest.get_ban_description(ip_or_name) end
750
751function minetest.ban_player(name) end
752
753function minetest.unban_player_or_ip(ip_or_name) end
754
755--- @overload fun(name)
756function minetest.kick_player(name, reason) end
757
758-- Particles
759-- ---------
760
761function minetest.add_particle(particle_definition) end
762
763function minetest.add_particlespawner(particlespawner_definition) end
764
765function minetest.delete_particlespawner(id, player) end
766
767-- Schematics
768-- ----------
769
770function minetest.create_schematic(p1, p2, probability_list, filename, slice_prob_list) end
771
772function minetest.place_schematic(pos, schematic, rotation, replacements, force_placement, flags) end
773
774function minetest.place_schematic_on_vmanip(vmanip, pos, schematic, rotation, replacement, force_placement, flags) end
775
776function minetest.serialize_schematic(schematic, format, options) end
777
778function minetest.read_schematic(schematic, options) end
779
780-- HTTP Requests
781-- -------------
782
783function minetest.request_http_api() end
784
785--- @class HTTPApiTable
786local cls = {}
787
788function cls.fetch(req, callback) end
789
790function cls.fetch_async(req) end
791
792function cls.fetch_async_get(handle) end
793
794-- Storage API
795-- -----------
796
797function minetest.get_mod_storage() end
798
799-- Misc.
800-- -----
801
802function minetest.get_connected_players() end
803
804function minetest.is_player(obj) end
805
806function minetest.player_exists(name) end
807
808function minetest.hud_replace_builtin(name, hud_definition) end
809
810function minetest.send_join_message(player_name) end
811
812function minetest.send_leave_message(player_name, timed_out) end
813
814function minetest.hash_node_position(pos) end
815
816function minetest.get_position_from_hash(hash) end
817
818function minetest.get_item_group(name, group) end
819
820function minetest.get_node_group(name, group) end
821
822function minetest.raillike_group(name) end
823
824function minetest.get_content_id(name) end
825
826function minetest.get_name_from_content_id(content_id) end
827
828--- @overload fun(string)
829function minetest.parse_json(string, nullvalue) end
830
831--- @overload fun(data)
832function minetest.write_json(data, styled) end
833
834function minetest.serialize(table) end
835
836--- @overload fun(string)
837function minetest.deserialize(string, safe) end
838
839function minetest.compress(data, method, ...) end
840
841function minetest.decompress(compressed_data, method, ...) end
842
843--- @overload fun(red, green, blue)
844function minetest.rgba(red, green, blue, alpha) end
845
846function minetest.encode_base64(string) end
847
848function minetest.decode_base64(string) end
849
850function minetest.is_protected(pos, name) end
851
852function minetest.record_protection_violation(pos, name) end
853
854function minetest.is_area_protected(pos1, pos2, player_name, interval) end
855
856--- @overload fun(itemstack, placer, pointed_thing)
857--- @overload fun(itemstack, placer, pointed_thing, infinitestacks)
858--- @overload fun(itemstack, placer, pointed_thing, infinitestacks, orient_flags)
859function minetest.rotate_and_place(itemstack, placer, pointed_thing, infinitestacks, orient_flags, prevent_after_place) end
860
861function minetest.rotate_node(itemstack, placer, pointed_thing) end
862
863function minetest.calculate_knockback(player, hitter, time_from_last_punch, tool_capabilities, dir, distance, damage) end
864
865--- @overload fun(pos)
866function minetest.forceload_block(pos, transient) end
867
868--- @overload fun(pos)
869function minetest.forceload_free_block(pos, transient) end
870
871function minetest.request_insecure_environment() end
872
873function minetest.global_exists(name) end
874
875-- Global objects
876-- --------------
877
878minetest.env = {}
879
880-- Global tables
881-- -------------
882
883-- Registered definition tables
884
885minetest.registered_items = {}
886
887minetest.registered_nodes = {}
888
889minetest.registered_craftitems = {}
890
891minetest.registered_tools = {}
892
893minetest.registered_entities = {}
894
895minetest.object_refs = {}
896
897minetest.luaentities = {}
898
899minetest.registered_abms = {}
900
901minetest.registered_lbms = {}
902
903minetest.registered_aliases = {}
904
905minetest.registered_ores = {}
906
907minetest.registered_biomes = {}
908
909minetest.registered_decorations = {}
910
911minetest.registered_schematics = {}
912
913minetest.registered_chatcommands = {}
914
915minetest.registered_privileges = {}
916
917
918
919
920-- =============== --
921-- Class reference --
922-- =============== --
923
924-- Sorted alphabetically.
925
926-- `AreaStore`
927-- -----------
928
929--- @class AreaStore @ A fast access data structure to store areas, and find areas near a given position or area.
930--- @field data string @ attribute to store additional information
931local cls = {}
932
933--- If you chose the parameter-less constructor, a fast implementation will be
934--- automatically chosen for you.
935--- @overload fun(): AreaStore
936--- @return AreaStore
937function AreaStore(type_name) end
938
939-- Methods
940
941function cls:get_area(id, include_borders, include_data) end
942
943function cls:get_areas_for_pos(pos, include_borders, include_data) end
944
945function cls:get_areas_in_area(edge1, edge2, accept_overlap, include_borders, include_data) end
946
947--- @overload fun(edge1, edge2, data)
948function cls:insert_area(edge1, edge2, data, id) end
949
950function cls:reserve(count) end
951
952function cls:remove_area(id) end
953
954function cls:set_cache_params(params) end
955
956function cls:to_string() end
957
958function cls:to_file(filename) end
959
960function cls:from_string(str) end
961
962function cls:from_file(filename) end
963
964-- `InvRef`
965-- --------
966
967--- @class InvRef @ a reference to an inventory
968local cls = {}
969
970-- Methods
971
972--- @return boolean @ `true` if list is empty
973function cls:is_empty(listname) end
974
975--- @return integer
976function cls:get_size(listname) end
977
978--- @param listname string
979--- @param size integer
980--- @param boolean @ `false` on error (e.g. invalid `listname` or `size`)
981function cls:set_size(listname, size) end
982
983--- @return integer
984function cls:get_width(listname) end
985
986--- currently used for crafting
987--- @param listname string
988--- @param width integer
989function cls:set_width(listname, width) end
990
991--- @param listname string
992--- @param i integer
993--- @return ItemStack
994function cls:get_stack(listname, i) end
995
996--- @param listname string
997--- @param i integer
998--- @param stack ItemStack
999function cls:set_stack(listname, i, stack) end
1000
1001--- @param listname string
1002--- @return ItemStack[]
1003function cls:get_list(listname) end
1004
1005--- @param listname string
1006--- @param list ItemStack[]
1007function cls:set_list(listname, list) end
1008
1009--- @return ItemStack[][]
1010function cls:get_lists() end
1011
1012--- @param lists ItemStack[][]
1013function cls:set_lists(lists) end
1014
1015--- @param listname string
1016--- @param stack ItemStack
1017--- @return ItemStack @ leftover `ItemStack`
1018function cls:add_item(listname, stack) end
1019
1020--- @param listname string
1021--- @param stack ItemStack
1022--- @return boolean @ `true` if the stack of items can be fully added to the list
1023function cls:room_for_item(listname, stack) end
1024
1025--- @overload fun(listname: string, stack: ItemStack): boolean
1026--- @param listname string
1027--- @param stack ItemStack
1028--- @param match_meta boolean @ If false, only the items' names are compared (default: `false`).
1029--- @return boolean @ `true` if the stack of items can be fully taken from the list.
1030function cls:contains_item(listname, stack, match_meta) end
1031
1032--- note that any item metadata is ignored, so attempting to remove a specific
1033--- unique item this way will likely remove the wrong one -- to do that use
1034--- `set_stack` with an empty `ItemStack`.
1035--- @param listname string
1036--- @param stack ItemStack
1037--- @return ItemStack @ the items that were actually removed
1038function cls:remove_item(listname, stack) end
1039
1040--- @class Location
1041--- @field type string
1042--- @field name string
1043--- @field pos Vector
1044local cls = {}
1045
1046--- @return Location @ a location compatible to `minetest.get_inventory(location)`, `{type="undefined"}` in case location is not known
1047function cls:get_location() end
1048
1049-- `ItemStack`
1050-- -----------
1051
1052--- @class ItemStack @ a stack of items.
1053local cls = {}
1054
1055--- @param x ItemStack|string|table|nil
1056--- @return ItemStack
1057function ItemStack(x) end
1058
1059-- Methods
1060
1061--- @return boolean @ `true` if stack is empty.
1062function cls:is_empty() end
1063
1064--- @return string @ item name (e.g. `"default:stone"`).
1065function cls:get_name() end
1066
1067--- @param item_name string
1068--- @return boolean @ whether the item was cleared.
1069function cls:set_name(item_name) end
1070
1071--- @return integer @ number of items on the stack.
1072function cls:get_count() end
1073
1074--- @param count integer
1075--- @return boolean @ whether the item was cleared.
1076function cls:set_count(count) end
1077
1078--- @return integer @ tool wear (`0`-`65535`), `0` for non-tools.
1079function cls:get_wear() end
1080
1081--- @param wear integer
1082--- @return boolean whether item was cleared
1083function cls:set_wear(wear) end
1084
1085--- @return ItemStackMetaRef
1086function cls:get_meta() end
1087
1088--- @return string @ the description shown in inventory list tooltips
1089function cls:get_description() end
1090
1091-- Removes all items from the stack, making it empty.
1092function cls:clear() end
1093
1094--- Replace the contents of this stack.
1095--- @param item ItemStack|string|table
1096function cls:replace(item) end
1097
1098--- @return string @ the stack in itemstring form
1099function cls:to_string() end
1100
1101--- @return table @ the stack in Lua table form
1102function cls:to_table() end
1103
1104--- @return integer @ the maximum size of the stack (depends on the item)
1105function cls:get_stack_max() end
1106
1107--- @return integer @ `get_stack_max() - get_count()`
1108function cls:get_free_space() end
1109
1110--- @return boolean @ `true` if the item name refers to a defined item type
1111function cls:is_known() end
1112
1113--- @return ItemDefinition @ the item definition table
1114function cls:get_definition() end
1115
1116--- @return ToolCapabilities @ the digging properties of the item, or those of the hand if none are defined for this item type
1117function cls:get_tool_capabilities() end
1118
1119--- Increases wear by `amount` if the item is a tool
1120--- @param amount integer
1121function cls:add_wear(amount) end
1122
1123--- Put some item or stack onto this stack
1124--- @param item ItemStack|string|table
1125--- @return ItemStack @ leftover `ItemStack`
1126function cls:add_item(item) end
1127
1128--- @return boolean @ `true` if item or stack can be fully added to this one
1129function cls:item_fits(item) end
1130
1131--- Take (and remove) up to `n` items from this stack
1132--- @param n integer @ default: `1`
1133--- @return ItemStack @ taken `ItemStack`
1134function cls:take_item(n) end
1135
1136--- Copy (don't remove) up to `n` items from this stack
1137--- @param n integer @ default: `1`
1138--- @return ItemStack @ taken `ItemStack`
1139function cls:peek_item(n) end
1140
1141-- `ItemStackMetaRef`
1142-- ------------------
1143
1144--- @class ItemStackMetaRef : MetaDataRef @ ItemStack metadata: reference extra data and functionality stored in a stack. Can be obtained via `item:get_meta()`.
1145local cls = {}
1146
1147-- Methods
1148
1149-- All methods in MetaDataRef
1150
1151--- * Overrides the item's tool capabilities
1152--- * A nil value will clear the override data and restore the original
1153--- behavior.
1154---
1155--- @overload fun()
1156function cls:set_tool_capabilities(tool_capabilities) end
1157
1158-- `MetaDataRef`
1159-- -------------
1160
1161--- @class MetaDataRef @ Base class used by [StorageRef], [NodeMetaRef], [ItemStackMetaRef], and [PlayerMetaRef].
1162local cls = {}
1163
1164-- Methods
1165
1166--- @param key string
1167--- @return boolean @ true if key present, otherwise false. Returns `nil` when the MetaData is inexistent.
1168function cls:contains(key) end
1169
1170--- @param key string
1171--- @return nil|string @ `nil` if key not present, else the stored string.
1172function cls:get(key) end
1173
1174--- Value of `""` will delete the key
1175--- @param key string
1176--- @param value string
1177function cls:set_string(key, value) end
1178
1179--- @param key string
1180--- @return string @ `""` if key not present
1181function cls:get_string(key) end
1182
1183--- @param key string
1184--- @param value integer
1185function cls:set_int(key, value) end
1186
1187--- @param key string
1188--- @return integer @ `0` if key not present
1189function cls:get_int(key) end
1190
1191--- @param key string
1192--- @param value float
1193function cls:set_float(key, value) end
1194
1195--- @param key string
1196--- @return float @ `0` if key not present
1197function cls:get_float(key) end
1198
1199--- @return nil|table
1200function cls:to_table() end
1201
1202--- Any non-table value will clear the metadata
1203--- @param table nil|table
1204--- @return boolean @ `true` on success
1205function cls:from_table(table) end
1206
1207--- @param other MetaDataRef
1208--- @return boolean @ `true` if this metadata has the same key-value pairs as `other`
1209function cls:equals(other) end
1210
1211-- `ModChannel`
1212-- ------------
1213
1214--- @class ModChannel @ An interface to use mod channels on client and server
1215local cls = {}
1216
1217-- Methods
1218
1219--- Leave the mod channel.
1220---
1221--- * Server leaves channel `channel_name`.
1222--- * No more incoming or outgoing messages can be sent to this channel from
1223--- server mods.
1224--- * This invalidate all future object usage.
1225--- * Ensure you set mod_channel to nil after that to free Lua resources.
1226function cls:leave() end
1227
1228--- @return boolean @ true if channel is writeable and mod can send over it.
1229function cls:is_writeable() end
1230
1231--- Send `message` though the mod channel.
1232---
1233--- * If mod channel is not writeable or invalid, message will be dropped.
1234--- * Message size is limited to 65535 characters by protocol.
1235---
1236--- @param message string
1237function cls:send_all(message) end
1238
1239-- `NodeMetaRef`
1240-- -------------
1241
1242--- @class NodeMetaRef : MetaDataRef @ Node metadata: reference extra data and functionality stored in a node. Can be obtained via `minetest.get_meta(pos)`.
1243local cls = {}
1244
1245-- Methods
1246
1247-- All methods in MetaDataRef
1248
1249--- @return InvRef
1250function cls:get_inventory() end
1251
1252--- Mark specific vars as private.
1253---
1254--- This will prevent them from being sent to the client. Note that the "private"
1255--- status will only be remembered if an associated key-value pair exists,
1256--- meaning it's best to call this when initializing all other meta (e.g.
1257--- `on_construct`).
1258---
1259--- @overload fun(names: string[])
1260--- @param name string
1261function cls:mark_as_private(name) end
1262
1263-- `NodeTimerRef`
1264-- --------------
1265
1266--- @class NodeTimerRef @ Node Timers: a high resolution persistent per-node timer. Can be gotten via `minetest.get_node_timer(pos)`.
1267local cls = {}
1268
1269-- Methods
1270
1271--- * set the timer's state
1272--- * will trigger the node's `on_timer` function after `(timeout - elapsed)`
1273--- seconds.
1274--- @param timeout float @ in seconds
1275--- @param elapsed float @ in seconds
1276function cls:set(timeout, elapsed) end
1277
1278--- * start the timer
1279--- * equivalent to `set(timeout,0)
1280--- @param timeout float @ in seconds
1281function cls:start(timeout) end
1282
1283--- stops the timer
1284function cls:stop() end
1285
1286--- * returns current timeout in seconds
1287--- * if `timeout` equals `0`, timer is inactive
1288--- @return float @ current timeout in seconds
1289function cls:get_timeout() end
1290
1291--- * returns current elapsed time in seconds
1292--- * the node's `on_timer` function will be called after `(timeout - elapsed)`
1293--- seconds.
1294--- @return float @ current elapsed time in seconds
1295function cls:get_elapsed() end
1296
1297--- returns boolean state of timer
1298--- @return boolean @ `true` if timer is started, otherwise `false`
1299function cls:is_started() end
1300
1301-- `ObjectRef`
1302-- -----------
1303
1304--- @class ObjectRef @ Moving things in the game are generally these. This is basically a reference to a C++ `ServerActiveObject`.
1305local cls = {}
1306
1307-- Methods
1308
1309--- @return Position
1310function cls:get_pos() end
1311
1312--- @param pos Position
1313function cls:set_pos(pos) end
1314
1315--- * Does an interpolated move for Lua entities for visually smooth transitions.
1316--- * If `continuous` is true, the Lua entity will not be moved to the current
1317--- position before starting the interpolated move.
1318--- * For players this does the same as `set_pos`,`continuous` is ignored.
1319--- @overload fun(pos: Position)
1320--- @param pos Position
1321--- @param continuous boolean @ defaults to `false`
1322function cls:move_to(pos, continuous) end
1323
1324--- If `direction` equals `nil` and `puncher` does not equal `nil`, `direction`
1325--- will be automatically filled in based on the location of `puncher`.
1326--- @param puncher ObjectRef @ the object performing the punch. Can be `nil`.
1327--- @param time_from_last_punch float @ time from last punch (by `puncher`) or `nil`
1328--- @param tool_capabilities ToolCapabilities @ can be `nil`
1329--- @param direction Vector @ a unit vector, pointing from the source of the punch to the punched object
1330--- @return integer @ tool wear
1331function cls:punch(puncher, time_from_last_punch, tool_capabilities, direction) end
1332
1333--- @param clicker ObjectRef
1334function cls:right_click(clicker) end
1335
1336--- @return float @ number of hitpoints (2 * number of hearts)
1337function cls:get_hp() end
1338
1339---
1340--- @class PlayerHPChangeReason @ may have additional fields from mods
1341--- @field type string | '"set_hp"' | '"punch"' | '"fall"' | '"node_damage"' | '"drown"' | '"respawn"'
1342--- @field from string | '"mod"' | '"engine"'
1343
1344---
1345--- * Is limited to the range of 0 ... 65535 (2^16 - 1)
1346--- * For players: HP are also limited by `hp_max` specified in the player's
1347--- object properties
1348--- @param hp float @ number of hitpoints (2 * number of hearts)
1349--- @param reason PlayerHPChangeReason
1350function cls:set_hp(hp, reason) end
1351
1352--- @return InvRef @ an [InvRef] for players, otherwise returns `nil`
1353function cls:get_inventory() end
1354
1355--- @return string @ the name of the inventory list the wielded item is in
1356function cls:get_wield_list() end
1357
1358--- @return integer @ the index of the wielded item
1359function cls:get_wield_index() end
1360
1361--- @return ItemStack
1362function cls:get_wielded_item() end
1363
1364--- replaces the wielded item
1365--- @return boolean @ `true` if successful
1366function cls:set_wielded_item(item) end
1367
1368--- @param groups table<string, integer> @ `{group1=rating, group2=rating, ...}`
1369function cls:set_armor_groups(groups) end
1370
1371--- @return table<string, integer> @ a table with the armor group ratings
1372function cls:get_armor_groups() end
1373
1374--- @param frame_range Vec2 @ default: `{x=1, y=1}`
1375--- @param frame_speed float @ default: `15.0`
1376--- @param frame_blend float @ default: `0.0`
1377--- @param frame_loop boolean @ default: `true`
1378function cls:set_animation(frame_range, frame_speed, frame_blend, frame_loop) end
1379
1380--- @return Vec2, float, float, boolean @ `range`, `frame_speed`, `frame_blend` and `frame_loop`
1381function cls:get_animation() end
1382
1383--- @param frame_speed float @ default: `15.0`
1384function cls:set_animation_frame_speed(frame_speed) end
1385
1386--- @param parent ObjectRef
1387--- @param bone string
1388--- @param position Position @ (relative)
1389--- @param rotation Vector @ Rotation on each axis, in degrees
1390function cls:set_attach(parent, bone, position, rotation) end
1391
1392--- @return ObjectRef, string, Position, Vector @ parent, bone, position, rotation or nil if it isn't attached
1393function cls:get_attach() end
1394
1395function cls:set_detach() end
1396
1397--- @param bone string
1398--- @param position Position @ (relative)
1399--- @param rotation Vector
1400function cls:set_bone_position(bone, position, rotation) end
1401
1402--- @return Position, Vector @ position and rotation of the bone
1403function cls:get_bone_position(bone) end
1404
1405--- @param object_property_table ObjectProperties
1406function cls:set_properties(object_property_table) end
1407
1408--- @return ObjectProperties @ object property table
1409function cls:get_properties() end
1410
1411--- @return boolean @ true for players, false otherwise
1412function cls:is_player() end
1413
1414---
1415--- @class NametagAttributes
1416--- @field color ColorSpec
1417--- @field text string
1418
1419---
1420--- returns a table with the attributes of the nametag of an object
1421--- @return NametagAttributes
1422function cls:get_nametag_attributes() end
1423
1424--- sets the attributes of the nametag of an object
1425--- @param attributes NametagAttributes
1426function cls:set_nametag_attributes(attributes) end
1427
1428-- Lua entity only (no-op for other objects)
1429
1430--- Remove object.
1431---
1432--- The object is removed after returning from Lua. However the `ObjectRef`
1433--- itself instantly becomes unusable with all further method calls having
1434--- no effect and returning `nil`.
1435function cls:remove() end
1436
1437--- @param vel Vector @ e.g. `{x=0.0, y=2.3, z=1.0}`
1438function cls:set_velocity(vel) end
1439
1440--- In comparison to using get_velocity, adding the velocity and then using
1441--- set_velocity, add_velocity is supposed to avoid synchronization problems.
1442--- @param vel Vector @ e.g. `{x=0.0, y=2.3, z=1.0}`
1443function cls:add_velocity(vel) end
1444
1445--- @return Vector
1446function cls:get_velocity() end
1447
1448--- @param acc Vector
1449function cls:set_acceleration(acc) end
1450
1451--- @return Vector
1452function cls:get_acceleration() end
1453
1454--- @param rot Vector @ (radians). X is pitch (elevation), Y is yaw (heading) and Z is roll (bank).
1455function cls:set_rotation(rot) end
1456
1457--- @param Vector @ (radians). X is pitch (elevation), Y is yaw (heading) and Z is roll (bank).
1458function cls:get_rotation() end
1459
1460--- @param yaw float @ (heading)
1461function cls:set_yaw(radians) end
1462
1463--- @param float @ (heading)
1464function cls:get_yaw() end
1465
1466--- @param mod string @ texture modifier
1467function cls:set_texture_mod(mod) end
1468
1469--- @return string @ current texture modifier
1470function cls:get_texture_mod() end
1471
1472--- Select sprite from spritesheet with optional animation and Dungeon Master
1473--- style texture selection based on yaw relative to camera.
1474--- @param p Vec2 @ the coordinate of the first frame (x: column, y: row), default: `{x=0, y=0}`
1475--- @param num_frames integer @ default: `1`
1476--- @param framelength float @ default: `0.2`
1477--- @param select_horiz_by_yawpitch boolean @ this was once used for the Dungeon Master mob, default: `false`
1478function cls:set_sprite(p, num_frames, framelength, select_horiz_by_yawpitch) end
1479
1480function cls:get_luaentity() end
1481
1482-- Player only (no-op for other objects)
1483
1484function cls:get_player_name() end
1485
1486function cls:get_player_velocity() end
1487
1488function cls:add_player_velocity(vel) end
1489
1490function cls:get_look_dir() end
1491
1492function cls:get_look_vertical() end
1493
1494function cls:get_look_horizontal() end
1495
1496function cls:set_look_vertical(radians) end
1497
1498function cls:set_look_horizontal(radians) end
1499
1500function cls:get_look_pitch() end
1501
1502function cls:get_look_yaw() end
1503
1504function cls:set_look_pitch(radians) end
1505
1506function cls:set_look_yaw(radians) end
1507
1508function cls:get_breath() end
1509
1510function cls:set_breath(value) end
1511
1512function cls:set_fov(fov, is_multiplier) end
1513
1514function cls:get_fov() end
1515
1516function cls:set_attribute(attribute, value) end
1517
1518function cls:get_attribute(attribute) end
1519
1520function cls:get_meta() end
1521
1522function cls:set_inventory_formspec(formspec) end
1523
1524function cls:get_inventory_formspec() end
1525
1526function cls:set_formspec_prepend(formspec) end
1527
1528function cls:get_formspec_prepend(formspec) end
1529
1530function cls:get_player_control() end
1531
1532function cls:get_player_control_bits() end
1533
1534function cls:set_physics_override(override_table) end
1535
1536function cls:get_physics_override() end
1537
1538function cls:hud_add(hud_definition) end
1539
1540function cls:hud_remove(id) end
1541
1542function cls:hud_change(id, stat, value) end
1543
1544function cls:hud_get(id) end
1545
1546function cls:hud_set_flags(flags) end
1547
1548function cls:hud_get_flags() end
1549
1550function cls:hud_set_hotbar_itemcount(count) end
1551
1552function cls:hud_get_hotbar_itemcount() end
1553
1554function cls:hud_set_hotbar_image(texturename) end
1555
1556function cls:hud_get_hotbar_image() end
1557
1558function cls:hud_set_hotbar_selected_image(texturename) end
1559
1560function cls:hud_get_hotbar_selected_image() end
1561
1562function cls:set_sky(parameters) end
1563
1564function cls:get_sky() end
1565
1566function cls:get_sky_color() end
1567
1568function cls:set_sun(parameters) end
1569
1570function cls:get_sun() end
1571
1572function cls:set_moon(parameters) end
1573
1574function cls:get_moon() end
1575
1576function cls:set_stars(parameters) end
1577
1578function cls:get_stars() end
1579
1580function cls:set_clouds(parameters) end
1581
1582function cls:get_clouds() end
1583
1584--- @param ratio float|nil
1585function cls:override_day_night_ratio(ratio) end
1586
1587function cls:get_day_night_ratio() end
1588
1589--- @overload fun(stand_idle, walk, dig, walk_and_dig)
1590--- @param frame_speed float @ default: `30`
1591function cls:set_local_animation(stand_idle, walk, dig, walk_and_dig, frame_speed) end
1592
1593function cls:get_local_animation() end
1594
1595--- Defines offset value for camera per player.
1596--- @param first Vector @ in first person view, default: {x=0,y=0,z=0}
1597--- @param third Vector @ in third person view (max. values `{x=-10/10,y=-10,15,z=-5/5}`), default: {x=0,y=0,z=0}
1598function cls:set_eye_offset(first, third) end
1599
1600--- @return Vector, Vector @ `offset_first` and `offset_third
1601function cls:get_eye_offset() end
1602
1603--- * Sends a server-side loaded mapblock to the player.
1604--- * Returns `false` if failed.
1605--- * Resource intensive - use sparsely
1606--- * To get blockpos, integer divide pos by 16
1607--- @return boolean @ `false` if failed
1608function cls:send_mapblock(blockpos) end
1609
1610
1611
1612
1613-- Definition tables
1614-- =================
1615
1616-- Object properties
1617-- -----------------
1618
1619--- @class ObjectProperties
1620--- @field hp_max integer
1621--- @field breath_max integer
1622--- @field zoom_fov float
1623--- @field eye_height float
1624--- @field physical boolean
1625--- @field collide_with_objects boolean
1626--- @field collisionbox box
1627--- @field selectionbox box
1628--- @field pointable boolean
1629--- @field visual string | '"cube"' | '"sprite"' | '"upright_sprite"' | '"mesh"' | '"wielditem"' | '"item"'
1630--- @field visual_size Vector
1631--- @field mesh string
1632--- @field textures string[]|string
1633--- @field colors ColorSpec[]
1634--- @field use_texture_alpha boolean
1635--- @field spritediv Vec2
1636--- @field initial_sprite_basepos Vec2
1637--- @field is_visible boolean
1638--- @field makes_footstep_sound boolean
1639--- @field automatic_rotate integer
1640--- @field stepheight integer
1641--- @field automatic_face_movement_dir float
1642--- @field automatic_face_movement_max_rotation_per_sec integer
1643--- @field backface_culling boolean
1644--- @field glow integer
1645--- @field nametag string
1646--- @field nametag_color ColorSpec
1647--- @field infotext string
1648--- @field static_save boolean
1649local cls = {}
1650
1651-- Tile definition
1652-- ---------------
1653
1654--- @alias TileDefinition TileDef|string
1655
1656--- @class TileDef
1657--- @field name string
1658--- @field animation TileAnimationDefinition
1659--- @field backface_culling boolean
1660--- @field tileable_vertical boolean
1661--- @field tileable_horizontal boolean
1662--- @field align_style string | '"node"' | '"world"' | '"user"'
1663--- @field scale integer
1664--- @field color ColorSpec
1665local cls = {}
1666
1667--- @class TileAnimationDefinition
1668--- @field type string | '"vertical_frames"' | '"sheet_2d"'
1669--- @field aspect_w integer @ Width of a frame in pixels
1670--- @field aspect_h integer @ Height of a frame in pixels
1671--- @field length float @ Full loop length
1672--- @field frames_w integer @ Width in number of frames
1673--- @field frames_h integer @ Height in number of frames
1674--- @field frame_length float @ Length of a single frame
1675local cls = {}
1676
1677-- Item definition
1678-- ---------------
1679
1680--- @class ItemDefinition @ Used by `minetest.register_node`, `minetest.register_craftitem`, and `minetest.register_tool`.
1681--- @field description string
1682--- @field groups table<string, integer>
1683--- @field inventory_image string
1684--- @field inventory_overlay string
1685--- @field wield_image string
1686--- @field wield_overlay string
1687--- @field palette string
1688--- @field color string
1689--- @field wield_scale Vector
1690--- @field stack_max integer
1691--- @field range float
1692--- @field liquids_pointable boolean
1693--- @field tool_capabilities ToolCapabilities
1694--- @field node_placement_prediction string
1695--- @field node_dig_prediction string
1696--- @field sound table<string, string|SimpleSoundSpec>
1697--- @field on_place fun(itemstack, user, pointed_thing)
1698--- @field on_secondary_use fun(itemstack, user, pointed_thing)
1699--- @field on_drop fun(itemstack, dropper, pos)
1700--- @field on_use fun(itemstack, user, pointed_thing)
1701--- @field after_use fun(itemstack, user, node, digparams)
1702local cls = {}
1703
1704-- Node definition
1705-- ---------------
1706
1707--- @class NodeDefinition : ItemDefinition @ Used by `minetest.register_node`.
1708--- @field drawtype string | '"normal"' | '"airlike"' | '"liquid"' | '"flowingliquid"' | '"glasslike"' | '"glasslike_framed"' | '"glasslike_framed_optional"' | '"allfaces"' | '"allfaces_optional"' | '"torchlike"' | '"signlike"' | '"plantlike"' | '"firelike"' | '"fencelike"' | '"raillike"' | '"nodebox"' | '"mesh"' | '"plantlike_rooted"'
1709--- @field visual_scale float @ Supported for drawtypes "plantlike", "signlike", "torchlike", "firelike", "mesh".
1710--- @field tiles TileDefinition[] @ Textures of node; +Y, -Y, +X, -X, +Z, -Z. List can be shortened to needed length.
1711--- @field overlay_tiles TileDefinition[]
1712--- @field special_tiles TileDefinition[]
1713--- @field color ColorSpec
1714--- @field use_texture_alpha boolean
1715--- @field palette string
1716--- @field post_effect_color ColorSpec
1717--- @field paramtype string | '"light"' | '"none"'
1718--- @field paramtype2 string | '"flowingliquid"' | '"wallmounted"' | '"facedir"' | '"leveled"' | '"degrotate"' | '"meshoptions"' | '"color"' | '"colorfacedir"' | '"colorwallmounted"' | '"glasslikeliquidlevel"' | '"none"'
1719--- @field place_param2 integer
1720--- @field is_ground_content boolean
1721--- @field sunlight_propagates boolean
1722--- @field walkable boolean
1723--- @field pointable boolean
1724--- @field diggable boolean
1725--- @field climbable boolean
1726--- @field buildable_to boolean
1727--- @field floodable boolean
1728--- @field liquidtype string
1729--- @field liquid_alternative_flowing string
1730--- @field liquid_alternative_source string
1731--- @field liquid_viscosity integer
1732--- @field liquid_renewable boolean
1733--- @field leveled integer
1734--- @field liquid_range integer
1735--- @field drowning integer
1736--- @field light_source integer
1737--- @field damage_per_second integer
1738--- @field node_box NodeBox
1739--- @field connects_to string[]
1740--- @field connect_sides string[]
1741--- @field mesh string
1742--- @field selection_box NodeBox
1743--- @field collision_box NodeBox
1744--- @field waving integer | '0' | '1' | '2' | '3'
1745--- @field sounds Sounds
1746--- @field drop string|Drop
1747--- @field on_construct fun(pos)
1748--- @field on_destruct fun(pos)
1749--- @field after_destruct fun(pos, oldnode)
1750--- @field on_flood fun(pos, oldnode, newnode)
1751--- @field preserve_metadata fun(pos, oldnode, oldmeta, drops)
1752--- @field after_place_node fun(pos, placer, itemstack, pointed_thing)
1753--- @field after_dig_node fun(pos, oldnode, oldmetadata, digger)
1754--- @field can_dig fun(pos, player)
1755--- @field on_punch fun(pos, node, puncher, pointed_thing)
1756--- @field on_rightclick fun(pos, node, clicker, itemstack, pointed_thing)
1757--- @field on_dig fun(pos, node, digger)
1758--- @field on_timer fun(pos, elapsed)
1759--- @field on_receive_fields fun(pos, formname, fields, sender)
1760--- @field allow_metadata_inventory_move fun(pos, from_list, from_index, to_list, to_index, count, player)
1761--- @field allow_metadata_inventory_put fun(pos, listname, index, stack, player)
1762--- @field allow_metadata_inventory_take fun(pos, listname, index, stack, player)
1763--- @field on_metadata_inventory_move fun(pos, from_list, from_index, to_list, to_index, count, player)
1764--- @field on_metadata_inventory_put fun(pos, listname, index, stack, player)
1765--- @field on_metadata_inventory_take fun(pos, listname, index, stack, player)
1766--- @field on_blast fun(pos, intensity)
1767local cls = {}
1768
1769--- @class Sounds
1770--- @field footstep SimpleSoundSpec @ If walkable, played when object walks on it. If node is climbable or a liquid, played when object moves through it
1771--- @field dig SimpleSoundSpec @ While digging node.
1772--- @field dug SimpleSoundSpec @ Node was dug
1773--- @field place SimpleSoundSpec @ Node was placed. Also played after falling
1774--- @field place_failed SimpleSoundSpec @ When node placement failed
1775--- @field fall SimpleSoundSpec @ When node starts to fall
1776local cls = {}
1777
1778--- @alias Drop string|DropSpec
1779
1780--- @class DropSpec
1781--- @field max_items integer
1782--- @field items DropEntry[]
1783local cls = {}
1784
1785--- @class DropEntry
1786--- @field tools string[]
1787--- @field rarity integer
1788--- @field items string[]
1789--- @field inherit_color boolean
1790local cls = {}