So when mod wants to do something which currently isn't supported by undo/redo system the mod would call "player.undo_redo_stack.register_lua_undo()" instead and pass whatever parameters would be needed by the mod to undo/redo that action (dictionary of Any).
When user then undoes the action, normal "on_undo_applied" event would be triggered and mod would be able to do whatever it needs to undo the changes. Same goes for when user tries to redo that action.
Required API changes (unless I'm missing something):
- New valid type of UndoRedoAction
- New function to register undoable actions (probably on LuaUndoRedoStack)
- Not possible to preview undo/redo changes (unless that also could somehow be provided by the mod)
- How to identify that mod should be processing specific "on_undo_applied" event?
- Should mod only get its own lua undoable events in "on_undo_applied" or should it get all of them and UndoRedoAction would contain "mod_name" (which registered it) so mods can filter for their own events?