diff --git a/source/control.lua b/source/control.lua index 784f979..81a01b7 100644 --- a/source/control.lua +++ b/source/control.lua @@ -24,10 +24,6 @@ script.on_init(function() init() end) -script.on_load(function() - init() -end) - function init() if not global.hardCrafting then global.hardCrafting = {} end diff --git a/source/control/belt-sorter.lua b/source/control/belt-sorter.lua index 81febdf..88ff2f3 100644 --- a/source/control/belt-sorter.lua +++ b/source/control/belt-sorter.lua @@ -169,10 +169,11 @@ beltSorter.tick = function(beltSorter,data) end local energyPercentage = math.min(beltSorter.energy,800) / 800 - local nextUpdate = math.floor(8 / energyPercentage) + local nextUpdate if energyPercentage < 0.1 then nextUpdate = 80 else + nextUpdate = math.floor(8 / energyPercentage) beltSorterSearchInputOutput(beltSorter,data) beltSorterDistributeItems(beltSorter,data) data.input = nil @@ -236,12 +237,12 @@ function beltSorterSearchInputOutput(beltSorter,data) local surface = beltSorter.surface local x = beltSorter.position.x local y = beltSorter.position.y - -- search for input / output belts + -- search for input and output belts data.input = {} data.output = {} for rowIndex = 1, 4 do - data.input[rowIndex] = nil -- [side] => BeltAccess / SplitterAccess objects - data.output[rowIndex] = nil -- [side] => BeltAccess / SplitterAccess objects + data.input[rowIndex] = nil -- [side] => BeltAccess or SplitterAccess objects + data.output[rowIndex] = nil -- [side] => BeltAccess or SplitterAccess objects local searchPos = searchPriority[rowIndex] local searchPoint = { x = x + searchPos[1], y = y + searchPos[2] } for _,searchType in pairs(BeltFactory.supportedTypes) do diff --git a/source/libs/itemSelection/control.lua b/source/libs/itemSelection/control.lua index 030be80..461ac9a 100644 --- a/source/libs/itemSelection/control.lua +++ b/source/libs/itemSelection/control.lua @@ -70,7 +70,13 @@ local function rebuildItemList(player) local index = 1 for name,prototype in pairs(game.item_prototypes) do if filter == "" or string.find(name,filter) then - frame.items.add(checkBoxForItem(name)) + local checkbox = checkBoxForItem(name) + local status, err = pcall(function() frame.items.add(checkbox) end) + if not status then + warn("Error occured with item: "..name..". The style is missing probably because item was registered in data-final-fixes.lua instead of before. The item will not be displayed in the list.") + warn(err) + end + index = index + 1 if index > mainMaxRows*mainMaxEntries then break end end