Fix flag teleport not working with negative co-ords

master
rubenwardy 2016-03-30 01:06:37 +01:00
parent 9f9bfff97d
commit 2ca92fefd4
1 changed files with 3 additions and 3 deletions

View File

@ -56,10 +56,10 @@ end)
minetest.register_on_player_receive_fields(function(player, formname, fields)
-- Todo: fix security issue here
local name = player:get_player_name()
if formname=="ctf:flags" then
if formname == "ctf:flags" then
for key, field in pairs(fields) do
local x,y,z = string.match(key, "goto_(%d+)_(%d+)_(%d+)")
if x and y and x then
local x,y,z = string.match(key, "goto_([%d-]+)_([%d-]+)_([%d-]+)")
if x and y and z then
player:setpos({ x=tonumber(x), y=tonumber(y), z=tonumber(z) })
return true
end