A Minetest trading mod by crabman, under the original idea of Cyberpangolin.
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.

44 lines
1.3KB

  1. minercantile = {}
  2. minetest.register_privilege("shop", "Can place|dig|configure shop")
  3. --path
  4. minercantile.path = minetest.get_worldpath()
  5. minercantile.path_wallet = minercantile.path.. "/minercantile_wallet/"
  6. minercantile.file_stock_base = minercantile.path.."/minercantile_stock_base.txt"
  7. minercantile.file_stock = minercantile.path.."/minercantile_stock.txt"
  8. minetest.mkdir(minercantile.path_wallet)
  9. --items
  10. minercantile.shop = {}
  11. minercantile.shop.items_inventory = {}
  12. minercantile.shop.items_whitelist = {}
  13. --stock items
  14. minercantile.stock_base = {}
  15. minercantile.stock = {} -- table saved money, items list
  16. minercantile.stock.items = {}
  17. minercantile.stock.money = 1000000
  18. minercantile.stock.transac_b = 0
  19. minercantile.stock.transac_s = 0
  20. --functions specific to wallet
  21. minercantile.wallet = {}
  22. -- table players wallets
  23. minercantile.wallets = {}
  24. --load money
  25. dofile(minetest.get_modpath("minercantile") .. "/whitelist.lua")
  26. dofile(minetest.get_modpath("minercantile") .. "/wallets.lua")
  27. dofile(minetest.get_modpath("minercantile") .. "/change.lua")
  28. dofile(minetest.get_modpath("minercantile") .. "/shop.lua")
  29. --load items base and available
  30. minercantile.load_stock_base()
  31. minetest.after(10, function()
  32. minercantile.shop.register_items()
  33. minercantile.load_stock()
  34. end
  35. )
  36. minetest.log("action", "[minercantile] Loaded")