From 484014475f695e595b47bd73e927c0ac841b9b61 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 6 Oct 2023 22:38:14 +0900 Subject: [PATCH] fixed non prod module insertion with recipe --- config/module.lua | 2 +- modules/gui/module.lua | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/config/module.lua b/config/module.lua index 9b50224e..a2a8e906 100644 --- a/config/module.lua +++ b/config/module.lua @@ -1,6 +1,6 @@ return { -- type of machine to handle together - default_module_row_count = 4, + default_module_row_count = 6, module_slot_max = 4, machine_prod_disallow = { ['beacon'] = true diff --git a/modules/gui/module.lua b/modules/gui/module.lua index 74470348..06981ba1 100644 --- a/modules/gui/module.lua +++ b/modules/gui/module.lua @@ -74,14 +74,32 @@ local function apply_module(player, area, machine, module) 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 + entity.surface.create_entity{name='item-request-proxy', target=entity, position=entity.position, force=entity.force, modules=module} + entity.last_user = player + + else + local prod = false + + for k, _ in pairs(module) do + if k:sub(1, 12) == 'productivity' then + prod = true + end + end + + if not prod then + entity.surface.create_entity{name='item-request-proxy', target=entity, position=entity.position, force=entity.force, modules=module} + entity.last_user = player + end + end else entity.surface.create_entity{name='item-request-proxy', target=entity, position=entity.position, force=entity.force, modules=module} + entity.last_user = player end else entity.surface.create_entity{name='item-request-proxy', target=entity, position=entity.position, force=entity.force, modules=module} + entity.last_user = player end end end