summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--extranodes/init.lua11
-rw-r--r--unifieddyes/init.lua9
2 files changed, 12 insertions, 8 deletions
diff --git a/extranodes/init.lua b/extranodes/init.lua
index 4871a0b..c3de5ab 100644
--- a/extranodes/init.lua
+++ b/extranodes/init.lua
@@ -146,10 +146,7 @@ local iclipfence_def = {
sounds = default.node_sound_stone_defaults(),
}
-if not minetest.get_modpath("unifieddyes") then
- minetest.register_node(":technic:insulator_clip", iclip_def)
- minetest.register_node(":technic:insulator_clip_fencepost", iclipfence_def)
-else
+if minetest.get_modpath("unifieddyes") then
iclip_def.paramtype2 = "colorwallmounted"
iclip_def.palette = "unifieddyes_palette_colorwallmounted.png"
iclip_def.after_place_node = unifieddyes.fix_rotation
@@ -162,11 +159,11 @@ else
iclipfence_def.after_dig_node = unifieddyes.after_dig_node
iclipfence_def.groups = {fence=1, choppy=1, snappy=1, oddly_breakable_by_hand=1, ud_param2_colorable = 1}
iclipfence_def.place_param2 = 171 -- medium amber, low saturation, closest color to default:wood
-
- minetest.register_node(":technic:insulator_clip", iclip_def)
- minetest.register_node(":technic:insulator_clip_fencepost", iclipfence_def)
end
+minetest.register_node(":technic:insulator_clip", iclip_def)
+minetest.register_node(":technic:insulator_clip_fencepost", iclipfence_def)
+
minetest.register_craft({
output = "technic:insulator_clip",
recipe = {
diff --git a/unifieddyes/init.lua b/unifieddyes/init.lua
index cfce06b..3329612 100644
--- a/unifieddyes/init.lua
+++ b/unifieddyes/init.lua
@@ -503,6 +503,14 @@ end
function unifieddyes.on_use(itemstack, player, pointed_thing)
+ local playername = player:get_player_name()
+
+ if minetest.is_protected(unifieddyes.select_node(pointed_thing), playername)
+ and not minetest.check_player_privs(playername, "protection_bypass") then
+ minetest.chat_send_player(playername, "Sorry, someone else owns that spot.")
+ return
+ end
+
if pointed_thing and pointed_thing.type == "object" then
pointed_thing.ref:punch(player, 0, itemstack:get_tool_capabilities())
return player:get_wielded_item() -- punch may modified the wielded item, load the new and return it
@@ -513,7 +521,6 @@ function unifieddyes.on_use(itemstack, player, pointed_thing)
local pos = minetest.get_pointed_thing_position(pointed_thing)
local node = minetest.get_node(pos)
local nodedef = minetest.registered_nodes[node.name]
- local playername = player:get_player_name()
if not nodedef then return end -- target was an unknown node, just bail out