diff --git a/locale/en/base.cfg b/locale/en/base.cfg index f7fdfc7..f3c676e 100644 --- a/locale/en/base.cfg +++ b/locale/en/base.cfg @@ -43,6 +43,9 @@ YARM-map-markers=Enable map markers YARM-order-by=Order resource list by YARM-site-prefix-with-surface=Prefix the site name with the surface name YARM-debug-profiling=(Debug) Enable profiling output +YARM-adjust-for-productivity=Adjust values for productivity researched +YARM-productivity-show-raw-and-adjusted=Show both raw and adjusted values +YARM-productivity-parentheses-part-is=Which value is in parentheses [mod-setting-description] YARM-ticks-between-checks=When a resource site is being monitored, the amount of resources in it is only updated once every N game ticks (60 ticks = 1 second), based on this value. Increase to hopefully improve UPS, at the cost of needing longer to update a site's estimates. @@ -53,12 +56,17 @@ YARM-warn-percent=The percentage of remaining resources that will alert the play YARM-order-by=Change the display order of sites in the YARM list. YARM-site-prefix-with-surface=Prefix the surface name to the site name. Useful for maps with multiple surfaces. YARM-debug-profiling=When enabled, outputs some information about tick timing to the player output and factorio-current.log. +YARM-adjust-for-productivity=Amounts are shown adjusted by mining productivity research. +YARM-productivity-show-raw-and-adjusted=Amounts show both raw amount and amount adjusted by mining productivity research, one of them in parentheses (default: show the raw amount in parentheses). +YARM-productivity-parentheses-part-is=Change which amount (raw or adjusted for mining productivity) is shown in parentheses. [string-mod-setting] YARM-order-by-percent-remaining=remaining percentage YARM-order-by-ore-type=ore type, then remaining percentage YARM-order-by-ore-count=ore count remaining YARM-order-by-etd=estimated time to depletion +YARM-productivity-parentheses-part-is-adjusted=adjusted for productivity research +YARM-productivity-parentheses-part-is-raw=raw [YARM-tooltips] rename-site-named=Rename site '__1__' diff --git a/resmon.lua b/resmon.lua index b9261d3..45f093b 100644 --- a/resmon.lua +++ b/resmon.lua @@ -517,6 +517,19 @@ function resmon.update_chart_tag(site) end local display_value = format_number_si(site.amount) + if settings.global["YARM-adjust-for-productivity"] then + local site_amount = display_value + local site_amount_w_productivity = format_number_si(site.amount * (1 + site.force.mining_drill_productivity_bonus)) + if settings.global["YARM-productivity-show-raw-and-adjusted"] then + if settings.global["YARM-productivity-parentheses-part-is"] == "adjusted" then + display_value = string.format("%s (%s)", site_amount, site_amount_w_productivity) + else + display_value = string.format("%s (%s)", site_amount_w_productivity, site_amount) + end + else + display_value = site_amount_w_productivity + end + end local entity_prototype = game.entity_prototypes[site.ore_type] if resmon.is_endless_resource(site.ore_type, entity_prototype) then display_value = string.format("%.1f%%", site.remaining_permille / 10) @@ -919,6 +932,21 @@ function resmon.print_single_site(site, player, sites_gui, player_data) el.style.font_color = color local display_amount = format_number(site.amount) + if settings.global["YARM-adjust-for-productivity"] then + local site_amount = display_amount + local site_amount_w_productivity = format_number(math.floor(site.amount * (1 + player.force.mining_drill_productivity_bonus))) + if settings.global["YARM-productivity-show-raw-and-adjusted"] then + if settings.global["YARM-productivity-parentheses-part-is"] == "adjusted" then + display_amount = string.format("%s (%s)", site_amount, site_amount_w_productivity) + else + display_amount = string.format("%s (%s)", site_amount_w_productivity, site_amount) + end + else + display_amount = site_amount_w_productivity + end + -- FIXME: honor the "show both" setting + end + local entity_prototype = game.entity_prototypes[site.ore_type] if resmon.is_endless_resource(site.ore_type, entity_prototype) then display_amount = {"YARM-infinite-entity-count", format_number(site.entity_count)} diff --git a/settings.lua b/settings.lua index 5316d50..d298fb0 100644 --- a/settings.lua +++ b/settings.lua @@ -49,6 +49,29 @@ data:extend({ order = "zz[debug]", default_value = false, }, + + { + type = "bool-setting", + name = "YARM-adjust-for-productivity", + setting_type = "runtime-global", + order = "c", + default_value = "false", + }, + { + type = "bool-setting", + name = "YARM-productivity-show-raw-and-adjusted", + setting_type = "runtime-global", + order = "d", + default_value = "false", + }, + { + type = "string-setting", + name = "YARM-productivity-parentheses-part-is", + setting_type = "runtime-global", + order = "e", + default_value = "adjusted", + allowed_values = {"adjusted", "raw"} + }, -- Per user settings {