summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua14
1 files changed, 10 insertions, 4 deletions
diff --git a/init.lua b/init.lua
index 6e23655..1a3b89f 100644
--- a/init.lua
+++ b/init.lua
@@ -84,7 +84,7 @@ markers.marker_placed = function( pos, placer, itemstack )
return;
end
- local meta = minetest.env:get_meta( pos );
+ local meta = minetest.get_meta( pos );
local name = placer:get_player_name();
meta:set_string( 'infotext', 'Marker at '..minetest.pos_to_string( pos )..
@@ -199,7 +199,7 @@ markers.marker_can_dig = function(pos,player)
return true;
end
- local meta = minetest.env:get_meta( pos );
+ local meta = minetest.get_meta( pos );
local owner = meta:get_string( 'owner' );
local time = meta:get_string( 'time' );
@@ -273,7 +273,7 @@ end
markers.get_marker_formspec = function(player, pos, error_msg)
local formspec = "";
- local meta = minetest.env:get_meta( pos );
+ local meta = minetest.get_meta( pos );
local owner = meta:get_string( 'owner' );
local name = player:get_player_name();
@@ -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
@@ -424,7 +430,7 @@ markers.marker_on_receive_fields = function(pos, formname, fields, sender)
end
- local meta = minetest.env:get_meta( pos );
+ local meta = minetest.get_meta( pos );
local name = sender:get_player_name();