Abort if static_spawnpoint is an invalid setting instead of just giving an error log
authorHybrid Dog <ovvv@web.de>
Sat, 12 Aug 2017 10:11:28 +0000 (12:11 +0200)
committerrubenwardy <rubenwardy@gmail.com>
Sat, 12 Aug 2017 18:37:53 +0000 (19:37 +0100)
builtin/game/static_spawn.lua

index b1157b42e9f08c3f62d348952af39dbff5379f52..2a5d9b1fa8fb7ead1ada2e1775c09cf4cde4d2df 100644 (file)
@@ -1,15 +1,13 @@
 -- Minetest: builtin/static_spawn.lua
 
-local function warn_invalid_static_spawnpoint()
-       if core.settings:get("static_spawnpoint") and
-                       not core.setting_get_pos("static_spawnpoint") then
-               core.log("error", "The static_spawnpoint setting is invalid: \""..
-                               core.settings:get("static_spawnpoint").."\"")
-       end
+local static_spawnpoint_string = core.settings:get("static_spawnpoint")
+if static_spawnpoint_string and
+               static_spawnpoint_string ~= "" and
+               not core.setting_get_pos("static_spawnpoint") then
+       error('The static_spawnpoint setting is invalid: "' ..
+                       static_spawnpoint_string .. '"')
 end
 
-warn_invalid_static_spawnpoint()
-
 local function put_player_in_spawn(player_obj)
        local static_spawnpoint = core.setting_get_pos("static_spawnpoint")
        if not static_spawnpoint then