mirror of
https://github.com/minetest/minetest.git
synced 2024-12-17 19:55:41 +01:00
c38985825f
This combats the problem of sending the hundreds of "creative" / "armor" or whatever detached invs that exist on popular servers to each and every player on join or on change of said invs.
21 lines
601 B
Lua
21 lines
601 B
Lua
-- Minetest: builtin/detached_inventory.lua
|
|
|
|
core.detached_inventories = {}
|
|
|
|
function core.create_detached_inventory(name, callbacks, player_name)
|
|
local stuff = {}
|
|
stuff.name = name
|
|
if callbacks then
|
|
stuff.allow_move = callbacks.allow_move
|
|
stuff.allow_put = callbacks.allow_put
|
|
stuff.allow_take = callbacks.allow_take
|
|
stuff.on_move = callbacks.on_move
|
|
stuff.on_put = callbacks.on_put
|
|
stuff.on_take = callbacks.on_take
|
|
end
|
|
stuff.mod_origin = core.get_current_modname() or "??"
|
|
core.detached_inventories[name] = stuff
|
|
return core.create_detached_inventory_raw(name, player_name)
|
|
end
|
|
|