2
0

deprecated.lua 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. -- Minetest: builtin/deprecated.lua
  2. --
  3. -- Default material types
  4. --
  5. local function digprop_err()
  6. core.log("deprecated", "The core.digprop_* functions are obsolete and need to be replaced by item groups.")
  7. end
  8. core.digprop_constanttime = digprop_err
  9. core.digprop_stonelike = digprop_err
  10. core.digprop_dirtlike = digprop_err
  11. core.digprop_gravellike = digprop_err
  12. core.digprop_woodlike = digprop_err
  13. core.digprop_leaveslike = digprop_err
  14. core.digprop_glasslike = digprop_err
  15. function core.node_metadata_inventory_move_allow_all()
  16. core.log("deprecated", "core.node_metadata_inventory_move_allow_all is obsolete and does nothing.")
  17. end
  18. function core.add_to_creative_inventory(itemstring)
  19. core.log("deprecated", "core.add_to_creative_inventory: This function is deprecated and does nothing.")
  20. end
  21. --
  22. -- EnvRef
  23. --
  24. core.env = {}
  25. local envref_deprecation_message_printed = false
  26. setmetatable(core.env, {
  27. __index = function(table, key)
  28. if not envref_deprecation_message_printed then
  29. core.log("deprecated", "core.env:[...] is deprecated and should be replaced with core.[...]")
  30. envref_deprecation_message_printed = true
  31. end
  32. local func = core[key]
  33. if type(func) == "function" then
  34. rawset(table, key, function(self, ...)
  35. return func(...)
  36. end)
  37. else
  38. rawset(table, key, nil)
  39. end
  40. return rawget(table, key)
  41. end
  42. })
  43. function core.rollback_get_last_node_actor(pos, range, seconds)
  44. return core.rollback_get_node_actions(pos, range, seconds, 1)[1]
  45. end
  46. --
  47. -- core.setting_*
  48. --
  49. local settings = core.settings
  50. local function setting_proxy(name)
  51. return function(...)
  52. core.log("deprecated", "WARNING: minetest.setting_* "..
  53. "functions are deprecated. "..
  54. "Use methods on the minetest.settings object.")
  55. return settings[name](settings, ...)
  56. end
  57. end
  58. core.setting_set = setting_proxy("set")
  59. core.setting_get = setting_proxy("get")
  60. core.setting_setbool = setting_proxy("set_bool")
  61. core.setting_getbool = setting_proxy("get_bool")
  62. core.setting_save = setting_proxy("write")