Page 10 of 10

Re: [0.12.x][v0.12.6] Bob's Electronics

Posted: Sun Oct 30, 2016 8:30 am
by Chronicon
okay thanks, from what you have said it is probably a mod conflicting with yours

Re: [0.12.x][v0.12.6] Bob's Electronics

Posted: Sun Mar 19, 2017 3:03 pm
by Estelyen
I'm in the process of learning lua right now and since I really enjoy your mods, I took a look at the underlying code. I have a general idea how you made it work now, but there's one thing I'm still trying to figure out: How your mod replaces the ingredients of the base mod recipes. For instance, if I wanted to make the recipe for the offshore pump require Electronic Processing Board instead of Electronic circuits or Basic Circuit Board, where would I have to make that change? Can't seem to find it anywhere :( Yes, I know that change would make absolutely zero sense, but as I said, just trying to learn here.

There's some recipe ingredient replacement functions in your library and the prototypes/recipe-updates.lua in this mod calls one of them for a few items, but only a few and changing that function call or adding another one there doesn't seem to do anything.

Also, the data-final-fixes.lua calls the replace in all function four times, but the order of its arguments makes it look like it would change the modded recipes back to the vanilla ones, which highly confuses me :?

Don't worry, I'm not intending to publish anything of I'm doing to your mods, I'm just experimenting in private so I can test and increase my fledgling lua knowledge :mrgreen: I hope you don't mind if I ask these questions here. As I said, your mods are amazing!

Re: [0.12.x][v0.12.6] Bob's Electronics

Posted: Sun Mar 19, 2017 3:32 pm
by ukezi
he uses a function of the lib for that. I believe it's in data-update of electronic. the game loads mods by 1. building a dependency tree 2. load data from root to leaf 3. load data-update form root to leaf. I don't know if it does depth or breath first.

Re: [0.12.x][v0.12.6] Bob's Electronics

Posted: Sun Mar 19, 2017 9:43 pm
by Estelyen
Ah I think I got it: The mod doesn't change any base mod recipes at all, it just replaces the items with modded ones (using dytechs advanced processing unit for its tier 4) :o

So to answer my own question from above, I can't change the mod itself to do it, but I could edit the recipe myself by adding

Code: Select all

data.raw.recipe["offshore-pump"].ingredients =
{
   {"pipe", 1},
   {"iron-gear-wheel", 1},
   {"advanced-processing-unit", 2},
   
}
, correct? :D

Re: [0.12.x][v0.12.6] Bob's Electronics

Posted: Sun Mar 19, 2017 10:34 pm
by ukezi
well that would be changeing them, wouldn't it? he doesn't state all the recipes directly but goes to all of them with a loop and uses the function in his lib to replace the items. that's how it also changes all the recipes of mods.
also there is an other step after data updates, data updates final.

Code: Select all

bobmods.lib.recipe.replace_ingredient_in_all("basic-electronic-circuit-board", "electronic-circuit")
bobmods.lib.recipe.replace_ingredient_in_all("electronic-circuit-board", "advanced-circuit")
bobmods.lib.recipe.replace_ingredient_in_all("electronic-processing-board", "processing-unit")
bobmods.lib.recipe.replace_ingredient_in_all("electronic-processing-board-2", "advanced-processing-unit")

if data.raw.item["basic-electronic-circuit-board"] then
  data.raw.item["basic-electronic-circuit-board"] = nil
end

if data.raw.item["electronic-circuit-board"] then
  data.raw.item["electronic-circuit-board"] = nil
end

if data.raw.item["electronic-processing-board"] then
  data.raw.item["electronic-processing-board"] = nil
end

if data.raw.item["electronic-processing-board-2"] then
  data.raw.item["electronic-processing-board-2"] = nil
end

Re: [0.12.x][v0.12.6] Bob's Electronics

Posted: Mon Mar 20, 2017 5:58 am
by Estelyen
ukezi wrote:well that would be changeing them, wouldn't it?
Yes, and that was my initial question, as I thought this mod would do just that.
ukezi wrote:

Code: Select all

bobmods.lib.recipe.replace_ingredient_in_all("basic-electronic-circuit-board", "electronic-circuit")
bobmods.lib.recipe.replace_ingredient_in_all("electronic-circuit-board", "advanced-circuit")
bobmods.lib.recipe.replace_ingredient_in_all("electronic-processing-board", "processing-unit")
bobmods.lib.recipe.replace_ingredient_in_all("electronic-processing-board-2", "advanced-processing-unit")
This is the thing that still confuses me a bit, since the function actually takes the item to replace as the first argument and the replacing item as the second, so these function calls would replace any modded electronic item ingredients with vanilla ones (which in turn have been changed by this mod). So I guess these lines are just meant for recipes added in other mods to "get them in line" or something?

Re: [0.12.x][v0.12.6] Bob's Electronics

Posted: Mon Mar 20, 2017 10:29 am
by bobingabout
Estelyen wrote:
ukezi wrote:well that would be changeing them, wouldn't it?
Yes, and that was my initial question, as I thought this mod would do just that.
ukezi wrote:

Code: Select all

bobmods.lib.recipe.replace_ingredient_in_all("basic-electronic-circuit-board", "electronic-circuit")
bobmods.lib.recipe.replace_ingredient_in_all("electronic-circuit-board", "advanced-circuit")
bobmods.lib.recipe.replace_ingredient_in_all("electronic-processing-board", "processing-unit")
bobmods.lib.recipe.replace_ingredient_in_all("electronic-processing-board-2", "advanced-processing-unit")
This is the thing that still confuses me a bit, since the function actually takes the item to replace as the first argument and the replacing item as the second, so these function calls would replace any modded electronic item ingredients with vanilla ones (which in turn have been changed by this mod). So I guess these lines are just meant for recipes added in other mods to "get them in line" or something?
The ones on the left are "Old" names from when electronics was not only part of the plates mod, but also added electronics alongside the old ones. This remains in the game mostly for legacy reasons, since you can't actually use old mods with newer versions of the game, this in theory could be removed now, and we only need a migration script to replace them if loading old savegames.

Considering there were effectively 2 entire trees of electronics, changing it to a replacement seemed like the way to go.

Also, there are some actual replacements for base game recipes around the place, Battery is one that has been completely replaced, and a lot of the very low tech items have had the electronic-circuit replaced by the basic-circuit-board.

Re: [0.12.x][v0.12.6] Bob's Electronics

Posted: Mon Apr 03, 2017 7:20 pm
by Uiop44000
Not sure if this has been asked before, but when I get Oil Processing & Plastics researches, the recipes requiring wood automatically change into Synthetic Wood. I'm not particularly fond of this, but I can live with it. However, to make the wood, I need to actually make Oil Refineries and Chemical Plants, which themselves require the wood, so I can't actually do anything at the moment. How can I fix this?

Re: [0.12.x][v0.12.6] Bob's Electronics

Posted: Mon Apr 03, 2017 11:08 pm
by steinio
Uiop44000 wrote:Not sure if this has been asked before, but when I get Oil Processing & Plastics researches, the recipes requiring wood automatically change into Synthetic Wood. I'm not particularly fond of this, but I can live with it. However, to make the wood, I need to actually make Oil Refineries and Chemical Plants, which themselves require the wood, so I can't actually do anything at the moment. How can I fix this?
You can craft wood with assemblers or per hand and then all other things.
I guess you need circuits which production should also be automated before chem plants.

It's a Factorio bug at selecting recipes in wrong order.
This mod should also fix this: https://mods.factorio.com/mods/Xuerian/ ... ndcrafting

Greetings steinio

Re: [0.12.x][v0.12.6] Bob's Electronics

Posted: Tue Apr 04, 2017 6:31 am
by Engimage
Uiop44000 wrote:Not sure if this has been asked before, but when I get Oil Processing & Plastics researches, the recipes requiring wood automatically change into Synthetic Wood. I'm not particularly fond of this, but I can live with it. However, to make the wood, I need to actually make Oil Refineries and Chemical Plants, which themselves require the wood, so I can't actually do anything at the moment. How can I fix this?
Actually recipes do not change. The new recipe is added yes. Both recipes remain in the game and you can opt to use any of them. However the recipes are on different pages (groups) so it might confuse you as they are not near each other.
Bob's mods do provide several options to get many things so you should choose carefully which recipe fits you most.

The greatest example would be Lead Plates that you require for batteries. You might opt to just smelt Lead Ore and get Sulfuric Acid from Oil but there is a more complex way by producing Lead Oxide from ore with Oxygen from electrolysis which will get you Sulfur Dioxide in the quantity exactly enough for the equal amount of lead plates for your batteries. You will need plastic anyways but you will not bother producing sulfuric acid from oil.

Re: [0.12.x][v0.12.6] Bob's Electronics

Posted: Wed Apr 05, 2017 7:49 am
by Uiop44000
steinio wrote:
Uiop44000 wrote:Not sure if this has been asked before, but when I get Oil Processing & Plastics researches, the recipes requiring wood automatically change into Synthetic Wood. I'm not particularly fond of this, but I can live with it. However, to make the wood, I need to actually make Oil Refineries and Chemical Plants, which themselves require the wood, so I can't actually do anything at the moment. How can I fix this?
You can craft wood with assemblers or per hand and then all other things.
I guess you need circuits which production should also be automated before chem plants.

It's a Factorio bug at selecting recipes in wrong order.
This mod should also fix this: https://mods.factorio.com/mods/Xuerian/ ... ndcrafting

Greetings steinio
Works now, thanks for the help. :D

Re: [0.12.x][v0.12.6] Bob's Electronics

Posted: Wed Jun 28, 2017 6:10 am
by featherwinglove
featherwinglove wrote:I've logged in with a proposal of my own that I'm a bit lazy to code myself.
Not anymore :mrgreen:
As electronics have evolved in real life, older devices (e.g. ball mice and portable Phillips' cassette players e.g. Sony Walkman) have been replaced by newer devices which are either cheaper/easier on power and of equivalent functionality (e.g. optical mice) or better functionality (e.g. portable Flash/MP3 players e.g. iPod.) Some (not all, 555 and 7400 fans!) components have gone out of production. In a lot of cases, older functions are performed by newer circuits. My equivalent proposal for Bob's Electronics is called Panelization, and I think it would be quite handy for some players who would like to toss older tier electronics factories even if they still need their older tier electronics boards.
Also saves an
lol
tonne of copper.

So I typed for about 15 minutes, scratched my head forgetting about require(prototypes) for about 20 minutes, fixed syntax errors for an hour, and got this, nerfed from my original proposal (which makes basic circuits hilariously cheap). Have fun!
Panelized Circuits
Think I should do more on this idea or would you like to take it from here?