FIRE-35479 cont.: Add a cmdline command to track - point map beacon at - a specific <x, y, z> position, or an avatar by name (triggers the same action as the radar's "track" menu option)

Signed-off-by: PanteraPolnocy <panterapolnocy@gmail.com>
This commit is contained in:
PanteraPolnocy
2026-06-14 00:10:40 +02:00
parent c40714138b
commit 5f0e33bf9f
7 changed files with 150 additions and 1 deletions
+11
View File
@@ -19266,6 +19266,17 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<string>tp2</string>
</map>
<key>FSCmdLineTrackPos</key>
<map>
<key>Comment</key>
<string>Track a position or avatar on the world map.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>trkpos</string>
</map>
<key>FSCmdLineCopyCam</key>
<map>
<key>Comment</key>
+88 -1
View File
@@ -45,6 +45,7 @@
#include "fsfloaternearbychat.h"
// </FS:Ansariel> [FS communication UI]
#include "llfloaterreg.h"
#include "llfloaterworldmap.h"
#include "llinventorymodel.h"
#include "llnotificationmanager.h"
#include "llparcel.h"
@@ -690,6 +691,79 @@ static void cmdline_apply_camera(const CmdlineCameraSpec& spec)
FSCommon::report_cmdline_result(LLTrans::getString("FSCameraPositionPasted", args));
}
void cmdline_track(std::string_view params)
{
std::string arg = static_cast<std::string>(params);
LLStringUtil::trim(arg);
if (arg.empty())
{
FSCommon::report_cmdline_result(LLTrans::getString("FSCmdLineTrackPosUsage"));
return;
}
if (arg.front() == '<')
{
CmdlineCameraSpec spec;
if (!parseCameraPositionString(arg, spec))
{
FSCommon::report_cmdline_result(LLTrans::getString("FSCmdLineTrackPosParseError"));
return;
}
LLViewerRegion* region = gAgent.getRegion();
if (!region)
{
FSCommon::report_cmdline_result(LLTrans::getString("FSCmdLineNoValidRegion"));
return;
}
LLFloaterWorldMap* world_map = LLFloaterWorldMap::getInstance();
if (!world_map)
{
world_map = LLFloaterReg::showTypedInstance<LLFloaterWorldMap>("world_map");
}
if (!world_map)
{
FSCommon::report_cmdline_result(LLTrans::getString("FSCmdLineTrackPosMapError"));
return;
}
const S32 x = ll_round(spec.pos.mV[VX]);
const S32 y = ll_round(spec.pos.mV[VY]);
const S32 z = ll_round(spec.pos.mV[VZ]);
world_map->trackURL(region->getName(), x, y, z);
LLStringUtil::format_map_t args;
args["[POS]"] = llformat("<%d, %d, %d>", x, y, z);
args["[REGION]"] = region->getName();
FSCommon::report_cmdline_result(LLTrans::getString("FSCmdLineTrackPosLocation", args));
return;
}
const LLUUID avatar_id = cmdline_partial_name2key(arg);
if (avatar_id.isNull())
{
LLStringUtil::format_map_t args;
args["[NAME]"] = arg;
FSCommon::report_cmdline_result(LLTrans::getString("FSCmdLineTrackPosNotFound", args));
return;
}
if (auto entry = FSRadar::getInstance()->getEntry(avatar_id))
{
LLAvatarActions::track(avatar_id);
LLStringUtil::format_map_t args;
args["[NAME]"] = entry->getName();
FSCommon::report_cmdline_result(LLTrans::getString("FSCmdLineTrackPosAvatar", args));
}
else
{
LLStringUtil::format_map_t args;
args["[NAME]"] = arg;
FSCommon::report_cmdline_result(LLTrans::getString("FSCmdLineTrackPosNotFound", args));
}
}
bool cmd_line_chat(std::string_view revised_text, EChatType type, bool from_gesture)
{
static LLCachedControl<bool> sFSCmdLine(gSavedSettings, "FSCmdLine");
@@ -710,6 +784,7 @@ bool cmd_line_chat(std::string_view revised_text, EChatType type, bool from_gest
static LLCachedControl<std::string> sFSCmdLineClearChat(gSavedSettings, "FSCmdLineClearChat");
static LLCachedControl<std::string> sFSCmdLineMedia(gSavedSettings, "FSCmdLineMedia");
static LLCachedControl<std::string> sFSCmdLineMusic(gSavedSettings, "FSCmdLineMusic");
static LLCachedControl<std::string> sFSCmdLineTrackPos(gSavedSettings, "FSCmdLineTrackPos");
static LLCachedControl<std::string> sFSCmdLineCopyCam(gSavedSettings, "FSCmdLineCopyCam");
static LLCachedControl<std::string> sFSCmdLinePasteCam(gSavedSettings, "FSCmdLinePasteCam");
static LLCachedControl<std::string> sFSCmdLineRollDice(gSavedSettings, "FSCmdLineRollDice");
@@ -1218,6 +1293,18 @@ bool cmd_line_chat(std::string_view revised_text, EChatType type, bool from_gest
}
return false;
}
else if (command == sFSCmdLineTrackPos())
{
if (revised_text.length() > command.length() + 1)
{
cmdline_track(revised_text.substr(command.length() + 1));
}
else
{
FSCommon::report_cmdline_result(LLTrans::getString("FSCmdLineTrackPosUsage"));
}
return false;
}
else if (command == sFSCmdLineClearChat())
{
@@ -1745,7 +1832,7 @@ bool cmd_line_chat(std::string_view revised_text, EChatType type, bool from_gest
}
else
{
FSCommon::report_cmdline_result("Could not get a valid region pointer.");
FSCommon::report_cmdline_result(LLTrans::getString("FSCmdLineNoValidRegion"));
}
return false;
}
+1
View File
@@ -39,6 +39,7 @@
bool cmd_line_chat(std::string_view revised_text, EChatType type, bool from_gesture = false);
void cmdline_rezplat(bool use_saved_value = true, F32 visual_radius = 30.f);
void cmdline_tp2name(std::string_view target);
void cmdline_track(std::string_view params);
LLUUID cmdline_partial_name2key(std::string name);
bool cmdline_packager(std::string_view message, const LLUUID& fromID, const LLUUID& ownerID);
@@ -2526,6 +2526,25 @@
tool_tip=""
control_name="FSCmdLineTeleportHome"
width="200"/>
<!--trkpos-->
<text
top_pad="3"
follows="left|top"
height="14"
name="FSCmdLineTrackPos_txt"
width="235">
Track position or avatar (cmd pos or name)
</text>
<line_editor
enabled_control="FSCmdLine"
top_pad="-2"
follows="left|top"
height="18"
max_length_chars="256"
name="FSCmdLineTrackPos"
tool_tip="Sets a world map beacon at a position (cpcampos format) or partial avatar name"
control_name="FSCmdLineTrackPos"
width="200"/>
<!--mapto-->
<text
top_pad="3"
@@ -3064,6 +3064,13 @@ and report the problem.
<string name="FSCameraPositionPasted">Camera restored to [POS].</string>
<string name="FSCameraPositionParseError">Invalid camera position. Expected: &lt;x, y, z&gt; or &lt;x, y, z&gt;|&lt;fx, fy, fz&gt;|roll (agent-local).</string>
<string name="FSCmdLineZOffsetUsage">Set avatar hover height (usage: /zoffset value or +delta).</string>
<string name="FSCmdLineNoValidRegion">Could not get a valid region pointer.</string>
<string name="FSCmdLineTrackPosUsage">Track a position or avatar on the world map (usage: cmd &lt;x, y, z&gt; or cmd name).</string>
<string name="FSCmdLineTrackPosParseError">Invalid position. Use cpcampos format: &lt;x, y, z&gt; or &lt;x, y, z&gt;|&lt;fx, fy, fz&gt;|roll.</string>
<string name="FSCmdLineTrackPosLocation">Tracking [REGION] ([POS]).</string>
<string name="FSCmdLineTrackPosAvatar">Tracking [NAME].</string>
<string name="FSCmdLineTrackPosNotFound">Could not find avatar matching &apos;[NAME]&apos; on radar.</string>
<string name="FSCmdLineTrackPosMapError">Could not open the world map.</string>
<string name="FSCmdLineDrawDistanceSet">Draw Distance set to [DISTANCE]m.</string>
<string name="FSCmdLineRollDiceTotal">Total result for [DICE]d[FACES][MODIFIER]: [RESULT].</string>
@@ -338,6 +338,9 @@
<text name="FSCmdLineTeleportHome_txt">
Teleport do Miejsca Startu (użycie: cmd)
</text>
<text name="FSCmdLineTrackPos_txt">
Śledź pozycję lub awatara (cmd pos lub imię)
</text>
<text name="FSCmdLineMapTo_txt">
Teleport do regionu (użycie: cmd nazwa | x y z)
</text>
@@ -6132,6 +6132,27 @@ do sekcji wsparcia witryny SecondLife.com i zgłoś problem.
<string name="FSCmdLineZOffsetUsage">
Ustawia wysokość unoszenia się awatara (użycie: /zoffset wartość lub +delta).
</string>
<string name="FSCmdLineNoValidRegion">
Nie można uzyskać prawidłowego wskaźnika regionu.
</string>
<string name="FSCmdLineTrackPosUsage">
Śledź pozycję lub awatara na mapie świata (użycie: cmd &lt;x, y, z&gt; lub cmd imię).
</string>
<string name="FSCmdLineTrackPosParseError">
Niepoprawna pozycja. Użyj formatu cpcampos: &lt;x, y, z&gt; lub &lt;x, y, z&gt;|&lt;fx, fy, fz&gt;|roll.
</string>
<string name="FSCmdLineTrackPosLocation">
Śledzenie [REGION] ([POS]).
</string>
<string name="FSCmdLineTrackPosAvatar">
Śledzenie [NAME].
</string>
<string name="FSCmdLineTrackPosNotFound">
Nie znaleziono awatara pasującego do &apos;[NAME]&apos; na radarze.
</string>
<string name="FSCmdLineTrackPosMapError">
Nie można otworzyć mapy świata.
</string>
<string name="FSCmdLineDrawDistanceSet">
Pole widzenia zostało ustawione na [DISTANCE]m.
</string>