mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 03:40:20 +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 we have a local entity tree set, then also update it.
|
||||||
if (_entityTree) {
|
if (_entityTree) {
|
||||||
_entityTree->lockForWrite();
|
_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();
|
_entityTree->unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if at this point, we know the id, send the update to the entity server
|
// if at this point, we know the id, and we should still delete the entity, send the update to the entity server
|
||||||
if (entityID.isKnownID) {
|
if (shouldDelete && entityID.isKnownID) {
|
||||||
getEntityPacketSender()->queueEraseEntityMessage(entityID);
|
getEntityPacketSender()->queueEraseEntityMessage(entityID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue