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 if elidragon.get_birthday(player) == os.date("%d/%m") then
45 minetest.chat_send_all(minetest.colorize("#FF20FF", name .. " has joined the game. Today is their birthday!"))
46 elidragon.flower_rain(name)
48 hud_elem_type = "text",
49 position = {x = 1, y = 0},
50 offset = {x = -5, y = 5},
51 text = "Happy Birthday!",
52 alignment = {x = -1, y = 1},
53 scale = {x = 100, y = 100},
58 minetest.register_chatcommand("birthday", {
59 description = "Set your birthday (e.g. 07/09 if your birthday is the seventh of september)",
61 func = function(name, param)
62 local player = minetest.get_player_by_name(name)
63 if not player then return false, "You need to be online to use this command." end
64 elidragon.set_birthday(player, param)
65 return true, "Birthday set to " .. param