Page 1 of 1

[0.17.79] game.player.force.reset_technology_effects() unlocks technologies

Posted: Thu Jan 16, 2020 11:34 am
by Honktown
I'm playing with a mod NonWaveDefense, which has some bad behavior which doesn't load bonus effects properly on loading a save.

I modded in a command locally which resets technology effects and then applies wave defense bonuses, which worked fine, until I used it in Warptorio2 expansion.

Using game.player.force.reset_technology_effects() unlocked all the technologies, which normally have to be unlocked by progressing through missions. I don't know if "unlocked" is the right word, they're present in the tech tree, but the background is transparent (neither red nor green) until the proper mission is completed (or item used).

https://lua-api.factorio.com/latest/Lua ... gy_effects
Reapplies all possible research effects, including unlocked recipes. Any custom changes are lost. Preserves research state of technologies.
That doesn't sound like it should alter the red/green/transparent state of research.

Edit: Sorry for the bad title. I have the command proper, above.

Re: [17.79] game.force.player.reset_technology_effects() unlocks recipes

Posted: Thu Jan 16, 2020 12:46 pm
by Honktown
Resetting technology effects also sets the visible_when_disabled to false.

A messy workaround was to store+log the disabled techs, and then ones which were disabled and visible when disabled, and then re-assign their status after resetting, via console.

Re: [17.79] game.force.player.reset_technology_effects() unlocks recipes

Posted: Thu Jan 16, 2020 4:09 pm
by Rseding91
I think the description might just be wrong. Part of the refresh is applying each unlocked recipes effects - of which some may have "enable recipe" which does exactly what you would think: researching that technology unlocks the recipe.

I don't see how any other way would make sense. If it doesn't unlock recipes that technologies say they should unlock then it doesn't do what it says it should do.

Re: [17.79] game.force.player.reset_technology_effects() unlocks recipes

Posted: Thu Jan 16, 2020 6:39 pm
by Honktown
Rseding91 wrote:
Thu Jan 16, 2020 4:09 pm
I think the description might just be wrong. Part of the refresh is applying each unlocked recipes effects - of which some may have "enable recipe" which does exactly what you would think: researching that technology unlocks the recipe.

I don't see how any other way would make sense. If it doesn't unlock recipes that technologies say they should unlock then it doesn't do what it says it should do.
Warptorio2 Expansion's technologies don't enable the subsequent technologies when researched, only a control.lua function explicitly does. It also doesn't explain why visible_when_disabled is modified, as that's not a listed modifier nor is it present in warptorio2 or warptorio2 expansion.

The problem [in my opinion] is likely the reset_technology_effects resets the prototype and applies the prototypes effects, which isn't the same as resetting modifier effects and applying currently researched technology effects in the force. Warptorio2 Expansion disables and hides technologies via a control effect, not by re-defining the prototypes.

Re: [17.79] game.force.player.reset_technology_effects() unlocks recipes

Posted: Thu Jan 16, 2020 8:19 pm
by Honktown
Damnit, I misdid recipes as technologies in the title. REALLY sorry for that confusion, had recipe stuff on my mind all day. Corrected.

Re: [0.17.79] game.player.force.reset_technology_effects() unlocks technologies

Posted: Tue Jan 21, 2020 10:03 pm
by Rseding91
Ok, it's now fixed for the next release.