[Rseding91] [0.14.2] on_built_entity error if others destroy the entity
Posted: Fri Sep 02, 2016 1:40 pm
Scenario:
1) My Creative Mode has the functionality of instant blueprint: instantly revive ghost entities. For compatibility to other mods, on_built_entity is raised for the revived entity so that other mods know and do things accordingly, e.g. register the entity to update it in on_tick.
2) Some mods have dummy entities. When any of these entities is built, it is destroyed immediately or replaced by another entity. E.g. Test Mode - the mjollnir, Natural Evolution Enemies - the Artifact Collector.
3) When I shift-place any of these dummy entities, it is revived. But when on_built_entity is raised, error message is shown and the game is quit.
These may be a little bit complicated, so I created 2 little mods to simulate instant blueprint and also entity destruction. You can easily reproduce the error with them.
Steps to reproduce:
1) Download the following mod. It has the functionality of instant blueprint. on_built_entity is raised. 2) Also the following one. When a wooden chest is built, this mod replaces it with a steel chest. The wooden chest is destroyed. They don't depend on each other. No problem will occur if only one of them is used or only one of them is triggered.
3) Use both of these 2 little mods. Start a game.
4) Shift-place a wooden chest.
The ghost of wooden chest is placed -> on_built_entity for the ghost -> mod 1 is triggered -> revive the ghost -> on_built_entity for the revived wooden chest -> mod 2 is triggered -> destroy the chest -> step 5...
5) Boom. ... game complains for mod 1 raising on_built_entity for an invalid entity.
Possible solution:
Have no idea at this moment.
1) My Creative Mode has the functionality of instant blueprint: instantly revive ghost entities. For compatibility to other mods, on_built_entity is raised for the revived entity so that other mods know and do things accordingly, e.g. register the entity to update it in on_tick.
2) Some mods have dummy entities. When any of these entities is built, it is destroyed immediately or replaced by another entity. E.g. Test Mode - the mjollnir, Natural Evolution Enemies - the Artifact Collector.
3) When I shift-place any of these dummy entities, it is revived. But when on_built_entity is raised, error message is shown and the game is quit.
These may be a little bit complicated, so I created 2 little mods to simulate instant blueprint and also entity destruction. You can easily reproduce the error with them.
Steps to reproduce:
1) Download the following mod. It has the functionality of instant blueprint. on_built_entity is raised. 2) Also the following one. When a wooden chest is built, this mod replaces it with a steel chest. The wooden chest is destroyed. They don't depend on each other. No problem will occur if only one of them is used or only one of them is triggered.
3) Use both of these 2 little mods. Start a game.
4) Shift-place a wooden chest.
The ghost of wooden chest is placed -> on_built_entity for the ghost -> mod 1 is triggered -> revive the ghost -> on_built_entity for the revived wooden chest -> mod 2 is triggered -> destroy the chest -> step 5...
5) Boom. ... game complains for mod 1 raising on_built_entity for an invalid entity.
Possible solution:
Have no idea at this moment.