[2.0.72] on_undo_applied is not fired for wire connections under certain circumstances
Posted: Sun Nov 09, 2025 1:56 pm
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.
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.