diff --git a/init.lua b/init.lua index a21c913..cd69a0d 100644 --- a/init.lua +++ b/init.lua @@ -336,6 +336,9 @@ markers.get_marker_formspec = function(player, pos, error_msg) if(not( ((n-i) == opposite ) or not(markers.positions[ name ][ n-i ] ) + or not( coords ) or not( coords[1]) or not( coords[2]) + or not(markers.positions[ name ] ) + or not(markers.positions[ name ][ n-i ] ) or ( markers.positions[ name ][ n-i ].x == coords[ 1 ].x and markers.positions[ name ][ n-i ].z == coords[ 2 ].z ) or ( markers.positions[ name ][ n-i ].x == coords[ 2 ].x @@ -349,6 +352,9 @@ markers.get_marker_formspec = function(player, pos, error_msg) -- save data meta:set_string( 'coords', minetest.serialize( coords ) ); end + if( not( coords ) or #coords < 2 or not( coords[1] ) or not( coords[2] )) then + return formspec_info.."Error: The last 4 markers\nyou placed do not form\na rectangle.]"; + end -- the coordinates are set; we may present an input form now diff --git a/land_title_register.lua b/land_title_register.lua index 9c456a4..4156acb 100644 --- a/land_title_register.lua +++ b/land_title_register.lua @@ -29,7 +29,7 @@ minetest.register_tool( "markers:land_title_register", local name = placer:get_player_name(); -- the position is what we're actually looking for - local pos = minetest.get_pointed_thing_position( pointed_thing, 0 ); --under ); + local pos = minetest.get_pointed_thing_position( pointed_thing, false ); -- not above if( not( pos ) or not( pos.x )) then minetest.chat_send_player( name, "Position not found."); @@ -50,7 +50,7 @@ minetest.register_tool( "markers:land_title_register", end local name = placer:get_player_name(); - local pos = minetest.get_pointed_thing_position( pointed_thing, under ); + local pos = minetest.get_pointed_thing_position( pointed_thing, false ); -- not above if( not( pos ) or not( pos.x )) then minetest.chat_send_player( name, "Position not found.");