[Not sure if this is a modding request or a bug report]
There are ten different UndoRedoAction types. Only three (removed-entity, built-tile and removed-tile) pass in the surface_index.
Trying to implement undo/redo for custom entities that retain state brings me to "keep a set of tombstones for entities that get deconstructed". All of the events operate on BlueprintEntity objects which contain position and direction, but not the surface. So trying to match up entities with my tombstones gets really hard as I do not know what surface to look at.
I can not use game.players[e.player_index].surface as the player could be on a different surface.
Please add the surface_index attribute to all the UndoRedoActions.
Some UndoRedoAction types lack surface_index
- protocol_1903
- Filter Inserter

- Posts: 413
- Joined: Fri Sep 09, 2022 4:33 pm
- Contact:
Re: Some UndoRedoAction types lack surface_index
+1 for consistency
Py and PyBlock developer, wielder of LUA in arbitrary ways. I make mods. Check them out, maybe.
https://mods.factorio.com/user/protocol_1903
https://mods.factorio.com/user/protocol_1903
Re: Some UndoRedoAction types lack surface_index
Okay, added surface_index to all remaining UndoRedoActions for 2.0.67. For wire removed and wire added it's part of the BlueprintWireEnds.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

