diff options
author | Rui <Rui914@users.noreply.github.com> | 2015-10-11 21:25:58 +0900 |
---|---|---|
committer | est31 <MTest31@outlook.com> | 2015-11-21 00:13:28 +0100 |
commit | 4fd394b657fbaf6f1966024553a45c4e5401542a (patch) | |
tree | 3446a3806fc9c7ce425665a68a980ab458a00eaf /builtin | |
parent | 2f58e4d9624b4f31c5064dc640e0ad40d8adb9ea (diff) | |
download | minetest-4fd394b657fbaf6f1966024553a45c4e5401542a.tar.gz minetest-4fd394b657fbaf6f1966024553a45c4e5401542a.tar.bz2 minetest-4fd394b657fbaf6f1966024553a45c4e5401542a.zip |
Log static_spawn error only once
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/game/static_spawn.lua | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/builtin/game/static_spawn.lua b/builtin/game/static_spawn.lua index 492ab6ca6..100334226 100644 --- a/builtin/game/static_spawn.lua +++ b/builtin/game/static_spawn.lua @@ -3,31 +3,23 @@ local function warn_invalid_static_spawnpoint() if core.setting_get("static_spawnpoint") and not core.setting_get_pos("static_spawnpoint") then - core.log('error', "The static_spawnpoint setting is invalid: \"".. + core.log("error", "The static_spawnpoint setting is invalid: \"".. core.setting_get("static_spawnpoint").."\"") end end warn_invalid_static_spawnpoint() -local function put_player_in_spawn(obj) - 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 return false end - core.log('action', "Moving "..obj:get_player_name().. - " to static spawnpoint at ".. - core.pos_to_string(static_spawnpoint)) - obj:setpos(static_spawnpoint) + core.log("action", "Moving " .. player_obj:get_player_name() .. + " to static spawnpoint at " .. core.pos_to_string(static_spawnpoint)) + player_obj:setpos(static_spawnpoint) return true end -core.register_on_newplayer(function(obj) - put_player_in_spawn(obj) -end) - -core.register_on_respawnplayer(function(obj) - return put_player_in_spawn(obj) -end) - +core.register_on_newplayer(put_player_in_spawn) +core.register_on_respawnplayer(put_player_in_spawn) |