Steps to reproduce:
Use the mod I attached. Place 2 electric poles and connect them with red or green wire. Then press Ctrl+Z. The floating text states that the connection was undone, but no chat message.
When I disconnect a wire connection by script the next tick after it was connected and I want to undo it (not 'really' undo it, since the connection is already gone, but I want to catch the event for further scripting), the on_undo_applied event is not fired. However, the action is still in the undo stack and the floating text appears.
The mod prints a chat message when the event was fired.
Is this maybe because the game checks "oh, nothing to undo here" and therefore not firing the event? Because the action is also not on the redo stack after that.
Using a custom input assigned to ctrl+z and ctrl+y is not a solution, as clicking the shortcut buttons does not fire anything then.
[2.0.72] on_undo_applied is not fired for wire connections under certain circumstances
[2.0.72] on_undo_applied is not fired for wire connections under certain circumstances
- Attachments
-
- test_0.0.1.zip
- (1.34 KiB) Downloaded 44 times
Re: [2.0.72] on_undo_applied is not fired for wire connections under certain circumstances
Thanks for the report. This is now fixed for 2.1. However: something worth mentioning - the way you've made this sample mod is going to cause desyncs in multiplayer since the "code to run next tick" is not saved/loaded and will not persist through multiplayer joining.
It will also fail if a player happened to save, quit, and load at the exact tick things were put into the "run next tick" logic.
It will also fail if a player happened to save, quit, and load at the exact tick things were put into the "run next tick" logic.
If you want to get ahold of me I'm almost always on Discord.

