summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2025-06-30 18:09:32 +0800
committerErik Kundiman <erik@megapahit.org>2025-06-30 18:09:32 +0800
commitd0e3c7a40395ea5ad7f7a9982ce4dbf464e24caa (patch)
tree92902324d9a26aeec801e55e9f65573024593569
parentd6e7979612be80b24441fa84678adb476fda8405 (diff)
Minimal @unsit=<y/n> command implementation
Hides the Stand up button too, but doesn't prevent teleporting yet.
-rw-r--r--indra/newview/llagent.cpp5
-rw-r--r--indra/newview/llagent.h4
-rw-r--r--indra/newview/llmoveview.cpp2
-rw-r--r--indra/newview/llmoveview.h1
-rw-r--r--indra/newview/rlvhandler.cpp11
-rw-r--r--indra/newview/rlvhelper.cpp1
6 files changed, 22 insertions, 2 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 2161dbe19e..b8b5ba2264 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -386,6 +386,8 @@ LLAgent::LLAgent() :
mbRunning(false),
mbTeleportKeepsLookAt(false),
+ mAllowedToStand(true),
+
mAgentAccess(new LLAgentAccess(gSavedSettings)),
mGodLevelChangeSignal(),
mCanEditParcel(false),
@@ -969,7 +971,8 @@ bool LLAgent::isSitting()
void LLAgent::standUp()
{
- setControlFlags(AGENT_CONTROL_STAND_UP);
+ if (mAllowedToStand)
+ setControlFlags(AGENT_CONTROL_STAND_UP);
}
void LLAgent::changeParcels()
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index c1d3c6c14b..74d8719047 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -446,6 +446,10 @@ public:
void standUp();
/// @brief ground-sit at agent's current position
void sitDown();
+ bool isAllowedToStand() const { return mAllowedToStand; }
+ void setAllowedToStand(bool allow) { mAllowedToStand = allow; }
+private:
+ bool mAllowedToStand;
//--------------------------------------------------------------------
// Do Not Disturb
diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp
index a8ceaffde8..df515389c5 100644
--- a/indra/newview/llmoveview.cpp
+++ b/indra/newview/llmoveview.cpp
@@ -538,7 +538,7 @@ void LLPanelStandStopFlying::setStandStopFlyingMode(EStandStopFlyingMode mode)
LLFirstUse::sit();
LLFirstUse::notMoving(false);
}
- panel->mStandButton->setVisible(SSFM_STAND == mode);
+ panel->mStandButton->setVisible((SSFM_STAND == mode) & gAgent.isAllowedToStand());
panel->mStopFlyingButton->setVisible(SSFM_STOP_FLYING == mode);
//visibility of it should be updated after updating visibility of the buttons
diff --git a/indra/newview/llmoveview.h b/indra/newview/llmoveview.h
index 3690245e1d..208e1e80f1 100644
--- a/indra/newview/llmoveview.h
+++ b/indra/newview/llmoveview.h
@@ -143,6 +143,7 @@ public:
static void clearStandStopFlyingMode(EStandStopFlyingMode mode);
/*virtual*/ bool postBuild();
/*virtual*/ void setVisible(bool visible);
+ void setVisibleStandButton(bool visible) { mStandButton->setVisible(visible); }
// *HACK: due to hard enough to have this control aligned with "Move" button while resizing
// let update its position in each frame
diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp
index 49b89c8cdf..01f5d28ced 100644
--- a/indra/newview/rlvhandler.cpp
+++ b/indra/newview/rlvhandler.cpp
@@ -28,6 +28,7 @@
#include "llviewerprecompiledheaders.h"
#include "llagent.h"
#include "llstartup.h"
+#include "llmoveview.h"
#include "llviewercontrol.h"
#include "llviewermenu.h"
#include "llviewerobject.h"
@@ -267,4 +268,14 @@ ECmdRet CommandHandlerBaseImpl<EParamType::AddRem>::processCommand(const RlvComm
return (*pHandler)(rlvCmd, toggle);
}
+template<> template<>
+ECmdRet BehaviourToggleHandler<EBehaviour::Unsit>::onCommand(const RlvCommand& rlvCmd, bool& toggle)
+{
+ gAgent.setAllowedToStand(toggle);
+ if (gAgent.isSitting())
+ LLPanelStandStopFlying::getInstance()->setVisibleStandButton(toggle);
+ return ECmdRet::Succeeded;
+}
+
+template<> template<>
// ============================================================================
diff --git a/indra/newview/rlvhelper.cpp b/indra/newview/rlvhelper.cpp
index c0658f8f8a..7c5f939d31 100644
--- a/indra/newview/rlvhelper.cpp
+++ b/indra/newview/rlvhelper.cpp
@@ -60,6 +60,7 @@ BehaviourDictionary::BehaviourDictionary()
addEntry(new ForceProcessor<EBehaviour::Unsit>("unsit"));
// AddRem
+ addEntry(new BehaviourProcessor<EBehaviour::Unsit>("unsit"));
// Populate mString2InfoMap (the tuple <behaviour, type> should be unique)
for (const BehaviourInfo* bhvr_info_p : mBhvrInfoList)