allow_metadata_inventory_put =
function(pos, list, idx, stack, player, entity)
return stack:get_count()
end,
})
Timers
local t = core.get_node_timer(pos)
t:start(5)
on_timer(pos, elapsed, entity) supported.
Metadata & Forms
local meta = core.get_meta(pos)
meta:set_string("infotext","Running")
Forms using [nodemeta] and [context] work automatically.
Notes
Most core., vector., and VoxelManip node access is wrapped.
this has been generated by pasting the source code into chatgtp please whoever made this mod add actual docs later luanti_node_entities
Turn nodes into entities while preserving metadata, inventories, timers, ABMs, LBMs, and formspecs.
Entities
nodeentity:node Node rendered as visual="node". Stores:
name, param1, param2
metadata (detached inventory)
timer state Forwards node callbacks (on_construct, on_timer, inventory callbacks, etc.).
nodeentity:nodeset Container entity used to attach multiple nodeentities (moving structures).
API nodeentity.add(pos, node) ObjectRef nodeentity.add(vector pos, table node)
Create a nodeentity.
local obj = nodeentity.add({x=0,y=5,z=0}, { name="default:chest", param1=0, param2=0 }) nodeentity.relative_pos(entity) vector nodeentity.relative_pos(luaentity entity)
Returns relative position used in forwarded callbacks.
nodeentity.read_world(pos, anchor, minp, maxp) ObjectRef nodeentity.read_world(vector pos, vector anchor, vector minp, vector maxp)
Copies a region into nodeentities attached to a nodeset.
local ship = nodeentity.read_world( {x=0,y=20,z=0}, {x=0,y=0,z=0}, {x=-5,y=0,z=-5}, {x=5,y=5,z=5} ) ship:set_velocity({x=2,y=0,z=0}) Node Definition Compatibility
Normal node defs work:
core.register_node("mymod:machine", { on_construct = function(pos, entity) core.get_node_timer(pos):start(5) end,
on_timer = function(pos, elapsed, entity) return true end,
allow_metadata_inventory_put = function(pos, list, idx, stack, player, entity) return stack:get_count() end, }) Timers local t = core.get_node_timer(pos) t:start(5)
on_timer(pos, elapsed, entity) supported. Metadata & Forms local meta = core.get_meta(pos) meta:set_string("infotext","Running") Forms using [nodemeta] and [context] work automatically. Notes
Most core., vector., and VoxelManip node access is wrapped.
ABMs & LBMs (run_at_every_load=true) supported.