restrict lava_source placement when ethereal mod detected

This commit is contained in:
Milan* 2017-03-26 21:39:07 +02:00
parent de70c5898b
commit e7e6118807

View File

@ -207,8 +207,35 @@ minetest.register_node("illuna:lw_instructions", {
groups = { unbreakable = 1 },
})
-- nodeboxes by https://github.com/D00Med/LegendofMinetest
if minetest.get_modpath("ethereal") then
-- disallow placing of lava below -2 except player has the trusted_player priv
minetest.override_item("default:lava_source", {
after_place_node = function(pos, placer, node)
if (minetest.check_player_privs(placer:get_player_name(), {trusted_player=true})) then
-- node was placed - let's store some playerinformations to make the moderators work easier
local meta = minetest.get_meta(pos)
meta:set_string("placer", placer:get_player_name() or "")
meta:set_string("infotext", "Some Lava (graceful placer: "..meta:get_string("placer") .. " - it's a trusted player.)")
else
-- player has not trusted_player, we will remove the node when not placed at least two nodes below sealevel
if pos.y >= -2 then
minetest.env:remove_node(pos)
else
-- node was placed - let's store some playerinformations to make the moderators work easier
local meta = minetest.get_meta(pos)
meta:set_string("placer", placer:get_player_name() or "")
meta:set_string("infotext", "Some Lava (graceful placer: "..meta:get_string("placer") .. ")")
end
end
end,
on_construct = function(pos, player)
local meta = minetest.get_meta(pos)
meta:set_string("placer", "")
end,
pointable = true,
})
-- nodeboxes by https://github.com/D00Med/LegendofMinetest
minetest.override_item("default:furnace", {
drawtype = "nodebox",
paramtype = "light",