From e7e611880740c1181847bd87f766a3eac8cfb609 Mon Sep 17 00:00:00 2001 From: Milan* Date: Sun, 26 Mar 2017 21:39:07 +0200 Subject: [PATCH] restrict lava_source placement when ethereal mod detected --- nodes.lua | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/nodes.lua b/nodes.lua index 99096d8..d862798 100644 --- a/nodes.lua +++ b/nodes.lua @@ -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",