From cf902df4fa1f64b8624bf9a42761776ab62f7e4d Mon Sep 17 00:00:00 2001 From: Kitty Barnett <develop@catznip.com> Date: Wed, 7 Apr 2021 02:05:27 +0200 Subject: [PATCH] Add sat/unsat notifications --- indra/newview/rlvhandler.cpp | 15 +++++++++++---- indra/newview/rlvhelper.cpp | 16 ++++++++++++++++ indra/newview/rlvhelper.h | 2 ++ 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index ba136231fb9..f690ea0b826 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -887,10 +887,7 @@ void RlvHandler::setCameraOverride(bool fOverride) // Checked: 2010-08-29 (RLVa-1.2.1c) | Modified: RLVa-1.2.1c void RlvHandler::onSitOrStand(bool fSitting) { - if (rlv_handler_t::isEnabled()) - { - RlvSettings::updateLoginLastLocation(); - } + RlvSettings::updateLoginLastLocation(); if ( (hasBehaviour(RLV_BHVR_STANDTP)) && (!fSitting) && (!m_posSitSource.isExactlyZero()) ) { @@ -908,6 +905,16 @@ void RlvHandler::onSitOrStand(bool fSitting) gAgent.setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); send_agent_update(TRUE, TRUE); } + + if (isAgentAvatarValid()) + { + const LLViewerObject* pSitObj = static_cast<const LLViewerObject*>(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 */); + else + RlvBehaviourNotifyHandler::instance().onStand(idSitObj, !gRlvHandler.hasBehaviourExcept(RLV_BHVR_UNSIT, getCurrentObject())); + } } // Checked: 2010-03-11 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a diff --git a/indra/newview/rlvhelper.cpp b/indra/newview/rlvhelper.cpp index 207ca5cebd4..bd9b0d6a9ad 100644 --- a/indra/newview/rlvhelper.cpp +++ b/indra/newview/rlvhelper.cpp @@ -1920,6 +1920,22 @@ void RlvBehaviourNotifyHandler::onReattach(const LLViewerJointAttachment* pAttac sendNotification(llformat("reattached %s %s", (fAllowed) ? "legally" : "illegally", pAttachPt->getName().c_str())); } +void RlvBehaviourNotifyHandler::onSit(const LLUUID& idObj, bool fAllowed) +{ + if (idObj.isNull()) + sendNotification(llformat("sat ground %s", (fAllowed) ? "legally" : "illegally")); + else + sendNotification(llformat("sat object %s %s", (fAllowed) ? "legally" : "illegally", idObj.asString().c_str())); +} + +void RlvBehaviourNotifyHandler::onStand(const LLUUID& idObj, bool fAllowed) +{ + if (idObj.isNull()) + sendNotification(llformat("unsat ground %s", (fAllowed) ? "legally" : "illegally")); + else + sendNotification(llformat("unsat object %s %s", (fAllowed) ? "legally" : "illegally", idObj.asString().c_str())); +} + // ========================================================================= // Various helper classes/timers/functors // diff --git a/indra/newview/rlvhelper.h b/indra/newview/rlvhelper.h index 9a561bfcfb5..f150d9f191d 100644 --- a/indra/newview/rlvhelper.h +++ b/indra/newview/rlvhelper.h @@ -633,6 +633,8 @@ class RlvBehaviourNotifyHandler : public LLSingleton<RlvBehaviourNotifyHandler> 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: void onCommand(const RlvCommand& rlvCmd, ERlvCmdRet eRet, bool fInternal); -- GitLab