diff --git a/band.lua b/band.lua index fd914d75..2a0f261f 100644 --- a/band.lua +++ b/band.lua @@ -32,7 +32,7 @@ local function create_band_gui(event) local player = game.players[event.player_index] global.band_last_change[event.player_index] = game.tick if player.gui.top.band_toggle_btn == nil then - local button = player.gui.top.add { name = "band_toggle_btn", type = "sprite-button", caption = "Tag", style = "dialog_button_style" } + local button = player.gui.top.add { name = "band_toggle_btn", type = "sprite-button", caption = "Tag" } button.style.font = "default-bold" button.style.minimal_height = 38 button.style.minimal_width = 38 @@ -123,7 +123,6 @@ end -- dev_icons(ctrl + click): show icon-choose buttons -- dev_addfakes(alt + click): add random number of player names w/ color expand_band_gui = function(player, dev_icons, dev_addfakes, right_click) - player.gui.left.direction = "horizontal" local frame = player.gui.left["band_panel"] if (frame) then frame.destroy() @@ -189,14 +188,13 @@ expand_band_gui = function(player, dev_icons, dev_addfakes, right_click) local button--reusable variable :D local frame = player.gui.left.add { type = "frame", direction = "vertical", name = "band_panel", caption = "Choose your role:"} - frame.style.font = "default-listbox" frame.style.font_color = { r=0.98, g=0.66, b=0.22} if dev_icons then local choose local chooselist = frame.add { type = "flow", direction = "horizontal" } -- ["signal"] = {type = "virtual", name = "signal-A"} - for itype, ivalue in pairs({["item"] = "green-wire", ["entity"] = "medium-spitter", ["tile"] = "grass"}) do + for itype, ivalue in pairs({["item"] = "green-wire", ["entity"] = "medium-spitter", ["tile"] = "concrete"}) do choose = chooselist.add { type = "choose-elem-button", elem_type = itype, [itype] = ivalue, name = "help_item_icon_choose_"..itype } choose.style.minimal_height = 36 choose.style.minimal_width = 36 @@ -212,7 +210,7 @@ expand_band_gui = function(player, dev_icons, dev_addfakes, right_click) scroll.style.minimal_width = 250 scroll.style.bottom_padding = 10 - local table_roles = scroll.add{type = "table", name = "table_roles", colspan = 2} + local table_roles = scroll.add{type = "table", name = "table_roles", column_count = 2} table_roles.style.horizontal_spacing = 15 table_roles.style.vertical_spacing = 4 @@ -227,17 +225,19 @@ expand_band_gui = function(player, dev_icons, dev_addfakes, right_click) local role_line = table_roles.add { type = "flow", direction = "horizontal" } - button = role_line.add { type = "sprite-button", sprite = get_random_from_table(role_icons), name = "band_role_"..role, style = "recipe_slot_button_style"} + button = role_line.add { type = "sprite-button", sprite = get_random_from_table(role_icons), name = "band_role_"..role} button.style.top_padding = 4 - button.style.left_padding = 0 - button.style.right_padding = 0 + button.style.left_padding = 4 + button.style.right_padding = 4 button.style.bottom_padding = 4 + button.style.width = 40 + button.style.height = 40 if show_role_tooltip and role_icons.tooltip then button.tooltip = get_random_from_table( role_icons.tooltip ) end local role_cap_line = role_line.add { type = "flow", name = "role_cap_line", direction = "horizontal" } - role_cap_line.style.max_on_row = 1 +-- role_cap_line.style.max_on_row = 1 local role_label = role_cap_line.add { type = "label", caption = role, single_line = true} -- role_label.style.minimal_width = 0 @@ -255,7 +255,7 @@ expand_band_gui = function(player, dev_icons, dev_addfakes, right_click) subgui_update_role_counter(role_cap_line, #players_by_role[role]) local list_players = table_roles.add { type = "flow", direction = "horizontal" } - list_players.style.max_on_row = 3 +-- list_players.style.max_on_row = 3 list_players.style.top_padding = 0 list_players.style.bottom_padding = 7 diff --git a/info.lua b/info.lua index f4fca002..25e6feef 100644 --- a/info.lua +++ b/info.lua @@ -32,15 +32,13 @@ And this is what you ought to know: Paypal: paypal.me/jsuesse ]===] - player.gui.left.direction = "horizontal" local frame = player.gui.left.add { type = "frame", name = "info_panel"} frame.style.top_padding = 20 frame.style.left_padding = 20 frame.style.right_padding = 20 frame.style.bottom_padding = 20 - local info_table = frame.add { type = "table", colspan = 1, name = "info_table" } + local info_table = frame.add { type = "table", column_count = 1, name = "info_table" } local headline_label = info_table.add { type = "label", name = "headline_label", caption = "redmew fishy info" } - headline_label.style.font = "default-listbox" headline_label.style.font_color = { r=0.98, g=0.66, b=0.22} @@ -53,10 +51,9 @@ And this is what you ought to know: text_box.style.left_padding = 5 text_box.style.bottom_padding = 5 - local info_table_2 = info_table.add { type = "table", colspan = 2, name = "info_table" } + local info_table_2 = info_table.add { type = "table", column_count = 2, name = "info_table" } info_table_2.add { type = "label", caption = " " } local close_button = info_table_2.add { type = "button", caption = "CLOSE", name = "info_close_button" } - close_button.style.font = "default-listbox" end diff --git a/locale/utils/game-info.lua b/locale/utils/game-info.lua index aa3b70e4..ed97eaf0 100644 --- a/locale/utils/game-info.lua +++ b/locale/utils/game-info.lua @@ -22,9 +22,9 @@ local FRAME_TABS = { -- Static Content local CONTENT = { - rules = {""}, - comm = {""}, - resources = {""}, + rules = {""}, + comm = {""}, + resources = {""}, about = {""} } @@ -158,21 +158,21 @@ end -- @param container - gui element to add to function draw_players(container) GUI.clear_element(container) -- Clear the current info before adding new - + local table_name = "tbl_readme_players" container.add {type = "label", name = "lbl_player_tile", caption = "=== ALL TIME PLAYERS ==="} - container.add {type = "table", name = table_name, colspan = 2} + container.add {type = "table", name = table_name, column_count = 2} container[table_name].style.minimal_width = 500 container[table_name].style.maximal_width = 500 container[table_name].add {type = "label", name = "lbl_hours", caption = "Time (h:m)"} container[table_name].add {type = "label", name = "lbl_name", caption = "Name"} - + -- Copy player list into local list local player_list = {} for i, player in pairs(game.players) do table.insert(player_list, {name = player.name, online_time = player.online_time}) end - + -- Sort players based on time played table.sort( player_list, @@ -180,7 +180,7 @@ function draw_players(container) return a.online_time > b.online_time end ) - + -- Add in gui list for i, player in pairs(player_list) do local total_min = Time.tick_to_min(player.online_time) diff --git a/player_list.lua b/player_list.lua index a3139d72..e0edb267 100644 --- a/player_list.lua +++ b/player_list.lua @@ -182,11 +182,9 @@ local function get_sorted_list(sort_by) end local function player_list_show(player, sort_by) - local frame = player.gui.left["player-list-panel"] if frame then frame.destroy() end - player.gui.left.direction = "horizontal" local frame = player.gui.left.add { type = "frame", name = "player-list-panel", direction = "vertical" } frame.style.minimal_width = 650 frame.style.top_padding = 8 @@ -195,7 +193,7 @@ local function player_list_show(player, sort_by) frame.style.bottom_padding = 8 - local player_list_panel_header_table = frame.add { type = "table", name = "player_list_panel_header_table", colspan = 7 } + local player_list_panel_header_table = frame.add { type = "table", name = "player_list_panel_header_table", column_count = 7 } local label = player_list_panel_header_table.add { type = "label", name = "player_list_panel_header_1", caption = " " .. #game.connected_players } label.style.font = "default-game" @@ -206,7 +204,6 @@ local function player_list_show(player, sort_by) if sort_by == "name_asc" then str = symbol_asc .. " " end if sort_by == "name_desc" then str = symbol_desc .. " " end local label = player_list_panel_header_table.add { type = "label", name = "player_list_panel_header_2", caption = str .. "Players online" } - label.style.font = "default-listbox" label.style.font_color = { r=0.98, g=0.66, b=0.22} label.style.minimal_width = 160 label.style.maximal_width = 160 @@ -215,7 +212,6 @@ local function player_list_show(player, sort_by) if sort_by == "time_played_asc" then str = symbol_asc .. " " end if sort_by == "time_played_desc" then str = symbol_desc .. " " end local label = player_list_panel_header_table.add { type = "label", name = "player_list_panel_header_3", caption = str .. "Time" } - label.style.font = "default-listbox" label.style.font_color = { r=0.98, g=0.66, b=0.22} label.style.minimal_width = 130 label.style.maximal_width = 130 @@ -225,7 +221,6 @@ local function player_list_show(player, sort_by) if sort_by == "distance_asc" then str = symbol_asc .. " " end if sort_by == "distance_desc" then str = symbol_desc .. " " end local label = player_list_panel_header_table.add { type = "label", name = "player_list_panel_header_4", caption = str .. "Walked" } - label.style.font = "default-listbox" label.style.font_color = { r=0.98, g=0.66, b=0.22} label.style.minimal_width = 100 label.style.maximal_width = 100 @@ -234,7 +229,6 @@ local function player_list_show(player, sort_by) if sort_by == "fish_asc" then str = symbol_asc .. " " end if sort_by == "fish_desc" then str = symbol_desc .. " " end local label = player_list_panel_header_table.add { type = "label", name = "player_list_panel_header_fish", caption = str .. "Fish" } - label.style.font = "default-listbox" label.style.font_color = { r=0.98, g=0.66, b=0.22} label.style.minimal_width = 80 label.style.maximal_width = 80 @@ -243,7 +237,6 @@ local function player_list_show(player, sort_by) if sort_by == "deaths_asc" then str = symbol_asc .. " " end if sort_by == "deaths_desc" then str = symbol_desc .. " " end local label = player_list_panel_header_table.add { type = "label", name = "player_list_panel_header_deaths", caption = str .. "Deaths" } - label.style.font = "default-listbox" label.style.font_color = { r=0.98, g=0.66, b=0.22} label.style.minimal_width = 80 label.style.maximal_width = 80 @@ -252,7 +245,6 @@ local function player_list_show(player, sort_by) if sort_by == "pokes_asc" then str = symbol_asc .. " " end if sort_by == "pokes_desc" then str = symbol_desc .. " " end local label = player_list_panel_header_table.add { type = "label", name = "player_list_panel_header_5", caption = str .. "Poke" } - label.style.font = "default-listbox" label.style.font_color = { r=0.98, g=0.66, b=0.22} label.style.minimal_width = 35 @@ -260,7 +252,7 @@ local function player_list_show(player, sort_by) player_list_panel_table.style.maximal_height = 650 - player_list_panel_table = player_list_panel_table.add { type = "table", name = "player_list_panel_table", colspan = 7 } + player_list_panel_table = player_list_panel_table.add { type = "table", name = "player_list_panel_table", column_count = 7 } local player_list = get_sorted_list(sort_by) diff --git a/poll.lua b/poll.lua index 1b401fa1..e952292a 100644 --- a/poll.lua +++ b/poll.lua @@ -20,10 +20,9 @@ end local function poll_show(player) - player.gui.left.direction = "horizontal" local frame = player.gui.left.add { type = "frame", name = "poll-panel", direction = "vertical" } - frame.add { type = "table", name = "poll_panel_table", colspan = 2 } + frame.add { type = "table", name = "poll_panel_table", column_count = 2 } local poll_panel_table = frame.poll_panel_table @@ -68,12 +67,11 @@ local function poll_show(player) answer_label.style.font = "default" local answerbutton = poll_panel_table.add { type = "button", caption = global.poll_button_votes[y], name = "answer_button_" .. z } - answerbutton.style.font = "default-listbox" end y = y + 1 end - frame.add { type = "table", name = "poll_panel_button_table", colspan = 3 } + frame.add { type = "table", name = "poll_panel_button_table", column_count = 3 } local poll_panel_button_table = frame.poll_panel_button_table poll_panel_button_table.add { type = "button", caption = "New Poll", name = "new_poll_assembler_button" } @@ -187,7 +185,7 @@ end local function poll_assembler(player) local frame = player.gui.left.add { type = "frame", name = "poll-assembler", caption = "" } - local frame_table = frame.add { type = "table", name = "table_poll_assembler", colspan = 2 } + local frame_table = frame.add { type = "table", name = "table_poll_assembler", column_count = 2 } frame_table.add { type = "label", caption = "Question:" } frame_table.add { type = "textfield", name = "textfield_question", text = "" } frame_table.add { type = "label", caption = "Answer #1:" } diff --git a/score.lua b/score.lua index 936a99d0..af1e161d 100644 --- a/score.lua +++ b/score.lua @@ -2,9 +2,9 @@ if not global.score_rockets_launched then global.score_rockets_launched = 0 end local function create_score_gui(event) local player = game.players[event.player_index] - + if player.gui.top.score == nil then - local button = player.gui.top.add({ type = "sprite-button", name = "score", sprite = "item/rocket-silo" }) + local button = player.gui.top.add({ type = "sprite-button", name = "score", sprite = "item/rocket-silo" }) button.style.minimal_height = 38 button.style.minimal_width = 38 button.style.top_padding = 2 @@ -16,13 +16,13 @@ end function refresh_score() local x = 1 - while (game.players[x] ~= nil) do + while (game.players[x] ~= nil) do local player = game.players[x] - local frame = player.gui.top["score_panel"] - - if (frame) then + local frame = player.gui.top["score_panel"] + + if (frame) then frame.score_table.label_rockets_launched.caption = "Rockets launched: " .. global.score_rockets_launched - frame.score_table.label_biters_killed.caption = "Biters liberated: " .. global.score_biter_total_kills + frame.score_table.label_biters_killed.caption = "Biters liberated: " .. global.score_biter_total_kills -- frame.score_table.label_score_polls_created.caption = "Polls created: " .. global.score_total_polls_created end x = x + 1 @@ -34,46 +34,46 @@ local function score_show(player) local rocket_score_value_string = tostring(global.score_rockets_launched) local frame = player.gui.top.add { type = "frame", name = "score_panel" } - - local score_table = frame.add { type = "table", colspan = 5, name = "score_table" } - local label = score_table.add { type = "label", caption = "", name = "label_rockets_launched" } - label.style.font = "default-bold" + + local score_table = frame.add { type = "table", column_count = 5, name = "score_table" } + local label = score_table.add { type = "label", caption = "", name = "label_rockets_launched" } + label.style.font = "default-bold" label.style.font_color = { r=0.98, g=0.66, b=0.22} label.style.top_padding = 2 label.style.left_padding = 4 label.style.right_padding = 4 - - score_table.add { type = "label", caption = "|"} - - local label = score_table.add { type = "label", caption = "", name = "label_biters_killed" } - label.style.font = "default-bold" + + score_table.add { type = "label", caption = "|"} + + local label = score_table.add { type = "label", caption = "", name = "label_biters_killed" } + label.style.font = "default-bold" label.style.font_color = { r=0.98, g=0.11, b=0.11} label.style.top_padding = 2 label.style.left_padding = 4 label.style.right_padding = 4 ---[[ +--[[ if global.score_total_polls_created then - score_table.add { type = "label", caption = "|"} - - local label = score_table.add { type = "label", caption = "", name = "label_score_polls_created" } - label.style.font = "default-bold" + score_table.add { type = "label", caption = "|"} + + local label = score_table.add { type = "label", caption = "", name = "label_score_polls_created" } + label.style.font = "default-bold" label.style.font_color = { r=0.80, g=0.80, b=0.80} label.style.top_padding = 2 label.style.left_padding = 4 label.style.right_padding = 4 end ---]] +--]] refresh_score() end local function on_gui_click(event) if not (event and event.element and event.element.valid) then return end - + local player = game.players[event.element.player_index] - local name = event.element.name - local frame = player.gui.top["score_panel"] - + local name = event.element.name + local frame = player.gui.top["score_panel"] + if (name == "score") and (frame == nil) then score_show(player) else @@ -81,12 +81,12 @@ local function on_gui_click(event) frame.destroy() end end - + end local function rocket_launched(event) global.score_rockets_launched = global.score_rockets_launched + 1 - game.print ("A rocket has been launched!") + game.print ("A rocket has been launched!") refresh_score() end @@ -95,4 +95,4 @@ end Event.register(defines.events.on_entity_died, refresh_score) Event.register(defines.events.on_gui_click, on_gui_click) Event.register(defines.events.on_player_joined_game, create_score_gui) -Event.register(defines.events.on_rocket_launched, rocket_launched) \ No newline at end of file +Event.register(defines.events.on_rocket_launched, rocket_launched) diff --git a/tasklist.lua b/tasklist.lua index 476f55bb..a62ac0be 100644 --- a/tasklist.lua +++ b/tasklist.lua @@ -20,10 +20,9 @@ end local function tasklist_show(player) - player.gui.left.direction = "horizontal" local frame = player.gui.left.add { type = "frame", name = "tasklist-panel", direction = "vertical" } - frame.add { type = "table", name = "tasklist_panel_table", colspan = 1 } + frame.add { type = "table", name = "tasklist_panel_table", column_count = 1 } local tasklist_panel_table = frame.tasklist_panel_table @@ -60,7 +59,7 @@ local function tasklist_show(player) tasklist_label.style.font_color = {r = 0.55, g = 0.55, b = 0.55} end - frame.add { type = "table", name = "tasklist_panel_button_table", colspan = 3 } + frame.add { type = "table", name = "tasklist_panel_button_table", column_count = 3 } local tasklist_panel_button_table = frame.tasklist_panel_button_table global.tasklist_panel_creation_time[player.index] = game.tick @@ -119,7 +118,7 @@ end local function tasklist_assembler(player) local frame = player.gui.left.add { type = "frame", name = "tasklist-assembler", caption = "" } - local frame_table = frame.add { type = "table", name = "table_tasklist_assembler", colspan = 2 } + local frame_table = frame.add { type = "table", name = "table_tasklist_assembler", column_count = 2 } frame_table.add { type = "label", caption = "Task #1:" } frame_table.add { type = "textfield", name = "textfield_task_1", text = global.tasklist_items[1], } frame_table["textfield_task_1"].style.minimal_width = 450