Skip to content
Snippets Groups Projects
Commit 40861c9e authored by Louis Royer's avatar Louis Royer Committed by Lars Müller
Browse files

Move keys to a separate mod (Fix #1490)

parent 0c1252bc
No related branches found
No related tags found
No related merge requests found
Showing
with 27 additions and 162 deletions
......@@ -188,8 +188,6 @@ Gambit (CC BY-SA 3.0):
default_snow.png
default_snow_side.png
default_snowball.png
default_key.png
default_key_skeleton.png
default_book.png
asl97 (CC BY-SA 3.0):
......
......@@ -196,61 +196,6 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
player:set_wielded_item(stack)
end)
minetest.register_craftitem("default:skeleton_key", {
description = S("Skeleton Key"),
inventory_image = "default_key_skeleton.png",
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then
return itemstack
end
local pos = pointed_thing.under
local node = minetest.get_node(pos)
if not node then
return itemstack
end
local node_reg = minetest.registered_nodes[node.name]
local on_skeleton_key_use = node_reg and node_reg.on_skeleton_key_use
if not on_skeleton_key_use then
return itemstack
end
-- make a new key secret in case the node callback needs it
local random = math.random
local newsecret = string.format(
"%04x%04x%04x%04x",
random(2^16) - 1, random(2^16) - 1,
random(2^16) - 1, random(2^16) - 1)
local secret, _, _ = on_skeleton_key_use(pos, user, newsecret)
if secret then
local inv = minetest.get_inventory({type="player", name=user:get_player_name()})
-- update original itemstack
itemstack:take_item()
-- finish and return the new key
local new_stack = ItemStack("default:key")
local meta = new_stack:get_meta()
meta:set_string("secret", secret)
meta:set_string("description", S("Key to @1's @2", user:get_player_name(),
minetest.registered_nodes[node.name].description))
if itemstack:get_count() == 0 then
itemstack = new_stack
else
if inv:add_item("main", new_stack):get_count() > 0 then
minetest.add_item(user:get_pos(), new_stack)
end -- else: added to inventory successfully
end
return itemstack
end
end
})
--
-- Craftitem registry
......@@ -479,13 +424,6 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = "default:skeleton_key",
recipe = {
{"default:gold_ingot"},
}
})
minetest.register_craft({
output = "default:steel_ingot 9",
recipe = {
......@@ -529,19 +467,6 @@ minetest.register_craft({
recipe = "default:gold_lump",
})
minetest.register_craft({
type = "cooking",
output = "default:gold_ingot",
recipe = "default:key",
cooktime = 5,
})
minetest.register_craft({
type = "cooking",
output = "default:gold_ingot",
recipe = "default:skeleton_key",
cooktime = 5,
})
minetest.register_craft({
type = "cooking",
......
......@@ -12,8 +12,6 @@ Save=Speichern
by @1=von @1
Page @1 of @2=Seite @1 von @2
"@1" by @2=„@1“ von @2
Skeleton Key=Skelettschlüssel
Key to @1's @2=Schlüssel für @2 von @1
Blueberries=Blaubeeren
Book=Buch
Book with Text=Buch mit Text
......@@ -212,7 +210,6 @@ Bronze Sword=Bronzeschwert
Steel Sword=Stahlschwert
Mese Sword=Meseschwert
Diamond Sword=Diamantschwert
Key=Schlüssel
Torch=Fackel
@1 will intersect protection on growth.=@1 wird bei Wachstum mit geschützter Zone überlappen.
......
......@@ -12,8 +12,6 @@ Save=Konservu
by @1=per @1
Page @1 of @2=Paĝo @1 el @2
"@1" by @2="@1" per @2
Skeleton Key=Skeleta Ŝlosilo
Key to @1's @2=Ŝlosilo por la @2 de @1
Blueberries=Mirteloj
Book=Libro
Book with Text=Libro kun Teksto
......@@ -212,7 +210,6 @@ Bronze Sword=Bronza Glavo
Steel Sword=Ŝtala Glavo
Mese Sword=Mesea Glavo
Diamond Sword=Diamanta Glavo
Key=Ŝlosilo
Torch=Torĉo
@1 will intersect protection on growth.=@1 sekcos protekto ĉe vegeto.
......
......@@ -12,8 +12,6 @@ Save=Guardar
by @1=por @1
Page @1 of @2=Página @1 de @2
"@1" by @2="@1" por @2
Skeleton Key=Llave esqueleto
Key to @1's @2=Llave para @2 de @1
Blueberries=Arándanos
Book=Libro
Book with Text=Libro escrito
......@@ -212,7 +210,6 @@ Bronze Sword=Espada de bronce
Steel Sword=Espada de acero
Mese Sword=Espada de mese
Diamond Sword=Espada de diamante
Key=Llave
Torch=Antorcha
@1 will intersect protection on growth.=@1 intersectará con protección cuando crezca.
......
......@@ -12,8 +12,6 @@ Save=Sauvegarder
by @1=de @1
Page @1 of @2=Page @1 sur @2
"@1" by @2=« @1 » de @2
Skeleton Key=Squelette
Key to @1's @2=Clé pour @2 de @1
Blueberries=Myrtille
Book=Livre
Book with Text=Livre avec du texte
......@@ -212,7 +210,6 @@ Bronze Sword=Epée en bronze
Steel Sword=Epée en acier
Mese Sword=Epée en Mese
Diamond Sword=Epée en diamant
Key=Clé
Torch=Torche
@1 will intersect protection on growth.=@1 chevauchera la zone protégée avec la croissance.
......
......@@ -12,8 +12,6 @@ Save=Simpan
by @1=oleh @1
Page @1 of @2=Halaman @1 dari @2
"@1" by @2="@1" oleh @2
Skeleton Key=Kunci Induk
Key to @1's @2=Kunci @2 milik @1
Blueberries=Blueberry
Book=Buku
Book with Text=Buku Tertulis
......@@ -212,7 +210,6 @@ Bronze Sword=Pedang Perunggu
Steel Sword=Pedang Baja
Mese Sword=Pedang Mese
Diamond Sword=Pedang Berlian
Key=Kunci
Torch=Obor
@1 will intersect protection on growth.=@1 akan memotong perlindungan ketika tumbuh.
......
......@@ -12,8 +12,6 @@ Save=
by @1=
Page @1 of @2=
"@1" by @2="@1" di @2
Skeleton Key=Chiave dello Scheletro
Key to @1's @2=Chiave per @2 di @1
Blueberries=Mirtilli
Book=Libro
Book with Text=Libro con testo
......@@ -212,7 +210,6 @@ Bronze Sword=Spada di bronzo
Steel Sword=Spada d'acciaio
Mese Sword=Spada di mese
Diamond Sword=Spada di diamante
Key=Chiave
Torch=Torcia
@1 will intersect protection on growth.=@1 crescendo attraverserà la protezione.
......
......@@ -12,8 +12,6 @@ Save=rejgau
by @1=la'o zo'i.@1.zo'i te cukta
Page @1 of @2=meirmoi fe li @1 li @2 le'i papri
"@1" by @2=lo cukta be la'o gy.@1.gy. bei la'o zo'i.@2.zo'i
Skeleton Key=lo greku ckiku
Key to @1's @2=lo ckiku be @2 po la'o zo'i.@1.zo'i
Blueberries=lo blajba
Book=lo cukta
Book with Text=lo cukta joi selci'a
......@@ -212,6 +210,5 @@ Bronze Sword=lo ransu cladakyxa'i
Steel Sword=lo gasta cladakyxa'i
Mese Sword=lo za'e kunrmese cladakyxa'i
Diamond Sword=lo tabjme cladakyxa'i
Key=lo ckiku
Torch=lo fagytergu'i
@1 will intersect protection on growth.=.i @1 cu ba kruca lo bandu ca lo nu banro
......@@ -12,8 +12,6 @@ Save=Simpan
by @1=oleh @1
Page @1 of @2=Ms. @1 / @2
"@1" by @2="@1" oleh @2
Skeleton Key=Kunci Induk
Key to @1's @2=Kunci @2 milik @1
Blueberries=Beri Biru
Book=Buku
Book with Text=Buku Bertulisan
......@@ -212,7 +210,6 @@ Bronze Sword=Pedang Gangsa
Steel Sword=Pedang Keluli
Mese Sword=Pedang Mese
Diamond Sword=Pedang Intan
Key=Kunci
Torch=Obor
@1 will intersect protection on growth.=@1 akan masuk kawasan perlindungan lain apabila ia tumbuh.
......
......@@ -12,8 +12,6 @@ Save=Salvar
by @1=por @1
Page @1 of @2=Página @1 de @2
"@1" by @2="@1" por @2
Skeleton Key=Chave de Mestra
Key to @1's @2=Chave para @2 de @1
Blueberries=Mirtilo
Book=Livro
Book with Text=Livro com Texto
......@@ -212,6 +210,5 @@ Bronze Sword=Espada de Bronze
Steel Sword=Espada de Aço
Mese Sword=Espada de Mese
Diamond Sword=Espada de Diamante
Key=Chave
Torch=Tocha
@1 will intersect protection on growth.=@1 cruzará a proteção no crescimento.
......@@ -12,8 +12,6 @@ Save=Сохранить
by @1=@1
Page @1 of @2=Страница @1 из @2
"@1" by @2="@1" @2
Skeleton Key=Ключ Скелета
Key to @1's @2=Ключ к @2 от @1
Blueberries=Черника
Book=Книга
Book with Text=Книга с Текстом
......@@ -212,7 +210,6 @@ Bronze Sword=Бронзовый Меч
Steel Sword=Стальной Меч
Mese Sword=Месе Меч
Diamond Sword=Алмазный Меч
Key=Ключ
Torch=Факел
@1 will intersect protection on growth.=@1 пересечёт защиту по росту.
......
......@@ -12,8 +12,6 @@ Save=Spara
by @1=av @1
Page @1 of @2=Sida @1 av @2
"@1" by @2="@1" av @2
Skeleton Key=Skelett Nyckel
Key to @1's @2=Nyckel till @1s @2
Blueberries=Blåbär
Book=Bok
Book with Text=Bok med text
......@@ -212,7 +210,6 @@ Bronze Sword=Brons Svärd
Steel Sword=Stål Svärd
Mese Sword=Mese Svärd
Diamond Sword=Diamant Svärd
Key=Nyckel
Torch=Fakla
@1 will intersect protection on growth.=@1 kommer korsa skyddet mot tillväxt.
......
......@@ -12,8 +12,6 @@ Save=Uložiť
by @1=od @1
Page @1 of @2=Strana @1 z @2
"@1" by @2=„@1“ z @2
Skeleton Key=Základný kľuč
Key to @1's @2=Kľuč pre @2 hráča @1
Blueberries=Čučoriedky
Book=Kniha
Book with Text=Kniha s textom
......@@ -212,7 +210,6 @@ Bronze Sword=Bronzový meč
Steel Sword=Oceľový meč
Mese Sword=Mese meč
Diamond Sword=Diamantový meč
Key=Kľúč
Torch=Fakľa
@1 will intersect protection on growth.=@1 prekročí pri raste chránenú zónu.
......
......@@ -12,8 +12,6 @@ Save=保存
by @1=由@1
Page @1 of @2=第@1页,共@2页。
"@1" by @2="@1" by @2
Skeleton Key=万能钥匙
Key to @1's @2=@1的@2的钥匙
Blueberries=蓝莓
Book=书
Book with Text=带文字的书
......@@ -212,7 +210,6 @@ Bronze Sword=青铜剑
Steel Sword=铁剑
Mese Sword=黄石剑
Diamond Sword=钻石剑
Key=钥匙
Torch=火把
@1 will intersect protection on growth.=@1生长时将与保护区域相交。
......
......@@ -12,8 +12,6 @@ Save=保存
by @1=由@1
Page @1 of @2=第@1頁,共@2頁。
"@1" by @2="@1" by @2
Skeleton Key=萬能鑰匙
Key to @1's @2=@1的@2的鑰匙
Blueberries=藍莓
Book=書
Book with Text=帶文字的書
......@@ -212,7 +210,6 @@ Bronze Sword=青銅劍
Steel Sword=鐵劍
Mese Sword=黃石劍
Diamond Sword=鑽石劍
Key=鑰匙
Torch=火把
@1 will intersect protection on growth.=@1將與增長的保護相交。
......
......@@ -12,8 +12,6 @@ Save=
by @1=
Page @1 of @2=
"@1" by @2=
Skeleton Key=
Key to @1's @2=
Blueberries=
Book=
Book with Text=
......@@ -212,6 +210,5 @@ Bronze Sword=
Steel Sword=
Mese Sword=
Diamond Sword=
Key=
Torch=
@1 will intersect protection on growth.=
......@@ -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",
......
Minetest Game mod: keys
==========================
See license.txt for license information.
Authors of source code
----------------------
Originally by celeron55, Perttu Ahola <celeron55@gmail.com> (LGPLv2.1+)
Various Minetest developers and contributors (LGPLv2.1+)
Authors of media (textures, sounds, models and schematics)
----------------------------------------------------------
Textures
--------
Gambit (CC BY-SA 3.0):
keys_key.png
keys_key_skeleton.png
Features
--------
This mod uses the key API as defined in game_api.txt section [Key API].
--
-- Aliases for backward compatibility
--
minetest.register_alias("default:key", "keys:key")
minetest.register_alias("default:skeleton_key", "keys:skeleton_key")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment