diff --git a/mods/ITEMS/mcl_maps/init.lua b/mods/ITEMS/mcl_maps/init.lua index fa0297aa..4358dfc5 100644 --- a/mods/ITEMS/mcl_maps/init.lua +++ b/mods/ITEMS/mcl_maps/init.lua @@ -1,4 +1,6 @@ -mcl_maps = {} +mcl_maps = { + map_update_fps = tonumber(minetest.settings:get("mcl_maps_map_update_fps")) or 15 +} local modname = minetest.get_current_modname() local modpath = minetest.get_modpath(modname) @@ -473,7 +475,14 @@ function mcl_maps.make_banner_overlay(banners, minp, maxp, border) return texture end +local time_since_last_frame = 0 + minetest.register_globalstep(function(dtime) + time_since_last_frame = time_since_last_frame + dtime + if time_since_last_frame < ( 1 / mcl_maps.map_update_fps ) then + return + end + time_since_last_frame = 0 for _, player in pairs(get_connected_players()) do local wield = player:get_wielded_item() local texture = mcl_maps.load_map_item(wield) diff --git a/settingtypes.txt b/settingtypes.txt index 3d583bdb..b6d236ad 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -102,6 +102,9 @@ animated_chests (Animated chests) bool true # Whether to preview the player in inventory in 3D (requires Minetest 5.4) 3d_player_preview (3D Player preview) bool true +# How often the handheld map is updated per second +mcl_maps_map_update_fps (Map Update FPS) int 15 0 60 + [Experimental] # Whether ice is translucent. If disabled, ice is fully opaque. #