From 54a5805b5c84f63613b16ef2f1756f4f27957476 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Tue, 18 Dec 2018 10:43:11 -0800 Subject: [PATCH] add final edit when dropping an avatar-entity. don't allow grabbing of other's avatar entities --- libraries/entities/src/EntityItem.cpp | 8 ++++++++ libraries/entities/src/EntityTree.cpp | 6 +++--- scripts/system/libraries/controllerDispatcherUtils.js | 3 +-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index cddf961dbd..8d46af0013 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -2465,6 +2465,14 @@ bool EntityItem::shouldSuppressLocationEdits() const { i++; } + i = _grabActions.begin(); + while (i != _grabActions.end()) { + if (i.value()->shouldSuppressLocationEdits()) { + return true; + } + i++; + } + // if any of the ancestors are MyAvatar, suppress return isChildOfMyAvatar(); } diff --git a/libraries/entities/src/EntityTree.cpp b/libraries/entities/src/EntityTree.cpp index 506df95007..c9e855f606 100644 --- a/libraries/entities/src/EntityTree.cpp +++ b/libraries/entities/src/EntityTree.cpp @@ -2969,9 +2969,9 @@ void EntityTree::updateEntityQueryAACubeWorker(SpatiallyNestablePointer object, if (success) { moveOperator.addEntityToMoveList(entity, newCube); } - // send an edit packet to update the entity-server about the queryAABox - // unless it is client-only - if (tellServer && packetSender && entity->isDomainEntity()) { + // 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 (tellServer && packetSender && (entity->isDomainEntity() || entity->isAvatarEntity())) { quint64 now = usecTimestampNow(); EntityItemProperties properties = entity->getProperties(); properties.setQueryAACubeDirty(); diff --git a/scripts/system/libraries/controllerDispatcherUtils.js b/scripts/system/libraries/controllerDispatcherUtils.js index d25450ed18..0b1d17c266 100644 --- a/scripts/system/libraries/controllerDispatcherUtils.js +++ b/scripts/system/libraries/controllerDispatcherUtils.js @@ -154,7 +154,6 @@ DISPATCHER_PROPERTIES = [ "grab.equippableIndicatorScale", "grab.equippableIndicatorOffset", "userData", - "entityHostType", "owningAvatarID" ]; @@ -291,7 +290,7 @@ getGrabbableData = function (ggdProps) { }; isAnothersAvatarEntity = function (iaaeProps) { - if (iaaeProps.entityHostType !== "avatar") { + if (!iaaeProps.avatarEntity) { return false; } if (iaaeProps.owningAvatarID === MyAvatar.sessionUUID) {