juanchi/mods/minetest_game/sfinv/init.lua

36 lines
1.1 KiB
Lua

-- sfinv/init.lua
dofile(minetest.get_modpath("sfinv") .. "/api.lua")
-- Load support for MT game translation.
local S = minetest.get_translator("sfinv")
-- Create the trash field
local trash = minetest.create_detached_inventory("creative_trash", {
-- Allow the stack to be placed and remove it in on_put()
-- This allows the creative inventory to restore the stack
allow_put = function(inv, listname, index, stack, player)
return stack:get_count()
end,
on_put = function(inv, listname)
inv:set_list(listname, {})
end,
})
trash:set_size("main", 1)
sfinv.register_page("sfinv:crafting", {
title = S("Crafting"),
get = function(self, player, context)
return sfinv.make_formspec(player, context, [[
list[current_player;craft;1.75,0.5;3,3;]
list[current_player;craftpreview;5.75,1.5;1,1;]
image[4.75,1.5;1,1;sfinv_crafting_arrow.png]
image[3.58,4;0.8,0.8;creative_trash_icon.png]
listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]
list[detached:creative_trash;main;3.52,3.9;1,1;]
listring[current_player;main]
listring[current_player;craft]
]], true)
end
})