[0.18.47] [Lua] on_research_finished gives incorrect research

Bugs that are actually features.
Post Reply
timboo07up
Inserter
Inserter
Posts: 23
Joined: Wed Nov 07, 2018 8:23 pm
Contact:

[0.18.47] [Lua] on_research_finished gives incorrect research

Post by timboo07up »

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)
Attachments
incorrect_level.png
incorrect_level.png (247.43 KiB) Viewed 824 times
control.lua
(202 Bytes) Downloaded 45 times

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

Re: [0.18.47] [Lua] on_research_finished gives incorrect research

Post by Rseding91 »

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 get ahold of me I'm almost always on Discord.

timboo07up
Inserter
Inserter
Posts: 23
Joined: Wed Nov 07, 2018 8:23 pm
Contact:

Re: [0.18.47] [Lua] on_research_finished gives incorrect research

Post by timboo07up »

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

Post Reply

Return to “Not a bug”