Make dependency on map mod optional

This commit is contained in:
Nils Dagsson Moskopp 2022-05-20 19:14:53 +02:00
parent 4538171d56
commit 7d339bb78d
Signed by untrusted user who does not match committer: erlehmann
GPG Key ID: A3BC671C35191080
2 changed files with 27 additions and 24 deletions

View File

@ -741,29 +741,6 @@ minetest.register_globalstep(
end
)
minetest.override_item(
"map:mapping_kit",
{
on_place = function(itemstack, player, pointed_thing)
local pos = pointed_thing.under
if pos then
local map = maps.create_map_item(
pos,
{ draw_x = true }
)
return map
end
end,
on_secondary_use = function(itemstack, player, pointed_thing)
local pos = player:get_pos()
if pos then
local map = maps.create_map_item(pos)
return map
end
end,
}
)
minetest.register_craftitem(
"maps:map",
{
@ -772,3 +749,28 @@ minetest.register_craftitem(
groups = { not_in_creative_inventory = 1 },
}
)
if minetest.registered_items["map:mapping_kit"] then
minetest.override_item(
"map:mapping_kit",
{
on_place = function(itemstack, player, pointed_thing)
local pos = pointed_thing.under
if pos then
local map = maps.create_map_item(
pos,
{ draw_x = true }
)
return map
end
end,
on_secondary_use = function(itemstack, player, pointed_thing)
local pos = player:get_pos()
if pos then
local map = maps.create_map_item(pos)
return map
end
end,
}
)
end

View File

@ -1,3 +1,4 @@
depends = map, tga_encoder
depends = tga_encoder
optional_depends = map
description = Shows maps in the player HUD
name = maps