Spawn mod: Avoid respawn conflict with beds mod (#2240)
authorParamat <paramat@users.noreply.github.com>
Sun, 14 Oct 2018 01:36:40 +0000 (02:36 +0100)
committerGitHub <noreply@github.com>
Sun, 14 Oct 2018 01:36:40 +0000 (02:36 +0100)
mods/spawn/depends.txt
mods/spawn/init.lua

index 4ad96d51599fb734101f6229f6c1a8a509bd6255..548489e2836eb788b41bc8578f96ea08ffcd525a 100644 (file)
@@ -1 +1,2 @@
 default
+beds?
index dc6366c125e1045a5009f4b546c6c88377a8e5bb..6707932c10332305c72947638a102940e26a0d03 100644 (file)
@@ -126,7 +126,18 @@ minetest.register_on_newplayer(function(player)
        on_spawn(player)
 end)
 
+local enable_bed_respawn = minetest.settings:get_bool("enable_bed_respawn")
+if enable_bed_respawn == nil then
+       enable_bed_respawn = true
+end
+
 minetest.register_on_respawnplayer(function(player)
+       -- Avoid respawn conflict with beds mod
+       if beds and enable_bed_respawn and
+                       beds.spawn[player:get_player_name()] then
+               return
+       end
+
        on_spawn(player)
 
        return true