forked from luanti-org/minetest_game
		
	Beds: Quicker saves with tidy output
Tweaked the beds.save_spawns() function to compile list then output to file with shortened co-ordinates containing 1 decimal place
This commit is contained in:
		| @@ -41,10 +41,12 @@ function beds.save_spawns() | |||||||
| 	if not beds.spawn then | 	if not beds.spawn then | ||||||
| 		return | 		return | ||||||
| 	end | 	end | ||||||
|  | 	local data = {} | ||||||
| 	local output = io.open(org_file, "w") | 	local output = io.open(org_file, "w") | ||||||
| 	for i, v in pairs(beds.spawn) do | 	for k, v in pairs(beds.spawn) do | ||||||
| 		output:write(v.x .. " " .. v.y .. " " .. v.z .. " " .. i .. "\n") | 		table.insert(data, string.format("%.1f %.1f %.1f %s\n", v.x, v.y, v.z, k)) | ||||||
| 	end | 	end | ||||||
|  | 	output:write(table.concat(data)) | ||||||
| 	io.close(output) | 	io.close(output) | ||||||
| end | end | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user