2021-03-13 00:47:10 +01:00
|
|
|
local wea = worldeditadditions
|
2023-02-12 03:18:04 +01:00
|
|
|
local wea_c = worldeditadditions_core
|
2024-10-10 05:35:45 +02:00
|
|
|
local wea_t = worldeditadditions_tools
|
2021-02-23 23:56:56 +01:00
|
|
|
|
2024-10-10 05:35:45 +02:00
|
|
|
wea_t.register_tool("cloudwand", {
|
2023-02-12 03:19:53 +01:00
|
|
|
description = "WorldEditAdditions far-reaching additive selector wand",
|
2021-02-23 23:56:56 +01:00
|
|
|
inventory_image = "worldeditadditions_cloudwand.png",
|
|
|
|
|
|
|
|
on_place = function(itemstack, player, pointed_thing)
|
|
|
|
local name = player:get_player_name()
|
|
|
|
-- print("[farwand] on_place", name)
|
|
|
|
-- Right click when pointing at something
|
|
|
|
-- Pointed thing: https://rubenwardy.com/minetest_modding_book/lua_api.html#pointed_thing
|
2021-03-13 03:01:17 +01:00
|
|
|
wea.selection.clear_points(name)
|
2021-02-23 23:56:56 +01:00
|
|
|
end,
|
|
|
|
|
|
|
|
on_use = function(itemstack, player, pointed_thing)
|
|
|
|
local name = player:get_player_name()
|
|
|
|
-- print("[farwand] on_use", name)
|
2024-10-10 18:21:08 +02:00
|
|
|
local looking_pos, node_id = wea_t.do_raycast(player)
|
2021-03-13 03:01:17 +01:00
|
|
|
wea.selection.add_point(name, looking_pos)
|
2021-02-23 23:56:56 +01:00
|
|
|
-- Left click when pointing at something or nothing
|
|
|
|
end,
|
|
|
|
|
|
|
|
on_secondary_use = function(itemstack, player, pointed_thing)
|
|
|
|
local name = player:get_player_name()
|
|
|
|
-- Right click when pointing at nothing
|
|
|
|
-- print("[farwand] on_secondary_use", name)
|
|
|
|
|
2023-02-12 03:18:04 +01:00
|
|
|
-- TODO: Move over to wea_c.pos completely
|
2021-03-13 03:01:17 +01:00
|
|
|
wea.selection.clear_points(name)
|
2023-02-12 03:18:04 +01:00
|
|
|
wea_c.pos.clear(name)
|
2021-02-23 23:56:56 +01:00
|
|
|
end
|
|
|
|
})
|