diff --git a/exp_scenario/module/gui/research_milestones.lua b/exp_scenario/module/gui/research_milestones.lua index c5fa4a71..2285cd59 100644 --- a/exp_scenario/module/gui/research_milestones.lua +++ b/exp_scenario/module/gui/research_milestones.lua @@ -31,6 +31,8 @@ local font_color = { negative = { r = 1, g = 0.3, b = 0.3 }, } +local ing_used = {} + --- @class ExpGui_ResearchMilestones.research_targets --- @field index_lookup table --- @field target_times table @@ -43,12 +45,25 @@ local research_targets = { do --- Calculate the research targets local research_index = 1 - local total_time = config.milestone_warmup_time * 3600 + local total_time = 0 for _, name in pairs(research_data.milestone[research_data.mod_set]) do - if prototypes.technology[name] and (not prototypes.technology[name].hidden) then + local proto = prototypes.technology[name] + if proto and (not proto.hidden) then research_targets.index_lookup[name] = research_index + + local r_ing = proto.research_unit_ingredients + if r_ing then + -- each new ingredient add warmup time once + for _, i in pairs(r_ing) do + if not ing_used[i.name] then + ing_used[i.name] = true + total_time = total_time + config.milestone_warmup_time * 3600 + end + end + end + -- The number is affected by multiplier already - total_time = total_time + math.ceil(prototypes.technology[name].research_unit_count * 3600 / config.milestone_rate) + total_time = total_time + math.ceil(proto.research_unit_count * 3600 / config.milestone_rate) research_targets.target_times[research_index] = { name = name,