Added playerlist, several fixes and ajustments.
parent
ed09d01004
commit
37a79426ca
2
init.lua
2
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")
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
|
@ -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,
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue