Greeting message sound

master
Wuzzy 2020-10-20 12:38:36 +02:00
parent a5820a53b5
commit 88d4bee91d
3 changed files with 28 additions and 8 deletions

View File

@ -0,0 +1,13 @@
This mod generates the greeting message for new players.
Credits:
Code:
* by Wuzzy
* License: CC0 <https://creativecommons.org/publicdomain/zero/1.0/>
Sounds:
hades_greeting_message.ogg
* licensed CC0
* Source: https://freesound.org/people/jotliner/sounds/200813/

View File

@ -3,22 +3,29 @@
-- TODO: Think of some better way to do this which doesn't use the chat
local COLOR = "#00FF00"
local msg = function(pname, message)
minetest.chat_send_player(pname, minetest.colorize(COLOR, message))
end
minetest.register_on_newplayer(function(player)
local cb = function(player)
if (not player) or (not player:is_player()) then
return
end
local pname = player:get_player_name()
minetest.sound_play({name="hades_greeting_message"}, {to_player=pname, gain=1.0})
if minetest.settings:get_bool("creative_mode") then
minetest.chat_send_player(pname, "Welcome to planet Hades!")
minetest.chat_send_player(pname, "Creative Mode is active. You have unlimited supplies.")
minetest.chat_send_player(pname, "Create the buildings of your dreams and have fun! <END OF TRANSMISSION>")
msg(pname, "Welcome to planet Hades!")
msg(pname, "Creative Mode is active. You have unlimited supplies.")
msg(pname, "Create the buildings of your dreams and have fun! <END OF TRANSMISSION>")
else
minetest.chat_send_player(pname, "You have stranded on planet Hades.")
minetest.chat_send_player(pname, "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.")
minetest.chat_send_player(pname, "Survive and build a nice habitable place!")
minetest.chat_send_player(pname, "Good luck! <END OF TRANSMISSION>")
msg(pname, "You have stranded on planet Hades.")
msg(pname, "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, "Survive and build a nice habitable place!")
msg(pname, "Good luck! <END OF TRANSMISSION>")
end
end
minetest.after(2.0, cb, player)
minetest.after(3.0, cb, player)
end)

Binary file not shown.