Factorio.com|Forums|Wiki|Mod Portal|API Docs

# Factorio Runtime Docs Version 2.0.77

# UndoRedoAction - Runtime Docs

## UndoRedoAction :: table

#### Table fields

type | :: `"built-entity"` or `"built-tile"` or `"copy-entity-settings"` or `"removed-entity"` or `"removed-tile"` or `"upgraded-entity"` or `"upgraded-modules"` or `"wire-added"` or `"wire-removed"` or `"rotated-entity"` | The type of action that was undone or redone.
The type of action that was undone or redone.
tags | :: Tags? | The tags attached to the undo action, if any.
The tags attached to the undo action, if any.

Other attributes may be specified depending on `type`:

#### `built-entity`

target | :: BlueprintEntity | The specification of the built entity.
The specification of the built entity.
surface_index | :: uint32? | The surface of the built entity.
The surface of the built entity.

#### `removed-entity`

target | :: BlueprintEntity | The specification of the removed entity.
The specification of the removed entity.
surface_index | :: uint32? | The surface from which the entity was removed. Not present for entities the game can't restore, like trees or rocks.
The surface from which the entity was removed. Not present for entities the game can't restore, like trees or rocks.
insert_plan | :: array[BlueprintInsertPlan]? | The items that the entity will request when revived, if there are any. It's a mapping of prototype names to amounts. Not present for entities the game can't restore, like trees or rocks.
The items that the entity will request when revived, if there are any. It's a mapping of prototype names to amounts. Not present for entities the game can't restore, like trees or rocks.
schedule | :: BlueprintSchedule? | The schedule of the entity, if it has one. Only relevant for locomotives. Not present for entities the game can't restore, like trees or rocks.
The schedule of the entity, if it has one. Only relevant for locomotives. Not present for entities the game can't restore, like trees or rocks.

#### `built-tile`

position | :: TilePosition | The position of the newly built tile.
The position of the newly built tile.
surface_index | :: uint32 | The surface on which the tile was built.
The surface on which the tile was built.
previous_tile | :: string? | The prototype name of the replaced tile, if any was replaced.
The prototype name of the replaced tile, if any was replaced.
new_tile | :: string | The prototype name of the newly built tile.
The prototype name of the newly built tile.

#### `removed-tile`

position | :: TilePosition | The position of the removed tile.
The position of the removed tile.
surface_index | :: uint32 | The surface from which the tile was removed.
The surface from which the tile was removed.
previous_tile | :: string | The prototype name of the removed tile.
The prototype name of the removed tile.

#### `upgraded-entity`

target | :: BlueprintEntity | The specification of the upgraded entity.
The specification of the upgraded entity.
surface_index | :: uint32? | The surface of the upgraded entity.
The surface of the upgraded entity.
original_name | :: string | The prototype name of the upgraded entity.
The prototype name of the upgraded entity.
original_quality_name | :: string | The quality prototype name of the entity before upgrading.
The quality prototype name of the entity before upgrading.

#### `upgraded-modules`

target | :: BlueprintEntity | The specification of the upgraded entity.
The specification of the upgraded entity.
surface_index | :: uint32? | The surface of the upgraded entity.
The surface of the upgraded entity.
modules_before | :: BlueprintInsertPlan | The modules present in the target before the upgrade.
The modules present in the target before the upgrade.

#### `wire-added`

a | :: BlueprintWireEnd |
b | :: BlueprintWireEnd |

#### `wire-removed`

a | :: BlueprintWireEnd |
b | :: BlueprintWireEnd |

#### `rotated-entity`

target | :: BlueprintEntity | The specification of the rotated entity.
The specification of the rotated entity.
surface_index | :: uint32? | The surface of the rotated entity.
The surface of the rotated entity.
original_direction | :: defines.direction | The direction of the entity before upgrading.
The direction of the entity before upgrading.
original_mirroring | :: boolean |

#### `copy-entity-settings`

target | :: BlueprintEntity? | The specification of the entity the settings were pasted onto.
The specification of the entity the settings were pasted onto.
surface_index | :: uint32? | The surface of the entity the settings were pasted onto.
The surface of the entity the settings were pasted onto.
entity_with_previous_settings | :: BlueprintEntity? |

Concept used in

- LuaUndoRedoStack::get_undo_item()
- LuaUndoRedoStack::get_redo_item()
- on_redo_applied
- on_undo_applied