[0.12+ onwards] Vanilla items lost after mod toggled

Bugs that are actually features.
User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 731
Joined: Sun Mar 13, 2016 9:48 am
Contact:

[0.12+ onwards] Vanilla items lost after mod toggled

Post by DRY411S »

Steps to reproduce
  • Design a mod that adds a new item and recipe into the game. The intention is to replace the vanilla item/recipe. (In my case this is to allow batteries to be made in assembly machine and stop them from being made in Chemical Plants.)
  • Assign the modded item and recipe to the same research as the vanilla item
  • Start game, note that vanilla item and modded item are unlocked by the research. So far, so good.
  • In your mod, hide and disable the vanilla recipe, hide the vanilla item
  • Start the game, note that the vanilla item still appears as being unlocked by the research. Not what I was expecting.
  • In your mod, alter the technology effects so that the vanilla item's recipe is no longer unlocked when the research completes.
  • Start game, note that only your modded item is unlocked now. Great.
What happens next is inconsistent.
  • If you research as far as reaching your modded item, save the game and then toggle your mod off, the research screen displays the vanilla item again as being unlocked but it is not craftable
  • If you DON'T research as far as your modded item, save the game and then toggle your mod off, then research as far as the vanilla item it IS craftable
To reproduce this, you can use my Add Assembler Batteries and Remove Chemical Batteries mods. You must use them both.

User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 731
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: [0.12+ onwards] Vanilla items lost after mod toggled

Post by DRY411S »

In a sentence....

Whether a vanilla item is available or not in a modded save but with the mod toggled/deleted depends on whether you have researched past the point it would have been available in vanilla, but wasn't available with the mod installed.

Rseding91
Factorio Staff
Factorio Staff
Posts: 14152
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.12+ onwards] Vanilla items lost after mod toggled

Post by Rseding91 »

DRY411S wrote:In a sentence....

Whether a vanilla item is available or not in a modded save but with the mod toggled/deleted depends on whether you have researched past the point it would have been available in vanilla, but wasn't available with the mod installed.
Thanks for the report however that's working as intended. In order for a recipe to be unlocked you have to research the technology while it's in the list of effects for that technology.

When you retroactively change technology effects they aren't re-applied - that's up to migration scripts or new/changed mods to handle.
If you want to get ahold of me I'm almost always on Discord.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2904
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: [0.12+ onwards] Vanilla items lost after mod toggled

Post by darkfrei »

Rseding91 wrote:When you retroactively change technology effects they aren't re-applied - that's up to migration scripts or new/changed mods to handle.
Is it possible to make a mod, that only check it and reset vanilla after mod disabling?

User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 731
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: [0.12+ onwards] Vanilla items lost after mod toggled

Post by DRY411S »

Rseding91 wrote: Thanks for the report however that's working as intended. In order for a recipe to be unlocked you have to research the technology while it's in the list of effects for that technology.

When you retroactively change technology effects they aren't re-applied - that's up to migration scripts or new/changed mods to handle.
That's pretty much the response I was expecting.

Is a way around this to not 'hijack' a vanilla technology, define my own, and disable the vanilla one in the mod? If somebody disables my mod, will the vanilla technology reappear? Will it need to be researched?

User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 731
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: [0.12+ onwards] Vanilla items lost after mod toggled

Post by DRY411S »

Rseding91 wrote:
Thanks for the report however that's working as intended. In order for a recipe to be unlocked you have to research the technology while it's in the list of effects for that technology.

When you retroactively change technology effects they aren't re-applied - that's up to migration scripts or new/changed mods to handle.
I've been thinking about this some more. The only reason that my mod removes the recipe from the technology effects is to stop it from appearing on the 'tab' on the Research screen. I'd be quite happy to leave it in the technology effects if I could hide the recipe from that tab. Would that be possible with the addition of a recipe property, or perhaps use of the hidden property?

BenSeidel
Filter Inserter
Filter Inserter
Posts: 588
Joined: Tue Jun 28, 2016 1:44 am
Contact:

Re: [0.12+ onwards] Vanilla items lost after mod toggled

Post by BenSeidel »

Hook into the "research_complete" event, and if it is the tech that enables the disabled tech, enable it. As the recipe is still disabled it won't appear as a crafting option, but only while your mod is enabled.

User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 731
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: [0.12+ onwards] Vanilla items lost after mod toggled

Post by DRY411S »

BenSeidel wrote:Hook into the "research_complete" event, and if it is the tech that enables the disabled tech, enable it. As the recipe is still disabled it won't appear as a crafting option, but only while your mod is enabled.
I think you mean that the recipe is still hidden?

That's exactly the solution that I've had to implement, but it feels 'clunky'. I think it would be easier if there was a simpler way of hiding recipes from the research tabs. The recipe.hidden flag would appear to be a good choice, but would break the rocket-part display for example, which I think is the only hidden vanilla recipe.

Post Reply

Return to “Not a bug”