From 2ed42e44bd6bc78b93c0a38abc2c073a10263c9b Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Mon, 30 Jun 2025 19:34:07 +0800 Subject: Minimal @sit= command implementation --- indra/newview/llagent.cpp | 6 +++--- indra/newview/llagent.h | 3 +++ indra/newview/llviewermenu.cpp | 2 +- indra/newview/rlvhandler.cpp | 7 +++++++ indra/newview/rlvhelper.cpp | 1 + 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index b8b5ba2264..3a4e29afc1 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -387,6 +387,7 @@ LLAgent::LLAgent() : mbTeleportKeepsLookAt(false), mAllowedToStand(true), + mAllowedToSit(true), mAgentAccess(new LLAgentAccess(gSavedSettings)), mGodLevelChangeSignal(), @@ -971,8 +972,7 @@ bool LLAgent::isSitting() void LLAgent::standUp() { - if (mAllowedToStand) - setControlFlags(AGENT_CONTROL_STAND_UP); + if (mAllowedToStand) setControlFlags(AGENT_CONTROL_STAND_UP); } void LLAgent::changeParcels() @@ -1346,7 +1346,7 @@ LLVector3d LLAgent::getPosGlobalFromAgent(const LLVector3 &pos_agent) const void LLAgent::sitDown() { - setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); + if (mAllowedToSit) setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); } diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 74d8719047..ca8aaaee86 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -448,8 +448,11 @@ public: void sitDown(); bool isAllowedToStand() const { return mAllowedToStand; } void setAllowedToStand(bool allow) { mAllowedToStand = allow; } + bool isAllowedToSit() const { return mAllowedToSit; } + void setAllowedToSit(bool allow) { mAllowedToSit = allow; } private: bool mAllowedToStand; + bool mAllowedToSit; //-------------------------------------------------------------------- // Do Not Disturb diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 63527d8594..cb2a8a54b7 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -4506,7 +4506,7 @@ void handle_object_sit(LLViewerObject* object, const LLVector3& offset) { // get object selection offset - if (object && object->getPCode() == LL_PCODE_VOLUME) + if (gAgent.isAllowedToSit() && object && object->getPCode() == LL_PCODE_VOLUME) { gMessageSystem->newMessageFast(_PREHASH_AgentRequestSit); diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index 01f5d28ced..dce1471100 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -268,6 +268,13 @@ ECmdRet CommandHandlerBaseImpl::processCommand(const RlvComm return (*pHandler)(rlvCmd, toggle); } +template<> template<> +ECmdRet BehaviourToggleHandler::onCommand(const RlvCommand& rlvCmd, bool& toggle) +{ + gAgent.setAllowedToSit(toggle); + return ECmdRet::Succeeded; +} + template<> template<> ECmdRet BehaviourToggleHandler::onCommand(const RlvCommand& rlvCmd, bool& toggle) { diff --git a/indra/newview/rlvhelper.cpp b/indra/newview/rlvhelper.cpp index 7c5f939d31..f26b5a115f 100644 --- a/indra/newview/rlvhelper.cpp +++ b/indra/newview/rlvhelper.cpp @@ -60,6 +60,7 @@ BehaviourDictionary::BehaviourDictionary() addEntry(new ForceProcessor("unsit")); // AddRem + addEntry(new BehaviourProcessor("sit")); addEntry(new BehaviourProcessor("unsit")); // Populate mString2InfoMap (the tuple should be unique) -- cgit v1.2.3