Merge pull request #14740 from AndrewMeadows/fix-case-20731

Case 20731: send updates when grabbing AvatarEntities
This commit is contained in:
John Conklin II 2019-01-22 12:33:25 -08:00 committed by GitHub
commit 4050e4d998
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View file

@ -873,9 +873,13 @@ void MyAvatar::simulate(float deltaTime, bool inView) {
collisionlessAllowed = zone->getGhostingAllowed();
}
EntityEditPacketSender* packetSender = qApp->getEntityEditPacketSender();
bool force = false;
bool iShouldTellServer = true;
forEachDescendant([&](SpatiallyNestablePointer object) {
// we need to update attached queryAACubes in our own local tree so point-select always works
// however we don't want to flood the update pipeline with AvatarEntity updates, so we assume
// others have all info required to properly update queryAACube of AvatarEntities on their end
EntityItemPointer entity = std::dynamic_pointer_cast<EntityItem>(object);
bool iShouldTellServer = !(entity && entity->isAvatarEntity());
const bool force = false;
entityTree->updateEntityQueryAACube(object, packetSender, force, iShouldTellServer);
});
});

View file

@ -3008,8 +3008,8 @@ void EntityTree::updateEntityQueryAACubeWorker(SpatiallyNestablePointer object,
// if the queryBox has changed, tell the entity-server
EntityItemPointer entity = std::dynamic_pointer_cast<EntityItem>(object);
if (entity) {
bool tellServerThis = tellServer && (entity->getEntityHostType() != entity::HostType::AVATAR);
if ((entity->updateQueryAACube() || force)) {
// NOTE: we rely on side-effects of the entity->updateQueryAACube() call in the following if() conditional:
if (entity->updateQueryAACube() || force) {
bool success;
AACube newCube = entity->getQueryAACube(success);
if (success) {
@ -3017,7 +3017,7 @@ void EntityTree::updateEntityQueryAACubeWorker(SpatiallyNestablePointer object,
}
// send an edit packet to update the entity-server about the queryAABox. We do this for domain-hosted
// entities as well as for avatar-entities; the packet-sender will route the update accordingly
if (tellServerThis && packetSender && (entity->isDomainEntity() || entity->isAvatarEntity())) {
if (tellServer && packetSender && (entity->isDomainEntity() || entity->isAvatarEntity())) {
quint64 now = usecTimestampNow();
EntityItemProperties properties = entity->getProperties();
properties.setQueryAACubeDirty();