2020-10-20 05:13:42 -07:00
local S = minetest.get_translator ( " hades_greeting " )
2017-12-22 18:00:24 -08:00
-- Show simple greeting message for new players.
-- Currently only uses the chat.
-- TODO: Think of some better way to do this which doesn't use the chat
2020-10-20 03:38:36 -07:00
local COLOR = " #00FF00 "
2021-07-12 08:52:34 -07:00
local msg = function ( pname , message , color )
if not color then
color = COLOR
end
minetest.chat_send_player ( pname , minetest.colorize ( color , message ) )
2020-10-20 03:38:36 -07:00
end
2017-12-22 18:00:24 -08:00
minetest.register_on_newplayer ( function ( player )
2021-07-09 07:49:34 -07:00
if not minetest.settings : get_bool ( " hades_greeting " , true ) then
return
end
2017-12-22 18:00:24 -08:00
local cb = function ( player )
2020-07-24 03:41:33 -07:00
if ( not player ) or ( not player : is_player ( ) ) then
return
end
local pname = player : get_player_name ( )
2020-10-20 03:38:36 -07:00
minetest.sound_play ( { name = " hades_greeting_message " } , { to_player = pname , gain = 1.0 } )
2020-11-06 15:34:01 -08:00
if minetest.is_creative_enabled ( pname ) then
2020-10-20 05:13:42 -07:00
msg ( pname , S ( " Welcome to planet Hades! " ) )
msg ( pname , S ( " Creative Mode is active. You have unlimited supplies. " ) )
msg ( pname , S ( " Create the buildings of your dreams and have fun! <END OF TRANSMISSION> " ) )
2017-12-22 18:00:24 -08:00
else
2020-10-20 05:13:42 -07:00
msg ( pname , S ( " You have stranded on planet Hades. " ) )
msg ( pname , S ( " Search for some water. Lay down fertile sand next to the water and it will soon turn into dirt. Use the crafting guide to see what you can craft. " ) )
msg ( pname , S ( " Survive and build a nice habitable place! " ) )
msg ( pname , S ( " Good luck! <END OF TRANSMISSION> " ) )
2017-12-22 18:00:24 -08:00
end
end
2020-10-20 03:38:36 -07:00
minetest.after ( 3.0 , cb , player )
2017-12-22 18:00:24 -08:00
end )
2021-07-12 08:52:34 -07:00
-- Also add a warning about alpha version status
minetest.register_on_joinplayer ( function ( player )
if not minetest.settings : get_bool ( " hades_greeting " , true ) then
return
end
local color = " #FF8000 "
local pname = player : get_player_name ( )
msg ( pname , S ( " Hades Revisited is a very incomplete game, so expect bugs, chaos, ugliness, broken gameplay, and worse. " ) , color )
msg ( pname , S ( " That having said, have fun playtesting, and please report bugs to Wuzzy. " ) , color )
end )