1 elidragon.savedata.birthday = elidragon.savedata.birthday or {}
3 function elidragon.set_birthday(player, birthday)
4 player:get_meta():set_string("elidragon:birthday", birthday)
7 function elidragon.get_birthday(player)
8 local name = player:get_player_name()
9 local birthday = player:get_meta():get_string("elidragon:birthday")
10 if birthday == "" then
11 birthday = elidragon.savedata.birthday[name]
13 elidragon.savedata.birthday[name] = nil
14 elidragon.set_birthday(player, birthday)
20 function elidragon.flower_rain(name)
21 local player = minetest.get_player_by_name(name)
22 if not player then return end
23 local pos = player:get_pos()
24 minetest.add_particlespawner({
27 minpos = vector.add(pos, {x = -1, y = 2, z = -1}),
28 maxpos = vector.add(pos, {x = 1, y = 3, z = 1}),
29 minvel = {x=0, y=0, z=0},
30 maxvel = {x=0, y=0, z=0},
31 minacc = {x=0, y=-8, z=0},
32 maxacc = {x=0, y=-8, z=0},
37 collisiondetection = true,
39 texture = "flowers_rose.png",
41 minetest.after(0.5, function() elidragon.flower_rain(name) end)
43 minetest.register_on_joinplayer(function(player)
44 local name = player:get_player_name()
45 if elidragon.get_birthday(player) == os.date("%d/%m") then
46 minetest.chat_send_all(minetest.colorize("#FF20FF", name .. " has joined the game. Today is their birthday!"))
47 elidragon.flower_rain(name)
49 hud_elem_type = "text",
50 position = {x = 1, y = 0},
51 offset = {x = -5, y = 5},
52 text = "Happy Birthday!",
53 alignment = {x = -1, y = 1},
54 scale = {x = 100, y = 100},
59 minetest.register_chatcommand("birthday", {
60 description = "Set your birthday (e.g. 07/09 if your birthday is the seventh of september)",
62 func = function(name, param)
63 local player = minetest.get_player_by_name(name)
64 if not player then return false, "You need to be online to use this command." end
65 elidragon.set_birthday(player, param)
66 return true, "Birthday set to " .. param