This is just a proof of concept and quite hacky, so don't use this on existing worlds without making a backup.
depends: default
license: GPL v2 or later
download: see attachment


for _, node_name in ipairs(nodes) do
minetest.override_item(node_name, {paramtype2 = "facedir"})
local old_after_place = minetest.registered_nodes[node_name].after_place
minetest.override_item(node_name, {after_place_node =
function(pos)
local facedir = math.random(0,3)
minetest.set_node(pos, {name=node_name, param2 = facedir})
if old_after_place then old_after_place(pos) end
end
})
even if the outer scope has passed, the function will still hold on to the variable.
loops create a new scope on each iteration:
texmex wrote:… but no outcome yet.
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)Users browsing this forum: No registered users and 10 guests