mirror of
https://github.com/overte-org/overte.git
synced 2025-04-09 07:12:45 +02:00
Update EntityScriptingInterface::deleteEntity to not delete when known entity is locked
This commit is contained in:
parent
4c10f6f23b
commit
86f7c28ee9
1 changed files with 14 additions and 3 deletions
|
@ -144,15 +144,26 @@ void EntityScriptingInterface::deleteEntity(EntityItemID entityID) {
|
|||
}
|
||||
}
|
||||
|
||||
bool shouldDelete = true;
|
||||
|
||||
// If we have a local entity tree set, then also update it.
|
||||
if (_entityTree) {
|
||||
_entityTree->lockForWrite();
|
||||
_entityTree->deleteEntity(entityID);
|
||||
|
||||
EntityItem* entity = const_cast<EntityItem*>(_entityTree->findEntityByEntityItemID(actualID));
|
||||
if (entity) {
|
||||
if (entity->getLocked()) {
|
||||
shouldDelete = false;
|
||||
} else {
|
||||
_entityTree->deleteEntity(entityID);
|
||||
}
|
||||
}
|
||||
|
||||
_entityTree->unlock();
|
||||
}
|
||||
|
||||
// if at this point, we know the id, send the update to the entity server
|
||||
if (entityID.isKnownID) {
|
||||
// if at this point, we know the id, and we should still delete the entity, send the update to the entity server
|
||||
if (shouldDelete && entityID.isKnownID) {
|
||||
getEntityPacketSender()->queueEraseEntityMessage(entityID);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue