[0.15.31] Crash on_research_finished research_all_technologi

We are aware of them, but they have low priority. We have more important things to do. They go here in order not to take space in the main bug thread list.
Post Reply
I_IBlackI_I
Long Handed Inserter
Long Handed Inserter
Posts: 73
Joined: Wed Feb 20, 2013 6:57 pm
Contact:

[0.15.31] Crash on_research_finished research_all_technologi

Post by I_IBlackI_I »

What did you do?
I Created a save-file with the (in this topic) included scenario, Main Menu -> Play -> Scenarios -> (under user-scenarios) FMMOTEST_Research_crash -> create.
(
FMMOTEST_Research_crash.zip
Scenario
(43.95 KiB) Downloaded 112 times
)
What happened?
The game crashes to desktop.
What did you expect to happen instead? It might be obvious to you, but do it anyway!
A new world would have been created
OR
An error in-game would have occured.
Code Explaination.
The file /locale/utils/modular_admin_ghosts creates a new force on line 25 on line 26 it calls the function research_all_technologies().
The file /locale/utils/force_mod has a event listener on line 303 this event resets all a force their bonusses and adds a user definable bonus on top.
Assumption:
On_research_finished gives a event.research back.
The LuaTechnology contains a force (LuaForce) this one is however read-only, which may cause the game to crash when I am modifying it.
Attachments
factorio-current.log
Crashlog
(164.19 KiB) Downloaded 97 times

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

Re: [0.15.31] Crash on_research_finished research_all_technologi

Post by Rseding91 »

Thanks for the report however this looks like a case of "don't do that". One of the mods is listening to the "research completed" event and possibly the same or another is resetting all technology effects in the research completed event which again fires "research completed" in a never ending cycle.

I guess I could disallow calling reset technology effects during the research completed event but that starts to get into the realm of hand-holding and there are all kinds of places these checks would need to be put in place bloating the API and complicating it at the same time.

Unless this starts to be come a common thing I think for now I'm just going to say "don't do that" :P Similar to calling "cancel deconstruction" during the "marked for deconstruction" event and then in the "deconstruction cancelled" calling "mark for deconstruction" you'd just end up in an infinite loop.

Currently the games way of letting you know you've done this is to crash to desktop :P
If you want to get ahold of me I'm almost always on Discord.

I_IBlackI_I
Long Handed Inserter
Long Handed Inserter
Posts: 73
Joined: Wed Feb 20, 2013 6:57 pm
Contact:

Re: [0.15.31] Crash on_research_finished research_all_technologi

Post by I_IBlackI_I »

Alright no worries. It just took quite a bit of time to find what is wrong. If possible I would suggest a error in the way of "Trying to modify read-only object on line: xxxxxxx"
I noticed it could be a crash because I messed it up, but because it was a crash to desktop I decided to report it anyway.

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

Re: [0.15.31] Crash on_research_finished research_all_technologi

Post by Rseding91 »

I_IBlackI_I wrote:Alright no worries. It just took quite a bit of time to find what is wrong. If possible I would suggest a error in the way of "Trying to modify read-only object on line: xxxxxxx"
I noticed it could be a crash because I messed it up, but because it was a crash to desktop I decided to report it anyway.
It's not read only though. If it was read only you'd get an error about it being read only. There seems to be some misconceptions around what "read only" means in the Lua docs. I'll see if we can change them to clear it up.

You can read the object - you can't assign directly to it. You can however read it, and then change properties on the object you got back.
If you want to get ahold of me I'm almost always on Discord.

I_IBlackI_I
Long Handed Inserter
Long Handed Inserter
Posts: 73
Joined: Wed Feb 20, 2013 6:57 pm
Contact:

Re: [0.15.31] Crash on_research_finished research_all_technologi

Post by I_IBlackI_I »

Alright thank you very much for the response.
I now understand the way the read only works in the lua doc.

It however seems that I had misread your first reply.
I thought that the reset_technology_effects() would only reapply all the bonuses and recipes a technology gives. I didn't think the function would actually fire the research finished event, since it states it preserves the state of the technologies.

Code: Select all

reset_technology_effects()

Reapplies all possible research effects, including unlocked recipes. Any custom [u][b]chages [/b][/u]are lost. Preserves research state of technologies. 
I will write a way around this current behavior. I would suggest stating that this function actually fires the event.
If it doesn't actually fire the event I got no clue where this code might crash the game.


PS: Any custom chages are lost.
I think this sentence is incorrect and should probably be changes.

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

Re: [0.15.31] Crash on_research_finished research_all_technologi

Post by Rseding91 »

I_IBlackI_I wrote:PS: Any custom chages are lost.
I think this sentence is incorrect and should probably be changes.
Thanks for noticing :)
If you want to get ahold of me I'm almost always on Discord.


Bilka
Factorio Staff
Factorio Staff
Posts: 3132
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: [0.15.31] Crash on_research_finished research_all_technologi

Post by Bilka »

I_IBlackI_I wrote:Possibly fixed in 0.16.30? https://www.reddit.com/r/factorio/comme ... ion_01630/
No, there the issue was different. I'll provide the desciprtion Rseding gave to bob:
Calling reset_technology_effects while the game was in the state of "researched finished, press T" would leave the research manager in a broken state.
Where it would say "I have just finished researching" but had no previous technology it researched saved.
So the GUI would attempt to show "XXXXXX finished, press T"
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Post Reply

Return to “Minor issues”