Page 1 of 1
[0.12+ onwards] Vanilla items lost after mod toggled
Posted: Tue Jul 18, 2017 9:45 am
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.
Re: [0.12+ onwards] Vanilla items lost after mod toggled
Posted: Tue Jul 18, 2017 10:00 am
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.
Re: [0.12+ onwards] Vanilla items lost after mod toggled
Posted: Tue Jul 18, 2017 11:18 am
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.
Re: [0.12+ onwards] Vanilla items lost after mod toggled
Posted: Tue Jul 18, 2017 11:32 am
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?
Re: [0.12+ onwards] Vanilla items lost after mod toggled
Posted: Tue Jul 18, 2017 11:44 am
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?
Re: [0.12+ onwards] Vanilla items lost after mod toggled
Posted: Wed Jul 19, 2017 8:08 am
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?
Re: [0.12+ onwards] Vanilla items lost after mod toggled
Posted: Wed Jul 19, 2017 1:37 pm
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.
Re: [0.12+ onwards] Vanilla items lost after mod toggled
Posted: Wed Jul 19, 2017 1:49 pm
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.