Page 1 of 1

[0.16.42] bob_power bug after latest update

Posted: Sat May 12, 2018 3:33 am
by Trblz
Just updated my mods and got
9.781 Loading mod bobpower 0.16.4 (data-updates.lua)
9.783 Script @__boblibrary__/technology-functions.lua:152: Technology bob-boiler-2 does not exist.
9.783 Script @__boblibrary__/technology-functions.lua:152: Technology bob-boiler-2 does not exist.
9.783 Script @__boblibrary__/technology-functions.lua:152: Technology bob-boiler-3 does not exist.
9.785 Script @__boblibrary__/technology-functions.lua:152: Technology steam-engine-generator-2 does not exist.
9.785 Script @__boblibrary__/technology-functions.lua:152: Technology steam-engine-generator-2 does not exist.
9.785 Script @__boblibrary__/technology-functions.lua:152: Technology steam-engine-generator-2 does not exist.
9.785 Script @__boblibrary__/technology-functions.lua:152: Technology steam-engine-generator-3 does not exist.
9.785 Script @__boblibrary__/technology-functions.lua:152: Technology steam-engine-generator-3 does not exist.
9.786 Error ModManager.cpp:1024: Failed to load mod "bobpower": __bobpower__/data-updates.lua:8: __boblibrary__/item-functions.lua:47: attempt to compare number with string
My modlist is
mod-list.json
Mod list
(4.03 KiB) Downloaded 46 times

Re: [0.16.42] bob_power bug after latest update

Posted: Sat May 12, 2018 4:01 am
by gnemonix
I'll re-post this from here
gnemonix wrote:A recent update of Nanobots (2.0.5) seemed to break BobPower.
Without Nanobots or with an older version (2.02) the game loads just fine.

Investigation discovered the culprit to be these:

bobpower/prototypes/fluid-generator-updates.lua

Code: Select all

if data.raw.item["steel-pipe"] then
  bobmods.lib.recipe.add_ingredient("fluid-generator-2", "normal", {"steel-pipe", 5})
end

Code: Select all

if data.raw.item["titanium-pipe"] then
  bobmods.lib.recipe.add_ingredient("fluid-generator-3", "normal", {"titanium-pipe", 5})
end
With the BobLibrary function defined as this:
boblibrary/recipe-functions.lua

Code: Select all

function bobmods.lib.recipe.add_ingredient(recipe, item)
The library function is defined with 2 parameters while the code calling it is using 3 parameters.

Due to the "normal" parameter in the middle, I noticed that there is a different function that might have been intended: add_difficulty_ingredient() which does have 3 parameters.

To get my game working for now I removed the "normal" parameter in the problem lines like so:

Code: Select all

if data.raw.item["steel-pipe"] then
  bobmods.lib.recipe.add_ingredient("fluid-generator-2", {"steel-pipe", 5})
end

Code: Select all

if data.raw.item["titanium-pipe"] then
  bobmods.lib.recipe.add_ingredient("fluid-generator-3", {"titanium-pipe", 5})
end
However, which is inteded? add_ingredient() or add_difficulty_ingredient()

Re: [0.16.42] bob_power bug after latest update

Posted: Sat May 12, 2018 4:41 am
by Trblz
The actual trigger was not bob_power but the nanobots update beyond 2.0.2 - this broke bob's code. (https://mods.factorio.com/mod/Nanobots/discussion)
Reversing the nano_bots version solved the current problem.

Re: [0.16.42] bob_power bug after latest update

Posted: Sat May 12, 2018 2:09 pm
by gnemonix
It's not Nanobots itself so much as a major bump in STDLIB that potentially broke it. However, the API calls for boblibrary are still inconsistent and need to be addressed.

Re: [0.16.42] bob_power bug after latest update

Posted: Mon May 14, 2018 9:29 am
by bobingabout
It's bob's fault. he needs to fix Power mod.

Re: [0.16.42] bob_power bug after latest update

Posted: Mon May 14, 2018 4:26 pm
by Nexela
Actually was a mixture of Bobs and Nexela's fault

Bob was using the wrong function so the parameters were not what was expected. In normal cases this didn't error it just logged.

Nexela then made an stdlib update that had a changed pushed to the wrong repo that changed the way strings behaved. which now caused caused bobs function to return a non number value (instead of nil) causing things to go boom.

Re: [0.16.42] bob_power bug after latest update

Posted: Mon May 14, 2018 4:49 pm
by Aeternus
Here's to never needing error handling, ay Bob? :D

Seems like a fairly simple fix though.

Re: [0.16.42] bob_power bug after latest update

Posted: Mon May 14, 2018 8:39 pm
by bobingabout
if you have recomendations to make that function in my library more robust, I'm open to sugestions.

Re: [0.16.42] bob_power bug after latest update

Posted: Tue May 15, 2018 1:22 am
by Nexela
bobingabout wrote:if you have recomendations to make that function in my library more robust, I'm open to sugestions.
I didn't follow the full logic of the function put it it is meant to only take a table then doing an if not type(input) == table then return log('blah") end at the top of the function will help

Other than that your function was working correctly just the string change broke it. So fixing it so bob-power calls the correct function would be the best first step :)

Re: [0.16.42] bob_power bug after latest update

Posted: Tue May 15, 2018 8:36 am
by bobingabout
Nexela wrote:
bobingabout wrote:if you have recomendations to make that function in my library more robust, I'm open to sugestions.
I didn't follow the full logic of the function put it it is meant to only take a table then doing an if not type(input) == table then return log('blah") end at the top of the function will help

Other than that your function was working correctly just the string change broke it.
So, add a check in bobmods.lib.item.basic_item to make sure input variable is actually a table.
Nexela wrote:So fixing it so bob-power calls the correct function would be the best first step :)
I already did this bit.