Page 1 of 1
Detect un-research in editor
Posted: Mon Jan 25, 2021 11:13 am
by ickputzdirwech
Is there any way to detect if a technology got un-researched in the map editor? I couldn't find any event that gets triggered or something like that. I want to revert changes I did on_research_finished. It's a very minor issue but I wondered if it is possible at all.
Re: Detect un-research in editor
Posted: Wed Jan 27, 2021 10:07 am
by ss_Baum
If you do this with the console you could mayby use on_console_command
https://lua-api.factorio.com/latest/eve ... le_command
but I think that just works in a running game, but I am not sure
Re: Detect un-research in editor
Posted: Wed Jan 27, 2021 10:26 am
by ickputzdirwech
I mean the “Un-research” button in the technology screen. I hadn’t thought about console commands yet. Right now I am making sure everything is in the right state on_research_finished and on_technology_effects_reset.
Re: Detect un-research in editor
Posted: Wed Jan 27, 2021 11:50 am
by ss_Baum
I actually never realized an un-research button, but I never really used the map editor.
But I think a button belongs to a GUI, so maybe this on_gui_click could work
https://lua-api.factorio.com/latest/eve ... _gui_click
Re: Detect un-research in editor
Posted: Wed Jan 27, 2021 1:03 pm
by ickputzdirwech
That only fires for custom GUIs, not base game ones. I also don’t want to “use a sledgehammer to crack a nut”. I am mostly fine with how I solved it for now, since it only poses a problem if people mess around in the editor or use console commands. And it’ll get fixed as soon as they research the next technology in the “normal” way.
Re: Detect un-research in editor
Posted: Fri Feb 05, 2021 5:31 am
by ss_Baum
They added on_research_reversed
viewtopic.php?f=3&t=95683
Re: Detect un-research in editor
Posted: Fri Feb 05, 2021 6:34 am
by ickputzdirwech
Yeah noticed that as well. Didn’t have time to test it yet, but the description in the docs sounds like it’s exactly what I was missing. The devs are just awesome!
@Moderators: I wouldn’t mind if this got moved to implement modding interface request.