From 59f374f38f51f13c6ba98357bcddfc154bf6a693 Mon Sep 17 00:00:00 2001 From: kaadmy Date: Fri, 27 Nov 2015 07:34:59 -0800 Subject: [PATCH] fixed a bug in maps --- mods/nav/map.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mods/nav/map.lua b/mods/nav/map.lua index 1d6107e..17c98b8 100644 --- a/mods/nav/map.lua +++ b/mods/nav/map.lua @@ -20,6 +20,10 @@ function nav.remove_waypoint(name) nav.waypoints[name] = nil end +function nav.relocate_waypoint(name, pos) + nav.waypoints[name].pos = pos +end + function nav.get_waypoints_in_square(pos, radius) local wpts = {} @@ -122,7 +126,9 @@ local function step(dtime) for wptname, wpt in pairs(nav.waypoints) do if wpt.type == "player" then - wpt.pos = players[wpt.label]:getpos() + if players[wpt.label] ~= nil and minetest.get_player_by_name(wpt.label) ~= nil then + nav.relocate_waypoint(wptname, players[wpt.label:]getpos()) + end end end