#Undo support for adding/removing wires

1 messages · Page 1 of 1 (latest)

wicked agate
#

I made a mod that adds and removes red and green wires. How do I add undo support?

The mod defines a selection-tool, similar to https://mods.factorio.com/mod/WideChests. (which also doesn't have undo). Then on_event(on_player_selected_area, it calls LuaWireConnector.connect_to.

Any way to make it work?

glossy latch
#

you might want to test if it actually goes onto the stack tho

wicked agate
#

I fear adding/removing multiple wires in this manner would add multiple items to the undo stack. I will test it over the next days. Thank you for the suggestion.

#

Another suggestion I got was to use a blueprint. But this would only add wires. Maybe a combination of "remove all wires" and "add back some removed wires" is possible

wicked agate
#

I've tried to get LuaPlayer.drag_wire to work, but couldn't get it do to anything. changing the cursor_stack to e. g. red wire worked. but drag_wire never had any effect.