2017-03-26 16:17:48 +02:00
|
|
|
--[[
|
2017-03-28 20:22:28 +02:00
|
|
|
Minetest Mod Storage Drawers - A Mod adding storage drawers
|
2017-03-26 16:17:48 +02:00
|
|
|
|
|
|
|
Copyright (C) 2017 LNJ <git@lnj.li>
|
|
|
|
|
|
|
|
MIT License
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
|
|
copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
SOFTWARE.
|
|
|
|
]]
|
|
|
|
|
|
|
|
drawers = {}
|
2017-04-01 19:13:09 +02:00
|
|
|
drawers.drawer_visuals = {}
|
2017-03-26 16:17:48 +02:00
|
|
|
|
2017-03-28 20:22:28 +02:00
|
|
|
if default then
|
2017-04-01 16:28:03 +02:00
|
|
|
drawers.WOOD_SOUNDS = default.node_sound_wood_defaults()
|
2017-04-03 13:05:36 +02:00
|
|
|
drawers.WOOD_ITEMSTRING = "group:wood"
|
2017-04-01 16:28:03 +02:00
|
|
|
drawers.CHEST_ITEMSTRING = "default:chest"
|
2017-03-29 19:12:55 +02:00
|
|
|
elseif mcl_core then -- MineClone 2
|
2017-04-03 13:05:36 +02:00
|
|
|
drawers.WOOD_ITEMSTRING = "group:wood"
|
2017-04-01 16:28:03 +02:00
|
|
|
drawers.CHEST_ITEMSTRING = "mcl_chests:chest"
|
2017-03-29 19:12:55 +02:00
|
|
|
if mcl_sounds then
|
2017-04-01 16:28:03 +02:00
|
|
|
drawers.WOOD_SOUNDS = mcl_sounds.node_sound_wood_defaults()
|
2017-03-29 19:12:55 +02:00
|
|
|
end
|
2017-03-28 20:22:28 +02:00
|
|
|
else
|
2017-04-01 16:28:03 +02:00
|
|
|
drawers.WOOD_ITEMSTRING = "wood"
|
|
|
|
drawers.CHEST_ITEMSTRING = "chest"
|
2017-03-28 20:22:28 +02:00
|
|
|
end
|
|
|
|
|
2017-03-28 21:48:37 +02:00
|
|
|
|
2017-04-09 22:31:31 +02:00
|
|
|
drawers.enable_1x1 = not core.setting_getbool("drawers_disable_1x1")
|
|
|
|
drawers.enable_1x2 = not core.setting_getbool("drawers_disable_1x2")
|
|
|
|
drawers.enable_2x2 = not core.setting_getbool("drawers_disable_2x2")
|
|
|
|
|
2017-04-01 16:28:03 +02:00
|
|
|
--
|
|
|
|
-- Load files
|
|
|
|
--
|
2017-03-26 16:17:48 +02:00
|
|
|
|
2017-04-01 16:28:03 +02:00
|
|
|
local modpath = core.get_modpath("drawers")
|
|
|
|
dofile(modpath .. "/lua/helpers.lua")
|
|
|
|
dofile(modpath .. "/lua/visual.lua")
|
|
|
|
dofile(modpath .. "/lua/api.lua")
|
2017-03-26 16:17:48 +02:00
|
|
|
|
|
|
|
|
2017-04-01 16:28:03 +02:00
|
|
|
--
|
|
|
|
-- Register drawers
|
|
|
|
--
|
2017-03-26 16:17:48 +02:00
|
|
|
|
|
|
|
drawers.register_drawer("drawers:wood", {
|
2017-04-05 13:29:00 +02:00
|
|
|
description = "Wooden",
|
2017-04-02 21:29:32 +02:00
|
|
|
tiles1 = {"drawers_wood.png", "drawers_wood.png", "drawers_wood.png",
|
|
|
|
"drawers_wood.png", "drawers_wood.png", "drawers_wood_front_1.png"},
|
2017-04-05 14:52:34 +02:00
|
|
|
tiles2 = {"drawers_wood.png", "drawers_wood.png", "drawers_wood.png",
|
|
|
|
"drawers_wood.png", "drawers_wood.png", "drawers_wood_front_2.png"},
|
2017-04-02 21:29:32 +02:00
|
|
|
tiles4 = {"drawers_wood.png", "drawers_wood.png", "drawers_wood.png",
|
|
|
|
"drawers_wood.png", "drawers_wood.png", "drawers_wood_front_4.png"},
|
2017-03-26 20:58:55 +02:00
|
|
|
groups = {choppy = 3, oddly_breakable_by_hand = 2},
|
2017-04-01 17:21:50 +02:00
|
|
|
sounds = drawers.WOOD_SOUNDS,
|
2017-03-28 20:22:28 +02:00
|
|
|
drawer_stack_max_factor = 3 * 8, -- normal chest size
|
2017-04-01 17:21:50 +02:00
|
|
|
material = drawers.WOOD_ITEMSTRING
|
2017-03-26 16:17:48 +02:00
|
|
|
})
|