mirror of
https://github.com/minetest-mods/i3.git
synced 2025-07-04 01:20:23 +02:00
Totally rework how bags work + other cool stuff
This commit is contained in:
32
src/detached_inv.lua
Normal file
32
src/detached_inv.lua
Normal file
@ -0,0 +1,32 @@
|
||||
local fmt, play_sound, create_inventory = i3.get("fmt", "play_sound", "create_inventory")
|
||||
|
||||
local trash = create_inventory("i3_trash", {
|
||||
allow_put = function(_, _, _, stack)
|
||||
return stack:get_count()
|
||||
end,
|
||||
|
||||
on_put = function(inv, listname, _, _, player)
|
||||
inv:set_list(listname, {})
|
||||
|
||||
local name = player:get_player_name()
|
||||
play_sound(name, "i3_trash", 1.0)
|
||||
|
||||
if not core.is_creative_enabled(name) then
|
||||
i3.set_fs(player)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
trash:set_size("main", 1)
|
||||
|
||||
local function init_inventories(player)
|
||||
local name = player:get_player_name()
|
||||
|
||||
local output_rcp = create_inventory(fmt("i3_output_rcp_%s", name), {}, name)
|
||||
output_rcp:set_size("main", 1)
|
||||
|
||||
local output_usg = create_inventory(fmt("i3_output_usg_%s", name), {}, name)
|
||||
output_usg:set_size("main", 1)
|
||||
end
|
||||
|
||||
return init_inventories
|
Reference in New Issue
Block a user