1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-01-12 02:28:02 +02:00

fixed issue where the tag window wouldn't open if a player had a custom tag.

Also implemented /tag
This commit is contained in:
Valansch 2017-07-21 01:29:49 +02:00
parent 8706bb6ce2
commit bbbcd5f38d
3 changed files with 72 additions and 86 deletions

View File

@ -140,7 +140,6 @@ expand_band_gui = function(player, dev_icons, dev_addfakes, right_click)
end
local player_role = player.tag:sub(2,-2)
-- Will be filled: { roleN = {{name,color},...} , ...}
local players_by_role = {}
@ -162,7 +161,7 @@ expand_band_gui = function(player, dev_icons, dev_addfakes, right_click)
else
for _, oplayer in pairs(game.connected_players) do
local prole = oplayer.tag:sub(2,-2)
if prole ~= "" then
if players_by_role[prole] ~= nil then
table.insert( players_by_role[prole], {oplayer.name, oplayer.color})
end
end
@ -311,43 +310,6 @@ local function update_player_role(player, role)
global.update_player_name.tag = ""
end
-- update other player gui (counter & label)
--[[
for _,cplayer in pairs( game.connected_players ) do
if cplayer.gui.left.band_panel then
local troles = cplayer.gui.left.band_panel.scroll.table_roles
if local_role then
local player_label = troles.children[roles[local_role].index*2]["list_players_" .. cplayer.name]
if player_label then
player_label.destroy()
end
end
if global.update_player_role_name then
subgui_add_player_label( troles.children[roles[global.update_player_role_name].index*2], cplayer.name, cplayer.color)
subgui_update_role_counter( troles.children[roles[global.update_player_role_name].index*2 - 1].role_cap_line, 1)
end
if local_role then
subgui_update_role_counter( troles.children[roles[local_role].index*2 - 1].role_cap_line, -1)
end
end
end
-- update local player gui (role label color)
local troles_local = player.gui.left.band_panel.scroll.table_roles
if local_role then
troles_local.children[roles[local_role].index*2 - 1].children[2].children[1].style.font_color = {r=1,g=1,b=1}
end
if global.update_player_role_name then
troles_local.children[roles[global.update_player_role_name].index*2 - 1].children[2].children[1].style.font_color = {r=.7,g=1,b=.7}
end
--]]
print_role_change(global.update_player_name.name, global.update_player_role_name)
expand_band_gui(player)
expand_band_gui(player)
@ -380,7 +342,6 @@ local function on_gui_click(event)
player.gui.top.band_toggle_btn.caption = "Tag"
player.gui.top.band_toggle_btn.tooltip = ""
player.gui.top.band_toggle_btn.sprite = ""
-- expand_band_gui(player)
return
end

View File

@ -12,6 +12,10 @@ Event.register(-1, function()
}
global.scenario.variables.regulars = {
helpower2 = "",
rorror = "",
Medival3 = "",
dpoba = "",
settdigger = ""
}
global.scenario.variables.player_positions = {}
global.scenario.variables.player_walk_distances = {}

View File

@ -242,6 +242,26 @@ local function afk()
end
end
local function tag(cmd)
if not game.player.admin then
cant_run(cmd.name)
return
end
local params = {}
for param in string.gmatch(cmd.parameter, "%w+") do table.insert(params, param) end
if #params ~= 2 then
game.player.print("Two arguments expect failed. Usage: <player> <tag> Sets a players tag.")
elseif game.players[params[1]] == nil then
game.player.print("Player does not exist.")
else
game.players[params[1]].tag = "[" .. params[2] .. "]"
game.print(params[1] .. " joined [" .. params[2] .. "].")
end
end
commands.add_command("kill", "Will kill you.", kill)
commands.add_command("detrain", "<player> - Kicks the player off a train. (Admins and moderators)", detrain)
commands.add_command("tpplayer", "<player> - Teleports you to the player. (Admins and moderators)", teleport_player)
@ -256,3 +276,4 @@ commands.add_command("regular", '<promote, demote>, <player> Change regular stat
commands.add_command("mods", 'Prints a list of game mods.', print_mods)
commands.add_command("mod", '<promote, demote>, <player> Changes moderator status of a player. (Admins only)', mod)
commands.add_command("afktime", 'Shows how long players have been afk.', afk)
commands.add_command("tag", '<player> <tag> Sets a players tag. (Admins only)', tag)