Make can_interact_with_node() check for key group instead of default:key
authorLejo <Lejo_1@web.de>
Mon, 6 Jan 2020 21:16:33 +0000 (22:16 +0100)
committerParamat <paramat@users.noreply.github.com>
Mon, 6 Jan 2020 21:16:33 +0000 (21:16 +0000)
mods/default/craftitems.lua
mods/default/functions.lua

index 045f745aacb2e9158eed3aa925547997c725997e..923d754f606be31fd6c6740d2474396e2be48bc0 100644 (file)
@@ -148,7 +148,6 @@ end)
 minetest.register_craftitem("default:skeleton_key", {
        description = S("Skeleton Key"),
        inventory_image = "default_key_skeleton.png",
-       groups = {key = 1},
        on_use = function(itemstack, user, pointed_thing)
                if pointed_thing.type ~= "node" then
                        return itemstack
index 450984d0d81e21a32556afb1e8372ae3efaeaf15..18ba561bfcf46b25cf89775bb17a62292ab0ab76 100644 (file)
@@ -639,7 +639,7 @@ function default.can_interact_with_node(player, pos)
 
        -- Is player wielding the right key?
        local item = player:get_wielded_item()
-       if item:get_name() == "default:key" then
+       if minetest.get_item_group(item:get_name(), "key") == 1 then
                local key_meta = item:get_meta()
 
                if key_meta:get_string("secret") == "" then