diff --git a/indra/newview/rlvactions.cpp b/indra/newview/rlvactions.cpp index 80178cd36242e87645afc1809138b13f3eca2d86..6629fc519b37de78d367d62ba32922fa243b39ee 100644 --- a/indra/newview/rlvactions.cpp +++ b/indra/newview/rlvactions.cpp @@ -571,8 +571,8 @@ bool RlvActions::canTouch(const LLViewerObject* pObj, const LLVector3& posOffset // (2) Attachment (on another avatar) // - a) not prevented from touching any object // - b) not specifically prevented from touching that object - // - d) not prevented from touching attachments (or the attachment is an exception) - // - e) not prevented from touching other avatar's attachments (or the attachment is an exception) + // - d) not prevented from touching attachments (or the attachment and/or its wearer is/are an exception) + // - e) not prevented from touching other avatar's attachments (or the attachment is worn by a specific avatar on the exception list) // - h) not prevented from touching faraway objects (or the attachment's center + pick offset is within range) // - i) specifically allowed to touch that object (overrides all restrictions) // (3) Attachment (on own avatar) @@ -590,7 +590,7 @@ bool RlvActions::canTouch(const LLViewerObject* pObj, const LLVector3& posOffset // NOTE-RLVa: * touch restrictions apply linkset-wide (as opposed to, for instance, hover text which is object-specific) but only the root object's restrictions are tested // * @touchall affects world objects and world attachments (self and others') but >not< HUD attachments // * @fartouch distance matches against the specified object + pick offset (so >not< the linkset root) - // * @touchattachother exceptions are only checked under the general @touchattach exceptions + // * @touchattachother exceptions change when they specify an avatar id (=block all) or an object id (=allow indiviual - see general @touchattach exceptions) // * @touchattachself exceptions are only checked under the general @touchattach exceptions // * @touchme in any object of a linkset affects that entire linkset (= if you can specifically touch one prim in a linkset you can touch that entire linkset) const LLUUID& idRoot = (pObj) ? pObj->getRootEdit()->getID() : LLUUID::null; @@ -603,12 +603,23 @@ bool RlvActions::canTouch(const LLViewerObject* pObj, const LLVector3& posOffset ( (!rlvHandler.hasBehaviour(RLV_BHVR_TOUCHTHIS)) || (!rlvHandler.isException(RLV_BHVR_TOUCHTHIS, idRoot, ERlvExceptionCheck::Permissive)) ); if (fCanTouch) { - if ( (!pObj->isAttachment()) || (!pObj->permYouOwner()) ) + if (!pObj->isAttachment()) + { + // Rezzed object - test for (1.c) and (1.h) + fCanTouch = + ( (!rlvHandler.hasBehaviour(RLV_BHVR_TOUCHWORLD)) || (rlvHandler.isException(RLV_BHVR_TOUCHWORLD, idRoot, ERlvExceptionCheck::Permissive)) ) && + ( (!rlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) || (dist_vec_squared(gAgent.getPositionGlobal(), pObj->getPositionGlobal() + LLVector3d(posOffset)) <= s_nFartouchDist * s_nFartouchDist) ); + } + else if (!pObj->permYouOwner()) { - // Rezzed or attachment worn by other - test for (1.c), (2.d), (2.e) and (1/2.h) + // Attachment worn by other - test for (2.d), (2.e) and (2.h) + const LLUUID& idAttachAgent = static_cast<LLViewerObject*>(pObj->getRoot())->getID(); fCanTouch = - ( (!pObj->isAttachment()) ? (!rlvHandler.hasBehaviour(RLV_BHVR_TOUCHWORLD)) || (rlvHandler.isException(RLV_BHVR_TOUCHWORLD, idRoot, ERlvExceptionCheck::Permissive)) - : ((!rlvHandler.hasBehaviour(RLV_BHVR_TOUCHATTACH)) && (!rlvHandler.hasBehaviour(RLV_BHVR_TOUCHATTACHOTHER))) || (rlvHandler.isException(RLV_BHVR_TOUCHATTACH, idRoot, ERlvExceptionCheck::Permissive)) ) && + ( + ( (!rlvHandler.hasBehaviour(RLV_BHVR_TOUCHATTACH) && !rlvHandler.hasBehaviour(RLV_BHVR_TOUCHATTACHOTHER)) || + (rlvHandler.isException(RLV_BHVR_TOUCHATTACH, idRoot, ERlvExceptionCheck::Permissive) || rlvHandler.isException(RLV_BHVR_TOUCHATTACH, idAttachAgent, ERlvExceptionCheck::Permissive)) ) && + (!rlvHandler.isException(RLV_BHVR_TOUCHATTACHOTHER, idAttachAgent)) + ) && ( (!rlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) || (dist_vec_squared(gAgent.getPositionGlobal(), pObj->getPositionGlobal() + LLVector3d(posOffset)) <= s_nFartouchDist * s_nFartouchDist) ); } else if (!pObj->isHUDAttachment()) diff --git a/indra/newview/rlvhelper.cpp b/indra/newview/rlvhelper.cpp index d69fbf45ed954d6b7481800a7bc8a1729d6339d6..4923d09dc74b8ffb8dea7419c422c743515306e0 100644 --- a/indra/newview/rlvhelper.cpp +++ b/indra/newview/rlvhelper.cpp @@ -168,7 +168,7 @@ RlvBehaviourDictionary::RlvBehaviourDictionary() addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE>("temprun", RLV_BHVR_TEMPRUN)); addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE>("touchall", RLV_BHVR_TOUCHALL)); addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE_OR_EXCEPTION>("touchattach", RLV_BHVR_TOUCHATTACH)); - addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE>("touchattachother", RLV_BHVR_TOUCHATTACHOTHER)); + addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE_OR_EXCEPTION>("touchattachother", RLV_BHVR_TOUCHATTACHOTHER)); addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE>("touchattachself", RLV_BHVR_TOUCHATTACHSELF)); addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE_OR_MODIFIER>("touchfar", RLV_BHVR_FARTOUCH, RlvBehaviourInfo::BHVR_SYNONYM)); addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE_OR_EXCEPTION>("touchhud", RLV_BHVR_TOUCHHUD, RlvBehaviourInfo::BHVR_EXTENDED));