mirror of
https://github.com/minetest-mods/more_chests.git
synced 2024-11-14 22:30:33 +01:00
74b3c5a25d
* Aliases moved to utils folder * Method to generate two different formspec layouts, big and small * Log Actions moved to separate module * Added method to generate a chest definition * Rewritten models * Add Fridge model * Add Toolbox models * "Mod loaded" message; Updated localization template * Add Italian localization * Fridge now has both normal and big (2 blocks) models * Fixed mixed indentation * Rewritten README; improved IT and FR (thanks to @louisroyer) localizations.
46 lines
1.3 KiB
Lua
46 lines
1.3 KiB
Lua
local gen_def = dofile(minetest.get_modpath("more_chests") .. "/utils/base.lua")
|
|
local actions = dofile(minetest.get_modpath("more_chests") .. "/utils/actions.lua")
|
|
local S = minetest.get_translator("more_chests")
|
|
|
|
local dropbox = gen_def({
|
|
description = S("Dropbox"),
|
|
type = "dropbox",
|
|
size = "small",
|
|
tiles = {
|
|
top = "dropbox_top.png",
|
|
side = "dropbox_side.png",
|
|
front = "dropbox_front.png"
|
|
},
|
|
pipeworks_enabled = true,
|
|
recipe = {
|
|
{"group:wood", "", "group:wood"},
|
|
{"group:wood", "default:steel_ingot", "group:wood"},
|
|
{"group:wood", "group:wood", "group:wood"}
|
|
},
|
|
allow_metadata_inventory_move = false,
|
|
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
|
local meta = minetest.get_meta(pos)
|
|
if actions.has_locked_chest_privilege(meta, player) then
|
|
return stack:get_count()
|
|
end
|
|
local target = meta:get_inventory():get_list(listname)[index]
|
|
local target_name = target:get_name()
|
|
local stack_count = stack:get_count()
|
|
if target_name == stack:get_name()
|
|
and target:get_count() < stack_count then
|
|
return stack_count
|
|
end
|
|
if target_name ~= "" then
|
|
return 0
|
|
end
|
|
return stack_count
|
|
end
|
|
})
|
|
|
|
|
|
minetest.register_node("more_chests:dropbox", dropbox)
|
|
minetest.register_craft({
|
|
output = "more_chests:dropbox",
|
|
recipe = dropbox.recipe,
|
|
})
|