Detect un-research in editor

Place to get help with not working mods / modding interface.
Post Reply
User avatar
ickputzdirwech
Filter Inserter
Filter Inserter
Posts: 768
Joined: Sun May 07, 2017 10:16 am
Contact:

Detect un-research in editor

Post 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.
Mods: Shortcuts for 1.1, ick's Sea Block, ick's vanilla tweaks
Tools: Atom language pack
Text quickly seems cold and unfriendly. Be careful how you write and interpret what others have written.
- A reminder for me and all who read what I write

ss_Baum
Long Handed Inserter
Long Handed Inserter
Posts: 58
Joined: Wed Apr 04, 2018 10:58 am
Contact:

Re: Detect un-research in editor

Post 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

User avatar
ickputzdirwech
Filter Inserter
Filter Inserter
Posts: 768
Joined: Sun May 07, 2017 10:16 am
Contact:

Re: Detect un-research in editor

Post 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.
Mods: Shortcuts for 1.1, ick's Sea Block, ick's vanilla tweaks
Tools: Atom language pack
Text quickly seems cold and unfriendly. Be careful how you write and interpret what others have written.
- A reminder for me and all who read what I write

ss_Baum
Long Handed Inserter
Long Handed Inserter
Posts: 58
Joined: Wed Apr 04, 2018 10:58 am
Contact:

Re: Detect un-research in editor

Post 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

User avatar
ickputzdirwech
Filter Inserter
Filter Inserter
Posts: 768
Joined: Sun May 07, 2017 10:16 am
Contact:

Re: Detect un-research in editor

Post 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.
Mods: Shortcuts for 1.1, ick's Sea Block, ick's vanilla tweaks
Tools: Atom language pack
Text quickly seems cold and unfriendly. Be careful how you write and interpret what others have written.
- A reminder for me and all who read what I write

ss_Baum
Long Handed Inserter
Long Handed Inserter
Posts: 58
Joined: Wed Apr 04, 2018 10:58 am
Contact:

Re: Detect un-research in editor

Post by ss_Baum »

They added on_research_reversed :D viewtopic.php?f=3&t=95683

User avatar
ickputzdirwech
Filter Inserter
Filter Inserter
Posts: 768
Joined: Sun May 07, 2017 10:16 am
Contact:

Re: Detect un-research in editor

Post 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. ;)
Mods: Shortcuts for 1.1, ick's Sea Block, ick's vanilla tweaks
Tools: Atom language pack
Text quickly seems cold and unfriendly. Be careful how you write and interpret what others have written.
- A reminder for me and all who read what I write

Post Reply

Return to “Modding help”