elidragon.savedata.birthday = elidragon.savedata.birthday or {}
+
+function elidragon.set_birthday(player, birthday)
+ player:get_meta():set_string("elidragon:birthday", birthday)
+end
+
+function elidragon.get_birthday(player)
+ local name = player:get_player_name()
+ local birthday = player:get_meta():get_string("elidragon:birthday")
+ if birthday == "" then
+ birthday = elidragon.savedata.birthday[name]
+ if birthday then
+ elidragon.savedata.birthday[name] = nil
+ elidragon.set_birthday(player, birthday)
+ end
+ end
+ return birthday
+end
+
function elidragon.flower_rain(name)
local player = minetest.get_player_by_name(name)
- if not player then
- return
- end
+ if not player then return end
local pos = player:get_pos()
minetest.add_particlespawner({
amount = 50,
minetest.after(0.5, function() elidragon.flower_rain(name) end)
end
minetest.register_on_joinplayer(function(player)
- local name = player:get_player_name()
- if elidragon.savedata.birthday[name] == os.date("%d/%m") then
+ if elidragon.get_birthday(player) == os.date("%d/%m") then
minetest.chat_send_all(minetest.colorize("#FF20FF", name .. " has joined the game. Today is their birthday!"))
elidragon.flower_rain(name)
player:hud_add({
description = "Set your birthday (e.g. 07/09 if your birthday is the seventh of september)",
param = "DD/MM",
func = function(name, param)
- elidragon.savedata.birthday[name] = param
- minetest.chat_send_player(name, "Birthday set to " .. param)
+ local player = minetest.get_player_by_name(name)
+ if not player then return false, "You need to be online to use this command." end
+ elidragon.set_birthday(player, param)
+ return true, "Birthday set to " .. param
end
})
elidragon.savedata.spawns = elidragon.savedata.spawns or elidragon.skyblock.load_legacy_spawns() or {}
-
--- level
---[[
-minetest.register_chatcommand("level", {
- description = "Get/set the current level of a player",
- params = "<player> [<level>]",
- func = function(name, param)
- local target = param:split(" ")[1]
- local level = tonumber(param:split(" ")[2])
- if not level then
- minetest.chat_send_player(name, target .. " is on level " .. elidragon.skyblock.get_level(target))
- elseif minetest.check_player_privs(name, {server = true}) and elidragon.skyblock.set_level(target, level) then
- minetest.chat_send_player(name, target .. " has been set to level " .. level)
- else
- minetest.chat_send_player(name, "Cannot change " .. target .. " to level " .. level)
- end
- end,
-})
-]]--
-
-- node
minetest.register_node("elidragon:skyblock", {
local node
if oldnode.name == "default:lava_source" then
node = "default:obsidian"
- elseif math.random() < 0.001 then
+ elseif math.random() < 0.0001 then
node = "moreores:mineral_mithril"
- elseif math.random() < 0.003 then
+ elseif math.random() < 0.0003 then
node = "default:stone_with_diamond"
- elseif math.random() < 0.005 then
+ elseif math.random() < 0.0005 then
node = "default:stone_with_mese"
- elseif math.random() < 0.01 then
+ elseif math.random() < 0.001 then
node = "default:stone_with_gold"
- elseif math.random() < 0.01 then
+ elseif math.random() < 0.001 then
node = "technic:mineral_chromium"
- elseif math.random() < 0.01 then
+ elseif math.random() < 0.001 then
node = "technic:mineral_zinc"
- elseif math.random() < 0.012 then
+ elseif math.random() < 0.0012 then
node = "technic:mineral_uranium"
- elseif math.random() < 0.015 then
+ elseif math.random() < 0.0015 then
node = "default:stone_with_tin"
- elseif math.random() < 0.02 then
+ elseif math.random() < 0.002 then
node = "default:stone_with_copper"
- elseif math.random() < 0.025 then
+ elseif math.random() < 0.0025 then
node = "technic:mineral_sulfur"
- elseif math.random() < 0.033 then
+ elseif math.random() < 0.0033 then
node = "default:stone_with_iron"
- elseif math.random() < 0.04 then
+ elseif math.random() < 0.004 then
node = "moreores:mineral_silver"
- elseif math.random() < 0.045 then
+ elseif math.random() < 0.0045 then
node = "technic:mineral_lead"
- elseif math.random() < 0.05 then
+ elseif math.random() < 0.005 then
node = "default:stone_with_coal"
else
node = "default:stone"
if stree ~= tree then
items[#items + 1] = {
items = {stree .. "sapling"},
- rarity = 1000,
+ rarity = 10000,
}
end
end