From 64b9d0db40dfb6f52c2d454a930c836fb8929c16 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 17 Apr 2025 04:29:35 +0900 Subject: [PATCH] Add asserts to auto research queue (#385) * Update research.lua * Use asserts rather than ignore errors --------- Co-authored-by: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com> --- exp_scenario/module/commands/research.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/research.lua b/exp_scenario/module/commands/research.lua index 420a8741..63939033 100644 --- a/exp_scenario/module/commands/research.lua +++ b/exp_scenario/module/commands/research.lua @@ -71,7 +71,9 @@ local function on_research_finished(event) if not research.res_queue_enable then return end local force = event.research.force - if force.technologies[config.bonus_inventory.res[config.mod_set].name].level > config.bonus_inventory.res[config.mod_set].level then + local research = assert(config.bonus_inventory.res[config.mod_set], "Unknown mod set: " .. tostring(config.mod_set)) + local technology = assert(force.technologies[research.name], "Unknown technology: " .. tostring(research.name)) + if technology.level > research.level then module.res_queue(force, event.by_script) end end