2012-07-25 01:36:54 +02:00
|
|
|
-- Minetest: builtin/detached_inventory.lua
|
|
|
|
|
2014-04-28 03:02:48 +02:00
|
|
|
core.detached_inventories = {}
|
2012-07-25 01:36:54 +02:00
|
|
|
|
2024-04-28 00:07:45 +02:00
|
|
|
local create_detached_inventory_raw = core.create_detached_inventory_raw
|
|
|
|
core.create_detached_inventory_raw = nil
|
|
|
|
|
2016-11-26 17:35:25 +01:00
|
|
|
function core.create_detached_inventory(name, callbacks, player_name)
|
2012-07-25 01:36:54 +02:00
|
|
|
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
|
2015-08-12 04:27:54 +02:00
|
|
|
stuff.mod_origin = core.get_current_modname() or "??"
|
2014-04-28 03:02:48 +02:00
|
|
|
core.detached_inventories[name] = stuff
|
2024-04-28 00:07:45 +02:00
|
|
|
return create_detached_inventory_raw(name, player_name)
|
2012-07-25 01:36:54 +02:00
|
|
|
end
|
|
|
|
|
2024-04-28 00:07:45 +02:00
|
|
|
local remove_detached_inventory_raw = core.remove_detached_inventory_raw
|
|
|
|
core.remove_detached_inventory_raw = nil
|
|
|
|
|
2018-10-10 20:48:58 +02:00
|
|
|
function core.remove_detached_inventory(name)
|
|
|
|
core.detached_inventories[name] = nil
|
2024-04-28 00:07:45 +02:00
|
|
|
return remove_detached_inventory_raw(name)
|
2018-10-10 20:48:58 +02:00
|
|
|
end
|