1 function elidragon.set_birthday(player, birthday)
2 player:get_meta():set_string("elidragon:birthday", birthday)
5 function elidragon.get_birthday(player)
6 return player:get_meta():get_string("elidragon:birthday")
9 function elidragon.flower_rain(name)
10 local player = minetest.get_player_by_name(name)
11 if not player then return end
12 local pos = player:get_pos()
13 minetest.add_particlespawner({
16 minpos = vector.add(pos, {x = -1, y = 2, z = -1}),
17 maxpos = vector.add(pos, {x = 1, y = 3, z = 1}),
18 minvel = {x=0, y=0, z=0},
19 maxvel = {x=0, y=0, z=0},
20 minacc = {x=0, y=-8, z=0},
21 maxacc = {x=0, y=-8, z=0},
26 collisiondetection = true,
28 texture = "flowers_rose.png",
30 minetest.after(0.5, function() elidragon.flower_rain(name) end)
32 minetest.register_on_joinplayer(function(player)
33 local name = player:get_player_name()
34 if elidragon.get_birthday(player) == os.date("%d/%m") then
35 minetest.chat_send_all(minetest.colorize("#FF20FF", name .. " has joined the game. Today is their birthday!"))
36 elidragon.flower_rain(name)
38 hud_elem_type = "text",
39 position = {x = 1, y = 0},
40 offset = {x = -5, y = 5},
41 text = "Happy Birthday!",
42 alignment = {x = -1, y = 1},
43 scale = {x = 100, y = 100},
48 minetest.register_chatcommand("birthday", {
49 description = "Set your birthday (e.g. 07/09 if your birthday is the seventh of september)",
51 func = function(name, param)
52 local player = minetest.get_player_by_name(name)
53 if not player then return false, "You need to be online to use this command." end
54 elidragon.set_birthday(player, param)
55 return true, "Birthday set to " .. param