update castles, areas, areas_protector, bakedclay, signs_lib,
bees, blox, bobblocks, coloredwood, homedecor, technic,
currency, digilines, digistguff, facade, farming_redo,
framedglass, gloopblocks, ilights, led_marquee, maptools,
mesecons, moreblocks, moreores, mymillwork, plasticbox,
replacer, ropes, street_signs, solidcolor, stained_glass,
teleport_request, unified_inventory, unifieddyes, worldedit,
add basic_signs, notify_hud_provider
2019-09-11 13:58:21 -04:00
|
|
|
local players_income = {}
|
2016-04-01 20:02:19 -04:00
|
|
|
|
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")
|
|
|
|
|
update castles, areas, areas_protector, bakedclay, signs_lib,
bees, blox, bobblocks, coloredwood, homedecor, technic,
currency, digilines, digistguff, facade, farming_redo,
framedglass, gloopblocks, ilights, led_marquee, maptools,
mesecons, moreblocks, moreores, mymillwork, plasticbox,
replacer, ropes, street_signs, solidcolor, stained_glass,
teleport_request, unified_inventory, unifieddyes, worldedit,
add basic_signs, notify_hud_provider
2019-09-11 13:58:21 -04:00
|
|
|
local income_enabled = minetest.settings:get_bool("currency.income_enabled", true)
|
|
|
|
local income_item = minetest.settings:get("currency.income_item") or "currency:minegeld_10"
|
|
|
|
local income_count = tonumber(minetest.settings:get("currency.income_count")) or 1
|
|
|
|
local income_period = tonumber(minetest.settings:get("currency.income_period")) or 720
|
|
|
|
|
|
|
|
if income_enabled then
|
|
|
|
local timer = 0
|
|
|
|
minetest.register_globalstep(function(dtime)
|
|
|
|
timer = timer + dtime;
|
|
|
|
if timer >= income_period then
|
|
|
|
timer = 0
|
|
|
|
for _, player in ipairs(minetest.get_connected_players()) do
|
2018-09-21 18:43:13 -04:00
|
|
|
local name = player:get_player_name()
|
update castles, areas, areas_protector, bakedclay, signs_lib,
bees, blox, bobblocks, coloredwood, homedecor, technic,
currency, digilines, digistguff, facade, farming_redo,
framedglass, gloopblocks, ilights, led_marquee, maptools,
mesecons, moreblocks, moreores, mymillwork, plasticbox,
replacer, ropes, street_signs, solidcolor, stained_glass,
teleport_request, unified_inventory, unifieddyes, worldedit,
add basic_signs, notify_hud_provider
2019-09-11 13:58:21 -04:00
|
|
|
players_income[name] = income_count
|
2018-09-21 18:43:13 -04:00
|
|
|
minetest.log("info", "[Currency] "..S("basic income for @1", name))
|
update castles, areas, areas_protector, bakedclay, signs_lib,
bees, blox, bobblocks, coloredwood, homedecor, technic,
currency, digilines, digistguff, facade, farming_redo,
framedglass, gloopblocks, ilights, led_marquee, maptools,
mesecons, moreblocks, moreores, mymillwork, plasticbox,
replacer, ropes, street_signs, solidcolor, stained_glass,
teleport_request, unified_inventory, unifieddyes, worldedit,
add basic_signs, notify_hud_provider
2019-09-11 13:58:21 -04:00
|
|
|
end
|
2018-09-21 18:43:13 -04:00
|
|
|
end
|
update castles, areas, areas_protector, bakedclay, signs_lib,
bees, blox, bobblocks, coloredwood, homedecor, technic,
currency, digilines, digistguff, facade, farming_redo,
framedglass, gloopblocks, ilights, led_marquee, maptools,
mesecons, moreblocks, moreores, mymillwork, plasticbox,
replacer, ropes, street_signs, solidcolor, stained_glass,
teleport_request, unified_inventory, unifieddyes, worldedit,
add basic_signs, notify_hud_provider
2019-09-11 13:58:21 -04:00
|
|
|
end)
|
2016-04-01 20:02:19 -04:00
|
|
|
|
update castles, areas, areas_protector, bakedclay, signs_lib,
bees, blox, bobblocks, coloredwood, homedecor, technic,
currency, digilines, digistguff, facade, farming_redo,
framedglass, gloopblocks, ilights, led_marquee, maptools,
mesecons, moreblocks, moreores, mymillwork, plasticbox,
replacer, ropes, street_signs, solidcolor, stained_glass,
teleport_request, unified_inventory, unifieddyes, worldedit,
add basic_signs, notify_hud_provider
2019-09-11 13:58:21 -04:00
|
|
|
local function earn_income(player)
|
|
|
|
if not player or player.is_fake_player then return end
|
|
|
|
local name = player:get_player_name()
|
2016-04-01 20:02:19 -04:00
|
|
|
|
update castles, areas, areas_protector, bakedclay, signs_lib,
bees, blox, bobblocks, coloredwood, homedecor, technic,
currency, digilines, digistguff, facade, farming_redo,
framedglass, gloopblocks, ilights, led_marquee, maptools,
mesecons, moreblocks, moreores, mymillwork, plasticbox,
replacer, ropes, street_signs, solidcolor, stained_glass,
teleport_request, unified_inventory, unifieddyes, worldedit,
add basic_signs, notify_hud_provider
2019-09-11 13:58:21 -04:00
|
|
|
local income_count = players_income[name]
|
|
|
|
if income_count and income_count > 0 then
|
|
|
|
local inv = player:get_inventory()
|
|
|
|
inv:add_item("main", {name=income_item, count=income_count})
|
|
|
|
players_income[name] = nil
|
|
|
|
minetest.log("info", "[Currency] "..S("added basic income for @1 to inventory", name))
|
|
|
|
end
|
|
|
|
end
|
2016-04-01 20:02:19 -04:00
|
|
|
|
update castles, areas, areas_protector, bakedclay, signs_lib,
bees, blox, bobblocks, coloredwood, homedecor, technic,
currency, digilines, digistguff, facade, farming_redo,
framedglass, gloopblocks, ilights, led_marquee, maptools,
mesecons, moreblocks, moreores, mymillwork, plasticbox,
replacer, ropes, street_signs, solidcolor, stained_glass,
teleport_request, unified_inventory, unifieddyes, worldedit,
add basic_signs, notify_hud_provider
2019-09-11 13:58:21 -04:00
|
|
|
minetest.register_on_dignode(function(pos, oldnode, digger) earn_income(digger) end)
|
|
|
|
minetest.register_on_placenode(function(pos, node, placer) earn_income(placer) end)
|
|
|
|
minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv) earn_income(player) end)
|
|
|
|
end
|