diff --git a/README.md b/README.md index 5c95025..916926c 100644 --- a/README.md +++ b/README.md @@ -37,10 +37,16 @@ It adds various types of money, exchange table, Dispensing Machines, Strongbox i * /csb **Settings:** - * Change the file **'[config.lua](https://github.com/Lunovox/minertrade/blob/master/config.lua)'** to change the initial settings of the mod, such as: - * Path of Database - * Delay of Install Strongbox and ATM, - * Size of inventory of Strongbox and ATM, + +In **minetest.conf** file: + +You don't need to do any of these presets mentioned below to make this mod work. But it's worth knowing the configuration values ​​in case you want to directly change the ````minetest.conf```` file. + +* ````minertrade.save_compressed = ```` : If enabled will save database bank in file '.db64', else in file '.tbl'. Default: ````true```` +* ````minertrade.salary.enabled = ```` : Allows for daily distribution of Salary. Default: ````true```` +* ````minertrade.salary.value = ```` : Specifies the amount of salary paid daily. Default: ````9```` +* ````minertrade.salary.intervalcheck = ```` : Specifies how many seconds the salary will be checked who still has to receive. Values below 5 can cause server lag. Default: ````60```` + **Translate to Others Languages:** diff --git a/config.lua b/config.lua index e69de29..e4728f3 100644 --- a/config.lua +++ b/config.lua @@ -0,0 +1,23 @@ +modMinerTrade = { + modName = minetest.get_current_modname(), + modPath = minetest.get_modpath(minetest.get_current_modname()), + save_compressed = (minetest.settings:get("minertrade.save_compressed") ~= "false"), + delayConstruct = 300, + bank = { + accounts = 0, + last_pay = 0, + player = { }, + }, + salary = { + enabled = function() + local isEnabled = minetest.settings:get("minertrade.salary.enabled") + if isEnabled == nil or (isEnabled ~= "true" and isEnabled ~= "false") then + isEnabled = true + minetest.settings:set_bool("minertrade.salary.enabled", isEnabled) + end + return isEnabled + end, + value = tonumber(minetest.settings:get("minertrade.salary.value") or 1), + intervalcheck = tonumber(minetest.settings:get("minertrade.salary.intervalcheck") or 60), + } +} diff --git a/init.lua b/init.lua index 9579d0d..c3f3e91 100644 --- a/init.lua +++ b/init.lua @@ -1,33 +1,18 @@ -modMinerTrade = { - modName = minetest.get_current_modname(), - modPath = minetest.get_modpath(minetest.get_current_modname()), - save_compressed = (minetest.settings:get("minertrade.save_compressed") ~= "false"), - delayConstruct = 300, - bank = { - accounts = 0, - last_pay = 0, - player = { }, - }, - salary = { - enabled = (minetest.settings:get("minertrade.salary.enabled") ~= "false"), - value = tonumber(minetest.settings:get("minertrade.salary.value") or 1), - intervalcheck = tonumber(minetest.settings:get("minertrade.salary.intervalcheck") or 1), - } -} +local modPath = minetest.get_modpath(minetest.get_current_modname()) ---dofile(modMinerTrade.modPath.."/config.lua") -- <== Antes de carregar tudo! -dofile(modMinerTrade.modPath.."/translate.lua") -- <== Antes de 'api.lua'! -dofile(modMinerTrade.modPath.."/api.lua") -dofile(modMinerTrade.modPath.."/item_exchange_table.lua") -dofile(modMinerTrade.modPath.."/item_dispensing_machine.lua") +dofile(modPath.."/config.lua") -- <== Antes de carregar tudo! +dofile(modPath.."/translate.lua") -- <== Antes de 'api.lua'! +dofile(modPath.."/api.lua") +dofile(modPath.."/item_exchange_table.lua") +dofile(modPath.."/item_dispensing_machine.lua") -dofile(modMinerTrade.modPath.."/item_atm.lua") ---dofile(modMinerTrade.modPath.."/item_strongbox.lua") ---dofile(modMinerTrade.modPath.."/item_strongbox_old.lua") -dofile(modMinerTrade.modPath.."/item_minercash.lua") +dofile(modPath.."/item_atm.lua") +--dofile(modPath.."/item_strongbox.lua") +--dofile(modPath.."/item_strongbox_old.lua") +dofile(modPath.."/item_minercash.lua") --dofile(path.."/item_rent_door.lua") -dofile(modMinerTrade.modPath.."/api_payday.lua") ---dofile(modMinerTrade.modPath.."/commands.lua") +dofile(modPath.."/api_payday.lua") +--dofile(modPath.."/commands.lua") --if modMinerTrade.doBankLoad ~= nil then modMinerTrade.doBankLoad()