How to reduce pollution of an assembling-machine with efficiency modules?

Place to get help with not working mods / modding interface.
Post Reply
Pi-C
Smart Inserter
Smart Inserter
Posts: 1639
Joined: Sun Oct 14, 2018 8:13 am
Contact:

How to reduce pollution of an assembling-machine with efficiency modules?

Post by Pi-C »

Is there a way to reduce the pollution of an assembling-machine prototype -- if the base pollution value is negative? :-D

Code: Select all

data:extend({
  {
    type = "assembling-machine",
    name = "bi-bio-garden",
    energy_usage = "200kW",
    energy_source = {
      type = "electric",
      usage_priority = "secondary-input",
      emissions_per_minute = -45, 
    },
    module_specification = {
      module_slots = 1
    },
    allowed_effects = "consumption",
  },
  …
})
Say I insert an efficiency-3 module into this. It will apply a factor of 0.5 to the base pollution. But 50 % of -45 is -22.5, so adding that module will double the pollution instead of reducing it. Can I work around this somehow?
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3699
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: How to reduce pollution of an assembling-machine with efficiency modules?

Post by DaveMcW »

Make an inefficiency module that doubles the base pollution?

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: How to reduce pollution of an assembling-machine with efficiency modules?

Post by Deadlock989 »

Pi-C wrote:
Mon Jan 18, 2021 10:48 pm
Say I insert an efficiency-3 module into this. It will apply a factor of 0.5 to the base pollution. But 50 % of -45 is -22.5, so adding that module will double the pollution instead of reducing it. Can I work around this somehow?
Strictly speaking this is not "doubling the pollution". If a machine's pollution is negative it is effectively "cleaning" the chunk it is in, i.e. it removes pollution from the chunk like a tree does. If the chunk's pollution is already zero, nothing is removed because a chunk's pollution value can't be negative. So efficiency modules simply make cleaning machines less effective - you're not "doubling the pollution", you're "halving the cleaning".

You could do as DaveMcW suggests and create a special anti-efficiency module. You can use the module limitation table to make this anti-efficiency module only work on the recipes that your machine works with. You could also add a limitation blacklist to the real efficiency modules. However all of that falls apart for drills and labs - those don't work with recipes so the only way to stop modules with effect X (positive or negative) being used in those machines is to ban that effect completely from drills and labs.

Another way of finessing it for specific situations is to set up an emissions multiplier scheme on all the recipes that the machine uses, e.g. create "more effective" variants of the recipe which multiply the cleaning power. It depends what you are trying to achieve.

My experience with air-cleaning machines is that you end up banning burner energy sources (because fuels can have emissions multipliers as well, creating the same problems; electric and void are fine) and also banning efficiency effects because it just saves you choosing from between two or three varieties of lightly broken hassle. Banning the efficiency effect does not change the way recipe and fuel emissions multipliers work.
Image

Pi-C
Smart Inserter
Smart Inserter
Posts: 1639
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: How to reduce pollution of an assembling-machine with efficiency modules?

Post by Pi-C »

DaveMcW wrote:
Tue Jan 19, 2021 12:22 am
Make an inefficiency module that doubles the base pollution?
Geez, another prototype -- I never thought about this, thanks for pointing out the obvious! I'll think about this some more. (Making a module for just one kind of assembler doesn't seem quite right. Also, "inefficiency module" doesn't seem to be the ideal name for "selling" it to the users. :mrgreen:)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Pi-C
Smart Inserter
Smart Inserter
Posts: 1639
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: How to reduce pollution of an assembling-machine with efficiency modules?

Post by Pi-C »

Deadlock989 wrote:
Tue Jan 19, 2021 1:23 am
Strictly speaking this is not "doubling the pollution". If a machine's pollution is negative it is effectively "cleaning" the chunk it is in, i.e. it removes pollution from the chunk like a tree does. If the chunk's pollution is already zero, nothing is removed because a chunk's pollution value can't be negative. So efficiency modules simply make cleaning machines less effective - you're not "doubling the pollution", you're "halving the cleaning".
Yes, you're right of course -- "doubling" the pollution isn't what it does, it just leaves you with twice the pollution (compared to the un-moduled variety).
You could do as DaveMcW suggests and create a special anti-efficiency module. You can use the module limitation table to make this anti-efficiency module only work on the recipes that your machine works with. You could also add a limitation blacklist to the real efficiency modules.
As mentioned in my reply to DaveMcW, I'm a bit in doubt about creating a new prototype for just one machine. However, making duplicates of the different efficiency modules (hidden items that differ from the original only in the effect on pollution) and changing the vanilla modules to the custom modules on inserting into one of my machines could be an option. (Have to check if the events allow to catch that.)
However all of that falls apart for drills and labs - those don't work with recipes so the only way to stop modules with effect X (positive or negative) being used in those machines is to ban that effect completely from drills and labs.
No concern in this case, I really wanted the module only for a particular kind of assembly-machine. :-)
Another way of finessing it for specific situations is to set up an emissions multiplier scheme on all the recipes that the machine uses, e.g. create "more effective" variants of the recipe which multiply the cleaning power. It depends what you are trying to achieve.
Actually, we do have a "more effective" variant: BI's bio gardens have one recipe for cleaning air using fertilizer + water and one using advanced fertilizer + water. Both recipe have the same non-result:

Code: Select all

results = {
      {type = "item", name = "bi-purified-air", amount = 1, probability = 0},
    },
The purified air is just a fake item that exists because recipes must have a result. The actual purpose of the recipe is that the garden can work and produce negative pollution while running. The main difference between the two recipes is energy_required, e.g. the time it takes to complete one non-product: It is 40 seconds with normal fertilizer vs. 100 seconds with advanced fertilizer. So everything is turned around (the gain of the recipe with advanced fertilizer is that you need much longer to produce one non-item, thus keeping the garden emitting negative pollution for a longer time, while consuming the same amount of ingredients per non-crafting run).
My experience with air-cleaning machines is that you end up banning burner energy sources (because fuels can have emissions multipliers as well, creating the same problems; electric and void are fine) and also banning efficiency effects because it just saves you choosing from between two or three varieties of lightly broken hassle. Banning the efficiency effect does not change the way recipe and fuel emissions multipliers work.
I've already considered removing all module slots from the gardens, actually. Productivity modules obviously make no sense when the output will always be 0. Speed modules don't make sense either because they would reduce the time the garden can emit negative pollution and increase consumption of ingredients (slow-down modules would be viable, though). But cluttering the crafting menu with new modules (the different tiers) that can only be used in one particular machine would be a waste of screen real estate, and trying to replace the module in the cursor on inserting may open up a whole box of new problems (e.g. with blueprints), so no modules seems like the easiest way out.

But if I may change the topic to pollution:
If a machine's pollution is negative it is effectively "cleaning" the chunk it is in, i.e. it removes pollution from the chunk like a tree does. If the chunk's pollution is already zero, nothing is removed because a chunk's pollution value can't be negative.
The wiki:
https://wiki.factorio.com/Pollution wrote: [Pollution] is produced by many buildings involved in processing items and spreads outwards at a steady rate.

The evolution factor is not increased by the spreading/absorbed pollution, but by the pollution produced by all the player's machinery at every tick.
The bio gardens are 3x3 entities, so for the sake of the argument, let's assume you could place 100 of them on chunk.Together, they'd reduce the pollution value of that chunk by 4500/minute, but that would have no immediate effect on that chunk because no machines with positive pollution could be placed there, so the chunk would end up with 0 pollution according to you. However, that chunk would remove any pollution spreading in from adjoining chunks (as long as that is less than 4500/minute), so it would make sense to place a chunk full of gardens in the center of heavily polluting chunks (to suck up pollution from all directions) and at the very border (to reduce the amount of pollution reaching the biters) -- is that correct? Also, while the cleaned area is limited to one chunk, a chunk full of those gardens would reduce the total amount of pollution produced by the complete factory and thus inhibit evolution, or is that assumption wrong? I'm asking because there was a request for a bigger version of the gardens, and I've played with the thought of making it a really huge entity (half a chunk, perhaps). Just want to make sure something like this really makes sense. :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Bilka
Factorio Staff
Factorio Staff
Posts: 3123
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: How to reduce pollution of an assembling-machine with efficiency modules?

Post by Bilka »

Pi-C wrote:
Tue Jan 19, 2021 10:36 am
Actually, we do have a "more effective" variant: BI's bio gardens have one recipe for cleaning air using fertilizer + water and one using advanced fertilizer + water. Both recipe have the same non-result:

Code: Select all

results = {
      {type = "item", name = "bi-purified-air", amount = 1, probability = 0},
    },
The purified air is just a fake item that exists because recipes must have a result.
No they don't. results = {} is perfectly valid. You can rid of those useless "void" items/fluids.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Pi-C
Smart Inserter
Smart Inserter
Posts: 1639
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: How to reduce pollution of an assembling-machine with efficiency modules?

Post by Pi-C »

Bilka wrote:
Tue Jan 19, 2021 10:41 am
Pi-C wrote:
Tue Jan 19, 2021 10:36 am
The purified air is just a fake item that exists because recipes must have a result.
No they don't. results = {} is perfectly valid. You can rid of those useless "void" items/fluids.
You're right, technically "results" can be an empty table and the garden would still work. Let me rephrase: "… recipes must have a result if you want to see the recipe data." See here:
(Left: results = {}; right: results = {fake_item})
(Left: results = {}; right: results = {fake_item})
results.png (177.7 KiB) Viewed 3990 times
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: How to reduce pollution of an assembling-machine with efficiency modules?

Post by Deadlock989 »

Pi-C wrote:
Tue Jan 19, 2021 10:36 am
Yes, you're right of course -- "doubling" the pollution isn't what it does, it just leaves you with twice the pollution (compared to the un-moduled variety).
No, that's not technically correct, but this is nitpicking. Regardless of how you word it, we agree that half of a negative number is another negative number.
As mentioned in my reply to DaveMcW, I'm a bit in doubt about creating a new prototype for just one machine. However, making duplicates of the different efficiency modules (hidden items that differ from the original only in the effect on pollution) and changing the vanilla modules to the custom modules on inserting into one of my machines could be an option. (Have to check if the events allow to catch that.)
There is no performance-friendly way of doing that as far as I know, there is certainly no event for any kind of slot being filled with an item. I took the original suggestion as being that you simply have additional modules, and maybe trying to make them specific to the entities of interest via recipe limitations. It is a possible option, but I wouldn't use it either because of the drills/labs issue and the proliferation of modules. For me the best compromise was (as described) banning efficiency effects and modules in general, and controlling it all with the recipe emissions multipliers.

Also, it just doesn't make sense. Remember that efficiency modules reduce emissions indirectly - the efficiency modifier is applied to the power consumption, and it is rate of power consumption (as a ratio of the machine's default consumption) that is applied to the emissions. If you want your "cleaning booster anti-efficiency module" to actually increase the cleaning power of a negative emissions machine, you would have to get it to use more power. Again, this another reason to avoid this hot mess and just manipulate recipe emissions multipliers because those aren't associated with power consumption in any way, they are direct modifiers of the base emissions rate.

Another route is that your specialist modules should be using only the pollution modifier effect, not the efficiency effect. I tried that for a while. But you still have the problem of not being able to fully control where this module gets placed (drills/labs again). And it's still all backwards: your pollution modules would need to be set to 200% if they were going to double the cleaning power of a negative emissions machine, so they would double the positive pollution of any other machine they were stuck into (including beacons).
I've already considered removing all module slots from the gardens, actually.
Don't forget to also remove the effect from allowed_effects (or just set allowed_effects to nil if you don't want any of the module effects to work). Otherwise beacons can still transmit the effect to the machine.
The bio gardens are 3x3 entities, so for the sake of the argument, let's assume you could place 100 of them on chunk.Together, they'd reduce the pollution value of that chunk by 4500/minute, but that would have no immediate effect on that chunk because no machines with positive pollution could be placed there, so the chunk would end up with 0 pollution according to you. However, that chunk would remove any pollution spreading in from adjoining chunks (as long as that is less than 4500/minute), so it would make sense to place a chunk full of gardens in the center of heavily polluting chunks (to suck up pollution from all directions) and at the very border (to reduce the amount of pollution reaching the biters) -- is that correct?
As I understand it, yes.
Also, while the cleaned area is limited to one chunk, a chunk full of those gardens would reduce the total amount of pollution produced by the complete factory and thus inhibit evolution, or is that assumption wrong? I'm asking because there was a request for a bigger version of the gardens, and I've played with the thought of making it a really huge entity (half a chunk, perhaps). Just want to make sure something like this really makes sense. :-)
I don't know the detail of how pollution emissions are fed into the evolution formula. But the machines in a chunk can never reduce "total" pollution by more than the pollution in that chunk, whether that's one machine or 1024. In my mod I set up a fake "chunk visualisation" on mouse-over in alt-mode with the rendering API, so that players can see which groups of cleaning machines affect a specific chunk.
Image

Pi-C
Smart Inserter
Smart Inserter
Posts: 1639
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: How to reduce pollution of an assembling-machine with efficiency modules?

Post by Pi-C »

Deadlock989 wrote:
Tue Jan 19, 2021 12:45 pm
Pi-C wrote:
Tue Jan 19, 2021 10:36 am
Yes, you're right of course -- "doubling" the pollution isn't what it does, it just leaves you with twice the pollution (compared to the un-moduled variety).
No, that's not technically correct, but this is nitpicking. Regardless of how you word it, we agree that half of a negative number is another negative number.
OK. :-)
As mentioned in my reply to DaveMcW, I'm a bit in doubt about creating a new prototype for just one machine. However, making duplicates of the different efficiency modules (hidden items that differ from the original only in the effect on pollution) and changing the vanilla modules to the custom modules on inserting into one of my machines could be an option. (Have to check if the events allow to catch that.)
There is no performance-friendly way of doing that as far as I know, there is certainly no event for any kind of slot being filled with an item.
Yep, I meanwhile found that out as well. I thought I'd seen an event like that, but I obviously have remembered wrongly.

I took the original suggestion as being that you simply have additional modules, and maybe trying to make them specific to the entities of interest via recipe limitations. It is a possible option, but I wouldn't use it either because of the drills/labs issue and the proliferation of modules. For me the best compromise was (as described) banning efficiency effects and modules in general, and controlling it all with the recipe emissions multipliers.
I was working at this bug report, which was about vanilla modules (BI doesn't have its own -- yet?). Perhaps it was too late already, but it actually never occurred to me that the vanilla modules are just prototypes like anything else, and that I could make my own. :oops:
Also, it just doesn't make sense. Remember that efficiency modules reduce emissions indirectly - the efficiency modifier is applied to the power consumption, and it is rate of power consumption (as a ratio of the machine's default consumption) that is applied to the emissions. If you want your "cleaning booster anti-efficiency module" to actually increase the cleaning power of a negative emissions machine, you would have to get it to use more power. Again, this another reason to avoid this hot mess and just manipulate recipe emissions multipliers because those aren't associated with power consumption in any way, they are direct modifiers of the base emissions rate.
OK, I'll give that a try. Thanks for the explanation!
I've already considered removing all module slots from the gardens, actually.
Don't forget to also remove the effect from allowed_effects (or just set allowed_effects to nil if you don't want any of the module effects to work). Otherwise beacons can still transmit the effect to the machine.
Thanks again, good to know that! I'd completely forgotten about beacons…
it would make sense to place a chunk full of gardens in the center of heavily polluting chunks (to suck up pollution from all directions) and at the very border (to reduce the amount of pollution reaching the biters) -- is that correct?
As I understand it, yes.
Good, so big gardens actually would make sense.
Also, while the cleaned area is limited to one chunk, a chunk full of those gardens would reduce the total amount of pollution produced by the complete factory and thus inhibit evolution, or is that assumption wrong? I'm asking because there was a request for a bigger version of the gardens, and I've played with the thought of making it a really huge entity (half a chunk, perhaps). Just want to make sure something like this really makes sense. :-)
I don't know the detail of how pollution emissions are fed into the evolution formula. But the machines in a chunk can never reduce "total" pollution by more than the pollution in that chunk, whether that's one machine or 1024.
There's a distinction between pollution and impact on the evolution factor on the wiki (at least that's how I understood that). I guess it all hinges on how this has to be interpreted:
The evolution factor is not increased by the spreading/absorbed pollution, but by the pollution produced by all the player's machinery at every tick. This means that no matter how hard the player tries to contain the pollution, enemies will still evolve at the same rate.
Does "pollution produced by all the player's machinery at every tick" mean the total sum of pollution units created by each polluter on the surface (then having negative pollutants anywhere would always reduce the total amount), or is the total pollution the sum of the pollution units per chunk (then each chunk with only negative pollutants would figure into the calculation with a value of 0)? Sure, there's "no matter how hard the player tries to contain the pollution, enemies will still evolve at the same rate" -- but we can't know if that applies just to vanilla entities that will always have a positive pollution value, or if it also applies to modded entities that may have negative pollution values. It's really hard to tell … :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: How to reduce pollution of an assembling-machine with efficiency modules?

Post by Deadlock989 »

Pi-C wrote:
Tue Jan 19, 2021 2:00 pm
Does "pollution produced by all the player's machinery at every tick" mean the total sum of pollution units created by each polluter on the surface (then having negative pollutants anywhere would always reduce the total amount), or is the total pollution the sum of the pollution units per chunk (then each chunk with only negative pollutants would figure into the calculation with a value of 0)?
Elsewhere it says:
Pollution production is the total pollution produced by buildings per tick, not the pollution spreading on the map, so it is not reduced by trees or other absorbers. e.g. : 10 boilers produce 300 pollution in one minute, raising the evolution factor by around 0.027%.
So it also depends on what "other absorbers" means. Are trees and tiles and other non-machine entities that have negative emissions treated as special cases, i.e. "absorbers", or is a machine with negative emissions an "other absorber"?

I don't know, I guess only someone with source access would be able to say with certainty.
Image

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: How to reduce pollution of an assembling-machine with efficiency modules?

Post by orzelek »

I'm not sure if you are aware but there is also a pollution effect on modules. This means module can actually affect pollution directly.

So you can make a new module that will only increase pollution and allow only pollution effect on your gardens. This still leaves the need to make new module but solves some of the other "allowance" problems. And if user wants to add polluting module to lab or mining drill.. well they can :D

Pi-C
Smart Inserter
Smart Inserter
Posts: 1639
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: How to reduce pollution of an assembling-machine with efficiency modules?

Post by Pi-C »

orzelek wrote:
Tue Jan 19, 2021 5:27 pm
I'm not sure if you are aware but there is also a pollution effect on modules. This means module can actually affect pollution directly.
Yes, I've found that already.
So you can make a new module that will only increase pollution and allow only pollution effect on your gardens. This still leaves the need to make new module but solves some of the other "allowance" problems. And if user wants to add polluting module to lab or mining drill.. well they can :D
Oh, I wouldnt' mind a reduced energy consumption either -- which shouldn't be any problem if I defined the module prototype myself. But I wonder if it would make sense to change things at base level: Define in the prototype if the expected value for an effect is positive or negative (e.g., for normal assembling-machines, the expected value of energy_source.emissions_per_minute would be >=0). If the module is placed in an entity with a differently signed value, the effect would be applied as value * (1 + effect) instead of value * (1- effect).
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Pi-C
Smart Inserter
Smart Inserter
Posts: 1639
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: How to reduce pollution of an assembling-machine with efficiency modules?

Post by Pi-C »

Off topic!
Deadlock989 wrote:
Tue Jan 19, 2021 3:27 pm
Hi, Deadlock! This is completely OT, but as I'm neither on Discord nor github, I thought I'd abuse this thread to direct your attention to a bug in IR2.

I've got a crash report for BI 1.1.4 and could reproduce it with this stacktrace:

Code: Select all

Failed to load mod "IndustrialRevolution": __IndustrialRevolution__/code/functions/functions-data.lua:1533: attempt to call global 'spam_log' (a nil value)
stack traceback:
	__IndustrialRevolution__/code/functions/functions-data.lua:1533: in function 'calculate_scraps'
	__IndustrialRevolution__/code/functions/functions-data.lua:1563: in function 'calculate_scraps'
	__IndustrialRevolution__/code/functions/functions-data.lua:1563: in function 'calculate_scraps'
	__IndustrialRevolution__/code/functions/functions-data.lua:1563: in function 'calculate_scraps'
	__IndustrialRevolution__/code/functions/functions-data.lua:1563: in function 'calculate_scraps'
	__IndustrialRevolution__/code/functions/functions-data.lua:1563: in function 'calculate_scraps'
	__IndustrialRevolution__/code/functions/functions-data.lua:1563: in function 'calculate_scraps'
	__IndustrialRevolution__/code/functions/functions-data.lua:1563: in function 'calculate_scraps'
	__IndustrialRevolution__/code/functions/functions-data.lua:1563: in function 'calculate_scraps'
	__IndustrialRevolution__/code/functions/functions-data.lua:1563: in function 'calculate_scraps'
	...
	__IndustrialRevolution__/code/functions/functions-data.lua:1563: in function 'calculate_scraps'
	__IndustrialRevolution__/code/functions/functions-data.lua:1563: in function 'calculate_scraps'
	__IndustrialRevolution__/code/functions/functions-data.lua:1563: in function 'calculate_scraps'
	__IndustrialRevolution__/code/functions/functions-data.lua:1563: in function 'calculate_scraps'
	__IndustrialRevolution__/code/functions/functions-data.lua:1563: in function 'calculate_scraps'
	__IndustrialRevolution__/code/functions/functions-data.lua:1563: in function 'calculate_scraps'
	__IndustrialRevolution__/code/functions/functions-data.lua:1563: in function 'calculate_scraps'
	__IndustrialRevolution__/code/functions/functions-data.lua:1563: in function 'calculate_scraps'
	...ialRevolution__/code/items-recipes/recipes-scrapping.lua:40: in main chunk
	[C]: in function 'require'
	__IndustrialRevolution__/data-final-fixes.lua:16: in main chunk
There are two problems, actually. The immediate crash is in line 1533:

Code: Select all

-- Wrong:
spam_log("Scrap calculator encountered an unexpected cycle in recipe chains, bailing out.", DIR.log_level.error)
-- Fixed:
DIR.spam_log("Scrap calculator encountered an unexpected cycle in recipe chains, bailing out.", DIR.log_level.error)
The second issue is that you're stuck in a loop.

Code: Select all

function DIR.calculate_scraps(item_data, scraptable, count)
        -- check for loop just in case some bonkers situation has arisen with impossible recipe chains
        if not count then count = 1 else count = count + 1 end
        if count > 100 then
                spam_log("Scrap calculator encountered an unexpected cycle in recipe chains, bailing out.", DIR.log_level.error)
                return
        end
[…]
        for _,scrapdata in pairs(scrapqueue) do
                DIR.calculate_scraps(scrapdata, scraptable, count)
        end
end
You call the same function recursively. I've let the game run for about 20 minutes and got half a million lines with "Scrap calculator encountered an unexpected cycle in recipe chains, bailing out" in my log file. Perhaps you should add a break condition inside the loop as well?

(I'll try to find out what BI recipe triggered this and fix the symptoms on my end, but that really would just fix symptoms until the next mod comes along with an incompatible recipe.)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: How to reduce pollution of an assembling-machine with efficiency modules?

Post by Deadlock989 »

Hi Pi-C,

Thanks for spotting the broken log function name. This code has been out on the portal for about 15 months and this is the first time (to my knowledge) that any other mod has triggered it - I wrote it "blind" to try and avoid infinite loops, clearly with limited success. Probably no player encountered it because there are other major incompatibilities between IR2 and BI which you have probably already spotted - you have recipes with iron components in Logistics research, and in IR2 that will create circular tech dependencies.

The other issue is more complex and it's essentially working as intended, it just doesn't handle the error very well. IR2 will try and generate scrapping recipes for items based on any recipes that produce them as a single result, which have "crafting" as a matching substring in its category name, and doesn't have either allow_intermediates or allow_as_intermediate set to false. If a third party mod creates a pair of fully reversible crafting recipes which don't use those latter properties to avoid crafting loops, it will create this kind of issue. The best way to "fix" the situation and avoid log giga-spam would be to simply terminate the script with an error rather than logging anything and trying to plough on regardless, so I will put that in place for the next release, along with an identifier in the error message for the item which is triggering the loop.

Edited to add: it appears to be the item "bi-woodpulp" triggering the issue in the first instance, though BI's own disassembling recipes are probably going to present issues as well.
Image

Pi-C
Smart Inserter
Smart Inserter
Posts: 1639
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: How to reduce pollution of an assembling-machine with efficiency modules?

Post by Pi-C »

Deadlock989 wrote:
Fri Jan 22, 2021 12:06 pm
Probably no player encountered it because there are other major incompatibilities between IR2 and BI which you have probably already spotted - you have recipes with iron components in Logistics research, and in IR2 that will create circular tech dependencies.
Not quite true. We unlock a bigger wooden pole (ingredients break down to copper and wood) with Logistics research -- but it includes small poles, which are unlocked by "Steam power" (after the iron milestone) in IR2. For the next release, I've moved the unlock to "Electric distribution 1" if IR2 is active (don't want to remove our large wooden poles completely because that would break games where they are already used).

However, there are some compatibility issues later on. For example, we use "crushed stone" made in our stone crusher which is usually unlocked by the steel research -- but as the tech has been removed, there's no way to make it. I'm going to fix that by replacing crushed stone with your gravel, but it seems there are some other things you've changed so that some of our products can be made only after one of your later techs has been researched. Some adaptations are clearly needed, I hope I'll find a solution! :-)
The best way to "fix" the situation and avoid log giga-spam would be to simply terminate the script with an error rather than logging anything and trying to plough on regardless, so I will put that in place for the next release, along with an identifier in the error message for the item which is triggering the loop.
With an identifier -- that would be extremely useful!
Edited to add: it appears to be the item "bi-woodpulp" triggering the issue in the first instance, though BI's own disassembling recipes are probably going to present issues as well.
Thanks, I've changed "bi-woodpulp", and now the game is loading successfully!
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

herman925
Manual Inserter
Manual Inserter
Posts: 2
Joined: Fri Mar 11, 2016 11:51 pm
Contact:

Re: How to reduce pollution of an assembling-machine with efficiency modules?

Post by herman925 »

Hi Deadlock and PI-C,

I saw the exchange of information and thanks for coming by with a solution on it - this was a bug I've encountered and raised a moment back. Hopefully it will be fixed when you guys have the time.

BTW I have encountered another issue that has suddenly cropped up since the update of 1.1.14 (like 10 mins ago). I believe it has something to do it IR2 since it looks like it's about an error in the Tips and Tricks window:

Code: Select all

Error loading mods
Failed to load mods: Error while running setup for tips-and-tricks-item prototype "fast-belt-bending" (tips-and-tricks-item): Dependency "drag-building" does not exist
This didn't seem to be an error I've encountered in 1.1.13

Post Reply

Return to “Modding help”