From 2ca92fefd4bedf35db72992837efed4a6db1c035 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Wed, 30 Mar 2016 01:06:37 +0100 Subject: [PATCH] Fix flag teleport not working with negative co-ords --- ctf_flag/gui.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ctf_flag/gui.lua b/ctf_flag/gui.lua index 3557443..1ce3c91 100644 --- a/ctf_flag/gui.lua +++ b/ctf_flag/gui.lua @@ -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