diff --git a/lua_api.html b/lua_api.html index 6bd2696..caeeefd 100644 --- a/lua_api.html +++ b/lua_api.html @@ -4,7 +4,7 @@ layout: default ---
If you have any difficulty in understanding this, please read Programming in Lua.
foomod_foosound.9.ogg
Examples of sound parameter tables:
--- Play location-less on all clients
+-- Play locationless on all clients
{
gain = 1.0, -- default
}
--- Play location-less to a player
+-- Play locationless to one player
{
to_player = name,
gain = 1.0, -- default
}
+-- Play locationless to one player, looped
+{
+ to_player = name,
+ gain = 1.0, -- default
+ loop = true,
+}
-- Play in a location
{
- pos = {x=1,y=2,z=3},
+ pos = {x = 1, y = 2, z = 3},
gain = 1.0, -- default
max_hear_distance = 32, -- default, uses an euclidean metric
}
@@ -730,16 +737,18 @@ from the available ones of the following files:
object = <an ObjectRef>,
gain = 1.0, -- default
max_hear_distance = 32, -- default, uses an euclidean metric
- loop = true, -- only sounds connected to objects can be looped
+ loop = true,
}
+Looped sounds must either be connected to an object or played locationless to
+one player using to_player = name,
SimpleSoundSpec
- e.g.
""
- #e.g.
"default_place_node"
- e.g.
{}
-- #e.g.
{name="default_place_node"}
-- #e.g.
{name="default_place_node", gain=1.0}
+- #e.g.
{name = "default_place_node"}
+- #e.g.
{name = "default_place_node", gain = 1.0}
Registered definitions of stuff
Anything added using certain minetest.register_*
functions get added to
@@ -1991,6 +2000,13 @@ pass key press events to formspec!
#"nodemeta:<X>,<Y>,<Z>"
: Any node metadata
#"detached:<name>"
: A detached inventory
+Player Inventory lists
+
+- #
main
: list containing the default inventory
+- #
craft
: list containing the craft input
+- #
craftpreview
: list containing the craft output
+- #
hand
: list containing an override for the empty hand
+
ColorString
#RGB
defines a color in hexadecimal format.
#RGBA
defines a color in hexadecimal format and alpha channel.
@@ -2319,9 +2335,10 @@ The following functions provide escape sequences:
#minetest.register_on_cheat(func(ObjectRef, cheat))
- Called when a player cheats
- #
cheat
: {type=<cheat_type>}
, where <cheat_type>
is one of:
-- #
"moved_too_fast"
-- #
"interacted_too_far"
-- #
"finished_unknown_dig"
+- #
moved_too_fast
+- #
interacted_too_far
+- #
interacted_while_dead
+- #
finished_unknown_dig
- #
dug_unbreakable
- #
dug_too_fast
@@ -2457,7 +2474,7 @@ and minetest.auth_reload
call the authetification handler.
- #Set node at position (
node = {name="foo", param1=0, param2=0}
)
-#minetest.swap_node(pos, node
+- #
minetest.swap_node(pos, node)
- Set node at position, but don't remove metadata
@@ -2733,6 +2750,19 @@ and minetest.auth_reload
call the authetification handler.
- can be negative for decreasing
+#core.check_single_for_falling(pos)
+- #causes an unsupported
group:falling_node
node to fall and causes an
+ unattached group:attached_node
node to fall.
+- does not spread these updates to neighbours.
+
+
+#core.check_for_falling(pos)
+- #causes an unsupported
group:falling_node
node to fall and causes an
+ unattached group:attached_node
node to fall.
+- spread these updates to neighbours and can cause a cascade
+ of nodes to fall.
+
+
Inventory
minetest.get_inventory(location)
: returns an InvRef
@@ -2743,8 +2773,11 @@ and minetest.auth_reload
call the authetification handler.
#{type="detached", name="creative"}
-#minetest.create_detached_inventory(name, callbacks)
: returns an InvRef
+- #
minetest.create_detached_inventory(name, callbacks, [player_name])
: returns an InvRef
- callbacks: See "Detached inventory callbacks"
+- player_name: Make detached inventory available to one player exclusively,
+ by default they will be sent to every player (even if not used).
+ Note that this parameter is mostly just a workaround and will be removed in future releases.
- Creates a detached inventory. If it already exists, it is cleared.
@@ -2763,6 +2796,15 @@ and minetest.auth_reload
call the authetification handler.
- #
formspec
: formspec to display
+#minetest.close_formspec(playername, formname)
+- #
playername
: name of player to close formspec
+- #
formname
: has to exactly match the one given in show_formspec, or the formspec will
+ not close.
+- calling show_formspec(playername, formname, "") is equal to this expression
+- to close a formspec regardless of the formname, call
+ minetest.close_formspec(playername, ""). USE THIS ONLY WHEN ABSOLUTELY NECESSARY!
+
+
#minetest.formspec_escape(string)
: returns a string
- escapes the characters "[", "]", "\", "," and ";", which can not be used in formspecs
@@ -3101,6 +3143,12 @@ and minetest.auth_reload
call the authetification handler.
Misc.
- #
minetest.get_connected_players()
: returns list of ObjectRefs
+- #
minetest.hud_replace_builtin(name, hud_definition)
+
- #
minetest.hash_node_position({x=,y=,z=})
: returns an 48-bit integer
- Gives a unique hash number for a node position (16+16+16=48bit)
@@ -3124,7 +3172,7 @@ and minetest.auth_reload
call the authetification handler.
#minetest.get_content_id(name)
: returns an integer
#minetest.get_name_from_content_id(content_id)
: returns a string
@@ -3196,7 +3244,7 @@ and minetest.auth_reload
call the authetification handler.
- #
minetest.is_protected(pos, name)
: returns boolean
-- #Returns true, if player
name
shouldn't be abled to dig at pos
or do other
+ - #Returns true, if player
name
shouldn't be abled to dig at pos
or do other
actions, defineable by mods, due to some mod-defined ownership-like concept.
Returns false or nil, if the player is allowed to do such actions.
- This function should be overridden by protection mods and should be used to
@@ -3573,12 +3621,6 @@ Can be gotten via
minetest.get_node_timer(pos)
.
- #
hud_get_hotbar_selected_image
: returns texturename
-- #
hud_replace_builtin(name, hud_definition)
-
- #
set_sky(bgcolor, type, {texture names})
- #
bgcolor
: ColorSpec, defaults to white
- #Available types:
@@ -4230,8 +4272,9 @@ minetest.spawn_tree(pos,apple_tree)
-- ^ Called sometimes; the string returned is passed to on_activate when
-- the entity is re-activated from static state
- -- Also you can define arbitrary member variables here
- myvariable = whatever,
+ -- Also you can define arbitrary member variables here (see item definition for
+ -- more info)
+ _custom_field = whatever,
}
register_abm
)