blob: 696b691006dd4b57e47ff3869a9689b28cd24809 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
-- adapted from the income.lua file from the currency mod.
local timer = 0
function atm.welfare_payout()
payout = false
for _,player in ipairs(minetest.get_connected_players()) do
local name = player:get_player_name()
local limit = atm.welfare[name] or atm.default_welfare
atm.ensure_init(name)
if limit > 5 then
atm.balance[name] = math.floor(atm.balance[name] + 5)
atm.welfare[name] = limit - 5
payout = true
end
end
if payout then
atm.saveaccounts()
end
end
minetest.register_globalstep(function(dtime)
timer = timer + dtime;
if timer >= 1000 then
timer = 0
atm.welfare_payout()
end
end)
|