i'm glad to ask for help here again :). I've a new problem, i would like to prevent the use of lava in a certain area.
I've made a quite little mod for that, but... now i would like to add an exception and permit to someone with a priv to put lava into this area.
Here is the problem, how to modify this to solve my problem ?
Code: Select all
local pos={x=0,y=0,z=0}
local rad=500
local rad2=-500
minetest.override_item("default:lava_source", {
on_construct = function(pos)
if rad2<pos.x and pos.x<rad and rad2<pos.y and pos.y<rad and rad2<pos.z and pos.z<rad then
minetest.env:remove_node(pos)
end
end
})
I've tested another idea with this:
Code: Select all
local pos={x=0,y=0,z=0}
local rad=500
local rad2=-500
minetest.register_privilege("overridelavazone", {
description = "Autorise le placement de lave",
give_to_singleplayer = false,
})
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing)
if rad2<pos.x and pos.x<rad and rad2<pos.y and pos.y<rad and rad2<pos.z and pos.z<rad and (newnode.name == "default:lava_source") and not minetest.check_player_privs(placer:get_player_name(),{overridelavazone = true}) then
minetest.env:remove_node(pos)
end
end)
Thanks for reading !