forked from erle/xmaps
Make dependency on map mod optional
This commit is contained in:
parent
4538171d56
commit
7d339bb78d
48
init.lua
48
init.lua
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue