i3/src/detached_inv.lua

34 lines
776 B
Lua
Raw Normal View History

2021-11-15 23:50:48 +01:00
local set_fs = i3.set_fs
2021-11-29 19:15:14 +01:00
IMPORT("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
2021-11-15 23:50:48 +01:00
set_fs(player)
end
end,
})
trash:set_size("main", 1)
2021-11-26 04:58:57 +01:00
local function init_detached(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
2021-11-26 04:58:57 +01:00
return init_detached