Error in boblibrary 0.15.8

Some mods, made by Bob. Basically streaks every Factroio-area.

Moderator: bobingabout

User avatar
Thorvin
Inserter
Inserter
Posts: 22
Joined: Tue Jul 18, 2017 5:44 pm
Contact:

Error in boblibrary 0.15.8

Post by Thorvin »

Hi, Bobingabout.

First of all I'd like to thank you for the work that you put in your mods. I've enjoyed them alot.

I am currently using your library for a mod of my own, and I had a hard time trying to generate ores that require mining fluids ; until I realised there is a minor error in ore-functions.lua on lines 360 and 361.

Code: Select all

360 data.raw.resource[inputs.name].required_fluid = inputs.required_fluid
361 data.raw.resource[inputs.name].fluid_amount = inputs.fluid_amount or 10
"required_fluid" and "fluid_amount" should be in in the minable object, not at the root of the ressource. The thorium ore acid requirement also (obviously) does not work.
I found nothing about this on the forums so I guess that's not the most used thing but i thought pointing it out could be useful.



If anyone else bumps into this problem before it is fixed, you can add the following lines juste before the end of the ore generation loop :

Code: Select all

if data.raw.resource[ore.name].required_fluid then
    data.raw.resource[ore.name].minable.required_fluid = data.raw.resource[ore.name].required_fluid
    data.raw.resource[ore.name].minable.fluid_amount = data.raw.resource[ore.name].fluid_amount
end
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Error in boblibrary 0.15.8

Post by bobingabout »

Doh...
Well, as you can tell, I've never actually used this short of adding in the new feature to try and fill the gap.

I'll have to remember to take a look some time.
Thorvin wrote:

Code: Select all

if data.raw.resource[ore.name].required_fluid then
    data.raw.resource[ore.name].minable.required_fluid = data.raw.resource[ore.name].required_fluid
    data.raw.resource[ore.name].minable.fluid_amount = data.raw.resource[ore.name].fluid_amount
end

Code: Select all

if data.raw.resource[ore.name].required_fluid then
    data.raw.resource[ore.name].minable.required_fluid = data.raw.resource[ore.name].required_fluid
    data.raw.resource[ore.name].minable.fluid_amount = data.raw.resource[ore.name].fluid_amount or 10
end
The or 10 on the end is basically a fallback in case you don't specify the amount.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.
User avatar
Thorvin
Inserter
Inserter
Posts: 22
Joined: Tue Jul 18, 2017 5:44 pm
Contact:

Re: Error in boblibrary 0.15.8

Post by Thorvin »

Yes, i noticed the numerous fallbacks all through the library. I appreciate the "best practiceness" of such details ;)

I did not include it in my code fix since it is in my mod, where i call generate_updates_stage, exactly like what you have in bobores, so the inputs have already gone through your function and are already defaluted at 10 if not specified.
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Error in boblibrary 0.15.8

Post by bobingabout »

I updated it last night.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.
Post Reply

Return to “Bob's mods”