Browse Source

sethome: Do not write empty homes file

sfan5 3 years ago
parent
commit
af045dcd8b
1 changed files with 3 additions and 0 deletions
  1. 3 0
      mods/sethome/init.lua

+ 3 - 0
mods/sethome/init.lua

@@ -32,6 +32,9 @@ sethome.set = function(name, pos)
 	player:set_attribute("sethome:home", minetest.pos_to_string(pos))
 
 	-- remove `name` from the old storage file
+	if not homepos[name] then
+		return true
+	end
 	local data = {}
 	local output = io.open(homes_file, "w")
 	if output then