diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index fff0d2c994..26022657b9 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -901,9 +901,11 @@ void RlvHandler::onSitOrStand(bool fSitting) } else if ( (!fSitting) && (m_fPendingGroundSit) ) { - m_fPendingGroundSit = false; gAgent.setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); send_agent_update(TRUE, TRUE); + + m_fPendingGroundSit = false; + m_idPendingSitActor = m_idPendingUnsitActor; } if (isAgentAvatarValid()) @@ -911,9 +913,15 @@ void RlvHandler::onSitOrStand(bool fSitting) const LLViewerObject* pSitObj = static_cast(gAgentAvatarp->getParent()); const LLUUID& idSitObj = (pSitObj) ? pSitObj->getID() : LLUUID::null; if (fSitting) - RlvBehaviourNotifyHandler::instance().onSit(idSitObj, true /* Apparently we shouldn't track legal vs 'illegal' (ground) sits */); + { + RlvBehaviourNotifyHandler::instance().onSit(idSitObj, !gRlvHandler.hasBehaviourExcept(RLV_BHVR_SIT, m_idPendingSitActor)); + m_idPendingSitActor.setNull(); + } else - RlvBehaviourNotifyHandler::instance().onStand(idSitObj, !gRlvHandler.hasBehaviourExcept(RLV_BHVR_UNSIT, getCurrentObject())); + { + RlvBehaviourNotifyHandler::instance().onStand(idSitObj, !gRlvHandler.hasBehaviourExcept(RLV_BHVR_UNSIT, m_idPendingUnsitActor)); + m_idPendingUnsitActor.setNull(); + } } } @@ -2748,6 +2756,9 @@ ERlvCmdRet RlvHandler::processForceCommand(const RlvCommand& rlvCmd) const { gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); send_agent_update(TRUE, TRUE); // See behaviour notes on why we have to force an agent update here + + gRlvHandler.m_idPendingSitActor.setNull(); + gRlvHandler.m_idPendingUnsitActor = gRlvHandler.getCurrentObject(); } } break; @@ -3199,13 +3210,19 @@ ERlvCmdRet RlvForceHandler::onCommand(const RlvCommand& rlvC if (!gAgentAvatarp->isSitting()) { - gRlvHandler.m_fPendingGroundSit = false; gAgent.setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); + + gRlvHandler.m_fPendingGroundSit = false; + gRlvHandler.m_idPendingSitActor = gRlvHandler.getCurrentObject(); + gRlvHandler.m_idPendingUnsitActor.setNull(); } else if (gAgentAvatarp->getParent()) { - gRlvHandler.m_fPendingGroundSit = true; gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); + + gRlvHandler.m_fPendingGroundSit = true; + gRlvHandler.m_idPendingSitActor.setNull(); + gRlvHandler.m_idPendingUnsitActor = gRlvHandler.getCurrentObject(); } send_agent_update(TRUE, TRUE); @@ -3246,6 +3263,9 @@ ERlvCmdRet RlvForceHandler::onCommand(const RlvCommand& rlvCmd) gMessageSystem->addUUIDFast(_PREHASH_TargetID, pObj->mID); gMessageSystem->addVector3Fast(_PREHASH_Offset, LLVector3::zero); pObj->getRegion()->sendReliableMessage(); + + gRlvHandler.m_idPendingSitActor = gRlvHandler.getCurrentObject(); + gRlvHandler.m_idPendingUnsitActor.setNull(); } else { diff --git a/indra/newview/rlvhandler.h b/indra/newview/rlvhandler.h index e36782c52a..e5a6b0895e 100644 --- a/indra/newview/rlvhandler.h +++ b/indra/newview/rlvhandler.h @@ -266,7 +266,9 @@ protected: bool m_fCanCancelTp; // @accepttp=n and @tpto=force mutable LLVector3d m_posSitSource; // @standtp=n (mutable because onForceXXX handles are all declared as const) - mutable bool m_fPendingGroundSit = false; // @sitground=force + bool m_fPendingGroundSit = false; // @sitground=force + LLUUID m_idPendingSitActor; // @sit=force and @sitground=force + LLUUID m_idPendingUnsitActor; // @unsit=force mutable LLUUID m_idAgentGroup; // @setgroup=n std::pair m_PendingGroupChange; // @setgroup=force std::pair m_GroupChangeExpiration; // @setgroup=force diff --git a/indra/newview/rlvhelper.h b/indra/newview/rlvhelper.h index 068d9eaea6..b2517ef3b8 100644 --- a/indra/newview/rlvhelper.h +++ b/indra/newview/rlvhelper.h @@ -628,11 +628,11 @@ public: * Event handlers */ public: - static void onWear(LLWearableType::EType eType, bool fAllowed); - static void onTakeOff(LLWearableType::EType eType, bool fAllowed); - static void onAttach(const LLViewerJointAttachment* pAttachPt, bool fAllowed); - static void onDetach(const LLViewerJointAttachment* pAttachPt, bool fAllowed); - static void onReattach(const LLViewerJointAttachment* pAttachPt, bool fAllowed); + static void onWear(LLWearableType::EType eType, bool fAllowed); + static void onTakeOff(LLWearableType::EType eType, bool fAllowed); + static void onAttach(const LLViewerJointAttachment* pAttachPt, bool fAllowed); + static void onDetach(const LLViewerJointAttachment* pAttachPt, bool fAllowed); + static void onReattach(const LLViewerJointAttachment* pAttachPt, bool fAllowed); void onSit(const LLUUID& idObj, bool fAllowed); void onStand(const LLUUID& idObj, bool fAllowed); protected: