Allow minimap for free in Creative Mode

This commit is contained in:
Wuzzy 2017-08-31 14:59:16 +02:00
parent 6f9d8a5663
commit 8dcb015182
2 changed files with 14 additions and 13 deletions

View File

@ -32,8 +32,8 @@ minetest.register_craftitem("mcl_maps:empty_map", {
-- has a very greatly zoomed-out version and even a radar mode -- has a very greatly zoomed-out version and even a radar mode
minetest.register_craftitem("mcl_maps:filled_map", { minetest.register_craftitem("mcl_maps:filled_map", {
description = "Map", description = "Map",
_doc_items_longdesc = "Maps show your surroundings as you explore the world. They can even show you the world like a radar. MAGIC!\nNote: Maps are incomplete and subject to change in future versions of MineClone 2.", _doc_items_longdesc = "Maps show your surroundings as you explore the world. They can even show you the world like a radar. MAGIC!\nNote: Maps are subject to change in future versions of MineClone 2.",
_doc_items_usagehelp = "Hold the map in any of the hotbar slots. This allows you to access the minimap by pressing the minimap key ([F9] by default).", _doc_items_usagehelp = "Hold the map in any of the hotbar slots. This allows you to access the minimap by pressing the minimap key ([F9] by default).\nIn Creative Mode, you don't need this item; the minimap is always available.",
inventory_image = "mcl_maps_map_filled.png^(mcl_maps_map_filled_markings.png^[colorize:#000000)", inventory_image = "mcl_maps_map_filled.png^(mcl_maps_map_filled_markings.png^[colorize:#000000)",
stack_max = 1, stack_max = 1,
}) })
@ -61,7 +61,7 @@ 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)
if has_item_in_hotbar(player, "mcl_maps:filled_map") then if minetest.settings:get_bool("creative_mode") or has_item_in_hotbar(player, "mcl_maps:filled_map") then
player:hud_set_flags({minimap = true}) player:hud_set_flags({minimap = true})
else else
player:hud_set_flags({minimap = false}) player:hud_set_flags({minimap = false})
@ -73,13 +73,15 @@ minetest.register_on_joinplayer(function(player)
end) end)
local updatetimer = 0 local updatetimer = 0
minetest.register_globalstep(function(dtime) if not minetest.settings:get_bool("creative_mode") then
updatetimer = updatetimer + dtime minetest.register_globalstep(function(dtime)
if updatetimer > 0.1 then updatetimer = updatetimer + dtime
local players = minetest.get_connected_players() if updatetimer > 0.1 then
for i=1, #players do local players = minetest.get_connected_players()
update_minimap(players[i]) for i=1, #players do
update_minimap(players[i])
end
updatetimer = updatetimer - dtime
end end
updatetimer = updatetimer - dtime end)
end end
end)

View File

@ -7,7 +7,6 @@ local wip_items = {
"mcl_end:chorus_flower", "mcl_end:chorus_flower",
"mcl_end:chorus_flower_dead", "mcl_end:chorus_flower_dead",
"mcl_fishing:fishing_rod", "mcl_fishing:fishing_rod",
"mcl_maps:filled_map",
"mcl_maps:empty_map", "mcl_maps:empty_map",
"gemalde:node_1", "gemalde:node_1",
"mcl_observers:observer", "mcl_observers:observer",