forked from minetest/minetest_game
e4b1c93512
This code adds the key concept to minetest_game, and integrates it with lockable nodes. Currently supported lockable items are the Steel Door, the Steel Trapdoor, and the Locked Chest. The goal of this modification is to introduce a fine-grained multi- player permission system that is intuitive and usable without any console or chat commands, and doesn't require extra privileges to be granted or setup. Keys can also physically be conveyed to other players, adding to gameplay and adding some personality that is preferable to console commands or editing formspecs. A skeleton key can be crafted with 1 gold ingot. Skeleton keys can then be matched to a lockable node by right-clicking the skeleton key on a lockable node, which changes the skeleton key to a "key". Gold was chosen as it's currently a not-so very useful item, and therefore it's likely that players have some, but aren't really using it for any purpose. This key can subsequently used by any player to open or access that lockable node, including retrieving items from Locked Chests, or putting items in them. They key is programmed to fit only the particular locked node it is programmed to. This is achieved by storing a secret value in both key and locked node. If this secret value doesn't match, the key will not open the locked node. This allows many keys to be created for one chest or door, but a key will only fit one node ever. The secrets are stored in node, and item meta for the key. If a locked node is removed, all keys that opened it are no longer valid. Even if a new door/chest is placed in exactly the same spot, the old keys will no longer fit that node. Keys can be smelted back in gold ingots if they are no longer useful. The method of storing a secret in nodemeta and itemstackmeta is secure as there is no way for the client to create new items on the server with a particular secret metadata value. Even if you could possible create such an itemstack on the client, the server does not ever read itemstackmeta from a client package. The patch adds an API that allows other nodes and nodes added by mods to use the same keys as well. The method how to implement this is described in game_api.txt. The mod should add 2 callbacks to it's node definition. Example code is given. Textures are from PixelBOX, thanks to Gambit. |
||
---|---|---|
.. | ||
models | ||
sounds | ||
textures | ||
depends.txt | ||
init.lua | ||
license.txt | ||
README.txt |
Minetest Game mod: doors ======================== See license.txt for license information. Authors of source code ---------------------- Originally by PilzAdam (MIT) Modified by BlockMen (MIT): Added sounds, glass doors (glass, obsidian glass) and trapdoor. Modified by sofar (sofar@foo-projects.org) (MIT): Added Steel trapdoor. Re-implemented most of the door algorithms, added meshes, UV wrapped texture. Added doors API to facilitate coding mods accessing and operating doors. Added Fence Gate model, code, and sounds. Various Minetest developers and contributors (MIT) Authors of media (textures) --------------------------- Following textures created by Fernando Zapata (CC BY-SA 3.0): door_wood.png door_wood_a.png door_wood_a_r.png door_wood_b.png door_wood_b_r.png Following textures created by BlockMen (CC BY-SA 3.0): door_trapdoor.png door_obsidian_glass_side.png Following textures created by celeron55 (CC BY-SA 3.0): door_glass_a.png door_glass_b.png Following textures created by PenguinDad (CC BY-SA 4.0): door_glass.png door_obsidian_glass.png Following textures created by sofar (CC-BY-SA-3.0): doors_trapdoor_steel.png doors_trapdoor_steel_side.png door_trapdoor_side.png Obsidian door textures by red-001 based on textures by Pilzadam and BlockMen (CC BY-SA 3.0): door_obsidian_glass.png Glass door textures by red-001 based on textures by celeron55 (CC BY-SA 3.0): door_glass.png All other textures (created by PilzAdam) (CC BY-SA 3.0): Door textures were converted to the new texture map by sofar, paramat and red-001, under the same license as the originals. Authors of media (models) ------------------------- Door 3d models by sofar (CC-BY-SA-3.0) - door_a.obj - door_b.obj Fence gate models by sofar (CC-BY-SA-3.0) - fencegate_open.obj - fencegate_closed.obj Authors of media (sounds) ------------------------- Opening-Sound created by CGEffex (CC BY 3.0), modified by BlockMen door_open.ogg Closing-Sound created by bennstir (CC BY 3.0) door_close.ogg fencegate_open.ogg: http://www.freesound.org/people/mhtaylor67/sounds/126041/ - (CC0 1.0) fencegate_close.ogg: http://www.freesound.org/people/BarkersPinhead/sounds/274807/ - (CC-BY-3.0) http://www.freesound.org/people/rivernile7/sounds/249573/ - (CC-BY-3.0) Steel door sounds open & close (CC-BY-3.0) by HazMatt - http://www.freesound.org/people/HazMattt/sounds/187283/ doors_steel_door_open.ogg doors_steel_door_close.ogg doors_glass_door_open.ogg, doors_glass_door_close.ogg: https://www.freesound.org/people/SkeetMasterFunk69/sounds/235546/ (CC0 1.0)