mirror of
				https://github.com/minetest-mods/warps.git
				synced 2025-11-04 09:35:30 +01:00 
			
		
		
		
	Escape warp names, log player name, remove unused variables
This commit is contained in:
		
							
								
								
									
										13
									
								
								init.lua
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								init.lua
									
									
									
									
									
								
							@@ -246,7 +246,7 @@ local function prepare_dropdown(x,y,w,h,curr_dest)
 | 
			
		||||
	local sel = 0
 | 
			
		||||
	for idx, warp in ipairs(warps) do
 | 
			
		||||
		local warpname = warp.name
 | 
			
		||||
		dd = dd .. warpname .. ","
 | 
			
		||||
		dd = dd .. minetest.formspec_escape(warpname) .. ","
 | 
			
		||||
		if curr_dest == warpname then
 | 
			
		||||
			sel = idx
 | 
			
		||||
		end
 | 
			
		||||
@@ -263,7 +263,8 @@ local function prepare_formspec(dest)
 | 
			
		||||
		custdest = ""
 | 
			
		||||
	end
 | 
			
		||||
	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]"
 | 
			
		||||
		..prepare_dropdown(0.7,0.4,3,1, dest)
 | 
			
		||||
	return s_formspec
 | 
			
		||||
@@ -299,8 +300,6 @@ minetest.register_node("warps:warpstone", {
 | 
			
		||||
			return
 | 
			
		||||
		end
 | 
			
		||||
 | 
			
		||||
		local ddwarp = fields.ddwarp
 | 
			
		||||
		local is_custom_dest = false
 | 
			
		||||
		local dest
 | 
			
		||||
		if fields.destination == "" and fields.ddwarp then
 | 
			
		||||
			dest = fields.ddwarp
 | 
			
		||||
@@ -332,9 +331,11 @@ minetest.register_node("warps:warpstone", {
 | 
			
		||||
					"Unknown warp location for this warp stone, cannot warp!")
 | 
			
		||||
			return false
 | 
			
		||||
		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)
 | 
			
		||||
	end,
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
firstload()
 | 
			
		||||
firstload()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user