diff --git a/locale/techage.de.tr b/locale/techage.de.tr index 8b0753b..df07e30 100644 --- a/locale/techage.de.tr +++ b/locale/techage.de.tr @@ -385,6 +385,7 @@ Type=Typ Unlock=Entsperren Unlock connected chest@nif all slots are below 2000=Nachfolgende Kiste entsperren,@nsofern alle Speicherplätze <= 2000 Update=Update +Use a trowel to remove the node.=Verwende eine Kelle, um den Block zu entfernen. Usmium Nuggets=Usmium Nuggets Usmium Powder=Usmium Pulver WLAN Chip=WLAN Chip diff --git a/locale/template.txt b/locale/template.txt index f14a696..749be29 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -383,6 +383,7 @@ Type= Unlock= Unlock connected chest@nif all slots are below 2000= Update= +Use a trowel to remove the node.= Usmium Nuggets= Usmium Powder= WLAN Chip= diff --git a/tools/trowel.lua b/tools/trowel.lua index 0782dbb..69e9684 100644 --- a/tools/trowel.lua +++ b/tools/trowel.lua @@ -116,3 +116,35 @@ minetest.register_craft({ {"", "", "default:stick"}, }, }) + +local function get_new_can_dig(old_can_dig) + return function(pos, player, ...) + if M(pos):get_string("techage_hidden_nodename") ~= "" then + if player and player.get_player_name then + minetest.chat_send_player(player:get_player_name(), S("Use a trowel to remove the node.")) + end + return false + end + if old_can_dig then + return old_can_dig(pos, player, ...) + else + return true + end + end +end + +-- Change can_dig for already registered nodes. +for _, ndef in pairs(minetest.registered_nodes) do + local old_can_dig = ndef.can_dig + minetest.override_item(ndef.name, { + can_dig = get_new_can_dig(old_can_dig) + }) +end + +-- Change can_dig for all nodes that are going to be registered in the future. +local old_register_node = minetest.register_node +minetest.register_node = function(name, def) + local old_can_dig = def.can_dig + def.can_dig = get_new_can_dig(old_can_dig) + return old_register_node(name, def) +end