1 minetest.register_tool(":worldedit:wand", {
2 description = "WorldEdit Wand tool, Left-click to set 1st position, right-click to set 2nd",
3 inventory_image = "worldedit_wand.png",
4 stack_max = 1, -- there is no need to have more than one
5 liquids_pointable = true, -- ground with only water on can be selected as well
7 on_use = function(itemstack, placer, pointed_thing)
8 if placer ~= nil and pointed_thing ~= nil and pointed_thing.type == "node" then
9 local name = placer:get_player_name()
10 worldedit.pos1[name] = pointed_thing.under
11 worldedit.mark_pos1(name)
13 return itemstack -- nothing consumed, nothing changed
16 on_place = function(itemstack, placer, pointed_thing) -- Left Click
17 if placer ~= nil and pointed_thing ~= nil and pointed_thing.type == "node" then
18 local name = placer:get_player_name()
19 worldedit.pos2[name] = pointed_thing.under
20 worldedit.mark_pos2(name)
22 return itemstack -- nothing consumed, nothing changed