Page 1 of 1

[1.1.42] Modifying .researched resets infinite techs

Posted: Sat Oct 23, 2021 11:21 am
by lyvgbfh
Now, you may be about to say "well this is by design!", but consider the following:

Code: Select all

event.research.researched = event.research.researched
will reset the tech as well. Now that's just silly.

This is reproducible with with an attached save and mod that just runs the above code on_research_finished. Note also that the research complete notification says you've finished level zero of the tech despite that not being what was completed.

Re: [1.1.42] Modifying .researched resets infinite techs

Posted: Sat Oct 23, 2021 3:10 pm
by Rseding91
Thanks for the report however as you already guessed: this is working correctly.

".researched" is a boolean state value of the entire technology: "has this technology been researched fully". For infinite technologies that's obviously "no". So reading it gives "false". Writing "researched" on an infinite technology to "false" resets the research level of that technology.

Essentially you don't ever want to use the value of "researched" from an infinite technology but instead a combination of ".researched" and ".level" https://lua-api.factorio.com/next/LuaTe ... logy.level

Re: [1.1.42] Modifying .researched resets infinite techs

Posted: Sat Oct 23, 2021 7:09 pm
by lyvgbfh
You mean setting the value of technology.researched from false to false having the effect of resetting .level is the intended behavior?

Re: [1.1.42] Modifying .researched resets infinite techs

Posted: Sat Oct 23, 2021 7:49 pm
by Rseding91
The previous state of .research is irrelevant to writing "false" to .researched. So, yes the way it functions is intended.