1
0
mirror of https://github.com/minetest/minetest_game.git synced 2025-06-30 05:40:24 +02:00

Move keys to a separate mod (Fix #1490)

This commit is contained in:
Louis Royer
2020-07-12 14:30:11 +02:00
committed by Lars Müller
parent 0c1252bcf5
commit 40861c9e4f
41 changed files with 288 additions and 162 deletions

View File

@ -452,46 +452,6 @@ for name, mat in pairs(craft_ingreds) do
})
end
minetest.register_tool("default:key", {
description = S("Key"),
inventory_image = "default_key.png",
groups = {key = 1, not_in_creative_inventory = 1},
stack_max = 1,
on_place = function(itemstack, placer, pointed_thing)
local under = pointed_thing.under
local node = minetest.get_node(under)
local def = minetest.registered_nodes[node.name]
if def and def.on_rightclick and
not (placer and placer:is_player() and
placer:get_player_control().sneak) then
return def.on_rightclick(under, node, placer, itemstack,
pointed_thing) or itemstack
end
if pointed_thing.type ~= "node" then
return itemstack
end
local pos = pointed_thing.under
node = minetest.get_node(pos)
if not node or node.name == "ignore" then
return itemstack
end
local ndef = minetest.registered_nodes[node.name]
if not ndef then
return itemstack
end
local on_key_use = ndef.on_key_use
if on_key_use then
on_key_use(pos, placer)
end
return nil
end
})
minetest.register_craft({
type = "fuel",
recipe = "default:pick_wood",