This commit is contained in:
2023-10-04 11:01:54 +09:00
parent 189a3b51b6
commit 7ef3c9a0cb
2 changed files with 53 additions and 65 deletions

View File

@@ -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