1
0
Fork
You've already forked multinode
0
API for Luanti
  • Lua 100%
Find a file
2026年04月22日 17:21:57 +10:00
init.lua fix warning 2026年04月22日 17:21:57 +10:00
LICENSE init 2026年01月19日 23:28:31 +11:00
mod.conf allow alternate nodes 2026年02月09日 10:24:51 +11:00
README.md allow alternate nodes 2026年02月09日 10:24:51 +11:00

multinode

Allows larger than 1x1 nodes such as doors and other oversized objects to be easily defined. You do not need to call any functions or hard-depend on this API under normal circumstances, but you should hard depend on it if your mod requires it to function correctly. Defining _multinode in your node definition is enough to trigger the API to handle the rest automatically.

To be implemented:

  • option to force placement of multinode nodes (unlikely but possible usecase) regardless of buildable_to
  • after_placed_multinode to give a list of positions that were placed so nodes can modify the placement or init nodes without manually getting this
core.register_node(name, {
	paramtype2 = "facedir",
	_multinode = {
		-- List of nodes to place and remove when placing and removing this node.
		-- In format `nodes[i] = {position, node, flags|nil}`. These can be any node.
		nodes = {
			{vector.new(1, 0, 0), {name="multinode:blocker", param2=1}, {optional=true}},
			{vector.new(0, 1, 0), {name="multinode:blocker", param2=0}, {optional=true}},
			{vector.new(-1, 0, 0), {name="multinode:blocker", param2=3}, {optional=true}},
		},
		-- Whether to rotate the nodes above according to param2
		no_rotation = true or false and nil,
		-- Skips overriding `on_construct`, same flags for other `no_*` fields.
		no_on_construct = nil,
		no_on_destruct = nil,
		no_on_place = nil,
		-- Stops node checking and replacing its extra nodes when updated (by punch, place etc).
		no_on_node_update = nil,
		-- Stops node adding its extra nodes back if they are missing.
		no_add_nodes_again_on_update = nil,
		-- Stops node being destroyed when it detects a node missing and can't replace it.
		no_dig_if_missing_nodes = nil,
		-- If true, skips checking if all the `nodes` can be placed and just does it.
		-- Does not cause overwriting non-`buildable_to` nodes however.
		always_place = nil,
	},
	-- (optional) should return the pos and node as it would be placed, so that
	-- the api can tell where it should check for the nodes in `_multinode.node`.
	-- Returns nil if it can't place.
	_get_on_place_prediction = function(itemstack, placer, pointed_thing)
		--- [...]
		return pos, node -- or nil
	end,
})