Describe the bug
Hey,
I tried to use event entityRemoved(Entity:entity) to detect and update an array of its adjacent entities of the removal of the entity in case unexpected removal takes place, but sadly it seems the entity loses its custom data before the entity itself is destroyed making me unable to retrieve stuff stuff like indexes etc. which I've associated to the entity via Entity["Index",number]=Index, I can technically include such information by utilizing for example entity color which seems to carry on until the actual removal has taken place, but I think this is bit silly and I think it would be potentially easy enough fix to implement to retain said data until entity removal... Please if you got insights why this is possible/impossible I'm also curious for the reasoning said data is removed before the entity is.
Use the code below and then delete the above entity with remover tool or any method that removes entities and it shows the value that was stored in the entity isnt returned.
Best regards,
Raven
@name DataLossExample
@inputs
@outputs
@persist E:entity
@trigger none
@strict
if(first())
{
E=propSpawn(entity():model(),entity():toWorld(vec(0,0,35)),ang(0,0,0),1)
E["Index",number]=10
}
runOnTick(1)
event entityRemoved(Entity:entity)
{
if(Entity==E)
{
print(E["Index",number])
}
}
Describe the bug
Hey,
I tried to use event entityRemoved(Entity:entity) to detect and update an array of its adjacent entities of the removal of the entity in case unexpected removal takes place, but sadly it seems the entity loses its custom data before the entity itself is destroyed making me unable to retrieve stuff stuff like indexes etc. which I've associated to the entity via Entity["Index",number]=Index, I can technically include such information by utilizing for example entity color which seems to carry on until the actual removal has taken place, but I think this is bit silly and I think it would be potentially easy enough fix to implement to retain said data until entity removal... Please if you got insights why this is possible/impossible I'm also curious for the reasoning said data is removed before the entity is.
Use the code below and then delete the above entity with remover tool or any method that removes entities and it shows the value that was stored in the entity isnt returned.
Best regards,
Raven