FIRE-24160 FIRE-9305 Show AO enabled/disabled messages in local chat where appropriate, don't allow scripts to enable the AO when it was disabled before, scripts can only pause the AO/AO stands, not disable them for good.

master
Zi Ree 2021-02-07 00:55:12 +01:00
parent e560a4c500
commit 57a1365eda
7 changed files with 112 additions and 3 deletions

View File

@ -63,6 +63,7 @@ AOEngine::AOEngine() :
{
gSavedPerAccountSettings.getControl("UseAO")->getCommitSignal()->connect(boost::bind(&AOEngine::onToggleAOControl, this));
gSavedPerAccountSettings.getControl("UseAOStands")->getCommitSignal()->connect(boost::bind(&AOEngine::onToggleAOStandsControl, this));
gSavedPerAccountSettings.getControl("PauseAO")->getCommitSignal()->connect(boost::bind(&AOEngine::onPauseAO, this));
mRegionChangeConnection = gAgent.addRegionChangedCallback(boost::bind(&AOEngine::onRegionChange, this));
}
@ -117,6 +118,15 @@ void AOEngine::onToggleAOStandsControl()
enableStands(gSavedPerAccountSettings.getBOOL("UseAOStands"));
}
void AOEngine::onPauseAO()
{
// can't use mEnabled here as that gets switched over by enable()
if (gSavedPerAccountSettings.getBOOL("UseAO"))
{
enable(!gSavedPerAccountSettings.getBOOL("PauseAO"));
}
}
void AOEngine::clear(bool from_timer)
{
mOldSets.insert(mOldSets.end(), mSets.begin(), mSets.end());

View File

@ -183,6 +183,8 @@ class AOEngine
void onToggleAOControl();
void onToggleAOStandsControl();
void onPauseAO();
static void onNotecardLoadComplete(LLVFS* vfs, const LLUUID& assetUUID, LLAssetType::EType type,
void* userdata, S32 status, LLExtStat extStatus);
void parseNotecard(const char* buffer);

View File

@ -744,6 +744,17 @@
<key>Value</key>
<integer>0</integer>
</map>
<key>UseAO</key>
<map>
<key>Comment</key>
<string>Pause the viewer side Animation Overrider</string>
<key>Persist</key>
<integer>0</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>UseAOStands</key>
<map>
<key>Comment</key>

View File

@ -16,7 +16,7 @@
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY MODULAR SYSTEMS AND CONTRIBUTORS AS IS
* THIS SOFTWARE IS PROVIDED BY MODULAR SYSTEMS AND CONTRIBUTORS <EFBFBD>AS IS<EFBFBD>
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MODULAR SYSTEMS OR CONTRIBUTORS
@ -673,13 +673,28 @@ bool cmd_line_chat(const std::string& revised_text, EChatType type, bool from_ge
std::string status;
if (i >> status)
{
// <FS:Zi> send appropriate enable/disable messages to nearby chat - FIRE-24160
bool aoWasEnabled = gSavedPerAccountSettings.getBOOL("UseAO");
if (status == "on")
{
gSavedPerAccountSettings.setBOOL("UseAO", TRUE);
// <FS:Zi> send appropriate enable/disable messages to nearby chat - FIRE-24160
if (!aoWasEnabled)
{
report_to_nearby_chat(LLTrans::getString("FSAOEnabled"));
}
}
else if (status == "off")
{
gSavedPerAccountSettings.setBOOL("UseAO", FALSE);
// <FS:Zi> send appropriate enable/disable messages to nearby chat - FIRE-24160
if (aoWasEnabled)
{
report_to_nearby_chat(LLTrans::getString("FSAODisabled"));
}
}
else if (status == "sit")
{

View File

@ -316,18 +316,31 @@ bool FSLSLBridge::lslToViewer(const std::string& message, const LLUUID& fromID,
}
if (tag == "<clientAO ")
{
// <FS:Zi> do nothing when the FS AO is disabled
if (!gSavedPerAccountSettings.getBOOL("UseAO"))
{
return true;
}
status = true;
size_t valuepos = message.find(FS_STATE_ATTRIBUTE);
if (valuepos != std::string::npos)
{
// <FS:Zi> send appropriate enable/disable messages to nearby chat - FIRE-24160
bool aoWasPaused = gSavedPerAccountSettings.getBOOL("PauseAO");
bool aoStandsWasEnabled = gSavedPerAccountSettings.getBOOL("UseAOStands");
// </FS:Zi>
if (message.substr(valuepos + FS_STATE_ATTRIBUTE.size(), 2) == "on")
{
gSavedPerAccountSettings.setBOOL("UseAO", TRUE);
// <FS:Zi> Pause AO via bridge instead of switch AO on or off - FIRE-9305
gSavedPerAccountSettings.setBOOL("PauseAO", FALSE);
gSavedPerAccountSettings.setBOOL("UseAOStands", TRUE);
}
else if (message.substr(valuepos + FS_STATE_ATTRIBUTE.size(), 3) == "off")
{
gSavedPerAccountSettings.setBOOL("UseAO", FALSE);
// <FS:Zi> Pause AO via bridge instead of switch AO on or off - FIRE-9305
gSavedPerAccountSettings.setBOOL("PauseAO", TRUE);
}
else if (message.substr(valuepos + FS_STATE_ATTRIBUTE.size(), 7) == "standon")
{
@ -341,6 +354,41 @@ bool FSLSLBridge::lslToViewer(const std::string& message, const LLUUID& fromID,
{
LL_WARNS("FSLSLBridge") << "AO control - Received unknown state" << LL_ENDL;
}
// <FS:Zi> send appropriate enable/disable messages to nearby chat - FIRE-24160
std::string aoMessage;
if (aoWasPaused != gSavedPerAccountSettings.getBOOL("PauseAO"))
{
if (aoWasPaused)
{
aoMessage = LLTrans::getString("FSAOResumedScript");
}
else
{
aoMessage = LLTrans::getString("FSAOPausedScript");
}
}
if (aoStandsWasEnabled != gSavedPerAccountSettings.getBOOL("UseAOStands"))
{
if (aoStandsWasEnabled)
{
aoMessage = LLTrans::getString("FSAOStandsPausedScript");
}
else
{
aoMessage = LLTrans::getString("FSAOStandsResumedScript");
}
}
if (!aoMessage.empty())
{
LLSD args;
args["AO_MESSAGE"] = aoMessage;
LLNotificationsUtil::add("FSAOScriptedNotification", args);
}
// </FS:Zi>
}
}
//</FS:TS> FIRE-962

View File

@ -13609,4 +13609,19 @@ Cannot create inventory item: [NAME]
type="notifytip">
Bulk import of Windlights has finished.
</notification>
<notification
icon = "notifytip.tga"
name = "FSAOScriptedNotification"
type = "notifytip"
log_to_chat = "false">
<unique combine = "cancel_old">
<context>FSAOScriptedNotification</context>
</unique>
Firestorm Animation Overrider: [AO_MESSAGE]
<usetemplate
ignoretext="Warn me when the Firestorm Animation Overrider gets accessed by a scripted object"
name="notifyignore"/>
</notification>
</notifications>

View File

@ -3024,6 +3024,14 @@ Your current position: [AVATAR_POS]
<string name="fsbridge_error_injection">NOTICE: One or more scripts have been added to your Firestorm bridge! If you did not expect this message, use the Firestorm 'Avatar/Avatar Health/Recreate Bridge' menu option to re-create your bridge now.</string>
<string name="fsbridge_error_wrongvm">NOTICE: Bridge script is using old LSO (16 KB memory limit) instead of new Mono (64 KB memory limit) virtual machine, which creates high probability of stack-heap collision and bridge failure by running out of memory. Please use the Firestorm 'Avatar/Avatar Health/Recreate Bridge' menu option to recreate the bridge. If you'll see this message again - please try again in a different region.</string>
<!-- <FS:Zi> Animation overrider enable/disable messages - FIRE-24160 -->
<string name="FSAOEnabled">Firestorm Animation Overrider enabled.</string>
<string name="FSAODisabled">Firestorm Animation Overrider disabled.</string>
<string name="FSAOPausedScript">Paused by scripted attachment.</string>
<string name="FSAOResumedScript">Resumed by scripted attachment.</string>
<string name="FSAOStandsPausedScript">Standing animations paused by scripted attachment.</string>
<string name="FSAOStandsResumedScript">Standing animations resumed by scripted attachment.</string>
<!-- <FS:Zi> Quick preferences default options -->
<string name="QP Draw Distance">Draw Distance</string>
<string name="QP Max Particles">Max Particles</string>