EnvRef
From Minetest Developer Wiki
(Redirected from EnvRef:add entity)
![]() |
This page contains unofficial Lua API documentation and is likely to be outdated or wrong. For the official and up-to-date documentation, refer to lua_api.txt found in your Minetest installation directory under doc . |
![]() |
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 |
---|---|
add_entity(pos, "name") | spawns Lua-defined entity at position. Returns ObjectRef on success or nil if failed |
add_item(pos, name) | spawns item. name is ItemStack or itemstring or table. Returns ObjectRef on success or nil if failed
|
add_node(pos, node) | set node at position, same as set_node(pos, node). node is node, not string representing its name!
|
clear_objects() | clear all objects in the environment |
dig_node(pos) | dig node with the same effects that a player would cause |
find_nodes_in_area(minp, maxp, nodenames) | minp and maxp are positions, nodenames is either a table (e.g. {"ignore", "group:tree"}) or a string ("default:dirt"). Returns list of positions.
|
find_node_near(pos, radius, nodenames) | same syntax, radius is integer value, returns position or nil
|
get_meta(pos) | get a NodeMetaRef at that position |
get_node(pos) | returns node, {name="ignore", …} for unloaded area |
get_node_light(pos, timeofday) | timeofday; returns node light at specific time |
get_node_timer(pos) | returns NodeTimerRef |
get_objects_inside_radius(pos, radius) | Returns list of ObjectRefs for objects found within radius distance of position pos, including Players and LuaEntitySAOs. |
get_perlin(seeddiff, octaves, persistence, scale) | Constructs a PerlinNoise object with seed derived from the world's seed value. |
get_player_by_name(name) | Get the ObjectRef for the named player |
place_node(pos, node) | place node with the same effects that a player would cause |
punch_node(pos) | punch node with the same effects that a player would cause |
remove_node(pos) | equivalent to set_node(pos, "air") |
set_node(pos, name) | same as add_node(pos, node) |
set_timeofday(val) | sets time of day |
get_timeofday() | returns time of day. |