Skip to content

Custom included data is removed before entity is finally removed... #3726

Description

@raven1934

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])
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions