deprecated.lua 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. -- Minetest: builtin/deprecated.lua
  2. --
  3. -- Default material types
  4. --
  5. function digprop_err()
  6. core.log("info", debug.traceback())
  7. core.log("info", "WARNING: The core.digprop_* functions are obsolete and need to be replaced by item groups.")
  8. end
  9. core.digprop_constanttime = digprop_err
  10. core.digprop_stonelike = digprop_err
  11. core.digprop_dirtlike = digprop_err
  12. core.digprop_gravellike = digprop_err
  13. core.digprop_woodlike = digprop_err
  14. core.digprop_leaveslike = digprop_err
  15. core.digprop_glasslike = digprop_err
  16. core.node_metadata_inventory_move_allow_all = function()
  17. core.log("info", "WARNING: core.node_metadata_inventory_move_allow_all is obsolete and does nothing.")
  18. end
  19. core.add_to_creative_inventory = function(itemstring)
  20. core.log('info', "WARNING: core.add_to_creative_inventory: This function is deprecated and does nothing.")
  21. end
  22. --
  23. -- EnvRef
  24. --
  25. core.env = {}
  26. local envref_deprecation_message_printed = false
  27. setmetatable(core.env, {
  28. __index = function(table, key)
  29. if not envref_deprecation_message_printed then
  30. core.log("info", "WARNING: core.env:[...] is deprecated and should be replaced with core.[...]")
  31. envref_deprecation_message_printed = true
  32. end
  33. local func = core[key]
  34. if type(func) == "function" then
  35. rawset(table, key, function(self, ...)
  36. return func(...)
  37. end)
  38. else
  39. rawset(table, key, nil)
  40. end
  41. return rawget(table, key)
  42. end
  43. })
  44. function core.rollback_get_last_node_actor(pos, range, seconds)
  45. return core.rollback_get_node_actions(pos, range, seconds, 1)[1]
  46. end