You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
2.0KB

  1. --
  2. -- money3
  3. --
  4. -- Copyright © 2012 Bad_Command
  5. -- Copyright © 2012 kotolegokot
  6. -- Copyright © 2019 by luk3yx
  7. --
  8. -- This library is free software; you can redistribute it and/or
  9. -- modify it under the terms of the GNU Lesser General Public
  10. -- License as published by the Free Software Foundation; either
  11. -- version 2.1 of the License, or (at your option) any later version.
  12. --
  13. -- This program is distributed in the hope that it will be useful,
  14. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. -- GNU General Public License for more details.
  17. --
  18. -- You should have received a copy of the GNU Lesser General Public
  19. -- License along with this library; if not, write to the Free Software
  20. -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. --
  22. money3 = {}
  23. money3.version = 2.5
  24. local modpath = assert(minetest.get_modpath("money3",
  25. "Please call this mod money3."))
  26. dofile(modpath .. "/config.lua")
  27. assert(not minetest.get_modpath("money2"), "money3 and money2 do not mix.")
  28. local storage = minetest.get_mod_storage()
  29. loadfile(modpath .. "/core.lua")(storage)
  30. -- Only load convertval.lua if required.
  31. if next(money3.convert_items) then
  32. loadfile(modpath .. "/convertval.lua")(storage)
  33. end
  34. -- Load income
  35. if money3.enable_income then
  36. dofile(modpath .. "/income.lua")
  37. end
  38. -- Make sure the lurkcoin mod knows that money3 exists
  39. if minetest.get_modpath("lurkcoin") then
  40. lurkcoin.change_bank({
  41. user_exists = money3.user_exists,
  42. getbal = money3.get,
  43. setbal = function(name, ...)
  44. if money3.user_exists(name) then
  45. money3.set(name, ...)
  46. return true
  47. end
  48. return false
  49. end,
  50. pay = function(from, to, amount)
  51. local err = money.transfer(from, to, amount)
  52. return not err, err
  53. end
  54. })
  55. end
  56. -- Backwards compatibility
  57. rawset(_G, "money", money3)
  58. -- I couldn't be bothered to update lockedsign.lua
  59. if minetest.get_modpath("locked_sign") then
  60. dofile(modpath .. "/lockedsign.lua")
  61. end