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/config.lua b/config.lua index c839cc63..c4243059 100644 --- a/config.lua +++ b/config.lua @@ -4,7 +4,7 @@ global.scenario.variables = {} global.scenario.variables.mods = require "locale.resources.mods" global.scenario.variables.regulars = require "locale.resources.regulars" global.scenario.variables.player_positions = {} -global.scenario.variables.player_walk_distances = {} +-- global.scenario.variables.player_walk_distances = {} global.scenario.variables.player_deaths = {} global.scenario.config = {} global.scenario.custom_functions = {} diff --git a/fish_market.lua b/fish_market.lua index 3700bff3..0dc67d79 100644 --- a/fish_market.lua +++ b/fish_market.lua @@ -137,7 +137,7 @@ local function fish_earned(event, amount) fish_earned_index( event.player_index, amount ) end -local function preplayer_mined_item(event) +local function pre_player_mined_item(event) -- game.print(event.entity.name) -- game.print(event.entity.type) @@ -151,19 +151,11 @@ local function preplayer_mined_item(event) end --]] - if event.entity.name == "stone-rock" then - fish_earned(event, 10) - end + if event.entity.type == "simple-entity" then -- Cheap check for rock, may have other side effects + fish_earned(event, 10) + end - if event.entity.name == "red-desert-rock-huge-01" then - fish_earned(event, 20) - end - - if event.entity.name == "red-desert-rock-big-01" then - fish_earned(event, 10) - end - - if event.entity.type == "tree" then + if event.entity.type == "tree" then local x = math.random(1,4) if x == 1 then fish_earned(event, 4) @@ -476,7 +468,7 @@ function fish_player_crafted_item(event) end end -Event.register(defines.events.on_preplayer_mined_item, preplayer_mined_item) +Event.register(defines.events.on_pre_player_mined_item, pre_player_mined_item) Event.register(defines.events.on_entity_died, fish_drop_entity_died) Event.register(defines.events.on_market_item_purchased, market_item_purchased) Event.register(defines.events.on_built_entity, fish_built_entity) diff --git a/info.lua b/info.lua index f4fca002..3254e5e2 100644 --- a/info.lua +++ b/info.lua @@ -25,22 +25,19 @@ And this is what you ought to know: - Don't argue with other players for silly things. - No political, racist, or misogynistic content. - If you suspect you desync, restart the game. -- Join our growing community on discord.me/redmew -- Post server pics (or didn't happen): redmew.reddit.com +- Join our growing community on redmew.com/discord - Contribute to our Hookers & Blow Fund with: Bitcoin: 18PferSFbkwsYai8sLnWKzrr8YXQ1bBqNg 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 +50,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/nuke_control.lua b/nuke_control.lua index a8a2cecc..be56498a 100644 --- a/nuke_control.lua +++ b/nuke_control.lua @@ -70,4 +70,4 @@ end Event.register(defines.events.on_player_ammo_inventory_changed, ammo_changed) Event.register(defines.events.on_player_deconstructed_area, on_player_deconstructed_area) -Event.register(defines.events.on_player_mined_entity, on_player_mined_item) +--Event.register(defines.events.on_player_mined_entity, on_player_mined_item) diff --git a/on_tick.lua b/on_tick.lua index e4f3a342..4e01b300 100644 --- a/on_tick.lua +++ b/on_tick.lua @@ -15,4 +15,4 @@ local function on_tick() end end -Event.register(defines.events.on_tick, on_tick) +--Event.register(defines.events.on_tick, on_tick) diff --git a/player_list.lua b/player_list.lua index a3139d72..31124b5d 100644 --- a/player_list.lua +++ b/player_list.lua @@ -144,7 +144,7 @@ local function get_sorted_list(sort_by) player_list[i2] = a end end - if sort_by == "distance_asc" then + --[[if sort_by == "distance_asc" then if global.scenario.variables.player_walk_distances[player_list[i].name] > global.scenario.variables.player_walk_distances[player_list[i2].name] then local a = player_list[i] local b = player_list[i2] @@ -160,6 +160,7 @@ local function get_sorted_list(sort_by) player_list[i2] = a end end + ]]-- if sort_by == "name_asc" then if player_list[i].name > player_list[i2].name then local a = player_list[i] @@ -182,11 +183,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 +194,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 = 6 } 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 +205,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,26 +213,23 @@ 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 - str = "" +--[[ str = "" 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 - +--]] str = "" 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 +238,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 +246,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 +253,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 = 6 } local player_list = get_sorted_list(sort_by) @@ -283,10 +276,10 @@ local function player_list_show(player, sort_by) label.style.minimal_width = 130 label.style.maximal_width = 130 - local label = player_list_panel_table.add { type = "label", name = "player_list_panel_player_distance_" .. i, caption = round(global.scenario.variables.player_walk_distances[player_list[i].name]/1000, 1) .. " km" } +--[[ local label = player_list_panel_table.add { type = "label", name = "player_list_panel_player_distance_" .. i, caption = round(global.scenario.variables.player_walk_distances[player_list[i].name]/1000, 1) .. " km" } label.style.minimal_width = 100 label.style.maximal_width = 100 - +--]] local label = player_list_panel_table.add { type = "label", name = "player_list_panel_player_fish" .. i, caption = global.fish_market_fish_caught[player_list[i].player_index] .. " / " .. global.fish_market_fish_spent[player_list[i].player_index] } label.style.minimal_width = 80 label.style.maximal_width = 80 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..b05e483d 100644 --- a/tasklist.lua +++ b/tasklist.lua @@ -20,16 +20,14 @@ 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 tasklist_panel_table.add { type = "label", caption = "Task List:", single_line = false, name = "tasklist_title"} local tasklist_label = tasklist_panel_table["tasklist_title"] - tasklist_label.style.maximal_width = 208 tasklist_label.style.minimal_width = 208 tasklist_label.style.maximal_height = 165 tasklist_label.style.font = "default" @@ -43,7 +41,6 @@ local function tasklist_show(player) tasklist_panel_table.add { type = "label", caption = counter .. ". " .. global.tasklist_items[y], single_line = false, name = "tasklist_item_label_" .. z} local tasklist_label = tasklist_panel_table["tasklist_item_label_" .. z] - tasklist_label.style.maximal_width = 208 tasklist_label.style.minimal_width = 208 tasklist_label.style.maximal_height = 165 tasklist_label.style.font = "default" @@ -53,14 +50,13 @@ local function tasklist_show(player) if global.tasklist_author ~= nil then tasklist_panel_table.add { type = "label", caption = "Updated by: " .. global.tasklist_author, single_line = false, name = "tasklist_author"} local tasklist_label = tasklist_panel_table["tasklist_author"] - tasklist_label.style.maximal_width = 208 tasklist_label.style.minimal_width = 208 tasklist_label.style.maximal_height = 165 tasklist_label.style.font = "default" 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 +115,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 @@ -153,11 +149,6 @@ function tasklist_sync_for_new_joining_player(event) local player = game.players[event.player_index] global.autoshow_tasklist_for_player[player.name] = true - - local frame = player.gui.left["tasklist-panel"] - if (frame == nil) then - tasklist_show(player) - end end local function on_gui_click(event) diff --git a/walk_distance.lua b/walk_distance.lua index e4ca8cd6..7dac4d2f 100644 --- a/walk_distance.lua +++ b/walk_distance.lua @@ -30,4 +30,4 @@ local function init_player_position(event) end end -Event.register(defines.events.on_player_joined_game, init_player_position) +-- Event.register(defines.events.on_player_joined_game, init_player_position)