diff --git a/.screenshots/dddgamer-softmod_auto-research.jpg b/.screenshots/dddgamer-softmod_auto-research.jpg deleted file mode 100644 index 73b9340..0000000 Binary files a/.screenshots/dddgamer-softmod_auto-research.jpg and /dev/null differ diff --git a/.screenshots/dddgamer-softmod_auto-research.png b/.screenshots/dddgamer-softmod_auto-research.png new file mode 100644 index 0000000..7245be8 Binary files /dev/null and b/.screenshots/dddgamer-softmod_auto-research.png differ diff --git a/.screenshots/dddgamer-softmod_task-list.jpg b/.screenshots/dddgamer-softmod_task-list.jpg deleted file mode 100644 index e05cc9e..0000000 Binary files a/.screenshots/dddgamer-softmod_task-list.jpg and /dev/null differ diff --git a/.screenshots/dddgamer-softmod_task-list.png b/.screenshots/dddgamer-softmod_task-list.png new file mode 100644 index 0000000..924d37c Binary files /dev/null and b/.screenshots/dddgamer-softmod_task-list.png differ diff --git a/README.md b/README.md index 6ba3236..619c8c3 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ Dev files will be removed from the release build, see the [github repository](ht ## Screenshots ![Game Start with softmod pack](.screenshots/dddgamer-softmod.jpg) -![Auto Research](.screenshots/dddgamer-softmod_auto-research.jpg) -![Task List](.screenshots/dddgamer-softmod_task-list.jpg) +![Auto Research](.screenshots/dddgamer-softmod_auto-research.png) +![Task List](.screenshots/dddgamer-softmod_task-list.png) ![Game Info](.screenshots/dddgamer-softmod_game-info.jpg) ![Player List](.screenshots/dddgamer-softmod_player-list.jpg) diff --git a/control.lua b/control.lua index 52eaa2b..9db1514 100644 --- a/control.lua +++ b/control.lua @@ -25,11 +25,11 @@ require('config') -- ======================================================= -- -- require('modules/dev/for-testing') --- Import Vanilla Modules if needed +-- == Import Vanilla Modules if needed == -- -- require('modules/vanilla/silo') -- require('modules/vanilla/player-init') --- Import Soft Mod Modules +-- == Import Soft Mod Modules == -- require('modules/common/spawn-marker') require('modules/common/death-marker') require('modules/common/autodeconstruct') diff --git a/modules/common/autodeconstruct.lua b/modules/common/autodeconstruct.lua index 5d1287e..b44e87f 100644 --- a/modules/common/autodeconstruct.lua +++ b/modules/common/autodeconstruct.lua @@ -172,9 +172,9 @@ function autodeconstruct.check_drill(drill) end -- Handle cancelled deconstruction -function autodeconstruct.on_canceled_deconstruction(event) +function autodeconstruct.on_cancelled_deconstruction(event) if event.player_index ~= nil or event.entity.type ~= 'mining-drill' then return end - if global.debug then msg_all({"autodeconstruct-debug", "on_canceled_deconstruction", util.positiontostr(event.entity.position) .. " deconstruction timed out, checking again"}) end + if global.debug then msg_all({"autodeconstruct-debug", "on_cancelled_deconstruction", util.positiontostr(event.entity.position) .. " deconstruction timed out, checking again"}) end autodeconstruct.check_drill(event.entity) end @@ -283,9 +283,9 @@ Event.register(defines.events.on_player_created, function() if err then msg_all({"autodeconstruct-err-generic", err}) end end) -Event.register(defines.events.on_canceled_deconstruction, function(event) - local _, err = pcall(autodeconstruct.on_canceled_deconstruction, event) - if err then msg_all({"autodeconstruct-err-specific", "on_canceled_deconstruction", err}) end +Event.register(defines.events.on_cancelled_deconstruction, function(event) + local _, err = pcall(autodeconstruct.on_cancelled_deconstruction, event) + if err then msg_all({"autodeconstruct-err-specific", "on_cancelled_deconstruction", err}) end end) Event.register(defines.events.on_resource_depleted, function(event) diff --git a/modules/common/custom-tech.lua b/modules/common/custom-tech.lua index 525b134..727b2d4 100644 --- a/modules/common/custom-tech.lua +++ b/modules/common/custom-tech.lua @@ -29,7 +29,9 @@ local DISABLED_RECIPE_LIST = { -- Tech to begin researched with local RESEARCH_TECH = { - 'toolbelt' + 'toolbelt', + 'steel-axe', + 'optics', } local PRINT_DISABLED_TECH = false diff --git a/modules/common/online-player-list.lua b/modules/common/online-player-list.lua index 56b59d9..3818298 100644 --- a/modules/common/online-player-list.lua +++ b/modules/common/online-player-list.lua @@ -11,7 +11,7 @@ -- ======================================================= -- local mod_gui = require('mod-gui') -- From `Factorio\data\core\lualib` local GUI = require('stdlib/GUI') -local Colors = require('util/Colors') +local Sprites = require('util/Sprites') local Math = require('util/Math') local Time = require('util/Time') @@ -22,7 +22,7 @@ local Player_List = { MASTER_FRAME_NAME = 'frame_playerlist', CHECKBOX_OFFLINE_PLAYERS = 'chbx_playerlist_players', SPRITE_NAMES = { - menu = 'entity/player', + menu = Sprites.character, -- inventory = 'utility/grey_rail_signal_placement_indicator' -- inventory = 'utility/item_editor_icon' inventory = 'utility/slot_icon_armor' @@ -137,6 +137,7 @@ function Player_List.draw_playerlist_frame() -- Flow local flow_header = master_frame.add({type = 'flow', direction = 'horizontal'}) + flow_header.style.horizontal_spacing = 20 -- Draw checkbox flow_header.add( diff --git a/modules/common/research-queue/Research_Queue_Styles.lua b/modules/common/research-queue/Research_Queue_Styles.lua index bc2bdeb..4a0d7c8 100644 --- a/modules/common/research-queue/Research_Queue_Styles.lua +++ b/modules/common/research-queue/Research_Queue_Styles.lua @@ -37,7 +37,8 @@ Research_Queue_Styles = { bottom_padding = 0, left_padding = 0, horizontally_squashable = true, - vertically_squashable = true + vertically_squashable = true, + stretch_image_to_widget_size = true, }, auto_research_sprite_button = { width = 24, diff --git a/modules/common/research-queue/auto-research.lua b/modules/common/research-queue/auto-research.lua index 3f29955..a34d3c4 100644 --- a/modules/common/research-queue/auto-research.lua +++ b/modules/common/research-queue/auto-research.lua @@ -23,17 +23,21 @@ Auto_Research = { MASTER_FRAME_LOCATION = GUI.MASTER_FRAME_LOCATIONS.left, -- Check Factorio prototype definitions in \Factorio\data\core and \Factorio\data\base SPRITE_NAMES = { - menu = 'item/lab', - up = 'utility/fluid_indication_arrow', - down = 'utility/hint_arrow_down', - blacklist = 'utility/clear', - remove = 'utility/set_bar_slot', + menu = Sprites.lab, + up = Sprites.hint_arrow_up, + down = Sprites.hint_arrow_down, + blacklist = Sprites.clear, + remove = Sprites.set_bar_slot, + tech_prefix = 'technology/', + item_prefix = 'item/', }, -- Utf shapes https://www.w3schools.com/charsets/ref_utf_geometric.asp -- Utf symbols https://www.w3schools.com/charsets/ref_utf_symbols.asp TEXT_SYMBOLS = { - up = "▲", - down = "▼" + up = '▲', + down = '▼', + blacklist = '⊘', + remove = '✖', }, get_menu_button = function(player) return GUI.menu_bar_el(player)[Auto_Research.MENU_BTN_NAME] @@ -45,16 +49,15 @@ Auto_Research = { end, default_queued_techs = { 'automation', + 'military-1', 'logistics', - 'automation-2', + 'turrets', }, default_blacklisted_techs = { - 'shotgun', - 'shotgun-shell-damage-1', - 'shotgun-shell-speed-1', + 'combat-robotics', }, default_allowed_research_ingredients = { - ['science-pack-1'] = true + ['automation-science-pack'] = true } } @@ -66,6 +69,7 @@ Auto_Research = { -- @param event on_player_joined_game function Auto_Research.on_player_joined_game(event) local player = game.players[event.player_index] + Auto_Research.disableDefaultGameQueue(player.force) Auto_Research.setDefaultConfig(player.force) Auto_Research.draw_menu_btn(player) -- Auto_Research.draw_master_frame(player) -- Will appear on load, cooment out to load later on button click @@ -137,7 +141,6 @@ function Auto_Research.GUI_onClick(event) local config = Auto_Research.getConfig(force) local name = event.element.name if name == "auto_research_enabled" then - game.print(serpent.block(event.element.state)) Auto_Research.setAutoResearch(force, event.element.state) elseif name == "auto_research_queued_only" then Auto_Research.setQueuedOnly(force, event.element.state) @@ -592,31 +595,46 @@ function Auto_Research.GUI_updateTechnologyList(scrollpane, technologies, player entryflow.add { type = "sprite-button", name = "auto_research_queue_top-" .. techname, - sprite = GUI.get_safe_sprite_name(player, Auto_Research.SPRITE_NAMES.up), + caption = Auto_Research.TEXT_SYMBOLS.up, + -- sprite = GUI.get_safe_sprite_name(player, Auto_Research.SPRITE_NAMES.up), tooltip = 'Move to beginning of Queue' } GUI.element_apply_style(temp_var_for_el_style, Research_Queue_Styles.auto_research_sprite_button) + GUI.element_apply_style(temp_var_for_el_style, Styles.txt_clr_blue) temp_var_for_el_style = entryflow.add { type = "sprite-button", name = "auto_research_queue_bottom-" .. techname, - sprite = GUI.get_safe_sprite_name(player, Auto_Research.SPRITE_NAMES.down), + caption = Auto_Research.TEXT_SYMBOLS.down, + -- sprite = GUI.get_safe_sprite_name(player, Auto_Research.SPRITE_NAMES.down), tooltip = 'Move to end of Queue' } GUI.element_apply_style(temp_var_for_el_style, Research_Queue_Styles.auto_research_sprite_button) + GUI.element_apply_style(temp_var_for_el_style, Styles.txt_clr_blue) end temp_var_for_el_style = entryflow.add { type = "sprite-button", name = "auto_research_delete-" .. techname, - sprite = GUI.get_safe_sprite_name(player, Auto_Research.SPRITE_NAMES.remove), + caption = Auto_Research.TEXT_SYMBOLS.remove, + -- sprite = GUI.get_safe_sprite_name(player, Auto_Research.SPRITE_NAMES.remove), tooltip = 'Remove' } GUI.element_apply_style(temp_var_for_el_style, Research_Queue_Styles.auto_research_sprite_button) + GUI.element_apply_style(temp_var_for_el_style, Styles.txt_clr_red) + + -- Tech icon + local sprite = GUI.get_safe_sprite_name(player, Auto_Research.SPRITE_NAMES.tech_prefix .. techname) + temp_var_for_el_style = entryflow.add {type = "sprite", sprite = sprite} + GUI.element_apply_style(temp_var_for_el_style, Research_Queue_Styles.auto_research_sprite) + + -- Research text name temp_var_for_el_style = entryflow.add {type = "label", caption = tech.localised_name} GUI.element_apply_style(temp_var_for_el_style, Research_Queue_Styles.auto_research_tech_label) + + -- Research science req (pots) for _, ingredient in pairs(tech.research_unit_ingredients) do - local sprite = GUI.get_safe_sprite_name(player, "item/" .. ingredient.name) + local sprite = GUI.get_safe_sprite_name(player, Auto_Research.SPRITE_NAMES.item_prefix .. ingredient.name) temp_var_for_el_style = entryflow.add {type = "sprite", sprite = sprite} GUI.element_apply_style(temp_var_for_el_style, Research_Queue_Styles.auto_research_sprite) end @@ -748,28 +766,43 @@ function Auto_Research.GUI_updateSearchResult(player, text) entryflow.add { type = "sprite-button", name = "auto_research_queue_top-" .. name, - sprite = GUI.get_safe_sprite_name(player, Auto_Research.SPRITE_NAMES.up), + caption = Auto_Research.TEXT_SYMBOLS.up, + -- sprite = GUI.get_safe_sprite_name(player, Auto_Research.SPRITE_NAMES.up), tooltip = 'Move to beginning of Queue' } GUI.element_apply_style(temp_var_for_el_style, Research_Queue_Styles.auto_research_sprite_button) + GUI.element_apply_style(temp_var_for_el_style, Styles.txt_clr_blue) temp_var_for_el_style = entryflow.add { type = "sprite-button", name = "auto_research_queue_bottom-" .. name, - sprite = GUI.get_safe_sprite_name(player, Auto_Research.SPRITE_NAMES.down), + caption = Auto_Research.TEXT_SYMBOLS.down, + -- sprite = GUI.get_safe_sprite_name(player, Auto_Research.SPRITE_NAMES.down), tooltip = 'Move to end of Queue' } GUI.element_apply_style(temp_var_for_el_style, Research_Queue_Styles.auto_research_sprite_button) + GUI.element_apply_style(temp_var_for_el_style, Styles.txt_clr_blue) temp_var_for_el_style = entryflow.add { type = "sprite-button", name = "auto_research_blacklist-" .. name, - sprite = GUI.get_safe_sprite_name(player, Auto_Research.SPRITE_NAMES.blacklist), + caption = Auto_Research.TEXT_SYMBOLS.blacklist, + -- sprite = GUI.get_safe_sprite_name(player, Auto_Research.SPRITE_NAMES.blacklist), tooltip = 'Blacklist' } GUI.element_apply_style(temp_var_for_el_style, Research_Queue_Styles.auto_research_sprite_button) + GUI.element_apply_style(temp_var_for_el_style, Styles.txt_clr_red) + + -- Tech icon + local sprite = GUI.get_safe_sprite_name(player, Auto_Research.SPRITE_NAMES.tech_prefix .. name) + temp_var_for_el_style = entryflow.add {type = "sprite", sprite = sprite} + GUI.element_apply_style(temp_var_for_el_style, Research_Queue_Styles.auto_research_sprite) + + -- Research text name temp_var_for_el_style = entryflow.add {type = "label", name = name, caption = tech.localised_name} GUI.element_apply_style(temp_var_for_el_style, Research_Queue_Styles.auto_research_tech_label) + + -- Research science req (pots) for _, ingredient in pairs(tech.research_unit_ingredients) do local sprite = GUI.get_safe_sprite_name(player, "item/" .. ingredient.name) temp_var_for_el_style = entryflow.add({type = "sprite", sprite = sprite}) @@ -1042,5 +1075,20 @@ function Auto_Research.startNextResearch(force, override_spam_detection) end end - force.current_research = next_research + -- v0.16 Intention + -- force.current_research = next_research + + -- v0.17 Adaptation of the above + -- We overwrite what ever the game has in the queue with the next tech from this custom queue + if(next_research) then + force.research_queue = nil; + -- force.cancel_current_research(); + force.add_research(next_research); + end +end + + +-- Disable the default recearch qeue that ships with the game and use ours instead +function Auto_Research.disableDefaultGameQueue(force) + force.research_queue_enabled = false; end diff --git a/modules/common/silo.lua b/modules/common/silo.lua index 9182837..2bafe8d 100644 --- a/modules/common/silo.lua +++ b/modules/common/silo.lua @@ -107,7 +107,7 @@ function draw_rocket_score_frame(player) -- Hide if no rockets launched yet if (player.force.rockets_launched <= 0) then - frame.style.visible = false + frame.visible = false end end @@ -121,5 +121,5 @@ function update_score(player) label.caption = {'silo.rocket_score', rocket_score} -- Show the score on first rocket launch - if(rocket_score == 1) then frame.style.visible = true end + if(rocket_score == 1) then frame.visible = true end end diff --git a/modules/common/spawn-marker.lua b/modules/common/spawn-marker.lua index 73de7b2..fdab946 100644 --- a/modules/common/spawn-marker.lua +++ b/modules/common/spawn-marker.lua @@ -9,29 +9,31 @@ -- Constants -- -- ======================================================= -- +local SpawnMarker = {} + -- Event Functions -- -- ======================================================= -- -- Various action when new player joins in game -- @param event on_player_created event -function on_player_created(event) +function SpawnMarker.on_player_created(event) local player = game.players[event.player_index] if (not global.spawn_marked_on_map) then - set_map_spawn_marker(player) + SpawnMarker.set_map_spawn_marker(player) global.spawn_marked_on_map = true end end -- Event Registration -- -- ======================================================= -- -Event.register(defines.events.on_player_created, on_player_created) +Event.register(defines.events.on_player_created, SpawnMarker.on_player_created) -- Helper Functions -- -- ======================================================= -- -- Set spawn mark on map -- @param player LuaPlayer -function set_map_spawn_marker(player) +function SpawnMarker.set_map_spawn_marker(player) local spawn_position = player.force.get_spawn_position(player.surface) local map_tag = { position = spawn_position, @@ -39,6 +41,7 @@ function set_map_spawn_marker(player) icon = {type = 'item', name = 'heavy-armor'} } - -- FIXME: This doesnt work for some reason while the one on death does. + -- FIXME: This doesnt work b/c area is not yet charted + -- Adding a chart call before this doesnt fix the problem as it seems to be async. player.force.add_chart_tag(player.surface, map_tag) end diff --git a/modules/common/tasks.lua b/modules/common/tasks.lua index 6e7f7e2..4921801 100644 --- a/modules/common/tasks.lua +++ b/modules/common/tasks.lua @@ -11,6 +11,7 @@ -- ======================================================= -- local GUI = require("stdlib/GUI") local Styles = require("util/Styles") +local Sprites = require('util/Sprites') -- Constants -- -- ======================================================= -- @@ -20,20 +21,24 @@ Tasks = { MASTER_FRAME_LOCATION = GUI.MASTER_FRAME_LOCATIONS.left, -- Check Factorio prototype definitions in \Factorio\data\core and \Factorio\data\base SPRITE_NAMES = { - menu = "utility/slot_icon_robot_material", - add = "utility/add", - edit = "utility/rename_icon_normal", - -- delete = 'utility/remove' - delete = "utility/set_bar_slot", - confirm = "utility/confirm_slot", - up = 'utility/fluid_indication_arrow', - down = 'utility/hint_arrow_down', + menu = Sprites.slot_icon_robot_material, + add = Sprites.add, + edit = Sprites.rename_icon_normal, + -- delete = Sprites.remove + delete = Sprites.set_bar_slot, + confirm = Sprites.confirm_slot, + up = Sprites.hint_arrow_up, + down = Sprites.hint_arrow_down, }, -- Utf shapes https://www.w3schools.com/charsets/ref_utf_geometric.asp -- Utf symbols https://www.w3schools.com/charsets/ref_utf_symbols.asp TEXT_SYMBOLS = { - up = "▲", - down = "▼" + up = '▲', + down = '▼', + add = '✚', + delete = '✖', + edit = '✒', + confirm = '✔', }, get_menu_button = function(player) return GUI.menu_bar_el(player)[Tasks.MENU_BTN_NAME] @@ -170,7 +175,8 @@ function Tasks.fill_master_frame(container, player, edit_task) { type = "sprite-button", name = "btn_confirm_task_" .. task.id, - sprite = GUI.get_safe_sprite_name(player, Tasks.SPRITE_NAMES.confirm), + caption = Tasks.TEXT_SYMBOLS.confirm, + -- sprite = GUI.get_safe_sprite_name(player, Tasks.SPRITE_NAMES.confirm), tooltip = "Confirm" }, -- On Click callback function @@ -183,6 +189,7 @@ function Tasks.fill_master_frame(container, player, edit_task) end ) GUI.element_apply_style(btn_confirm_task, Styles.small_button) + GUI.element_apply_style(btn_confirm_task, Styles.txt_clr_green) local lbl_test = task_flow.add({type = "textfield", name = "textfield_" .. task.id, text = task.text}) else -- Edit button @@ -192,7 +199,8 @@ function Tasks.fill_master_frame(container, player, edit_task) { type = "sprite-button", name = "btn_edit_task_" .. task.id, - sprite = GUI.get_safe_sprite_name(player, Tasks.SPRITE_NAMES.edit), + caption = Tasks.TEXT_SYMBOLS.edit, + -- sprite = GUI.get_safe_sprite_name(player, Tasks.SPRITE_NAMES.edit), tooltip = "Edit" }, -- On Click callback function @@ -201,6 +209,7 @@ function Tasks.fill_master_frame(container, player, edit_task) end ) GUI.element_apply_style(btn_edit_task_, Styles.small_button) + GUI.element_apply_style(btn_edit_task_, Styles.txt_clr_yellow) -- Delete button local btn_delete_task_ = @@ -209,7 +218,8 @@ function Tasks.fill_master_frame(container, player, edit_task) { type = "sprite-button", name = "btn_delete_task_" .. task.id, - sprite = GUI.get_safe_sprite_name(player, Tasks.SPRITE_NAMES.delete), + caption = Tasks.TEXT_SYMBOLS.delete, + -- sprite = GUI.get_safe_sprite_name(player, Tasks.SPRITE_NAMES.delete), tooltip = "Delete" }, -- On Click callback function @@ -219,6 +229,7 @@ function Tasks.fill_master_frame(container, player, edit_task) end ) GUI.element_apply_style(btn_delete_task_, Styles.small_button) + GUI.element_apply_style(btn_delete_task_, Styles.txt_clr_red) -- Up button local btn_up_task = @@ -228,8 +239,8 @@ function Tasks.fill_master_frame(container, player, edit_task) -- type = "button", type = "sprite-button", name = "btn_up_task" .. task.id, - -- caption = Tasks.TEXT_SYMBOLS.up, - sprite = GUI.get_safe_sprite_name(player, Tasks.SPRITE_NAMES.up), + caption = Tasks.TEXT_SYMBOLS.up, + -- sprite = GUI.get_safe_sprite_name(player, Tasks.SPRITE_NAMES.up), tooltip = "Increse Priority" }, -- On Click callback function @@ -240,6 +251,7 @@ function Tasks.fill_master_frame(container, player, edit_task) ) -- GUI.element_apply_style(btn_up_task, Styles.small_symbol_button) GUI.element_apply_style(btn_up_task, Styles.small_button) + GUI.element_apply_style(btn_up_task, Styles.txt_clr_blue) if (key <= 1) then btn_up_task.enabled = false else @@ -254,8 +266,8 @@ function Tasks.fill_master_frame(container, player, edit_task) -- type = "button", type = "sprite-button", name = "btn_down_task" .. task.id, - -- caption = Tasks.TEXT_SYMBOLS.down, - sprite = GUI.get_safe_sprite_name(player, Tasks.SPRITE_NAMES.down), + caption = Tasks.TEXT_SYMBOLS.down, + -- sprite = GUI.get_safe_sprite_name(player, Tasks.SPRITE_NAMES.down), tooltip = "Decrease Priority" }, -- On Click callback function @@ -266,6 +278,7 @@ function Tasks.fill_master_frame(container, player, edit_task) ) -- GUI.element_apply_style(btn_down_task, Styles.small_symbol_button) GUI.element_apply_style(btn_down_task, Styles.small_button) + GUI.element_apply_style(btn_down_task, Styles.txt_clr_blue) if (key >= table.maxn(config.tasks)) then btn_down_task.enabled = false else @@ -293,7 +306,8 @@ function Tasks.fill_master_frame(container, player, edit_task) { type = "sprite-button", name = "btn_add_task", - sprite = GUI.get_safe_sprite_name(player, Tasks.SPRITE_NAMES.add), + caption = Tasks.TEXT_SYMBOLS.add, + -- sprite = GUI.get_safe_sprite_name(player, Tasks.SPRITE_NAMES.add), tooltip = "Add new task" }, -- On Click callback function @@ -305,6 +319,7 @@ function Tasks.fill_master_frame(container, player, edit_task) end -- GUI.element_apply_style(btn_add_task, Styles.small_button) GUI.element_apply_style(btn_add_task, Styles.small_symbol_button) + GUI.element_apply_style(btn_add_task, Styles.txt_clr_green) if (edit_task) then btn_add_task.enabled = false else diff --git a/modules/dddgamer/death-marker-simple.lua b/modules/dddgamer/death-marker-simple.lua index f6a2191..7d5de6d 100644 --- a/modules/dddgamer/death-marker-simple.lua +++ b/modules/dddgamer/death-marker-simple.lua @@ -10,12 +10,16 @@ -- ======================================================= -- local Time = require('util/Time') +-- Constants -- +-- ======================================================= -- +local DeathMarker = {} + -- Event Functions -- -- ======================================================= -- -- When a player dies, place a marker on the map of death location -- @param event - on_pre_player_died -function on_player_death(event) +function DeathMarker.on_player_death(event) local player = game.players[event.player_index] local death_hms = Time.tick_to_time_hms(game.tick) local map_tag = { @@ -29,7 +33,7 @@ end -- Event Registration -- -- ======================================================= -- if(Event) then - Event.register(defines.events.on_pre_player_died, on_player_death) + Event.register(defines.events.on_pre_player_died, DeathMarker.on_player_death) else - script.on_event(defines.events.on_pre_player_died, on_player_death) + script.on_event(defines.events.on_pre_player_died, DeathMarker.on_player_death) end diff --git a/modules/dddgamer/game-info.lua b/modules/dddgamer/game-info.lua index a0b31d2..909cb94 100644 --- a/modules/dddgamer/game-info.lua +++ b/modules/dddgamer/game-info.lua @@ -21,7 +21,8 @@ local SECTION_CONTENT = { { title = 'Game Info', content = { - '* Gameplay: Vanilla with Disabled Handcrafting and QOL Mods', + '* Gameplay: Vanilla with QOL Mods', + -- '* Handcrafting is Disabled', '* Join discord for discussion, voice chat and admin support:', 'https://discord.gg/hmwb3dB', '* Check the factorio cheatsheet for help:', @@ -43,7 +44,7 @@ local SECTION_CONTENT = { { title = 'Station Naming Guidelines', content = { - '* Exclude "[" and "]" L = Load, U = Unload, S = Stacker', + '* L = Load, U = Unload, Q = Queue/Stacker (Exclude "[" and "]" for the following examples):', '* Resource Trains: [Location]_[L/U]_[Resource-Name]_[ID]', '* Taxi Trains: #PAX_[Location]_[Resource-Name]_[ID]', '* Example Ore: "Mine_L_Iron-Ore_1"', @@ -177,14 +178,13 @@ function draw_gameinfo_frame(player) -- Flow local button_flow = master_frame.add({type = 'flow', direction = 'horizontal'}) button_flow.style.horizontally_stretchable = true -- Needed for align to work - button_flow.style.align = 'right' + button_flow.style.horizontal_align = 'right' -- Close Button local close_button = button_flow.add( {type = 'button', name = 'btn_gameinfo_close', caption = 'Close', tooltip = 'Hide this window'} ) - close_button.style.font_color = Colors.orange end end @@ -196,19 +196,18 @@ function draw_static_content(container, content) for i, text in pairs(content) do -- Regular text if (string.find(text, 'http', 1) == nil) then - -- Links go into textfields + -- Links go into textfields, rest as text local txt = container.add({type = 'label', name = i, caption = text}) if (string.find(text, '===', 1) ~= nil) then txt.style.font_color = Colors.orange txt.style.font = 'default-bold' - txt.style.align = 'center' + txt.style.horizontal_align = 'center' end else local txt = container.add({type = 'textfield', name = i, text = text}) txt.style.horizontally_stretchable = true -- txt.read_only = true txt.style.width = 500 - txt.style.selection_background_color = Colors.orange -- txt.style.color = Colors.grey end end @@ -223,7 +222,7 @@ function draw_section(container, section_content_data) -- Header flow local header_flow = section.add({type = 'flow', direction = 'horizontal'}) header_flow.style.horizontally_stretchable = true -- Needed for align to work - header_flow.style.align = 'center' + header_flow.style.horizontal_align = 'center' -- Section Header Text local header = header_flow.add({type = 'label', caption = '=== ' .. section_content_data.title .. ' ==='}) diff --git a/modules/dddgamer/player-init.lua b/modules/dddgamer/player-init.lua index 494c446..3fb4a6b 100644 --- a/modules/dddgamer/player-init.lua +++ b/modules/dddgamer/player-init.lua @@ -58,16 +58,9 @@ Event.register(defines.events.on_player_respawned, on_player_respawned) -- Helper Functions -- -- ======================================================= -- --- Give player basic items appropriate with research: axe, gun, ammo +-- Give player basic items appropriate with research: gun, ammo -- @param player LuaPlayer function addBasicItems(player) - -- No need for iron axes anymore - if (is_steel_researched(player)) then - player.insert {name = 'steel-axe', count = 1} - else - player.insert {name = 'iron-axe', count = 1} - end - -- Lets avoid hoarding pistols... if (is_military_1_researched(player)) then player.insert {name = 'submachine-gun', count = 1} @@ -90,7 +83,6 @@ function addStartingItems(player) player.insert {name = 'iron-plate', count = 10} player.insert {name = 'pistol', count = 1} player.insert {name = 'firearm-magazine', count = 10} - player.insert {name = 'iron-axe', count = 1} -- Give different items depending on game time -- Ex: No need for burner miners late game diff --git a/stdlib/GUI.lua b/stdlib/GUI.lua index d14e93d..b44577e 100644 --- a/stdlib/GUI.lua +++ b/stdlib/GUI.lua @@ -39,10 +39,10 @@ end -- @tparam LuaGuiElement el Element to toggle visibility of function GUI.toggle_element(el) if el ~= nil then - if (el.style.visible == nil) then -- game treats nil as true - el.style.visible = true + if (el.visible == nil) then -- game treats nil as true + el.visible = true end - el.style.visible = not el.style.visible or false + el.visible = not el.visible or false end end diff --git a/stdlib/Game.lua b/stdlib/Game.lua index 6b0c0bc..5667a97 100644 --- a/stdlib/Game.lua +++ b/stdlib/Game.lua @@ -9,7 +9,7 @@ Game = {} -- @tparam[opt="missing value"] string msg message function Game.fail_if_missing(var, msg) if not var then - error(msg or "Missing value", 3) + error(msg .. var or "Missing value", 3) end return false end diff --git a/util/Sprites.lua b/util/Sprites.lua index 3c2a831..6a93b16 100644 --- a/util/Sprites.lua +++ b/util/Sprites.lua @@ -296,7 +296,9 @@ Sprites = { nuclear_reactor = 'item/nuclear-reactor', lab = 'item/lab', -- - player = 'entity/player' + character = 'entity/character', + -- + advanced_electronics = 'technology/advanced-electronics', } return Sprites diff --git a/util/Styles.lua b/util/Styles.lua index 9ac0970..5bb5f18 100644 --- a/util/Styles.lua +++ b/util/Styles.lua @@ -20,10 +20,10 @@ Styles = { -- Match label size, etc.. the style of sprite buttons lbl_menu = { font = 'default-bold', - top_padding = 4, - bottom_padding = 0, - left_padding = 4, - right_padding = 4, + top_padding = 1, + -- bottom_padding = 0, + -- left_padding = 4, + -- right_padding = 4, }, frm_menu = { -- top_padding = 0, @@ -51,8 +51,27 @@ Styles = { right_padding = 0, bottom_padding = 0, left_padding = 0, - font = 'default-listbox' + font = 'default-listbox', + }, + txt_clr_yellow = { + font_color = Colors.yellow, + }, + txt_clr_orange = { + font_color = Colors.orange, + }, + txt_clr_blue = { + font_color = Colors.lightblue, }, + txt_clr_red = { + font_color = Colors.red, + }, + txt_clr_green = { + font_color = Colors.green, + }, + txt_clr_disabled = { + font_color = Colors.darkgrey, + }, + } return Styles