forked from nalc/nalc_game
Move keys to a separate mod (Fix #1490)
This commit is contained in:
21
mods/keys/README.txt
Normal file
21
mods/keys/README.txt
Normal file
@ -0,0 +1,21 @@
|
||||
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].
|
6
mods/keys/aliases.lua
Normal file
6
mods/keys/aliases.lua
Normal file
@ -0,0 +1,6 @@
|
||||
--
|
||||
-- Aliases for backward compatibility
|
||||
--
|
||||
|
||||
minetest.register_alias("default:key", "keys:key")
|
||||
minetest.register_alias("default:skeleton_key", "keys:skeleton_key")
|
28
mods/keys/crafting.lua
Normal file
28
mods/keys/crafting.lua
Normal file
@ -0,0 +1,28 @@
|
||||
--
|
||||
-- Crafting recipes
|
||||
--
|
||||
|
||||
minetest.register_craft({
|
||||
output = "keys:skeleton_key",
|
||||
recipe = {
|
||||
{"default:gold_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
--
|
||||
-- Cooking recipes
|
||||
--
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "default:gold_ingot",
|
||||
recipe = "keys:key",
|
||||
cooktime = 5,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "default:gold_ingot",
|
||||
recipe = "keys:skeleton_key",
|
||||
cooktime = 5,
|
||||
})
|
102
mods/keys/craftitems.lua
Normal file
102
mods/keys/craftitems.lua
Normal file
@ -0,0 +1,102 @@
|
||||
-- Load support for MT game translation.
|
||||
local S = minetest.get_translator("keys")
|
||||
|
||||
--
|
||||
-- Craftitems
|
||||
--
|
||||
|
||||
minetest.register_craftitem("keys:skeleton_key", {
|
||||
description = S("Skeleton Key"),
|
||||
inventory_image = "keys_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("keys: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
|
||||
})
|
||||
|
||||
minetest.register_tool("keys:key", {
|
||||
description = S("Key"),
|
||||
inventory_image = "keys_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
|
||||
})
|
6
mods/keys/init.lua
Normal file
6
mods/keys/init.lua
Normal file
@ -0,0 +1,6 @@
|
||||
-- Minetest mod: keys
|
||||
local keys_path = minetest.get_modpath("keys")
|
||||
|
||||
dofile(keys_path.."/craftitems.lua")
|
||||
dofile(keys_path.."/crafting.lua")
|
||||
dofile(keys_path.."/aliases.lua")
|
52
mods/keys/license.txt
Normal file
52
mods/keys/license.txt
Normal file
@ -0,0 +1,52 @@
|
||||
License of source code
|
||||
----------------------
|
||||
|
||||
GNU Lesser General Public License, version 2.1
|
||||
Copyright (C) 2011-2018 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
Copyright (C) 2011-2018 Various Minetest developers and contributors
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under the terms
|
||||
of the GNU Lesser General Public License as published by the Free Software Foundation;
|
||||
either version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Lesser General Public License for more details:
|
||||
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
|
||||
|
||||
|
||||
Licenses of media (textures, models and sounds)
|
||||
-----------------------------------------------
|
||||
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
Copyright (C) 2010-2018:
|
||||
|
||||
Gambit
|
||||
|
||||
You are free to:
|
||||
Share — copy and redistribute the material in any medium or format.
|
||||
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
|
||||
The licensor cannot revoke these freedoms as long as you follow the license terms.
|
||||
|
||||
Under the following terms:
|
||||
|
||||
Attribution — You must give appropriate credit, provide a link to the license, and
|
||||
indicate if changes were made. You may do so in any reasonable manner, but not in any way
|
||||
that suggests the licensor endorses you or your use.
|
||||
|
||||
ShareAlike — If you remix, transform, or build upon the material, you must distribute
|
||||
your contributions under the same license as the original.
|
||||
|
||||
No additional restrictions — You may not apply legal terms or technological measures that
|
||||
legally restrict others from doing anything the license permits.
|
||||
|
||||
Notices:
|
||||
|
||||
You do not have to comply with the license for elements of the material in the public
|
||||
domain or where your use is permitted by an applicable exception or limitation.
|
||||
No warranties are given. The license may not give you all of the permissions necessary
|
||||
for your intended use. For example, other rights such as publicity, privacy, or moral
|
||||
rights may limit how you use the material.
|
||||
|
||||
For more details:
|
||||
http://creativecommons.org/licenses/by-sa/3.0/
|
5
mods/keys/locale/keys.de.tr
Normal file
5
mods/keys/locale/keys.de.tr
Normal file
@ -0,0 +1,5 @@
|
||||
# textdomain: keys
|
||||
|
||||
Key=Schlüssel
|
||||
Key to @1's @2=Schlüssel für @2 von @1
|
||||
Skeleton Key=Skelettschlüssel
|
5
mods/keys/locale/keys.eo.tr
Normal file
5
mods/keys/locale/keys.eo.tr
Normal file
@ -0,0 +1,5 @@
|
||||
# textdomain: keys
|
||||
|
||||
Key=Ŝlosilo
|
||||
Key to @1's @2=Ŝlosilo por la @2 de @1
|
||||
Skeleton Key=Skeleta Ŝlosilo
|
5
mods/keys/locale/keys.es.tr
Normal file
5
mods/keys/locale/keys.es.tr
Normal file
@ -0,0 +1,5 @@
|
||||
# textdomain: keys
|
||||
|
||||
Key=Llave
|
||||
Key to @1's @2=Llave para @2 de @1
|
||||
Skeleton Key=Llave esqueleto
|
5
mods/keys/locale/keys.fr.tr
Normal file
5
mods/keys/locale/keys.fr.tr
Normal file
@ -0,0 +1,5 @@
|
||||
# textdomain: keys
|
||||
|
||||
Key=Clé
|
||||
Key to @1's @2=Clé pour @2 de @1
|
||||
Skeleton Key=Squelette
|
5
mods/keys/locale/keys.id.tr
Normal file
5
mods/keys/locale/keys.id.tr
Normal file
@ -0,0 +1,5 @@
|
||||
# textdomain: keys
|
||||
|
||||
Key=Kunci
|
||||
Key to @1's @2=Kunci @2 milik @1
|
||||
Skeleton Key=Kunci Induk
|
5
mods/keys/locale/keys.it.tr
Normal file
5
mods/keys/locale/keys.it.tr
Normal file
@ -0,0 +1,5 @@
|
||||
# textdomain: keys
|
||||
|
||||
Key=Chiave
|
||||
Key to @1's @2=Chiave per @2 di @1
|
||||
Skeleton Key=Chiave dello Scheletro
|
5
mods/keys/locale/keys.jbo.tr
Normal file
5
mods/keys/locale/keys.jbo.tr
Normal file
@ -0,0 +1,5 @@
|
||||
# textdomain: keys
|
||||
|
||||
Key=lo ckiku
|
||||
Key to @1's @2=lo ckiku be @2 po la'o zo'i.@1.zo'i
|
||||
Skeleton Key=lo greku ckiku
|
5
mods/keys/locale/keys.ms.tr
Normal file
5
mods/keys/locale/keys.ms.tr
Normal file
@ -0,0 +1,5 @@
|
||||
# textdomain: keys
|
||||
|
||||
Key=Kunci
|
||||
Key to @1's @2=Kunci @2 milik @1
|
||||
Skeleton Key=Kunci Induk
|
5
mods/keys/locale/keys.pt_BR.tr
Normal file
5
mods/keys/locale/keys.pt_BR.tr
Normal file
@ -0,0 +1,5 @@
|
||||
# textdomain: keys
|
||||
|
||||
Key=Chave
|
||||
Key to @1's @2=Chave para @2 de @1
|
||||
Skeleton Key=Chave de Mestra
|
5
mods/keys/locale/keys.ru.tr
Normal file
5
mods/keys/locale/keys.ru.tr
Normal file
@ -0,0 +1,5 @@
|
||||
# textdomain: keys
|
||||
|
||||
Key=Ключ
|
||||
Key to @1's @2=Ключ к @2 от @1
|
||||
Skeleton Key=Ключ Скелета
|
5
mods/keys/locale/keys.se.tr
Normal file
5
mods/keys/locale/keys.se.tr
Normal file
@ -0,0 +1,5 @@
|
||||
# textdomain: keys
|
||||
|
||||
Key=Nyckel
|
||||
Key to @1's @2=Nyckel till @1s @2
|
||||
Skeleton Key=Skelett Nyckel
|
5
mods/keys/locale/keys.zh_CN.tr
Normal file
5
mods/keys/locale/keys.zh_CN.tr
Normal file
@ -0,0 +1,5 @@
|
||||
# textdomain: keys
|
||||
|
||||
Key=钥匙
|
||||
Key to @1's @2=@1的@2的钥匙
|
||||
Skeleton Key=万能钥匙
|
5
mods/keys/locale/keys.zh_TW.tr
Normal file
5
mods/keys/locale/keys.zh_TW.tr
Normal file
@ -0,0 +1,5 @@
|
||||
# textdomain: keys
|
||||
|
||||
Key=鑰匙
|
||||
Key to @1's @2=@1的@2的鑰匙
|
||||
Skeleton Key=萬能鑰匙
|
5
mods/keys/locale/template.txt
Normal file
5
mods/keys/locale/template.txt
Normal file
@ -0,0 +1,5 @@
|
||||
# textdomain: keys
|
||||
|
||||
Key=
|
||||
Key to @1's @2=
|
||||
Skeleton Key=
|
3
mods/keys/mod.conf
Normal file
3
mods/keys/mod.conf
Normal file
@ -0,0 +1,3 @@
|
||||
name = keys
|
||||
description = Minetest Game mod: keys
|
||||
depends = default
|
BIN
mods/keys/textures/keys_key.png
Normal file
BIN
mods/keys/textures/keys_key.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 180 B |
BIN
mods/keys/textures/keys_key_skeleton.png
Normal file
BIN
mods/keys/textures/keys_key_skeleton.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 187 B |
Reference in New Issue
Block a user