mirror of
https://gitlab.com/lunovox/minertrade.git
synced 2025-03-15 05:31:20 +00:00
This commit is contained in:
parent
fa5dde2b28
commit
a086a2da7f
5 changed files with 52 additions and 13 deletions
|
@ -42,7 +42,9 @@ 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.
|
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.debug = <boolean>```` : If show debug info of this mod. Only util to developers. Default: ````false````
|
||||||
* ````minertrade.save_compressed = <boolean>```` : If enabled will save database bank in file '.db64', else in file '.tbl'. Default: ````true````
|
* ````minertrade.save_compressed = <boolean>```` : If enabled will save database bank in file '.db64', else in file '.tbl'. Default: ````true````
|
||||||
|
* ````minertrade.bank.max_statements = <number>```` : Specifies the amount statement records to each player in databade bank. Default: ````30````; Min: ````1````, Max: ````300````.
|
||||||
* ````minertrade.salary.enabled = <boolean>```` : Allows for daily distribution of Salary. Default: ````true````
|
* ````minertrade.salary.enabled = <boolean>```` : Allows for daily distribution of Salary. Default: ````true````
|
||||||
* ````minertrade.salary.value = <number>```` : Specifies the amount of salary paid daily. Default: ````9````
|
* ````minertrade.salary.value = <number>```` : Specifies the amount of salary paid daily. Default: ````9````
|
||||||
* ````minertrade.salary.intervalcheck = <number>```` : Specifies how many seconds the salary will be checked who still has to receive. Values below 5 can cause server lag. Default: ````60````
|
* ````minertrade.salary.intervalcheck = <number>```` : Specifies how many seconds the salary will be checked who still has to receive. Values below 5 can cause server lag. Default: ````60````
|
||||||
|
|
|
@ -4,11 +4,11 @@ minetest.register_privilege("salary", {
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.after(3.5, function()
|
minetest.after(3.5, function()
|
||||||
if modMinerTrade.salary.enabled then
|
if modMinerTrade.salary.isEnabled() then
|
||||||
modMinerTrade.salary.timer = 0
|
modMinerTrade.salary.timer = 0
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
modMinerTrade.salary.timer = modMinerTrade.salary.timer + dtime
|
modMinerTrade.salary.timer = modMinerTrade.salary.timer + dtime
|
||||||
if modMinerTrade.salary.timer >= modMinerTrade.salary.intervalcheck then
|
if modMinerTrade.salary.timer >= modMinerTrade.salary.getIntervalCheck() then
|
||||||
modMinerTrade.salary.timer = 0
|
modMinerTrade.salary.timer = 0
|
||||||
local players = minetest.get_connected_players()
|
local players = minetest.get_connected_players()
|
||||||
if #players >= 1 then
|
if #players >= 1 then
|
||||||
|
@ -31,7 +31,7 @@ minetest.after(3.5, function()
|
||||||
)
|
)
|
||||||
--]]
|
--]]
|
||||||
if modMinerTrade.isExistAcount(playername) then
|
if modMinerTrade.isExistAcount(playername) then
|
||||||
local value = modMinerTrade.salary.value
|
local value = modMinerTrade.salary.getValue()
|
||||||
local description = modMinerTrade.translate("The city hall deposited the %2d° salary in your bank account!"):format(minetest.get_day_count())
|
local description = modMinerTrade.translate("The city hall deposited the %2d° salary in your bank account!"):format(minetest.get_day_count())
|
||||||
modMinerTrade.addBalance(playername, value)
|
modMinerTrade.addBalance(playername, value)
|
||||||
modMinerTrade.addStatement(playername, value, description)
|
modMinerTrade.addStatement(playername, value, description)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
--[[
|
||||||
minetest.register_privilege("checkstrongbox", {
|
minetest.register_privilege("checkstrongbox", {
|
||||||
description=modMinerTrade.translate("Lets you check the contents of another players strongbox."),
|
description=modMinerTrade.translate("Lets you check the contents of another players strongbox."),
|
||||||
give_to_singleplayer=false,
|
give_to_singleplayer=false,
|
||||||
|
@ -44,6 +45,8 @@ end
|
||||||
|
|
||||||
minetest.register_chatcommand(modMinerTrade.translate("checkstrongbox"), modMinerTrade.propCheckStrongBox())
|
minetest.register_chatcommand(modMinerTrade.translate("checkstrongbox"), modMinerTrade.propCheckStrongBox())
|
||||||
minetest.register_chatcommand("csb", modMinerTrade.propCheckStrongBox())
|
minetest.register_chatcommand("csb", modMinerTrade.propCheckStrongBox())
|
||||||
|
--]]
|
||||||
|
|
||||||
|
|
||||||
--###############################################################################################################
|
--###############################################################################################################
|
||||||
|
|
||||||
|
|
50
config.lua
50
config.lua
|
@ -9,15 +9,49 @@ modMinerTrade = {
|
||||||
player = { },
|
player = { },
|
||||||
},
|
},
|
||||||
salary = {
|
salary = {
|
||||||
enabled = function()
|
isEnabled = function()
|
||||||
local isEnabled = minetest.settings:get("minertrade.salary.enabled")
|
if modMinerTrade.salary.enabled == nil then
|
||||||
if isEnabled == nil or (isEnabled ~= "true" and isEnabled ~= "false") then
|
modMinerTrade.salary.enabled = minetest.settings:get("minertrade.salary.enabled")
|
||||||
isEnabled = true
|
if modMinerTrade.salary.enabled == nil
|
||||||
minetest.settings:set_bool("minertrade.salary.enabled", isEnabled)
|
or (
|
||||||
|
modMinerTrade.salary.enabled ~= "true"
|
||||||
|
and modMinerTrade.salary.enabled ~= "false"
|
||||||
|
)
|
||||||
|
then
|
||||||
|
modMinerTrade.salary.enabled = true
|
||||||
|
minetest.settings:set_bool("minertrade.salary.enabled", modMinerTrade.salary.enabled)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return isEnabled
|
return modMinerTrade.salary.enabled
|
||||||
|
end,
|
||||||
|
--value = tonumber(minetest.settings:get("minertrade.salary.value") or 1),
|
||||||
|
getValue = function()
|
||||||
|
if modMinerTrade.salary.value == nil then
|
||||||
|
modMinerTrade.salary.value = minetest.settings:get("minertrade.salary.value")
|
||||||
|
if modMinerTrade.salary.value == nil
|
||||||
|
or type(tonumber(modMinerTrade.salary.value)) ~= "number"
|
||||||
|
or tonumber(modMinerTrade.salary.value) < 1
|
||||||
|
then
|
||||||
|
modMinerTrade.salary.value = 1
|
||||||
|
minetest.settings:set("minertrade.salary.value", modMinerTrade.salary.value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return tonumber(modMinerTrade.salary.value)
|
||||||
|
end,
|
||||||
|
--intervalcheck = tonumber(minetest.settings:get("minertrade.salary.intervalcheck") or 60),
|
||||||
|
getIntervalCheck = function()
|
||||||
|
if modMinerTrade.salary.intervalcheck == nil then
|
||||||
|
modMinerTrade.salary.intervalcheck = minetest.settings:get("minertrade.salary.intervalcheck")
|
||||||
|
if modMinerTrade.salary.intervalcheck == nil
|
||||||
|
or type(tonumber(modMinerTrade.salary.intervalcheck)) ~= "number"
|
||||||
|
or tonumber(modMinerTrade.salary.intervalcheck) < 1
|
||||||
|
or tonumber(modMinerTrade.salary.intervalcheck) > (60*60*24)
|
||||||
|
then
|
||||||
|
modMinerTrade.salary.intervalcheck = 60
|
||||||
|
minetest.settings:set("minertrade.salary.intervalcheck", modMinerTrade.salary.intervalcheck)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return tonumber(modMinerTrade.salary.intervalcheck)
|
||||||
end,
|
end,
|
||||||
value = tonumber(minetest.settings:get("minertrade.salary.value") or 1),
|
|
||||||
intervalcheck = tonumber(minetest.settings:get("minertrade.salary.intervalcheck") or 60),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,8 +95,8 @@ modMinerTrade.getMaxStatements = function() --MÁXIMO DE EXTRATOS ARMAZENADOS.
|
||||||
local maxStatements = minetest.settings:get("minertrade.bank.max_statements")
|
local maxStatements = minetest.settings:get("minertrade.bank.max_statements")
|
||||||
if maxStatements == nil
|
if maxStatements == nil
|
||||||
or type(tonumber(maxStatements)) ~= "number"
|
or type(tonumber(maxStatements)) ~= "number"
|
||||||
or tonumber(maxStatements) < 1
|
or tonumber(maxStatements) < 1 --Min
|
||||||
or tonumber(maxStatements) > 300
|
or tonumber(maxStatements) > 300 --Max
|
||||||
then
|
then
|
||||||
maxStatements = 30
|
maxStatements = 30
|
||||||
minetest.settings:set("minertrade.bank.max_statements", tostring(maxStatements))
|
minetest.settings:set("minertrade.bank.max_statements", tostring(maxStatements))
|
||||||
|
|
Loading…
Add table
Reference in a new issue