@@ 86,15 86,13 @@ minetest.register_tool(modname .. ":extruder", {
liquids_pointable = true,
-- MAYBE switch to on_place since a node should be pointed?
on_use = function(_, placer, pointed_thing)
- if placer == nil or pointed_thing == nil then return end
+ if placer == nil or pointed_thing == nil or pointed_thing.type ~= "node" then return end
if not check_privs_with_msg(placer) then return end
- if pointed_thing.type == "node" then
- local direction = vector.direction(pointed_thing.under, pointed_thing.above)
- local surface = visit(pointed_thing.under, direction)
- -- TODO ask for confirmation if surface is too big (block limit field/checkbox in formspec?)
- -- confirmation can be "click again" (store previous above and under)
- extrude(surface, direction)
- end
+ local direction = vector.direction(pointed_thing.under, pointed_thing.above)
+ local surface = visit(pointed_thing.under, direction)
+ -- TODO ask for confirmation if surface is too big (block limit field/checkbox in formspec?)
+ -- confirmation can be "click again" (store previous above and under)
+ extrude(surface, direction)
end,
-- TODO add formspec with "amount" field and "go/select through vertices" checkbox