[Simple Silicon:] Can't change crafting time for quartz

Place to get help with not working mods / modding interface.
Post Reply
okurt
Manual Inserter
Manual Inserter
Posts: 4
Joined: Sun Dec 08, 2019 10:59 pm
Contact:

[Simple Silicon:] Can't change crafting time for quartz

Post by okurt »

Dear Community,

I am using the Simple Silicon mod v1.2.1 and would like to change the recipe for quartz. Currently it looks like this:

Code: Select all

        type = "recipe",
        name = "SiSi-quartz",
        category = "crafting-with-fluid",
        energy_required = 0.5,
        normal = 
        {
            enabled = false,
            ingredients =
            {
                {type="item", name="stone", amount=1},
                {type="fluid", name="water", amount=35}
            },
            results =
            {
                {type="item", name="SiSi-quartz", probability=0.50, amount_min=1, amount_max=1} -- estimated output:  0.5 units per cycle on average
            }
        }
I don't like the idea of output depending on chance and only averaging to the correct amount, so I changed the recipe:

Code: Select all

        energy_required = 1,
        normal = 
        {
	...
            ingredients =
            {
                {type="item", name="stone", amount=2},
                {type="fluid", name="water", amount=70}
            },
            results =
            {
                {type="item", name="SiSi-quartz", amount=1}
            }
        }
Changing the amount of ingredient as well as removing the probability factor worked fine, but (and that's the problem) the crafting time did not change. I am playing 0.17.79 on a savegame, but the problem also occurs when starting a new game. I am using the following mods: AloneInTheDark, assault-rifle, bigger-slower-trains, Hovercraft, laborat, Pre0-17-60Oil, SimpleSilicon (So nothing that should conflict).
I tried the following:
  • Setting the crafting time to an arbitrary amount (2 or 0.01), but that did not affect it whatsoever.
  • Resetting the recipes with /c game.player.force.reset_recipes().
  • Explicitly reloading the recipe with /c game.player.force.recipes["SiSi-quartz"].reload()
It appears that any change made at energy_required would be discarded and instead the 0.5 default value would be set. This becomes even stranger as nowhere in the procedural code the recipe is touched. I am not familiar with Factorio modding, I just know a thing or two about programming. My next approach would be explicitly setting the value with something like recipe["SiSi-quartz"]["normal"].energy_required = 1. How would I do that?
Does anyone have a clue how to solve that issue? You help would be greatly appreciated!

Greets

Honktown
Smart Inserter
Smart Inserter
Posts: 1026
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: [Simple Silicon:] Can't change crafting time for quartz

Post by Honktown »

You could add the energy change in data-final-fixes, at the end of the file. It'd be "brittle" in that anything could break it, but as long as no other mods change it, the change would take effect after everything else.

editedit: nevermind, you had it right the first time. Seems for recipes with difficulties, the energy value should be in the difficulty.

data.raw.recipe["SiSi-quartz"].normal.energy_required = .5
I have mods! I guess!
Link

okurt
Manual Inserter
Manual Inserter
Posts: 4
Joined: Sun Dec 08, 2019 10:59 pm
Contact:

Re: [Simple Silicon:] Can't change crafting time for quartz

Post by okurt »

Honktown wrote:
Mon Dec 09, 2019 12:46 am
You could add the energy change in data-final-fixes, at the end of the file. ...
data.raw.recipe["SiSi-quartz"].normal.energy_required = .5
Hallelujah, Brothers and Sisters, this circumvents the problem! I added the line at the bottom of recipe.lua (with energy_required=1, not .5, that's the default value I wanted to overwrite). Thank you very much for your help!

(Bottom note: It would be nice to know what the actual problem was. Changing energy_required works just fine for every other recipe in the file, only quartz causes an issue. Maybe someone else has an idea? If not, meh.)

Honktown
Smart Inserter
Smart Inserter
Posts: 1026
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: [Simple Silicon:] Can't change crafting time for quartz

Post by Honktown »

okurt wrote:
Mon Dec 09, 2019 7:32 pm
Honktown wrote:
Mon Dec 09, 2019 12:46 am
You could add the energy change in data-final-fixes, at the end of the file. ...
data.raw.recipe["SiSi-quartz"].normal.energy_required = .5
Hallelujah, Brothers and Sisters, this circumvents the problem! I added the line at the bottom of recipe.lua (with energy_required=1, not .5, that's the default value I wanted to overwrite). Thank you very much for your help!

(Bottom note: It would be nice to know what the actual problem was. Changing energy_required works just fine for every other recipe in the file, only quartz causes an issue. Maybe someone else has an idea? If not, meh.)
I did mention in my edit, the energy_required does seem to need to be part of the difficulty, if the difficulty exists. I don't know the interaction between having one at the item level and having one at the item.difficulty level. The recipe you originally posted has the energy required outside, and I know for some other values it won't take from different layers like that.

If you're more intent on finding the original problem, add:

Code: Select all

if data.raw.recipe["SiSi-quartz"] then
  log( "we are in wherever" )
  log( serpent.block( data.raw.recipe["SiSi-quartz"], {comment = false, numformat = '%1.8g' } ) )
end
in a bunch of places. Anywhere it exists, it'll barf up the recipe into the log. Either the recipe never changed and the game is doing some annoying default behavior, or something is changing it and that would log it.
I have mods! I guess!
Link

okurt
Manual Inserter
Manual Inserter
Posts: 4
Joined: Sun Dec 08, 2019 10:59 pm
Contact:

Re: [Simple Silicon:] Can't change crafting time for quartz

Post by okurt »

Honktown wrote:
Mon Dec 09, 2019 11:46 pm
I did mention in my edit, the energy_required does seem to need to be part of the difficulty, if the difficulty exists. I don't know the interaction between having one at the item level and having one at the item.difficulty level. The recipe you originally posted has the energy required outside, and I know for some other values it won't take from different layers like that.
Again it turns out you're right! If I add energy_required at the item.difficulty level, it perfectly works without explicitly overwriting. I am sorry I didn't respond the first time you mentioned it, I simply didn't get your point. The rest of the file doesn't suggest that you need to declare energy_required on item.difficulty level since quartz is the only item with different recipes for different difficulties.

Again, thank you very much for your help! Without you, I may not have gotten rid of that issue and I assume it would have bugged me until I would have either uninstalled the mod or stopped playing the game. Great to have people like you around :)

Honktown
Smart Inserter
Smart Inserter
Posts: 1026
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: [Simple Silicon:] Can't change crafting time for quartz

Post by Honktown »

okurt wrote:
Wed Dec 11, 2019 10:32 pm
Honktown wrote:
Mon Dec 09, 2019 11:46 pm
I did mention in my edit, the energy_required does seem to need to be part of the difficulty, if the difficulty exists. I don't know the interaction between having one at the item level and having one at the item.difficulty level. The recipe you originally posted has the energy required outside, and I know for some other values it won't take from different layers like that.
Again it turns out you're right! If I add energy_required at the item.difficulty level, it perfectly works without explicitly overwriting. I am sorry I didn't respond the first time you mentioned it, I simply didn't get your point. The rest of the file doesn't suggest that you need to declare energy_required on item.difficulty level since quartz is the only item with different recipes for different difficulties.

Again, thank you very much for your help! Without you, I may not have gotten rid of that issue and I assume it would have bugged me until I would have either uninstalled the mod or stopped playing the game. Great to have people like you around :)
VERY shameless plug: I have a stack-size changing mod, and someone in the discussions mentioned quartz stacks to 50 which they didn't like.

https://mods.factorio.com/mod/DeepPockets
If you use the raw-material option, quartz can stack higher. You'd want to set fish, smelter results, and wood to -1, and the raw-material multiplier to whatever. You can check the log to see what's actually being affected.
I have mods! I guess!
Link

Post Reply

Return to “Modding help”