detached_inventory.lua 575 B

1234567891011121314151617181920
  1. -- Minetest: builtin/detached_inventory.lua
  2. core.detached_inventories = {}
  3. function core.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. stuff.mod_origin = core.get_current_modname() or "??"
  15. core.detached_inventories[name] = stuff
  16. return core.create_detached_inventory_raw(name)
  17. end