forked from VoxeLibre/VoxeLibre
Merge pull request 'ITEMS/mcl_maps: send hud_flags only if actually changed' (#146) from fix-minimap-spam into master
Reviewed-on: Mineclonia/Mineclonia#146 Reviewed-by: erlehmann <nils+git.minetest.land@dieweltistgarnichtso.net>
This commit is contained in:
commit
3a78211be4
|
@ -43,13 +43,19 @@ end
|
||||||
-- Checks if player is still allowed to display the minimap
|
-- Checks if player is still allowed to display the minimap
|
||||||
local function update_minimap(player)
|
local function update_minimap(player)
|
||||||
local creative = minetest.is_creative_enabled(player:get_player_name())
|
local creative = minetest.is_creative_enabled(player:get_player_name())
|
||||||
|
|
||||||
|
local newstate=false
|
||||||
|
local oldstate=player:hud_get_flags().minimap
|
||||||
|
|
||||||
|
if creative or has_item_in_hotbar(player, "mcl_maps:filled_map") then
|
||||||
|
newstate=true
|
||||||
|
end
|
||||||
|
|
||||||
|
if oldstate ~= newstate then
|
||||||
if creative then
|
if creative then
|
||||||
player:hud_set_flags({minimap = true, minimap_radar = true})
|
player:hud_set_flags({minimap = true, minimap_radar = true})
|
||||||
else
|
else
|
||||||
if has_item_in_hotbar(player, "mcl_maps:filled_map") then
|
player:hud_set_flags({minimap = newstate, minimap_radar = false})
|
||||||
player:hud_set_flags({minimap = true, minimap_radar = false})
|
|
||||||
else
|
|
||||||
player:hud_set_flags({minimap = false, minimap_radar = false})
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue