2016-04-01 20:02:19 -04:00
|
|
|
players_income = {}
|
|
|
|
|
Updated several mods for Minetest 0.4.16
castles modpack, areas, biome_lib, blox, boost_cart, plantlife modpack
caverealms, coloredwood, concrete, currency, farming redo, home decor,
ilights, mesecons, moreores, pipeworks, signs_lib, technic, unified inventory
unified bricks, unified dyes, worldedit, and xban2
2017-06-16 18:12:21 -04:00
|
|
|
-- internationalization boilerplate
|
|
|
|
local MP = minetest.get_modpath(minetest.get_current_modname())
|
|
|
|
local S, NS = dofile(MP.."/intllib.lua")
|
|
|
|
|
2016-04-01 20:02:19 -04:00
|
|
|
local timer = 0
|
|
|
|
minetest.register_globalstep(function(dtime)
|
2018-09-21 18:43:13 -04:00
|
|
|
timer = timer + dtime;
|
|
|
|
if timer >= 720 then --720 for one day
|
|
|
|
timer = 0
|
|
|
|
for _,player in ipairs(minetest.get_connected_players()) do
|
|
|
|
local name = player:get_player_name()
|
|
|
|
if players_income[name] == nil then
|
|
|
|
players_income[name] = 0
|
|
|
|
end
|
|
|
|
players_income[name] = 1
|
|
|
|
minetest.log("info", "[Currency] "..S("basic income for @1", name))
|
|
|
|
end
|
|
|
|
end
|
2016-04-01 20:02:19 -04:00
|
|
|
end)
|
|
|
|
|
|
|
|
earn_income = function(player)
|
2018-09-21 18:43:13 -04:00
|
|
|
if not player or player.is_fake_player then return end
|
|
|
|
local name = player:get_player_name()
|
|
|
|
if players_income[name] == nil then
|
|
|
|
players_income[name] = 0
|
|
|
|
end
|
|
|
|
if players_income[name] > 0 then
|
|
|
|
count = players_income[name]
|
|
|
|
local inv = player:get_inventory()
|
|
|
|
inv:add_item("main", {name="currency:minegeld_10", count=count})
|
|
|
|
players_income[name] = 0
|
|
|
|
minetest.log("info", "[Currency] "..S("added basic income for @1 to inventory", name))
|
|
|
|
end
|
2016-04-01 20:02:19 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
minetest.register_on_dignode(function(pos, oldnode, digger)
|
|
|
|
earn_income(digger)
|
|
|
|
end)
|
|
|
|
|
|
|
|
minetest.register_on_placenode(function(pos, node, placer)
|
|
|
|
earn_income(placer)
|
|
|
|
end)
|