From 207cfa3897c00cc027125292e169ed4dad981983 Mon Sep 17 00:00:00 2001 From: judos Date: Sun, 19 Jun 2016 18:12:46 +0200 Subject: [PATCH 1/3] fix crash when mod items are registered in final-fixes --- source/libs/itemSelection/control.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 From c58e600ffe9d6ed3bc2723368edcddef82a3ef3e Mon Sep 17 00:00:00 2001 From: judos Date: Sun, 19 Jun 2016 18:13:16 +0200 Subject: [PATCH 2/3] fix potential division by zero --- source/control/belt-sorter.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/control/belt-sorter.lua b/source/control/belt-sorter.lua index 7cc69e4..3c96fd8 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) end @@ -234,12 +235,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 From ad7b67d818126209328491ee14136ef16e202559 Mon Sep 17 00:00:00 2001 From: judos Date: Sun, 19 Jun 2016 18:14:22 +0200 Subject: [PATCH 3/3] fix potential desync due to on_load function call --- source/control.lua | 4 ---- 1 file changed, 4 deletions(-) diff --git a/source/control.lua b/source/control.lua index 9898bc9..9ba15ae 100644 --- a/source/control.lua +++ b/source/control.lua @@ -23,10 +23,6 @@ script.on_init(function() init() end) -script.on_load(function() - init() -end) - function init() if not global.hardCrafting then global.hardCrafting = {} end