Early Bio Boiler


Alters the recipe unlock for Bio Industries' Bio Boiler to be unlocked earlier in a playthrough.

3 years ago
0.18 - 1.1
233

b Mod breaks Bio Industries

4 years ago

I've sent you a PM at the forums with the details -- please check there! :-)

4 years ago

Thanks for letting me know! Sorry, I'm still very much a novice modder, and apologies for failing to notice the issue. I've been playing with it on my own, but never noticed any problems. I'll do my best to fix it in the coming days.

4 years ago
(updated 4 years ago)

Pi-C, I have news. Unfortunately, I cannot send private messages on the forums, as it states I've not participated in enough discussions/am new. I did experiment with my mod active alongside Bio Industries, and I don't seem to have the same problem with recipes being removed from the Bio Farm technology. I went into a sandbox world to research the tech manually and verify that everything was there, and indeed, the technology has the bio nursery, bio farm, terraformer, etc. I tested with only Bio Industries and Early Bio Boiler installed. I will still add your proposed fixes to the mod as soon as I can, but I wanted to ask about how often/how frequently this issue occurred when tested?

4 years ago
(updated 4 years ago)

Pi-C, I have news. Unfortunately, I cannot send private messages on the forums, as it states I've not participated in enough discussions/am new.

Oh, that's kind of a spam protection. You must have made at least one forum post before you can PM somebody. But I thought one only couldn't send PMs first, forgot about that you also can't answer if somebody has sent you a message. :-)

I did experiment with my mod active alongside Bio Industries, and I don't seem to have the same problem with recipes being removed from the Bio Farm technology. I went into a sandbox world to research the tech manually and verify that everything was there, and indeed, the technology has the bio nursery, bio farm, terraformer, etc. I tested with only Bio Industries and Early Bio Boiler installed.

The effect depends on your mod setting:

if settings.startup["earlybioboilers-require-research"].value == true then
    data.raw["technology"]["bi-tech-bio-farming"].effects = {{type = "unlock-recipe", recipe = "bi-bio-boiler"}}
    data:extend({
  …
   })
end

I will still add your proposed fixes to the mod as soon as I can, but I wanted to ask about how often/how frequently this issue occurred when tested?

If you give away the Bio boiler for free right from the start (i.e. "earlybioboilers-require-research" is not checked), the line that overwrites the techs won't be executed and all of BI's recipes are available. If the setting is on, only the Bio boiler will be unlocked by researching bio farming.

Sorry, I'm still very much a novice modder, and apologies for failing to notice the issue.

Such things may happen to more experienced modders as well! It's likely to happen if you play around with rearranging code and doing things in different way -- it's quite easy to overlook that a variable you already had defined in its original place will be undefined if you move the block up a bit… Incidentally, I've noticed just yesterday that I've locked most of the optional disassembly recipes myself by mistake when I tried to be clever and unlock them in a loop (fixed for next release). But that concerned only some recipes that are optional anyway, and didn't remove core recipes. Most important: Nobody has complained about it yet, so I doubt anybody noticed the issue. :-)

Anyway, testing everything in every possible combination would be ideal. (That's difficult with BI because it defines so may things of its own, and not everything is supposed to be there in every situation: Mod settings play a role, some recipes will be toggled or changed if certain other mods -- Krastorio, Bob's, Angel's, Pyanodon's and several more -- are active or if certain recipes already exist etc. Way too much to test for just one person!)

Anyway, while working on your mod, it's a good idea to use log() a lot, and to check factorio-current.log for the output. (Don't forget to comment out these commands before uploading, or people will complain about log spam!) You can easily get at the content of a table like this:

log("Technology effects: " .. serpent.block(data.raw["technology"]["bi-tech-bio-farming"].effects))

You may get an insane amount of output, but usually it's a good idea to look at it -- if only to get a feeling for Factorio's data structures. Also, I've found that being strict about indenting code (e.g. "if" and the matching "end" would always be indented by the same amount) makes it much easier to spot mistakes. Just some hints … :-)

4 years ago
(updated 4 years ago)

Thanks for all the help! After doing a bit of reworking the mod using the code you gave and adjusting it for the mod settings, it seems to have worked well. I tested the effects in sandbox both with and without the research mod setting enabled, and all recipes from the affected tech were once again present. I added expensive mode recipes as well, and I believe the bio-boiler unlock appearing in its original tech after being moved to a different one has been fixed. Please feel free to test it out and let me know if I missed something or left something out.\

Edit:
I was logged out of my Factorio Forums account for whatever reason, so I didn't get the notification about your second message until just checking it. I see you attached a fixed version of the mod. I already uploaded the one I finished working on earlier, but I will download and look through your version as well to make sure mine is on-par. Thank you again for all the assistance!

4 years ago
(updated 4 years ago)

Great, this is much better now! However, there are still two bugs -- but they're easy to fix and not as grave as the one I've complained about:

data-final-fixes.lua:

if tech and tech.effects then
…
end
data:extend({tech})

This will break if the tech doesn't exist (could happen if I'd rename it, or if it has been removed in BI or by some other mod)! You must call data:extend() inside the if-block to prevent crashes.

technology.lua:

if settings.startup["earlybioboilers-require-research"].value == true then
…
local new = data.raw.recipe["bi-bio-boiler"]
…
new.enabled = true
data:extend({new})

This recipe will now also be freely available if the tech hasn't been researched yet, "new.enabled" needs to be false in this branch! Keep "new.enabled = true" in the "else" branch, though!

4 years ago

I'll work on the first issue, though the second one hasn't been a problem for me. Notably, new.enabled does nothing as far as I've seen. new.normal.enabled and new.expensive.enabled are what I had to use in the research-less recipe to get it to become available, while new.enabled didn't affect it at all. But I suppose it's good habit to remove residual/useless code, so I'll take care of that soon too.

4 years ago

Notably, new.enabled does nothing as far as I've seen. new.normal.enabled and new.expensive.enabled are what I had to use in the research-less recipe to get it to become available, while new.enabled didn't affect it at all.

You're right! When I noticed that line I focused on that and didn't really look at the lines above it. If at least one of "normal" and "expensive" is defined, recipe data in that definition will be used and recipe data at the top level will be ignored (see here.) So new.enabled really doesn't do anything …

Also, I must have made a mistake in my testing and just have seen things because I expected them to be there. I've just tried again with the setting turned on, and the boiler isn't in the crafting menu on starting a new game, but is shown as research result of Bio farming -- just as it should be. :-)

New response