diff --git a/config/module.lua b/config/module.lua index cb776990..9b50224e 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', @@ -16,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 760ea015..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,15 +69,17 @@ 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] 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 - 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