mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
delete avatar entity when switching domains
This commit is contained in:
parent
806d9f1436
commit
f6208a394c
2 changed files with 5 additions and 0 deletions
|
@ -615,6 +615,7 @@ public:
|
|||
Q_INVOKABLE AvatarEntityMap getAvatarEntityData() const;
|
||||
Q_INVOKABLE void setAvatarEntityData(const AvatarEntityMap& avatarEntityData);
|
||||
void setAvatarEntityDataChanged(bool value) { _avatarEntityDataChanged = value; }
|
||||
void insertDetachedEntityID(const QUuid entityID) { _avatarEntityDetached.insert(entityID); }
|
||||
AvatarEntityIDs getAndClearRecentlyDetachedIDs();
|
||||
|
||||
// thread safe
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <VariantMapToScriptValue.h>
|
||||
#include <SharedUtil.h>
|
||||
#include <SpatialParentFinder.h>
|
||||
#include <AvatarHashMap.h>
|
||||
|
||||
#include "EntityItemID.h"
|
||||
#include "EntitiesLogging.h"
|
||||
|
@ -497,8 +498,11 @@ void EntityScriptingInterface::deleteEntity(QUuid id) {
|
|||
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
const QUuid myNodeID = nodeList->getSessionUUID();
|
||||
auto avatarHashMap = DependencyManager::get<AvatarHashMap>();
|
||||
AvatarSharedPointer myAvatar = avatarHashMap->getAvatarBySessionID(myNodeID);
|
||||
if (entity->getClientOnly() && entity->getOwningAvatarID() != myNodeID) {
|
||||
// don't delete other avatar's avatarEntities
|
||||
myAvatar->insertDetachedEntityID(id);
|
||||
shouldDelete = false;
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue