support mapsync change dispatch

This commit is contained in:
BuckarooBanzay 2023-07-03 08:06:13 +02:00
parent f26ad98d23
commit c89ab557a0
3 changed files with 12 additions and 2 deletions

View File

@ -11,5 +11,8 @@ read_globals = {
"vector", "ItemStack",
"dump", "dump2",
"VoxelArea",
"minetest"
"minetest",
-- mods
"mapsync"
}

View File

@ -1,3 +1,4 @@
name = pick_and_place
description = Pick and place utility
depends = wield_events
depends = wield_events
optional_depends = mapsync

View File

@ -1,3 +1,5 @@
local has_mapsync = minetest.get_modpath("mapsync")
minetest.register_tool("pick_and_place:place", {
description = "Placement tool",
inventory_image = "pick_and_place_plus.png^[colorize:#0000ff",
@ -47,6 +49,10 @@ minetest.register_tool("pick_and_place:place", {
-- build preview
pick_and_place.show_preview(playername, "pick_and_place_plus.png", "#0000ff", pos1, pos2)
end
if has_mapsync then
mapsync.mark_changed(pos1, pos2)
end
end,
on_deselect = function(_, player)
local playername = player:get_player_name()