How to restore information for undo?
Posted: Sat Nov 28, 2020 8:47 am
Hello,
I have a custom entity, for which I store additional information in a global table referenced by unit_number. For copy/paste/blueprint I am able to save and restore these information using tags.
Now I also want to restore this information after I mined this entity and restore its ghost with undo. Is this possible?
What I basically need is something like this:
This information is only relevant for the undo process, I don't want to save the information in the item.
Can someone help me with this?
Thanks, Jaren
I have a custom entity, for which I store additional information in a global table referenced by unit_number. For copy/paste/blueprint I am able to save and restore these information using tags.
Now I also want to restore this information after I mined this entity and restore its ghost with undo. Is this possible?
What I basically need is something like this:
Code: Select all
function on_player_entity_mined(event)
if event.entity.name == "my-entity" then
-- these tags are stored in the ghost, which is created with undo
event.tags = create_tags(event.entity)
end
end
Can someone help me with this?
Thanks, Jaren