diff --git a/changelog.txt b/changelog.txt index a463ccb..6a3903b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,8 +3,8 @@ Version: 3.0.40 Date: ???? Changes: - Added unsafe modes for recipe functions, allowing the alteration of recipes regardless if the items/fluids exist. - - Add compatibility with AAI Signal Transmission. Now researched after - logistics science and uses contemporary ingredients + - Add compatibility with AAI Signal Transmission. Now researched after logistics science and uses contemporary ingredients + - Adjusted logic that determines the amount and name of a product to display with the "Add recipe signals" startup setting. --------------------------------------------------------------------------------------------------- Version: 3.0.39 Date: 2025-09-15 diff --git a/data-final-fixes.lua b/data-final-fixes.lua index 81affff..f0e8186 100644 --- a/data-final-fixes.lua +++ b/data-final-fixes.lua @@ -95,23 +95,26 @@ if create_signal_mode then break end -- Determine amount of main product to display in signal name - amt = 0 + local amt = 0 + local main_product_name = recipe:get_main_product(true).name for _, result in pairs(recipe.results) do - if result.name then - local is_main_product = recipe.main_product and result.name == recipe.main_product - if is_main_product and result.probability and result.probability < 1 then - amt = result.probability + if result.name == main_product_name then + if result.probability and result.probability < 1 then + -- Some recipes have random amount for multiples, such as nuclear isotopes. + local prob_amt = 0 + if result.amount then + prob_amt = result.amount + elseif result.amount_min and result.amount_max then + prob_amt = (result.amount_min + result.amount_max) / 2 + end + amt = result.probability * prob_amt break - elseif is_main_product and result.amount_min and result.amount_max then + elseif result.amount_min and result.amount_max then amt = (result.amount_min + result.amount_max) / 2 break elseif result.amount then - if is_main_product then - amt = result.amount - break - end - -- Fallback that determines main product based on highest output - amt = math.max(amt, result.amount) + amt = result.amount + break end end end diff --git a/info.json b/info.json index af7c4ef..5d2a18e 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "pypostprocessing", - "version": "3.0.39", + "version": "3.0.40", "factorio_version": "2.0", "title": "Pyanodons Post-processing", "author": "Pyanodon, Shadowglass, LambdaLemon", diff --git a/lib/metas/recipe.lua b/lib/metas/recipe.lua index 86ada2e..cd3f116 100644 --- a/lib/metas/recipe.lua +++ b/lib/metas/recipe.lua @@ -456,4 +456,4 @@ metas.get_icons = function(self) error(string.format("Couldn't find icons for recipe %s", self.name)) end -return metas +return metas \ No newline at end of file diff --git a/locale/zh-CN/pypostprocessing.cfg b/locale/zh-CN/pypostprocessing.cfg index 54dce45..b9ac626 100644 --- a/locale/zh-CN/pypostprocessing.cfg +++ b/locale/zh-CN/pypostprocessing.cfg @@ -1,4 +1,4 @@ -#汉化:aotix +#汉化:aotix [mod-name] pypostprocessing=Py之后期处理