index - Uberi/MineTest-API GitHub Wiki
- minetest.after - Call function after time seconds, param is optional; to pass multiple parameters, pass a table.
- minetest.auth_reload - This calls the authentication handler. Can also be accessed with the chatcommand /auth_reload
- minetest.ban_player - Ban a player.
- minetest.chat_send_all - Send a chat message to all players.
- minetest.chat_send_player - Send a chat message to a specific player.
- minetest.check_player_privs - privs is a table {priv1=true,...} returns bool, missing_privs
- minetest.create_detached_inventory - returns InvRef
- minetest.debug - Always printed to stderr and logfile (print() is redirected here)
- minetest.deserialize - Convert a table containing tables, strings, numbers, booleans and nils into string form readable by minetest.deserialize
- minetest.dir_to_facedir - Convert a vector to a facedir value, used in param2 for paramtype2="facedir"
- minetest.dir_to_wallmounted - Convert a vector to a wallmounted value, used for paramtype2="wallmounted"
- minetest.get_ban_description - Gets the text explaining why a player was banned.
- minetest.get_ban_list - returns ban list (same as minetest.get_ban_description(""))
- minetest.get_connected_players - returns a list of ObjectRefs
- minetest.get_craft_recipe - output is a node or item type such as 'default:torch' input.method = 'normal' or 'cooking' or 'fuel' input.width = for example 3 input.items = for example { stack 1, stack 2, stack 3, stack 4, stack 5, stack 6, stack 7, stack 8, stack 9 } input.items = nil if no recipe found
- minetest.get_craft_result - returns output, decremented_input
- minetest.get_current_modname - Gets the current mod name.
- minetest.get_inventory - Gets an InvRef to access inventory methods.
- minetest.get_item_group - Get rating of a group of an item. (0 = not in group)
- minetest.get_modnames - Return a list of installed mods, sorted alphabetically
- minetest.get_modpath - eg. "/home/user/.minetest/usermods/modname"
- minetest.get_node_drops - Returns list of item names.
- minetest.get_password_hash - Convert a name-password pair to a password hash that minetest can use
- minetest.get_player_privs - Returns table {priv1=true,...}
- minetest.get_pointed_thing_position - Get position of a pointed_thing (that you can get from somewhere)
- minetest.get_server_status - Get server status string
- minetest.get_worldpath - Useful for storing custom data
- minetest.handle_node_drops - drops: list of itemstrings Handles drops from nodes after digging: Default action is to put them into digger's inventory Can be overridden to get different functionality (eg. dropping items on ground)
- minetest.hash_node_position - Returns 48-bit integer
- minetest.inventorycube - Returns a string for making an image of a cube (useful as an item image)
- minetest.is_singleplayer -
- minetest.item_drop - Drop the item
- minetest.item_eat - Eat the item. replace_with_item can be nil.
- minetest.item_place - Use item_place_node() or item_place_object() based on what the item is.
- minetest.item_place_node - Place item as a node
- minetest.item_place_object - Place item as-is
- minetest.log - loglevel one of "error", "action", "info", "verbose", if line is nil then line=loglevel
- minetest.node_dig - Checks if node can be dug, puts item into inventory, removes node Calls functions registered by minetest.registered_on_dignodes()
- minetest.node_punch - Calls functions registered by minetest.register_on_punchnode()
- minetest.notify_authentication_modified - Should be called by the authentication handler if privileges change. To report everybody, set name=nil.
- minetest.pos_to_string - Retuns "(X,Y,Z)"
- minetest.privs_to_string - Returns "priv1,priv2,..."
- minetest.register_abm -
- minetest.register_alias -
- minetest.register_authentication_handler - See minetest.builtin_auth_handler in builtin.lua for reference
- minetest.register_chatcommand -
- minetest.register_craft -
- minetest.register_craftitem - Inserted into - minetest.registered_items[name]
- minetest.register_entity - Inserted into - minetest.registered_entities[name]
- minetest.register_globalstep - Called every server step, usually interval of 0.05s
- minetest.register_node - Inserted into - minetest.registered_items[name] Inserted into - minetest.registered_nodes[name]
- minetest.register_on_chat_message - Called always when a player says something
- minetest.register_on_dieplayer - Called when a player dies
- minetest.register_on_dignode - Called when a node has been dug.
- minetest.register_on_generated - Called after generating a piece of world. Modifying nodes inside the area is a bit faster than usually.
- minetest.register_on_joinplayer - Called when a player joins the game
- minetest.register_on_leaveplayer - Called when a player leaves the game
- minetest.register_on_newplayer - Called after a new player has been created
- minetest.register_on_placenode - Called when a node has been placed
- minetest.register_on_player_receive_fields - Called when a button is pressed in player's inventory form Newest functions are called first If function returns true, remaining functions are not called
- minetest.register_on_punchnode - Called when a node is punched
- minetest.register_on_respawnplayer - Called when player is to be respawned Called before repositioning of player occurs return true in func to disable regular player placement
- minetest.register_privilege - definition: "description text" definition: { description = "description text", give_to_singleplayer = boolean, -- default: true }
- minetest.register_tool - Inserted into - minetest.registered_items[name]
- minetest.request_shutdown - request for server shutdown
- minetest.rollback_get_last_node_actor - Find who has done something to a node, or near a node Returns actor, p, seconds actor: "player:", also "liquid".
- minetest.rollback_revert_actions_by - Revert latest actions of someone actor: "player:", also "liquid".
- minetest.serialize - Convert a table containing tables, strings, numbers, booleans and nils into string form readable by minetest.deserialize
- minetest.setting_get -
- minetest.setting_getbool -
- minetest.setting_get_pos -
- minetest.setting_set -
- minetest.set_player_password -
- minetest.set_player_privs - privs = {priv1=true,...}
- minetest.sound_play - spec = SimpleSoundSpec parameters = sound parameter table
- minetest.sound_stop -
- minetest.string_to_pos -
- minetest.string_to_privs - Returns {priv1=true,...}
- minetest.unban_player_or_ip - unban player or IP address
Basically ServerEnvironment and ServerMap combined. Can be gotten via minetest.env
- EnvRef:add_entity - Spawn Lua-defined entity at position Returns ObjectRef, or nil if failed
- EnvRef:add_item - Spawn item Returns ObjectRef, or nil if failed
- EnvRef:add_node - Set node at position (node = {name="foo", param1=0, param2=0}) alias: set_node(pos, node)
- EnvRef:clear_objects - clear all objects in the environments
- EnvRef:dig_node - Dig node with the same effects that a player would cause
- EnvRef:find_nodes_in_area - nodenames: eg. {"ignore", "group:tree"} or "default:dirt"
- EnvRef:find_node_near - nodenames: eg. {"ignore", "group:tree"} or "default:dirt"
- EnvRef:get_meta - Get a NodeMetaRef at that position
- EnvRef:get_node - Returns {name="ignore", ...} for unloaded area
- EnvRef:get_node_light - timeofday: nil = current time, 0 = night, 0.5 = day
- EnvRef:get_node_or_nil - Returns nil for unloaded area
- EnvRef:get_node_timer - Get NodeTimerRef
- EnvRef:get_objects_inside_radius -
- EnvRef:get_perlin - Return world-specific perlin noise (int(worldseed)+seeddiff)
- EnvRef:get_player_by_name - Get an ObjectRef to a player
- EnvRef:get_timeofday - Returns 0...1; 0 = midnight, 0.5 = midday
- EnvRef:place_node - Place node with the same effects that a player would cause
- EnvRef:punch_node - Punch node with the same effects that a player would cause
- EnvRef:remove_node - Equivalent to set_node(pos, "air")
- EnvRef:set_node - Set node at position (node = {name="foo", param1=0, param2=0})
- EnvRef:set_timeofday - val: 0...1; 0 = midnight, 0.5 = midday
Can be gotten via minetest.env:get_node_timer(pos)
- NodeTimerRef:get_elapsed -
- NodeTimerRef:get_timeout -
- NodeTimerRef:is_started -
- NodeTimerRef:set -
- NodeTimerRef:start -
- NodeTimerRef:stop -
Moving things in the game are generally these (basically reference to a C++ ServerActiveObject)
- ObjectRef:getpos - returns {x=num, y=num, z=num}
- ObjectRef:get_hp - returns number of hitpoints (2 * number of hearts)
- ObjectRef:get_inventory - returns the InvRef of the object
- ObjectRef:get_wielded_item - returns the wielded item
- ObjectRef:get_wield_index - returns the index of the wielded item
- ObjectRef:get_wield_list - returns the name of the inventory list the wielded item is in
- ObjectRef:moveto - interpolated move
- ObjectRef:punch - puncher = an another ObjectRef, time_from_last_punch = time since last punch action of the puncher direction: can be nil
- ObjectRef:remove - remove object (after returning from Lua)
- ObjectRef:right_click - clicker = an another ObjectRef
- ObjectRef:setpos - sets the position of the object
- ObjectRef:set_armor_groups - armor_groups = {group1=rating, group2=rating, ...}
- ObjectRef:set_hp - set number of hitpoints (2 * number of hearts)
- ObjectRef:set_properties - set properties of an object
- ObjectRef:set_wielded_item - replaces the wielded item, returns true if successful
These are non-player moving things in the game. It inherits all the properties of ObjectRef
- LuaEntitySAO:getacceleration -
- LuaEntitySAO:getvelocity -
- LuaEntitySAO:getyaw -
- LuaEntitySAO:get_entity_name -
- LuaEntitySAO:get_luaentity -
- LuaEntitySAO:setacceleration -
- LuaEntitySAO:setsprite - Select sprite from spritesheet with optional animation and DM-style texture selection based on yaw relative to camera
- LuaEntitySAO:settexturemod -
- LuaEntitySAO:setvelocity -
- LuaEntitySAO:setyaw -
These are players in the game. It inherits all the properties of ObjectRef
- Player:get_inventory_formspec - returns formspec string
- Player:get_look_dir - get camera direction as a unit vector
- Player:get_look_pitch - pitch in radians
- Player:get_look_yaw - yaw in radians (wraps around pretty randomly as of now)
- Player:get_player_name - returns "" if is not a player
- Player:is_player - true for players, false for others
- Player:set_inventory_formspec - Redefine player's inventory form. Should usually be called in on_joinplayer.
Reference to an inventory
- InvRef:add_item - add item somewhere in list, returns leftover ItemStack
- InvRef:contains_item - returns true if the stack of items
- InvRef:get_list - return full list
- InvRef:get_size - get size of a list
- InvRef:get_stack - get a copy of stack index i in list
- InvRef:get_width - get width of a list
- InvRef:is_empty - return true if list is empty
- InvRef:remove_item - take as many items as specified from the list, returns the items that were actually removed (as an ItemStack)
- InvRef:room_for_item - returns true if the stack of items can be fully added to the list
- InvRef:set_list - set full list (size will not change)
- InvRef:set_size - set size of a list
- InvRef:set_stack - copy stack to index i in list
A stack of items. Can be created via ItemStack(itemstack or itemstring or table or nil)
- ItemStack:add_item - put some item or stack onto this stack, returns leftover ItemStack
- ItemStack:add_wear - increases wear by amount if the item is a tool
- ItemStack:clear - removes all items from the stack, making it empty
- ItemStack:get_count - returns number of items on the stack
- ItemStack:get_definition - returns the item definition table
- ItemStack:get_free_space - returns get_stack_max() - get_count()
- ItemStack:get_metadata - returns metadata (a string attached to an item stack)
- ItemStack:get_name - returns item name (e.g. "default:stone")
- ItemStack:get_stack_max - returns the maximum size of the stack (depends on the item)
- ItemStack:get_tool_capabilities - returns the digging properties of the item, or those of the hand if none are defined for this item type
- ItemStack:get_wear - returns tool wear (0-65535), 0 for non-tools
- ItemStack:is_empty - return true if stack is empty
- ItemStack:is_known - returns true if the item name refers to a defined item type
- ItemStack:item_fits - returns true if item or stack can be fully added to this one
- ItemStack:peek_item - copy (don't remove) up to n items from this stack, returns copied ItemStack, if quantity is omitted, quantity=1 is used
- ItemStack:replace - replace the contents of this stack (item can also be an itemstring or table)
- ItemStack:take_item - take (and remove) up to n items from this stack, returns taken ItemStack, if quantity is omitted, quantity=1 is used
- ItemStack:to_string - returns the stack in itemstring form
- ItemStack:to_table - returns the stack in Lua table form
A pseudorandom number generator. Can be created via PseudoRandom(seed)
A perlin noise generator. Can be created via PerlinNoise(seed, octaves, persistence, scale)
or minetest.env:get_perlin(seeddiff, octaves, persistence, scale)
There are developers, modders, themers, server admins and players on IRC at freenode on the channel #minetest (chatlogs)