diff options
author | LNJ <git@lnj.li> | 2017-03-28 20:22:28 +0200 |
---|---|---|
committer | LNJ <git@lnj.li> | 2017-03-28 20:22:28 +0200 |
commit | 602abde7f58fb63f5b26520be6025473cd3acd50 (patch) | |
tree | be6b9acf6fc2b38aff587207d18ce085f9704851 /init.lua | |
parent | 1b280c54421ed5a4decc8d9799c2839355eef5f2 (diff) |
Make drawers craftable
The recipe is as in the MC Mod:
W W W
C -> D
W W W
W: Wood; C: Chest; D: Wooden Drawer
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 31 |
1 files changed, 28 insertions, 3 deletions
@@ -1,5 +1,5 @@ --[[ -Minetest Mod Drawers - A Mod adding storage drawers +Minetest Mod Storage Drawers - A Mod adding storage drawers Copyright (C) 2017 LNJ <git@lnj.li> Copyright (C) 2016 Mango Tango <mtango688@gmail.com> @@ -27,6 +27,19 @@ SOFTWARE. drawers = {} +-- TODO: Support other games than MTG/MTG-like (e.g. MineClone2) +local WOOD_SOUNDS +local WOOD_ITEMSTRING +local CHEST_ITEMSTRING +if default then + WOOD_SOUNDS = default.node_sound_wood_defaults() + WOOD_ITEMSTRING = "default:wood" + CHEST_ITEMSTRING = "default:chest" +else + WOOD_ITEMSTRING = "wood" + CHEST_ITEMSTRING = "chest" +end + drawers.node_box_simple = { {-0.5, -0.5, -0.4375, 0.5, 0.5, 0.5}, {-0.5, -0.5, -0.5, -0.4375, 0.5, -0.4375}, @@ -381,11 +394,23 @@ function drawers.register_drawer(name, def) end core.register_node(name, def) + + if (not def.no_craft) and def.material then + core.register_craft({ + output = name, + recipe = { + {def.material, def.material, def.material}, + {"", CHEST_ITEMSTRING, ""}, + {def.material, def.material, def.material} + } + }) + end end drawers.register_drawer("drawers:wood", { description = "Wooden Drawer", groups = {choppy = 3, oddly_breakable_by_hand = 2}, - sounds = default.node_sound_wood_defaults(), - drawer_stack_max_factor = 3 * 8 -- normal chest size + sounds = WOOD_SOUNDS, + drawer_stack_max_factor = 3 * 8, -- normal chest size + material = WOOD_ITEMSTRING }) |