Add setting for update frequency of handheld maps

This commit is contained in:
Nils Dagsson Moskopp 2022-02-08 04:08:28 +01:00
parent e91f29ac24
commit 738cbf4861
Signed by untrusted user who does not match committer: erle
GPG Key ID: A3BC671C35191080
2 changed files with 13 additions and 1 deletions

View File

@ -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)

View File

@ -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.
#