don't put actions on other people's avatarEntities

This commit is contained in:
Seth Alves 2016-05-10 16:43:27 -07:00
parent 356ccdba26
commit de12680ff1
3 changed files with 15 additions and 0 deletions

View file

@ -187,6 +187,10 @@ void Avatar::updateAvatarEntities() {
return;
}
if (getID() == QUuid()) {
return; // wait until MyAvatar gets an ID before doing this.
}
EntityTreeRenderer* treeRenderer = qApp->getEntities();
EntityTreePointer entityTree = treeRenderer ? treeRenderer->getTree() : nullptr;
if (!entityTree) {

View file

@ -44,6 +44,10 @@ void EntityEditPacketSender::queueEditAvatarEntityMessage(PacketType type,
return; // bail early
}
if (properties.getOwningAvatarID() != _myAvatar->getID()) {
return; // don't send updates for someone else's avatarEntity
}
assert(properties.getClientOnly());
// this is an avatar-based entity. update our avatar-data rather than sending to the entity-server

View file

@ -788,6 +788,9 @@ bool EntityScriptingInterface::actionWorker(const QUuid& entityID,
return false;
}
auto nodeList = DependencyManager::get<NodeList>();
const QUuid myNodeID = nodeList->getSessionUUID();
EntityItemPointer entity;
bool doTransmit = false;
_entityTree->withWriteLock([&] {
@ -803,6 +806,10 @@ bool EntityScriptingInterface::actionWorker(const QUuid& entityID,
return;
}
if (entity->getClientOnly() && entity->getOwningAvatarID() != nodeList->getSessionUUID()) {
return;
}
doTransmit = actor(simulation, entity);
if (doTransmit) {
_entityTree->entityChanged(entity);