Add unconditional hiding of minimap

This commit is contained in:
James Stevenson 2016-07-28 06:16:48 -04:00 committed by Amaz
parent 8a7ed09353
commit 07d164f8ce
2 changed files with 25 additions and 17 deletions

View File

@ -1,20 +1,26 @@
minetest.register_privilege("minimap", {
description = "Allows players to use the minimap",
give_to_singleplayer = false,
})
if not minetest.setting_getbool("hide_minimap_unconditional") then
minetest.register_privilege("minimap", {
description = "Allows players to use the minimap",
give_to_singleplayer = false,
})
local time = 0
minetest.register_globalstep(function(dtime)
time = time + dtime
if time > 20 then
for _,player in pairs(minetest.get_connected_players()) do
local name = player:get_player_name()
local privs = minetest.get_player_privs(name)
if not privs.minimap then
player:hud_set_flags({minimap = false})
elseif privs.minimap == true then
player:hud_set_flags({minimap = true})
local time = 0
minetest.register_globalstep(function(dtime)
time = time + dtime
if time > 20 then
for _,player in pairs(minetest.get_connected_players()) do
local name = player:get_player_name()
local privs = minetest.get_player_privs(name)
if not privs.minimap then
player:hud_set_flags({minimap = false})
elseif privs.minimap == true then
player:hud_set_flags({minimap = true})
end
end
end
end
end)
end)
else
minetest.register_on_joinplayer(function(player)
player:hud_set_flags({minimap = false})
end)
end

2
settingtypes.txt Normal file
View File

@ -0,0 +1,2 @@
# Set to true to hide minimap for all players, regardless of privileges.
hide_minimap_unconditional (Never show minimap) bool false