[FIXED] @sitground=force from an object holding the only @sit=n,unsit=n reports the avatar standing and sitting illegally

master
Kitty Barnett 2021-06-19 15:27:36 +02:00
parent a7395a9e98
commit f044949ed3
3 changed files with 33 additions and 11 deletions

View File

@ -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<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 */);
{
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<RLV_BHVR_SITGROUND>::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<RLV_BHVR_SIT>::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
{

View File

@ -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<LLUUID, std::string> m_PendingGroupChange; // @setgroup=force
std::pair<LLTimer, LLUUID> m_GroupChangeExpiration; // @setgroup=force

View File

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