TL;DR
When a mod orders a bp or deconstruction the undo queue doesn't undo the action, even if a player was supplied in the call as "the player that did it". If the order was added to the undo-stack (as an option) then CTRL+Z should undo the order.What?
The codeCode: Select all
p.selected.order_deconstruction(p.force, p)
Other examples:
A mod "blueprint alignment" can force blueprints to be placed aligned to a configurable grid for each blueprint. This is amazing for chunk-sized blueprints you want to place in a neat row and makes long walls and rails and lots of other things much simpler and faster. But any blueprint order that is modified by the mod can't be undone because of the API limitations. Once the mod acts to help you the game sees it as if it's not the player that ordered the action.The mod "Recursive Blueprints" can place blueprints commanded by circuit network (It should definitely be a vanilla feature though, automating placing blueprints is the most fun and Factorio-ish thing possible). Sometimes a circuit might order a blueprint or deconstruction based on some calculation without player involvement and then it makes sense that the player that doesn't know about the placement doesn't undo the blueprint deployers actions when he uses undo to undo what he himself just did. But in other cases, the player might press a pushbutton to tell the circuit to initiate some blueprint orders. The combinator circuit, built by the player, could then supply a "add to player undo queue"-signal on the wire when it orders the construction and the mod (or vanilla feature when it's added) would detect this and supply the "add to players undo queue" argument to the API call in those cases.