diff options
author | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2016-10-24 09:15:59 +0200 |
---|---|---|
committer | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2016-10-24 09:15:59 +0200 |
commit | dcbf1fce1e9303a00be15451e1802c2d4004070f (patch) | |
tree | 792f0d131355f3566c5436d5244ef7c00f84f5cd | |
parent | 3c79ab6847a1a22bdcda9f806ee2062797e5ce83 (diff) | |
download | apartment-dcbf1fce1e9303a00be15451e1802c2d4004070f.tar.gz apartment-dcbf1fce1e9303a00be15451e1802c2d4004070f.tar.bz2 apartment-dcbf1fce1e9303a00be15451e1802c2d4004070f.zip |
Assigning apartments to players is now configurabe, enabled by default.
-rw-r--r-- | init.lua | 26 |
1 files changed, 14 insertions, 12 deletions
@@ -938,19 +938,21 @@ minetest.register_abm({ }) -- give each player an apartment upon joining the server -- - -minetest.register_on_newplayer(function(player) - for k,v in pairs( apartment.apartments ) do - if (v.owner == '' and v.category == 'apartment') then - if (apartment.rent( v.pos, player:get_player_name(), nil, player )) then - player:moveto( v.pos, false); - local meta = minetest.get_meta( v.pos ); - meta:set_string( 'formspec', apartment.get_formspec( v.pos, player )); - minetest.chat_send_player(player:get_player_name(),"Welcome to your new apartment. You can return here by saying '/aphome'") - break +local apartment_give_player = minetest.setting_getbool("apartment_give_newplayer") or true; +if apartment_give_player then + minetest.register_on_newplayer(function(player) + for k,v in pairs( apartment.apartments ) do + if (v.owner == '' and v.category == 'apartment') then + if (apartment.rent( v.pos, player:get_player_name(), nil, player )) then + player:moveto( v.pos, false); + local meta = minetest.get_meta( v.pos ); + meta:set_string( 'formspec', apartment.get_formspec( v.pos, player )); + minetest.chat_send_player(player:get_player_name(),"Welcome to your new apartment. You can return here by saying '/aphome'") + break + end end end - end -end) + end) +end -- upon server start, read the savefile apartment.restore_data(); |