Bug Fix/Feature: Make the spam of radar on open/close and login optional

Adds RadarAlertFlood and RadarAlertFloodLeaving
RadarAlertFloodLeaving requires RadarAlertFlood
Radar uses new announcements for these events.
These settings are off by default,
Find them in your local debug settings!
This commit is contained in:
Lirusaito
2019-01-20 14:23:43 -05:00
parent f9fe8a056a
commit 413c24bde8
4 changed files with 48 additions and 15 deletions

View File

@@ -7790,6 +7790,28 @@ This should be as low as possible, but too low may break functionality</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>RadarAlertFlood</key>
<map>
<key>Comment</key>
<string>Show the flood of people arriving and (if RadarAlertFloodLeaving) leaving when you login and when you open/close the Radar with RadarKeepOpen off.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>RadarAlertFloodLeaving</key>
<map>
<key>Comment</key>
<string>When activated along with RadarAlertFlood shows the flood of people leaving when you close the Radar with RadarKeepOpen off.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>RadarAlertShowDist</key>
<map>
<key>Comment</key>

View File

@@ -70,7 +70,7 @@ const S32& radar_namesystem()
namespace
{
void chat_avatar_status(const std::string& name, const LLUUID& key, ERadarStatType type, bool entering, const F32& dist)
void chat_avatar_status(const std::string& name, const LLUUID& key, ERadarStatType type, bool entering, const F32& dist, bool flood = false)
{
static LLCachedControl<bool> radar_chat_alerts(gSavedSettings, "RadarChatAlerts");
if (!radar_chat_alerts) return;
@@ -82,6 +82,8 @@ namespace
}
// </Alchemy>
if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMETAGS)) return; // RLVa:LF Don't announce people are around when blind, that cheats the system.
static LLCachedControl<bool> radar_alert_flood(gSavedSettings, "RadarAlertFlood");
if (flood && !radar_alert_flood) return;
static LLCachedControl<bool> radar_alert_sim(gSavedSettings, "RadarAlertSim");
static LLCachedControl<bool> radar_alert_draw(gSavedSettings, "RadarAlertDraw");
static LLCachedControl<bool> radar_alert_shout_range(gSavedSettings, "RadarAlertShoutRange");
@@ -100,7 +102,7 @@ namespace
default: llassert(type); break;
}
args["[NAME]"] = name;
args["[ACTION]"] = LLTrans::getString(entering ? "has_entered" : "has_left");
args["[ACTION]"] = LLTrans::getString((entering ? "has_entered" : "has_left") + (flood ? "_flood" : LLStringUtil::null));
if (args.find("[RANGE]") != args.end())
chat.mText = LLTrans::getString("radar_alert_template", args);
else if (chat.mText.empty()) return;
@@ -144,7 +146,12 @@ LLAvatarListEntry::LLAvatarListEntry(const LLUUID& id, const std::string& name,
LLAvatarListEntry::~LLAvatarListEntry()
{
setPosition(mPosition, F32_MIN, false); // Dead and gone
static LLCachedControl<bool> radar_alert_flood_leaving(gSavedSettings, "RadarAlertFloodLeaving");
bool cleanup = LLFloaterAvatarList::instance().isCleanup();
if (radar_alert_flood_leaving || !cleanup)
{
setPosition(mPosition, F32_MIN, false, cleanup); // Dead and gone
}
LLAvatarPropertiesProcessor::instance().removeObserver(mID, this);
}
@@ -185,17 +192,17 @@ void LLAvatarListEntry::processProperties(void* data, EAvatarProcessorType type)
}
}
void LLAvatarListEntry::setPosition(const LLVector3d& position, const F32& dist, bool drawn)
void LLAvatarListEntry::setPosition(const LLVector3d& position, const F32& dist, bool drawn, bool flood)
{
mPosition = position;
bool here(dist != F32_MIN); // F32_MIN only if dead
bool this_sim(here && (gAgent.getRegion()->pointInRegionGlobal(position) || !(LLWorld::getInstance()->positionRegionValidGlobal(position))));
if (this_sim != mStats[STAT_TYPE_SIM]) chat_avatar_status(mName, mID, STAT_TYPE_SIM, mStats[STAT_TYPE_SIM] = this_sim, dist);
if (drawn != mStats[STAT_TYPE_DRAW]) chat_avatar_status(mName, mID, STAT_TYPE_DRAW, mStats[STAT_TYPE_DRAW] = drawn, dist);
if (this_sim != mStats[STAT_TYPE_SIM]) chat_avatar_status(mName, mID, STAT_TYPE_SIM, mStats[STAT_TYPE_SIM] = this_sim, dist, flood);
if (drawn != mStats[STAT_TYPE_DRAW]) chat_avatar_status(mName, mID, STAT_TYPE_DRAW, mStats[STAT_TYPE_DRAW] = drawn, dist, flood);
bool shoutrange(here && dist < LFSimFeatureHandler::getInstance()->shoutRange());
if (shoutrange != mStats[STAT_TYPE_SHOUTRANGE]) chat_avatar_status(mName, mID, STAT_TYPE_SHOUTRANGE, mStats[STAT_TYPE_SHOUTRANGE] = shoutrange, dist);
if (shoutrange != mStats[STAT_TYPE_SHOUTRANGE]) chat_avatar_status(mName, mID, STAT_TYPE_SHOUTRANGE, mStats[STAT_TYPE_SHOUTRANGE] = shoutrange, dist, flood);
bool chatrange(here && dist < LFSimFeatureHandler::getInstance()->sayRange());
if (chatrange != mStats[STAT_TYPE_CHATRANGE]) chat_avatar_status(mName, mID, STAT_TYPE_CHATRANGE, mStats[STAT_TYPE_CHATRANGE] = chatrange, dist);
if (chatrange != mStats[STAT_TYPE_CHATRANGE]) chat_avatar_status(mName, mID, STAT_TYPE_CHATRANGE, mStats[STAT_TYPE_CHATRANGE] = chatrange, dist, flood);
}
void LLAvatarListEntry::resetName(const bool& hide_tags, const bool& anon_names, const std::string& hidden)
@@ -240,6 +247,8 @@ LLFloaterAvatarList::LLFloaterAvatarList() : LLFloater(std::string("radar")),
LLFloaterAvatarList::~LLFloaterAvatarList()
{
mCleanup = true;
mAvatars.clear();
}
//static
@@ -413,7 +422,7 @@ BOOL LLFloaterAvatarList::postBuild()
mAvatarList->setSortChangedCallback(boost::bind(&LLFloaterAvatarList::onAvatarSortingChanged,this));
for (LLViewerRegion* region : LLWorld::instance().getRegionList())
{
updateAvatarList(region);
updateAvatarList(region, true);
}
assessColumns();
@@ -515,7 +524,7 @@ const F32& radar_range_radius()
return radius;
}
void LLFloaterAvatarList::updateAvatarList(const LLViewerRegion* region)
void LLFloaterAvatarList::updateAvatarList(const LLViewerRegion* region, bool first)
{
// Check whether updates are enabled
if (!mUpdate)
@@ -561,7 +570,7 @@ void LLFloaterAvatarList::updateAvatarList(const LLViewerRegion* region)
}
// Announce position
entry->setPosition(position, (position - mypos).magVec(), avatarp);
entry->setPosition(position, (position - mypos).magVec(), avatarp, first);
// Mark as typing if they are typing
if (avatarp && avatarp->isTyping()) entry->setActivity(LLAvatarListEntry::ACTIVITY_TYPING);

View File

@@ -79,7 +79,7 @@ enum ACTIVITY_TYPE
* Update world position.
* Affects age.
*/
void setPosition(const LLVector3d& position, const F32& dist, bool drawn);
void setPosition(const LLVector3d& position, const F32& dist, bool drawn, bool flood = false);
const LLVector3d& getPosition() const { return mPosition; }
@@ -202,7 +202,7 @@ public:
/**
* @brief Updates the internal avatar list with the currently present avatars.
*/
void updateAvatarList(const class LLViewerRegion* region);
void updateAvatarList(const class LLViewerRegion* region, bool first = false);
/**
* @brief Refresh avatar list (display)
@@ -318,8 +318,6 @@ public:
static bool onConfirmRadarChatKeys(const LLSD& notification, const LLSD& response );
static void callbackIdle(void *userdata);
void doCommand(avlist_command_t cmd, bool single = false) const;
/**
@@ -330,6 +328,7 @@ public:
*/
void expireAvatarList(const std::list<LLUUID>& ids);
void updateAvatarSorting();
bool isCleanup() const { return mCleanup; }
private:
void setFocusAvatarInternal(const LLUUID& id);
@@ -340,6 +339,7 @@ private:
LLScrollListCtrl* mAvatarList;
av_list_t mAvatars;
bool mDirtyAvatarSorting;
bool mCleanup = false;
/**
* @brief true when Updating

View File

@@ -3119,7 +3119,9 @@ Where tag = tag string to match. Removes bot's matching the tag.
<!-- [ACTION] -->
<string name="has_triggered_your_avatar_age_alert">has triggered your avatar age alert</string>
<string name="has_entered">has entered</string>
<string name="has_entered_flood">is now detected in</string>
<string name="has_left">has left</string>
<string name="has_left_flood">is now off the radar for</string>
<!-- [RANGE] -->
<string name="the_sim">the sim</string>
<string name="draw_distance">draw distance</string>