Fix coordinates in marker calls
This commit is contained in:
parent
675281b8c3
commit
cef6495f4a
@ -272,7 +272,7 @@ minetest.register_on_player_receive_fields(function(player, name, fields)
|
||||
local marker = k:match("marker%-(.+)");
|
||||
local pos = player:get_pos();
|
||||
if marker or k == "clear_marker" then
|
||||
local player_x, player_z = map:to_coordinates(pos.x, pos.z);
|
||||
local player_x, player_z = map:to_coordinates(pos.x, pos.z, true);
|
||||
map:set_marker(player_x, player_z, marker);
|
||||
|
||||
audio.play_feedback("cartographer_write", player);
|
||||
|
@ -44,7 +44,7 @@ end
|
||||
-- z: The z position, in map coordinates
|
||||
-- marker: The marker ID to set, or nil to unset
|
||||
function Map.set_marker(self, x, z, marker)
|
||||
if x < self.x or x > self.x + self.w or z < self.z or z > self.z + self.h then
|
||||
if x < 0 or x > self.w or z < 0 or z > self.h then
|
||||
return;
|
||||
end
|
||||
|
||||
@ -64,7 +64,7 @@ end
|
||||
--
|
||||
-- Returns a marker id
|
||||
function Map.get_marker(self, x, z)
|
||||
if x < self.x or x > self.x + self.w or z < self.z or z > self.z + self.h or not self.markers[x] then
|
||||
if x < 0 or x > self.w or z < 0 or z > self.h or not self.markers[x] then
|
||||
return nil;
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user