From 076c91d5dece74d3c66ce11fb00f6af0220b5957 Mon Sep 17 00:00:00 2001 From: "Tai @ Flex" Date: Sat, 14 Jan 2017 15:57:37 +0000 Subject: [PATCH] let game do initial placement. better when with valleys mapgen --- init.lua | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/init.lua b/init.lua index 1faff32..cbdd7bc 100644 --- a/init.lua +++ b/init.lua @@ -69,6 +69,7 @@ minetest.register_chatcommand("newspawn", { playerspawns[name] = newspawn() minetest.get_player_by_name(name):setpos(playerspawns[name]) spawnsave() + minetest.chat_send_player(name, "New spawn set !") end }) @@ -81,6 +82,7 @@ minetest.register_chatcommand("setspawn", { func = function(name) playerspawns[name] = minetest.get_player_by_name(name):getpos() spawnsave() + minetest.chat_send_player(name, "New spawn set !") end }) @@ -111,16 +113,10 @@ end spawnload() minetest.register_on_newplayer(function(player) - minetest.after(1,function() - local name = player:get_player_name() - - -- Set immediately so that joinplayer does not get triggered whilst we're stil looking - playerspawns[name] = player:getpos() - - playerspawns[name] = newspawn() - player:setpos(playerspawns[name]) - spawnsave() - end) + local name = player:get_player_name() + playerspawns[name] = player:getpos() + spawnsave() + return end) minetest.register_on_joinplayer(function(player)