Add unconditional hiding of minimap
This commit is contained in:
parent
8a7ed09353
commit
07d164f8ce
40
init.lua
40
init.lua
@ -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
2
settingtypes.txt
Normal 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
|
Loading…
x
Reference in New Issue
Block a user