Add sat/unsat notifications

master
Kitty Barnett 2021-04-07 02:05:27 +02:00
parent 36afcdf55b
commit cf902df4fa
3 changed files with 29 additions and 4 deletions

View File

@ -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

View File

@ -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
//

View File

@ -633,6 +633,8 @@ public:
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);