From 8d0bf3614287496374a4464d4095bc8e6cbb6354 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 31 May 2019 17:34:02 +0100 Subject: [PATCH 1/7] Fixed hiding action bar when player offline --- modules/gui/player-list.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/gui/player-list.lua b/modules/gui/player-list.lua index 73fa7671..186d6317 100644 --- a/modules/gui/player-list.lua +++ b/modules/gui/player-list.lua @@ -203,6 +203,7 @@ local function update_action_bar(player) if not action_player.connected then element.visible = false Store.set(action_player_store,player.name) -- clears store if player is offline + Store.set_child(action_name_store,player.name) else element.visible = true for action_name,buttons in pairs(config) do @@ -325,11 +326,13 @@ Store.register(action_name_store,function(value,category) local frame = Gui.classes.left_frames.get_frame(player_list_name,player) local element = frame.container.reason_bar if value then - local action_player = Game.get_player_from_any(value) + local action_player_name = Store.get_child(action_player_store,category) + local action_player = Game.get_player_from_any(action_player_name) if action_player.connected then element.visible = true else - Store.set_child(action_name_store,category) -- clears store if player is offline + Store.set_child(action_player_store,category) -- clears store if player is offline + Store.set_child(action_name_store,category) end else element.visible = false From 4cdb50de2d47215e267d57379a8800d71037c027 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 31 May 2019 18:23:13 +0100 Subject: [PATCH 2/7] Fixed player list all showing same percentage --- modules/gui/player-list.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/gui/player-list.lua b/modules/gui/player-list.lua index 186d6317..e5a90bab 100644 --- a/modules/gui/player-list.lua +++ b/modules/gui/player-list.lua @@ -306,7 +306,7 @@ end) if time_element and time_element.valid then time_element.label.caption = format_time(next_player.online_time) local tick = game.tick > 0 and game.tick or 1 - local percent = math.round(player.online_time/tick,3)*100 + local percent = math.round(next_player.online_time/tick,3)*100 time_element.label.tooltip = {'player-list.afk-time',percent,format_time(player.afk_time,{minutes=true,long=true})} end end From 27891eebcea7dbfe25314f0dba2b0e7027a41cfe Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 31 May 2019 18:28:02 +0100 Subject: [PATCH 3/7] Fixed mods not being able to clear tags --- config/roles.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/roles.lua b/config/roles.lua index ebc40583..83f5d728 100644 --- a/config/roles.lua +++ b/config/roles.lua @@ -70,7 +70,7 @@ Roles.new_role('Moderator','Mod') 'command/unassign-role', 'command/repair', 'command/kill/always', - 'command/tag-clear/always', + 'command/clear-tag/always', 'command/go-to-spawn/always', 'command/clear-reports', 'command/clear-warnings', From be0be285fa1b14d7010da36dbcec4480475f3e40 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 31 May 2019 18:44:02 +0100 Subject: [PATCH 4/7] Added rmb for player list names --- modules/gui/player-list.lua | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/modules/gui/player-list.lua b/modules/gui/player-list.lua index e5a90bab..74af9f89 100644 --- a/modules/gui/player-list.lua +++ b/modules/gui/player-list.lua @@ -16,8 +16,20 @@ local zoom_to_map_name = Gui.uid_name() Gui.on_click(zoom_to_map_name,function(event) local action_player_name = event.element.caption local action_player = Game.get_player_from_any(action_player_name) - local position = action_player.position - event.player.zoom_to_world(position,2) + if event.button == defines.mouse_button_type.left then + -- lmb will zoom to map + local position = action_player.position + event.player.zoom_to_world(position,2) + else + -- rmb will open settings + local player_name = event.player.name + local old_action_player_name = Store.get_child(action_player_store,player_name) + if action_player_name == old_action_player_name then + Store.set_child(action_player_store,player_name) -- will close if already open + else + Store.set_child(action_player_store,player_name,action_player_name) + end + end end) --- Button used to open the action bar @@ -34,7 +46,13 @@ end) style.height = 14 end) :on_click(function(player,element) - Store.set_child(action_player_store,player.name,element.parent.name) + local new_action_player_name = element.parent.name + local action_player_name = Store.get_child(action_player_store,player.name) + if action_player_name == new_action_player_name then + Store.set_child(action_player_store,player.name) -- will close if already open + else + Store.set_child(action_player_store,player.name,element.parent.name) + end end) --- Button used to close the action bar From 60b0f1bad7f9b3144d48e076f62327984aa8246c Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 31 May 2019 18:48:52 +0100 Subject: [PATCH 5/7] Fixed afk time on player list --- modules/gui/player-list.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/gui/player-list.lua b/modules/gui/player-list.lua index 74af9f89..754370cb 100644 --- a/modules/gui/player-list.lua +++ b/modules/gui/player-list.lua @@ -325,7 +325,7 @@ end) time_element.label.caption = format_time(next_player.online_time) local tick = game.tick > 0 and game.tick or 1 local percent = math.round(next_player.online_time/tick,3)*100 - time_element.label.tooltip = {'player-list.afk-time',percent,format_time(player.afk_time,{minutes=true,long=true})} + time_element.label.tooltip = {'player-list.afk-time',percent,format_time(next_player.afk_time,{minutes=true,long=true})} end end end) From d8e509af20cf0e36404d73bab4fa55fe22f024f1 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 31 May 2019 18:59:37 +0100 Subject: [PATCH 6/7] Changed new tasks not to say test --- modules/gui/task-list.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/gui/task-list.lua b/modules/gui/task-list.lua index abfe3a82..d6b291d7 100644 --- a/modules/gui/task-list.lua +++ b/modules/gui/task-list.lua @@ -41,7 +41,7 @@ local function add_task(player,task_number) editing={[player.name]=true} } - Store.set_child(task_store,task_id,'test') + Store.set_child(task_store,task_id,'New task') end --- Removes all refrences to a task From 4f6f9d962b80b35dcebc6c99185d2ff5c13d7f3f Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 31 May 2019 20:06:26 +0100 Subject: [PATCH 7/7] Player list size fixed --- modules/gui/player-list.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/gui/player-list.lua b/modules/gui/player-list.lua index 754370cb..2666422e 100644 --- a/modules/gui/player-list.lua +++ b/modules/gui/player-list.lua @@ -122,7 +122,7 @@ local function generate_container(player,element) } Gui.set_padding(list_scroll,1,1,2,2) list_scroll.style.horizontally_stretchable = true - list_scroll.style.maximal_height = 200 + list_scroll.style.maximal_height = 188 -- 3 wide table to contain: action button, player name, and play time local list_table = @@ -279,6 +279,8 @@ local function add_fake_players(list_table,count) for i = 1,count do add_player(list_table,{ name='Player '..i, + index=0-i, + tag='', online_time=math.random(0,game.tick), afk_time=math.random(0,game.tick), chat_color=table.get_random_dictionary_entry(Colors) @@ -314,6 +316,7 @@ Gui.new_left_frame('gui/player-list') end end + --add_fake_players(list_table,6) --add_fake_players(list_table,20) end) :on_update(function(player,element)