- image
Displays an image on the HUD.
- - scale: The scale of the image, with 1 being the original texture size.
- Only the X coordinate scale is used.
+ - scale: The scale of the image, with 1 being the original texture size.
+ Only the X coordinate scale is used (positive values)
+ Negative values represent that percentage of the screen it
+ should take; e.g. x=-100 means 100% (width)
- text: The name of the texture that is displayed.
- alignment: The alignment of the image.
- offset: offset in pixels from position.
minetest.string_to_pos(string) -> position
^ Same but in reverse
^ escapes characters [ ] \ , ; that can not be used in formspecs
+minetest.is_yes(arg)
+^ returns whether arg can be interpreted as yes
minetest namespace reference
-----------------------------
Global callback registration functions: (Call these only at load time)
minetest.register_globalstep(func(dtime))
-^ Called every server step, usually interval of 0.05s
+^ Called every server step, usually interval of 0.1s
minetest.register_on_shutdown(func())
^ Called before server shutdown
^ WARNING: If the server terminates abnormally (i.e. crashes), the registered
minetest.get_objects_inside_radius(pos, radius)
minetest.set_timeofday(val): val: 0...1; 0 = midnight, 0.5 = midday
minetest.get_timeofday()
+minetest.get_gametime(): returns the time, in seconds, since the world was created
minetest.find_node_near(pos, radius, nodenames) -> pos or nil
^ nodenames: eg. {"ignore", "group:tree"} or "default:dirt"
minetest.find_nodes_in_area(minp, maxp, nodenames) -> list of positions
Defaults for the on_* item definition functions:
(These return the leftover itemstack)
-minetest.item_place_node(itemstack, placer, pointed_thing)
+minetest.item_place_node(itemstack, placer, pointed_thing, param2)
^ Place item as a node
+^ param2 overrides facedir and wallmounted param2
+^ returns itemstack, success
minetest.item_place_object(itemstack, placer, pointed_thing)
^ Place item as-is
-minetest.item_place(itemstack, placer, pointed_thing)
+minetest.item_place(itemstack, placer, pointed_thing, param2)
^ Use one of the above based on what the item is.
^ Calls on_rightclick of pointed_thing.under if defined instead
^ Note: is not called when wielded item overrides on_place
+^ param2 overrides facedir and wallmounted param2
+^ returns itemstack, success
minetest.item_drop(itemstack, dropper, pos)
^ Drop the item
minetest.item_eat(hp_change, replace_with_item)
methods:
- is_empty(): return true if stack is empty
- get_name(): returns item name (e.g. "default:stone")
+- set_name(itemname)
- get_count(): returns number of items on the stack
+- set_count(count)
- get_wear(): returns tool wear (0-65535), 0 for non-tools
+- set_wear(wear)
- get_metadata(): returns metadata (a string attached to an item stack)
+- set_metadata(metadata)
- clear(): removes all items from the stack, making it empty
- replace(item): replace the contents of this stack (item can also
be an itemstring or table)
^ from (minx,miny,minz) to (maxx,maxy,maxz) in the order of [z [y [x]]]
- iterp(minp, maxp): same as above, except takes a vector
+Settings: An interface to read config files in the format of minetest.conf
+- Can be created via Settings(filename)
+methods:
+- get(key) -> value
+- get_bool(key) -> boolean
+- set(key, value)
+- remove(key) -> success
+- get_names() -> {key1,...}
+- write() -> success
+ ^ write changes to file
+- to_table() -> {[key1]=value1,...}
+
Mapgen objects
---------------
A mapgen object is a construct used in map generation. Mapgen objects can be used by an on_generate
- on_activate(self, staticdata)
^ Called when the object is instantiated.
- on_step(self, dtime)
- ^ Called on every server tick (dtime is usually 0.05 seconds)
+ ^ Called on every server tick (dtime is usually 0.1 seconds)
- on_punch(self, puncher, time_from_last_punch, tool_capabilities, dir)
^ Called when somebody punches the object.
^ Note that you probably want to handle most punches using the
makes_footstep_sound = false,
automatic_rotate = false,
stepheight = 0,
- automatic_face_movement_dir = false,
+ automatic_face_movement_dir = 0.0,
+ ^ automatically set yaw to movement direction; offset in degrees; false to disable
}
Entity definition (register_entity)
eg. itemstack:take_item(); return itemstack
^ Otherwise, the function is free to do what it wants.
^ The default functions handle regular use cases.
+ after_use = func(itemstack, user, node, digparams),
+ ^ default: nil
+ ^ If defined, should return an itemstack and will be called instead of
+ wearing out the tool. If returns nil, does nothing.
+ If after_use doesn't exist, it is the same as:
+ function(itemstack, user, node, digparams)
+ itemstack:add_wear(digparams.wear)
+ return itemstack
+ end
}
Tile definition:
drawtype = "normal", -- See "Node drawtypes"
visual_scale = 1.0,
+ ^ Supported for drawtypes "plantlike", "signlike", "torchlike".
+ ^ For plantlike, the image will start at the bottom of the node; for the
+ ^ other drawtypes, the image will be centered on the node.
+ ^ Note that positioning for "torchlike" may still change.
tiles = {tile definition 1, def2, def3, def4, def5, def6},
^ Textures of node; +Y, -Y, +X, -X, +Z, -Z (old field name: tile_images)
^ List can be shortened to needed length