fix settings save, fix /back on death

This commit is contained in:
Evert Prants 2020-01-22 13:44:24 +02:00
parent 596878a2c6
commit 4f4d7288ce
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
2 changed files with 6 additions and 4 deletions

View File

@ -36,7 +36,7 @@ spawn.register_chatcommand("setspawn", {
local pos = minetest.get_player_by_name(name):get_pos(spawnpoint) local pos = minetest.get_player_by_name(name):get_pos(spawnpoint)
local str = minetest.pos_to_string(pos) local str = minetest.pos_to_string(pos)
minetest.settings:set("static_spawnpoint", str) minetest.settings:set("static_spawnpoint", str)
minetest.settings:save() minetest.settings:write()
return true, "Set the world's spawn point to " .. str return true, "Set the world's spawn point to " .. str
end end
}) })

View File

@ -54,12 +54,14 @@ sethome.get = function(name, target)
return targ, target return targ, target
end end
sethome.go = function(name,point) sethome.go = function(name,point,skipsave)
local pos, target = sethome.get(name,point) local pos, target = sethome.get(name,point)
local player = minetest.get_player_by_name(name) local player = minetest.get_player_by_name(name)
if player and pos then if player and pos then
if not skipsave then
ess.save_player_pos(player) ess.save_player_pos(player)
end
player:set_pos(pos) player:set_pos(pos)
return true, target return true, target
end end
@ -180,6 +182,6 @@ end
if homerespawn then if homerespawn then
minetest.register_on_respawnplayer(function(player) minetest.register_on_respawnplayer(function(player)
return sethome.go(player:get_player_name()) return sethome.go(player:get_player_name(), nil, true)
end) end)
end end