From 4015e5058ab1728ee7ec3fc7f8f2af6e32842608 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 30 Sep 2023 18:40:15 +0900 Subject: [PATCH 1/3] fix no recipe module insertion --- config/module.lua | 9 +++++++++ modules/gui/module.lua | 17 ++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/config/module.lua b/config/module.lua index cb776990..a519398b 100644 --- a/config/module.lua +++ b/config/module.lua @@ -5,6 +5,15 @@ return { machine_prod_disallow = { ['beacon'] = true }, + machine_craft = { + ['assembling-machine-2'] = true, + ['assembling-machine-3'] = true, + ['electric-furnace'] = true, + ['oil-refinery'] = true, + ['chemical-plant'] = true, + ['centrifuge'] = true, + ['rocket-silo'] = true + }, machine = { ['electric-mining-drill'] = 'effectivity-module', ['assembling-machine-2'] = 'productivity-module', diff --git a/modules/gui/module.lua b/modules/gui/module.lua index 760ea015..1afdef3d 100644 --- a/modules/gui/module.lua +++ b/modules/gui/module.lua @@ -123,15 +123,22 @@ end local function apply_module(player, area, machine, module) for _, entity in pairs(player.surface.find_entities_filtered{area=area, name=machine, force=player.force}) do - local m_current_recipe = entity.get_recipe() + if config.machine_craft[machine] ~= nil then + if config.machine_craft[machine] then + local m_current_recipe = entity.get_recipe() - -- insert - if m_current_recipe ~= nil then - if module_allowed[m_current_recipe.name] ~= nil then - if module_allowed[m_current_recipe.name] then + if m_current_recipe ~= nil then + if module_allowed[m_current_recipe.name] ~= nil then + if module_allowed[m_current_recipe.name] then + entity.surface.create_entity{name='item-request-proxy', target=entity, position=entity.position, force=entity.force, modules=module} + end + end + + else entity.surface.create_entity{name='item-request-proxy', target=entity, position=entity.position, force=entity.force, modules=module} end end + else entity.surface.create_entity{name='item-request-proxy', target=entity, position=entity.position, force=entity.force, modules=module} end From 189a3b51b6bfee122890bbb4da78e200a2051509 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 3 Oct 2023 02:43:54 +0900 Subject: [PATCH 2/3] . --- modules/gui/module.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/gui/module.lua b/modules/gui/module.lua index 1afdef3d..0f561aa7 100644 --- a/modules/gui/module.lua +++ b/modules/gui/module.lua @@ -128,10 +128,8 @@ local function apply_module(player, area, machine, module) local m_current_recipe = entity.get_recipe() if m_current_recipe ~= nil then - if module_allowed[m_current_recipe.name] ~= nil then - if module_allowed[m_current_recipe.name] then - entity.surface.create_entity{name='item-request-proxy', target=entity, position=entity.position, force=entity.force, modules=module} - end + if module_allowed[m_current_recipe.name] then + entity.surface.create_entity{name='item-request-proxy', target=entity, position=entity.position, force=entity.force, modules=module} end else From 7ef3c9a0cb5b7e175c461bd2615641a19c9c5e3c Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 4 Oct 2023 11:01:54 +0900 Subject: [PATCH 3/3] update --- config/module.lua | 47 +++++++++++++++++++++++++++- modules/gui/module.lua | 71 +++++------------------------------------- 2 files changed, 53 insertions(+), 65 deletions(-) diff --git a/config/module.lua b/config/module.lua index a519398b..9b50224e 100644 --- a/config/module.lua +++ b/config/module.lua @@ -25,5 +25,50 @@ return { ['centrifuge'] = 'productivity-module-3', ['lab'] = 'productivity-module-3', ['rocket-silo'] = 'productivity-module-3' + }, + module_allowed = { + ['advanced-circuit'] = true, + ['automation-science-pack'] = true, + ['battery'] = true, + ['chemical-science-pack'] = true, + ['copper-cable'] = true, + ['copper-plate'] = true, + ['electric-engine-unit'] = true, + ['electronic-circuit'] = true, + ['empty-barrel'] = true, + ['engine-unit'] = true, + ['explosives'] = true, + ['flying-robot-frame'] = true, + ['iron-gear-wheel'] = true, + ['iron-plate'] = true, + ['iron-stick'] = true, + ['logistic-science-pack'] = true, + ['low-density-structure'] = true, + ['lubricant'] = true, + ['military-science-pack'] = true, + ['nuclear-fuel'] = true, + ['plastic-bar'] = true, + ['processing-unit'] = true, + ['production-science-pack'] = true, + ['rocket-control-unit'] = true, + ['rocket-fuel'] = true, + ['rocket-part'] = true, + ['steel-plate'] = true, + ['stone-brick'] = true, + ['sulfur'] = true, + ['sulfuric-acid'] = true, + ['uranium-fuel-cell'] = true, + ['utility-science-pack'] = true, + ['basic-oil-processing'] = true, + ['advanced-oil-processing'] = true, + ['coal-liquefaction'] = true, + ['heavy-oil-cracking'] = true, + ['light-oil-cracking'] = true, + ['solid-fuel-from-light-oil'] = true, + ['solid-fuel-from-petroleum-gas'] = true, + ['solid-fuel-from-heavy-oil'] = true, + ['uranium-processing'] = true, + ['nuclear-fuel-reprocessing'] = true, + ['kovarex-enrichment-process'] = true } -} \ No newline at end of file +} diff --git a/modules/gui/module.lua b/modules/gui/module.lua index 0f561aa7..74470348 100644 --- a/modules/gui/module.lua +++ b/modules/gui/module.lua @@ -24,60 +24,6 @@ for k, _ in pairs(config.machine) do table.insert(machine_name, k) end ---[[ -local module_allowed = {} - -for _, r in pairs(game.item_prototypes['productivity-module'].limitations) do - module_allowed[r] = true -end -]] - -local module_allowed = { - ['advanced-circuit'] = true, - ['automation-science-pack'] = true, - ['battery'] = true, - ['chemical-science-pack'] = true, - ['copper-cable'] = true, - ['copper-plate'] = true, - ['electric-engine-unit'] = true, - ['electronic-circuit'] = true, - ['empty-barrel'] = true, - ['engine-unit'] = true, - ['explosives'] = true, - ['flying-robot-frame'] = true, - ['iron-gear-wheel'] = true, - ['iron-plate'] = true, - ['iron-stick'] = true, - ['logistic-science-pack'] = true, - ['low-density-structure'] = true, - ['lubricant'] = true, - ['military-science-pack'] = true, - ['nuclear-fuel'] = true, - ['plastic-bar'] = true, - ['processing-unit'] = true, - ['production-science-pack'] = true, - ['rocket-control-unit'] = true, - ['rocket-fuel'] = true, - ['rocket-part'] = true, - ['steel-plate'] = true, - ['stone-brick'] = true, - ['sulfur'] = true, - ['sulfuric-acid'] = true, - ['uranium-fuel-cell'] = true, - ['utility-science-pack'] = true, - ['basic-oil-processing'] = true, - ['advanced-oil-processing'] = true, - ['coal-liquefaction'] = true, - ['heavy-oil-cracking'] = true, - ['light-oil-cracking'] = true, - ['solid-fuel-from-light-oil'] = true, - ['solid-fuel-from-petroleum-gas'] = true, - ['solid-fuel-from-heavy-oil'] = true, - ['uranium-processing'] = true, - ['nuclear-fuel-reprocessing'] = true, - ['kovarex-enrichment-process'] = true -} - local elem_filter = { name = {{ filter = 'name', @@ -123,18 +69,15 @@ end local function apply_module(player, area, machine, module) for _, entity in pairs(player.surface.find_entities_filtered{area=area, name=machine, force=player.force}) do - if config.machine_craft[machine] ~= nil then - if config.machine_craft[machine] then - local m_current_recipe = entity.get_recipe() + if config.machine_craft[machine] then + local m_current_recipe = entity.get_recipe() - if m_current_recipe ~= nil then - if module_allowed[m_current_recipe.name] then - entity.surface.create_entity{name='item-request-proxy', target=entity, position=entity.position, force=entity.force, modules=module} - end + if m_current_recipe ~= nil then + if config.module_allowed[m_current_recipe.name] then + entity.surface.create_entity{name='item-request-proxy', target=entity, position=entity.position, force=entity.force, modules=module} end - else - entity.surface.create_entity{name='item-request-proxy', target=entity, position=entity.position, force=entity.force, modules=module} - end + else + entity.surface.create_entity{name='item-request-proxy', target=entity, position=entity.position, force=entity.force, modules=module} end else