EnvRef
(Redirected from EnvRef:add item)
Jump to navigation
Jump to search
![]() |
This page contains unofficial, low-quality Lua API documentation and is likely to be outdated or wrong. Do not rely on it! For the official and up-to-date documentation, see Lua API Documentation. |
![]() |
This page has been proposed for deletion for the following reason: "Contains unofficial and potentially outdated, redundant and inconsistent Lua API information" If you don't think that this page should be deleted, please explain why on the talk page. |
Important Note: Since 0.4.7, minetest.env
is deprecated. This feature won't be dropped soon to not break compatibility with older mods, but will be removed in a future version.
All functions listed here are (from 0.4.7 onwards) accessible via the global minetest
table. For example, minetest.env:set_node(pos, node)
becomes minetest.set_node(pos, node)
.
Basically ServerEnvironment
and ServerMap
combined. Can be gotten via minetest.env
.
Methods
name | description |
---|---|
<source enclose="none">add_entity(pos, "name")</source> | spawns Lua-defined entity at position. Returns ObjectRef on success or <source enclose="none">nil</source> if failed |
<source enclose="none">add_item(pos, name)</source> | spawns item. name is ItemStack or itemstring or table. Returns ObjectRef on success or <source enclose="none">nil</source> if failed
|
<source enclose="none">add_node(pos, node)</source> | set node at position, same as <source enclose="none">set_node(pos, node)</source>. node is node, not string representing its name!
|
<source enclose="none">clear_objects()</source> | clear all objects in the environment |
<source enclose="none">dig_node(pos)</source> | dig node with the same effects that a player would cause |
<source enclose="none">find_nodes_in_area(minp, maxp, nodenames)</source> | minp and maxp are positions, nodenames is either a table (e.g. <source enclose="none">{"ignore", "group:tree"}</source>) or a string (<source enclose="none">"default:dirt"</source>). Returns list of positions.
|
<source enclose="none">find_node_near(pos, radius, nodenames)</source> | same syntax, radius is integer value, returns position or <source enclose="none">nil</source>
|
<source enclose="none">get_meta(pos)</source> | get a NodeMetaRef at that position |
<source enclose="none">get_node(pos)</source> | returns node, <source enclose="none">{name="ignore", …}</source> for unloaded area |
<source enclose="none">get_node_light(pos, timeofday)</source> | timeofday; returns node light at specific time |
<source enclose="none">get_node_timer(pos)</source> | returns NodeTimerRef |
<source enclose="none">get_objects_inside_radius(pos, radius)</source> | Returns list of ObjectRefs for objects found within radius distance of position pos, including Players and LuaEntitySAOs. |
<source enclose="none">get_perlin(seeddiff, octaves, persistence, scale)</source> | Constructs a PerlinNoise object with seed derived from the world's seed value. |
<source enclose="none">get_player_by_name(name)</source> | Get the ObjectRef for the named player |
<source enclose="none">place_node(pos, node)</source> | place node with the same effects that a player would cause |
<source enclose="none">punch_node(pos)</source> | punch node with the same effects that a player would cause |
<source enclose="none">remove_node(pos)</source> | equivalent to <source enclose="none">set_node(pos, "air")</source> |
<source enclose="none">set_node(pos, name)</source> | same as <source enclose="none">add_node(pos, node)</source> |
<source enclose="none">set_timeofday(val)</source> | sets time of day |
<source enclose="none">get_timeofday()</source> | returns time of day. |