detached_inventory.lua 536 B

12345678910111213141516171819
  1. -- Minetest: builtin/detached_inventory.lua
  2. minetest.detached_inventories = {}
  3. function minetest.create_detached_inventory(name, callbacks)
  4. local stuff = {}
  5. stuff.name = name
  6. if callbacks then
  7. stuff.allow_move = callbacks.allow_move
  8. stuff.allow_put = callbacks.allow_put
  9. stuff.allow_take = callbacks.allow_take
  10. stuff.on_move = callbacks.on_move
  11. stuff.on_put = callbacks.on_put
  12. stuff.on_take = callbacks.on_take
  13. end
  14. minetest.detached_inventories[name] = stuff
  15. return minetest.create_detached_inventory_raw(name)
  16. end