From fdbe9b3290d67e207dbbf52c5bded736f7f827a4 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Sun, 31 May 2020 15:36:39 +0200 Subject: [PATCH] Addded Spirit --- init.lua | 2 +- spirit.lua | 54 ++++++++++++++++++++++-------------------------------- 2 files changed, 23 insertions(+), 33 deletions(-) diff --git a/init.lua b/init.lua index ecb1002..3530627 100755 --- a/init.lua +++ b/init.lua @@ -1,6 +1,6 @@ coronaserver = {} -local modules = {"functions", "privs", "ranks", "playerlist", "commands", "teamchat", "chest_control"} +local modules = {"functions", "privs", "ranks", "playerlist", "commands", "teamchat", "chest_control", "spirit"} for _, m in pairs(modules) do dofile(minetest.get_modpath("coronaserver") .. "/" .. m .. ".lua") diff --git a/spirit.lua b/spirit.lua index 15b66f3..946c595 100755 --- a/spirit.lua +++ b/spirit.lua @@ -1,47 +1,37 @@ -function coronaserver.flame(name) +local spirit = false +function coronaserver.spirit(name) local player = minetest.get_player_by_name(name) if not player then return end local pos = player:get_pos() minetest.add_particlespawner({ amount = 50, time = 2, - minpos = vector.add(pos, {x = -1, y = 2, z = -1}), - maxpos = vector.add(pos, {x = 1, y = 3, z = 1}), - minvel = {x=0, y=0, z=0}, - maxvel = {x=0, y=0, z=0}, - minacc = {x=0, y=-8, z=0}, - maxacc = {x=0, y=-8, z=0}, + minpos = vector.add(pos, {x = -0.1, y = 2, z = -0.1}), + maxpos = vector.add(pos, {x = 0.1, y = 3, z = 0.1}), + minvel = {x = -0.1, y = 0, z = -0.1}, + maxvel = {x = 0.1, y = 0, z = -0.1}, + minacc = {x = -0.1, y = 5, z = -0.1}, + maxacc = {x = 0.1, y = 7, z = 0.1}, minexptime = 0.7, maxexptime = 1, minsize = 5, - maxsize = 10, - collisiondetection = true, - vertical = true, - texture = "flowers_rose.png", + maxsize = 7, + collisiondetection = false, + vertical = false, + texture = "fire_basic_flame.png", }) - minetest.after(0.5, function() elidragon.flower_rain(name) end) + minetest.after(0.5, function() coronaserver.spirit(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 - minetest.chat_send_all(minetest.colorize("#FF20FF", name .. " has joined the game. Today is their birthday!")) - elidragon.flower_rain(name) - player:hud_add({ - hud_elem_type = "text", - position = {x = 1, y = 0}, - offset = {x = -5, y = 5}, - text = "Happy Birthday!", - alignment = {x = -1, y = 1}, - scale = {x = 100, y = 100}, - number = 0xFFF40A, - }) - end + if spirit then coronaserver.spirit(player:get_player_name()) end end) -minetest.register_chatcommand("birthday", { - 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) +minetest.register_chatcommand("spirit", { + privs = {server = true}, + func = function() + spirit = true + local players = minetest.get_connected_players() + for _, player in pairs(players) do + coronaserver.spirit(player:get_player_name()) + end end }) -- 2.44.0