[2.0.72] on_undo_applied is not fired for wire connections under certain circumstances

Natha
Filter Inserter
Filter Inserter
Posts: 310
Joined: Sun Mar 15, 2015 1:48 pm
Contact:

[2.0.72] on_undo_applied is not fired for wire connections under certain circumstances

Post by Natha »

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.
Attachments
test_0.0.1.zip
(1.34 KiB) Downloaded 44 times
Rseding91
Factorio Staff
Factorio Staff
Posts: 16586
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.0.72] on_undo_applied is not fired for wire connections under certain circumstances

Post by Rseding91 »

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.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Fixed for 2.1”