Skip to content

Commit 8e37a70

Browse files
committed
fix: update research triggers and queue handling for Factorio 2.0 API
- Research trigger `trig.item` is now a table, not a string. Use `trig.item.name` for localisation and amount lookups. - Research queue now returns LuaTechnology objects instead of tech names. Pass these directly to `tech_name_string` when announcing the queue.
1 parent da77d58 commit 8e37a70

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

scripts/research.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ local function localise_trigger(tech, trig)
139139
local res = { string.format("fa.research-trigger-%s", trig.type) }
140140

141141
if trig.type == "craft-item" then
142-
table.insert(res, Localising.get_localised_name_with_fallback(prototypes.item[trig.item]))
142+
table.insert(res, Localising.get_localised_name_with_fallback(prototypes.item[trig.item.name]))
143143

144-
local amount = CRAFT_ITEM_COUNTS()[tech.name][trig.item]
144+
local amount = CRAFT_ITEM_COUNTS()[tech.name][trig.item.name]
145145
assert(amount)
146146
table.insert(res, amount)
147147
table.insert(res, trig.item_quality or "normal")
@@ -729,7 +729,7 @@ function mod.queue_announce(pindex)
729729

730730
local joining = {}
731731
for _, t in pairs(queue) do
732-
table.insert(joining, tech_name_string(player.force.technologies[t]))
732+
table.insert(joining, tech_name_string(t))
733733
end
734734
local joined = FaUtils.localise_cat_table(joining, ", ")
735735

0 commit comments

Comments
 (0)