When having an research that has multiple levels (e.g. infinite research) the on_research_finished gives off the wrong level.
I have not tested it with lower levels (e.g. mining-productivity-[1-3]). but with infinite research levels this is certainly the case.
Setup:
factorio default settings
in the mod:
- using the event_handler.lua from core
- use a lib {events = {[defines.events.on_research_complete] => function() end} }
- In this
The added screenshot should show exactly the issue. Since i would assume that it would show the actual researched tech.
It also has the researched: false.
So it seems to me it points to the incorrect tech (aka the next in the list, instead of the actual researched one)
You get the same value/tech in the game.forces.player.previous_research in that event.
I would expect that it would show the correct level that has been researched, not the one that can be researched.
(minimized control.lua attached)
[0.18.47] [Lua] on_research_finished gives incorrect research
-
- Inserter
- Posts: 23
- Joined: Wed Nov 07, 2018 8:23 pm
- Contact:
[0.18.47] [Lua] on_research_finished gives incorrect research
- Attachments
-
- incorrect_level.png (247.43 KiB) Viewed 991 times
-
- control.lua
- (202 Bytes) Downloaded 60 times
Re: [0.18.47] [Lua] on_research_finished gives incorrect research
Thanks for the report however that's just how that works; infinite research is just 1 technology and the researched-level on it keeps getting increased as it is researched more. So there is no "previous" one to send to the event - just "the" technology.
If you want to know what level of an infinite technology was just researched just take the current level - 1.
If you want to know what level of an infinite technology was just researched just take the current level - 1.
If you want to get ahold of me I'm almost always on Discord.
-
- Inserter
- Posts: 23
- Joined: Wed Nov 07, 2018 8:23 pm
- Contact:
Re: [0.18.47] [Lua] on_research_finished gives incorrect research
Was kind of expecting that.
Thank you for the reply, but it feels like its somewhat incorrect.
From a tech perspective i get that its that way. But it took me a while to figure it out.
So you're saying: if level > 1 then level = level -1.
I can live with that. although it might be helpfull to have that documented somewhere near the event documentation.
Anyhow this one can be closed if its not going to get fixed
Thank you for the reply, but it feels like its somewhat incorrect.
From a tech perspective i get that its that way. But it took me a while to figure it out.
So you're saying: if level > 1 then level = level -1.
I can live with that. although it might be helpfull to have that documented somewhere near the event documentation.
Anyhow this one can be closed if its not going to get fixed