2016-05-24 22:34:56 +02:00
|
|
|
minercantile = {}
|
2016-06-11 15:49:49 +02:00
|
|
|
minetest.register_privilege("shop", "Can place|dig|configure shop")
|
2016-05-24 22:34:56 +02:00
|
|
|
--path
|
|
|
|
minercantile.path = minetest.get_worldpath()
|
|
|
|
minercantile.path_wallet = minercantile.path.. "/minercantile_wallet/"
|
|
|
|
minercantile.file_stock_base = minercantile.path.."/minercantile_stock_base.txt"
|
|
|
|
minercantile.file_stock = minercantile.path.."/minercantile_stock.txt"
|
|
|
|
minetest.mkdir(minercantile.path_wallet)
|
|
|
|
|
|
|
|
--items
|
|
|
|
minercantile.stock_base = {}
|
|
|
|
minercantile.stock = {} -- table saved money, items list
|
|
|
|
minercantile.shop = {}
|
|
|
|
minercantile.shop.items_inventory = {}
|
|
|
|
minercantile.stock.items = {}
|
2016-06-10 19:16:33 +02:00
|
|
|
minercantile.stock.money = 8000
|
2016-06-09 21:50:54 +02:00
|
|
|
minercantile.stock.transac_b = 0
|
|
|
|
minercantile.stock.transac_s = 0
|
2016-05-24 22:34:56 +02:00
|
|
|
|
|
|
|
--functions specific to wallet
|
|
|
|
minercantile.wallet = {}
|
|
|
|
-- table players wallets
|
|
|
|
minercantile.wallets = {}
|
2016-06-04 22:55:24 +02:00
|
|
|
|
2016-05-24 22:34:56 +02:00
|
|
|
--load money
|
|
|
|
dofile(minetest.get_modpath("minercantile") .. "/wallets.lua")
|
|
|
|
dofile(minetest.get_modpath("minercantile") .. "/change.lua")
|
2016-06-06 02:02:27 +02:00
|
|
|
dofile(minetest.get_modpath("minercantile") .. "/shop.lua")
|
2016-06-04 22:55:24 +02:00
|
|
|
|
2016-05-24 22:34:56 +02:00
|
|
|
|
|
|
|
--load items base and available
|
|
|
|
minercantile.load_stock_base()
|
2016-06-06 02:02:27 +02:00
|
|
|
minetest.after(1, function()
|
|
|
|
minercantile.shop.register_items()
|
|
|
|
minercantile.load_stock()
|
|
|
|
end
|
|
|
|
)
|
2016-06-10 19:16:33 +02:00
|
|
|
|
2016-05-24 22:34:56 +02:00
|
|
|
minetest.log("action", "[minercantile] Loaded")
|