Escape warp names, log player name, remove unused variables

This commit is contained in:
Montandalar 2021-02-10 19:19:50 +11:00
parent 286454bce5
commit be8a39eae0

View File

@ -246,7 +246,7 @@ local function prepare_dropdown(x,y,w,h,curr_dest)
local sel = 0 local sel = 0
for idx, warp in ipairs(warps) do for idx, warp in ipairs(warps) do
local warpname = warp.name local warpname = warp.name
dd = dd .. warpname .. "," dd = dd .. minetest.formspec_escape(warpname) .. ","
if curr_dest == warpname then if curr_dest == warpname then
sel = idx sel = idx
end end
@ -263,7 +263,8 @@ local function prepare_formspec(dest)
custdest = "" custdest = ""
end end
s_formspec = "size[4.5,3]label[0.7,0;Warp destination]" s_formspec = "size[4.5,3]label[0.7,0;Warp destination]"
s_formspec = s_formspec .. "field[1,2.2;3,0.2;destination;Future destination;"..custdest.."]" s_formspec = s_formspec .. "field[1,2.2;3,0.2;destination;Future destination;"
..minetest.formspec_escape(custdest).."]"
.."button_exit[0.7,2.7;3,0.5;proceed;Proceed]" .."button_exit[0.7,2.7;3,0.5;proceed;Proceed]"
..prepare_dropdown(0.7,0.4,3,1, dest) ..prepare_dropdown(0.7,0.4,3,1, dest)
return s_formspec return s_formspec
@ -299,8 +300,6 @@ minetest.register_node("warps:warpstone", {
return return
end end
local ddwarp = fields.ddwarp
local is_custom_dest = false
local dest local dest
if fields.destination == "" and fields.ddwarp then if fields.destination == "" and fields.ddwarp then
dest = fields.ddwarp dest = fields.ddwarp
@ -332,9 +331,11 @@ minetest.register_node("warps:warpstone", {
"Unknown warp location for this warp stone, cannot warp!") "Unknown warp location for this warp stone, cannot warp!")
return false return false
end end
minetest.log("action", "Going to warp to: "..destination) minetest.log("action", string.format("Going to warp player %s to waypoint %s",
puncher:get_player_name(), minetest.formspec_escape(destination)
))
warp_queue_add(puncher, destination) warp_queue_add(puncher, destination)
end, end,
}) })
firstload() firstload()