mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-24 11:53:46 +01:00
Fix crash in mcl_maps
This commit is contained in:
parent
28b2085492
commit
f0ba364120
@ -28,6 +28,18 @@ minetest.register_craftitem("mcl_maps:empty_map", {
|
||||
stack_max = 64,
|
||||
})
|
||||
|
||||
local function has_item_in_hotbar(player, item)
|
||||
-- Requirement: player carries the tool in the hotbar
|
||||
local inv = player:get_inventory()
|
||||
local hotbar = player:hud_get_hotbar_itemcount()
|
||||
for i=1, hotbar do
|
||||
if inv:get_stack("main", i):get_name() == item then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- Checks if player is still allowed to display the minimap
|
||||
local function update_minimap(player)
|
||||
local creative = minetest.settings:get_bool("creative_mode")
|
||||
@ -77,18 +89,6 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
|
||||
local function has_item_in_hotbar(player, item)
|
||||
-- Requirement: player carries the tool in the hotbar
|
||||
local inv = player:get_inventory()
|
||||
local hotbar = player:hud_get_hotbar_itemcount()
|
||||
for i=1, hotbar do
|
||||
if inv:get_stack("main", i):get_name() == item then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
update_minimap(player)
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user