]> git.lizzy.rs Git - elidragon.git/commitdiff
Added playerlist, several fixes and ajustments.
authorElias Fleckenstein <eliasfleckenstein@web.de>
Sun, 10 May 2020 17:11:09 +0000 (19:11 +0200)
committerElias Fleckenstein <eliasfleckenstein@web.de>
Sun, 10 May 2020 17:11:09 +0000 (19:11 +0200)
init.lua
nodes.lua
playerlist.lua [new file with mode: 0644]
ranks.lua

index 337212beb9307a634dee45654ba5d308e64186d7..6c2649161080a02ea69a9c6310d2c4c706b1e6f9 100755 (executable)
--- a/init.lua
+++ b/init.lua
@@ -1,6 +1,6 @@
 elidragon = {}
 
-local modules = {"functions", "nodes", "commands", "ranks", "tags", "warps", "misc", "birthday", "skyblock"}
+local modules = {"functions", "nodes", "commands", "ranks", "tags", "warps", "misc", "birthday", "skyblock", "playerlist"}
 
 local modpath = minetest.get_modpath("elidragon")
 
index bc97e4668f683b7d3b6b18b3b764b624d56df69b..2bedc9ecce76faf745b545b1873910e35682a81b 100755 (executable)
--- a/nodes.lua
+++ b/nodes.lua
@@ -17,7 +17,7 @@ for _, def in pairs(nodes) do
     minetest.register_node(name, {
         description = def[1] .. " Block",
         tiles = {def[2]},
-        groups = {cracky = 3, stone = 1},
+               groups = {oddly_breakable_by_hand = 1, choppy = 1},
         stack_max = 1,
     })
     if def[3] then
diff --git a/playerlist.lua b/playerlist.lua
new file mode 100644 (file)
index 0000000..1f45483
--- /dev/null
@@ -0,0 +1,37 @@
+elidragon.playerlist = {}
+controls.register_on_press(function(player, key)
+       if key == "sneak" then
+               local name = player:get_player_name()
+               local list = {}
+               local players = minetest.get_connected_players()
+               for i, p in pairs(players) do
+                       local n = p:get_player_name()
+                       list[#list + 1] = player:hud_add({
+                               hud_elem_type = "text",
+                               position = {x = 1, y = 0},
+                               offset = {x = -50, y = 5 + (i - 1) * 18},
+                               text = n,
+                               alignment = {x = -1, y = 1},
+                               scale = {x = 100, y = 100},
+                               number = tonumber(elidragon.get_rank(n).color:gsub("#", ""), 16),
+                       })
+                       list[#list + 1] = player:hud_add({
+                               hud_elem_type = "image",
+                               position = {x = 1, y = 0},
+                               offset = {x = -5, y = (i - 1) * 18},
+                               text = "server_ping_" .. math.ceil(4 - minetest.get_player_information(n).avg_rtt / 2 * 4) .. ".png",
+                               alignment = {x = -1, y = 1},
+                               scale = {x = 1.5, y = 1.5},
+                               number = 0xFFFFFF,
+                       })
+               end
+               elidragon.playerlist[name] = list
+       end
+end)
+controls.register_on_release(function(player, key)
+       if key == "sneak" then
+               for _, id in pairs(elidragon.playerlist[player:get_player_name()]) do
+                       player:hud_remove(id)
+               end
+       end
+end)
index a56e6a471e20823f78b4103609a4a93bc2a90554..d61e1192d48746c148190ec24596d064a4370820 100755 (executable)
--- a/ranks.lua
+++ b/ranks.lua
@@ -109,6 +109,7 @@ minetest.register_chatcommand("rank", {
                if not rank_ref then 
             minetest.chat_send_player(name, "Invalid Rank: " .. rank)
         else
+                       elidragon.savedata.ranks[target] = rank
                        local privs = {}
                        for _, r in pairs(elidragon.ranks) do
                                for k, v in pairs(r.privs) do
@@ -119,10 +120,10 @@ minetest.register_chatcommand("rank", {
                                end
                        end
                        minetest.set_player_privs(target, privs)
+                       minetest.chat_send_all(target .. " is now a " .. minetest.colorize(rank_ref.color, rank_ref.name))
                        if target_ref then
                                target_ref:set_nametag_attributes({color = rank_ref.color})
                        end
-                       minetest.chat_send_all(target .. " is now a " .. minetest.colorize(rank_ref.color, rank_ref.name))
                end
        end,
 })