From 423cf5aff24313edc38c0c25bea93ae4332fa158 Mon Sep 17 00:00:00 2001 From: Deadlock989 <3128845+Deadlock989@users.noreply.github.com> Date: Sun, 22 Nov 2020 09:10:07 +0000 Subject: [PATCH] Update steel-display.lua ickputzdirwech's fix only handled specific cases and ignored the values for technologies and recipes defined in globals.lua also didn't handle the situation where any IR unlocks are specified --- migrations/steel-display.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/migrations/steel-display.lua b/migrations/steel-display.lua index 46aa4fb..c61a4d3 100644 --- a/migrations/steel-display.lua +++ b/migrations/steel-display.lua @@ -1,11 +1,11 @@ +local DID = require("globals") + for index, force in pairs(game.forces) do - local technologies = force.technologies - local recipes = force.recipes - - if technologies["steel-processing"].researched then - recipes["steel-display-small"].enabled = true - recipes["steel-display-medium"].enabled = true - recipes["steel-display"].enabled = true - end - + for display,displaydata in pairs(DID.displays) do + if displaydata.IR_unlock and force.technologies[displaydata.IR_unlock] and force.technologies[displaydata.IR_unlock].researched then + force.recipes[display].enabled = true + elseif displaydata.unlock and force.technologies[displaydata.unlock] and force.technologies[displaydata.unlock].researched then + force.recipes[display].enabled = true + end + end end