Refactor avatar track and teleport to code and make the features available in LLAvatarActions for convenience
parent
44e89efb8c
commit
1b43e16363
|
|
@ -38,6 +38,7 @@
|
|||
#include "fsradar.h"
|
||||
#include "llagent.h"
|
||||
#include "llagentcamera.h"
|
||||
#include "llavataractions.h"
|
||||
#include "llcalc.h"
|
||||
// <FS:Ansariel> [FS communication UI]
|
||||
//#include "llfloaternearbychat.h"
|
||||
|
|
@ -1207,20 +1208,10 @@ LLUUID cmdline_partial_name2key(std::string partial_name)
|
|||
void cmdline_tp2name(std::string target)
|
||||
{
|
||||
LLUUID avkey = cmdline_partial_name2key(target);
|
||||
FSRadar* radar = FSRadar::getInstance();
|
||||
if (avkey.notNull() && radar)
|
||||
if (avkey.notNull())
|
||||
{
|
||||
FSRadarEntry* entry = radar->getEntry(avkey);
|
||||
if (entry)
|
||||
{
|
||||
LLVector3d pos = entry->getGlobalPos();
|
||||
pos.mdV[VZ] += 2.0;
|
||||
gAgent.teleportViaLocation(pos);
|
||||
return;
|
||||
}
|
||||
LLAvatarActions::teleportTo(avkey);
|
||||
}
|
||||
|
||||
reportToNearbyChat("Avatar not found.");
|
||||
}
|
||||
|
||||
void cmdline_rezplat(bool use_saved_value, F32 visual_radius) //cmdline_rezplat() will still work... just will use the saved value
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ public:
|
|||
}
|
||||
else if (level == "teleport_to")
|
||||
{
|
||||
LLUrlAction::executeSLURL(LLSLURL("firestorm", getAvatarId(), "teleportto").getSLURLString());
|
||||
LLAvatarActions::teleportTo(getAvatarId());
|
||||
}
|
||||
else if (level == "teleport")
|
||||
{
|
||||
|
|
@ -244,7 +244,7 @@ public:
|
|||
}
|
||||
else if (level == "track")
|
||||
{
|
||||
LLUrlAction::executeSLURL(LLSLURL("firestorm", getAvatarId(), "track").getSLURLString());
|
||||
LLAvatarActions::track(getAvatarId());
|
||||
}
|
||||
else if (level == "share")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -782,9 +782,13 @@ void FSRadar::teleportToAvatar(const LLUUID& targetAv)
|
|||
}
|
||||
else
|
||||
{
|
||||
avpos.mdV[VZ] += 2.0;
|
||||
gAgent.teleportViaLocation(avpos);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
LLNotificationsUtil::add("TeleportToAvatarNotPossible");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -870,8 +874,15 @@ bool FSRadar::radarReportToCheck(const LLSD& userdata)
|
|||
|
||||
void FSRadar::startTracking(const LLUUID& avatar_id)
|
||||
{
|
||||
mTrackedAvatarId = avatar_id;
|
||||
updateTracking();
|
||||
if (getEntry(avatar_id))
|
||||
{
|
||||
mTrackedAvatarId = avatar_id;
|
||||
updateTracking();
|
||||
}
|
||||
else
|
||||
{
|
||||
LLNotificationsUtil::add("TrackAvatarNotPossible");
|
||||
}
|
||||
}
|
||||
|
||||
void FSRadar::checkTracking()
|
||||
|
|
|
|||
|
|
@ -246,21 +246,13 @@ void FSRadarMenu::teleportToAvatar()
|
|||
// AO: wrapper for functionality managed by LLPanelPeople, because it manages the nearby avatar list.
|
||||
// Will only work for avatars within radar range.
|
||||
{
|
||||
FSRadar* radar = FSRadar::getInstance();
|
||||
if (radar)
|
||||
{
|
||||
radar->teleportToAvatar(mUUIDs.front());
|
||||
}
|
||||
LLAvatarActions::teleportTo(mUUIDs.front());
|
||||
}
|
||||
|
||||
// Ansariel: Avatar tracking feature
|
||||
void FSRadarMenu::onTrackAvatarMenuItemClick()
|
||||
{
|
||||
FSRadar* radar = FSRadar::getInstance();
|
||||
if (radar)
|
||||
{
|
||||
radar->startTracking(mUUIDs.front());
|
||||
}
|
||||
LLAvatarActions::track(mUUIDs.front());
|
||||
}
|
||||
|
||||
void FSRadarMenu::addToContactSet()
|
||||
|
|
|
|||
|
|
@ -94,20 +94,7 @@ public:
|
|||
{
|
||||
if (gAgentID != target_id)
|
||||
{
|
||||
FSRadar* radar = FSRadar::getInstance();
|
||||
if (radar)
|
||||
{
|
||||
FSRadarEntry* entry = radar->getEntry(target_id);
|
||||
if (entry)
|
||||
{
|
||||
LLVector3d pos = entry->getGlobalPos();
|
||||
pos.mdV[VZ] += 2.0;
|
||||
gAgent.teleportViaLocation(pos);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
LLNotificationsUtil::add("TeleportToAvatarNotPossible");
|
||||
LLAvatarActions::teleportTo(target_id);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -117,19 +104,7 @@ public:
|
|||
{
|
||||
if (gAgentID != target_id)
|
||||
{
|
||||
FSRadar* radar = FSRadar::getInstance();
|
||||
if (radar)
|
||||
{
|
||||
FSRadarEntry* entry = radar->getEntry(target_id);
|
||||
if (entry)
|
||||
{
|
||||
radar->startTracking(target_id);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LLNotificationsUtil::add("TrackAvatarNotPossible");
|
||||
LLAvatarActions::track(target_id);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -654,6 +654,29 @@ void LLAvatarActions::share(const LLUUID& id)
|
|||
}
|
||||
}
|
||||
|
||||
// <FS:Ansariel> Avatar tracking feature
|
||||
//static
|
||||
void LLAvatarActions::track(const LLUUID& id)
|
||||
{
|
||||
FSRadar* radar = FSRadar::getInstance();
|
||||
if (radar)
|
||||
{
|
||||
radar->startTracking(id);
|
||||
}
|
||||
}
|
||||
// </FS:Ansariel>
|
||||
|
||||
// <FS:Ansariel> Teleport to feature
|
||||
//static
|
||||
void LLAvatarActions::teleportTo(const LLUUID& id)
|
||||
{
|
||||
FSRadar* radar = FSRadar::getInstance();
|
||||
if (radar)
|
||||
{
|
||||
radar->teleportToAvatar(id);
|
||||
}
|
||||
}
|
||||
|
||||
namespace action_give_inventory
|
||||
{
|
||||
typedef std::set<LLUUID> uuid_set_t;
|
||||
|
|
|
|||
|
|
@ -255,6 +255,12 @@ public:
|
|||
static void zoomIn(const LLUUID& idAgent);
|
||||
static void getScriptInfo(const LLUUID& idAgent);
|
||||
|
||||
// <FS:Ansariel> Avatar tracking feature
|
||||
static void track(const LLUUID& id);
|
||||
|
||||
// <FS:Ansariel> Teleport to feature
|
||||
static void teleportTo(const LLUUID& id);
|
||||
|
||||
//
|
||||
// Parcel actions
|
||||
//
|
||||
|
|
|
|||
|
|
@ -1808,11 +1808,7 @@ void LLNetMap::handleStartTracking()
|
|||
{
|
||||
if (mClosestAgentRightClick.notNull())
|
||||
{
|
||||
FSRadar* radar = FSRadar::getInstance();
|
||||
if (radar)
|
||||
{
|
||||
radar->startTracking(mClosestAgentRightClick);
|
||||
}
|
||||
LLAvatarActions::track(mClosestAgentRightClick);
|
||||
}
|
||||
}
|
||||
// </FS:Ansariel> Avatar tracking feature
|
||||
|
|
@ -1986,7 +1982,7 @@ void LLNetMap::handleRequestTeleport()
|
|||
|
||||
void LLNetMap::handleTeleportToAvatar()
|
||||
{
|
||||
FSRadar::getInstance()->teleportToAvatar(mClosestAgentRightClick);
|
||||
LLAvatarActions::teleportTo(mClosestAgentRightClick);
|
||||
}
|
||||
|
||||
void LLNetMap::handleGroupInvite()
|
||||
|
|
|
|||
|
|
@ -4391,7 +4391,7 @@ Zoomen auf Avatar nicht möglich, da er sich außerhalb der Reichweite befindet.
|
|||
</notification>
|
||||
|
||||
<notification name="TrackAvatarNotPossible">
|
||||
Verfolgen des Avatars nicht möglich, da er sich außerhalb der Reichweite befindet.
|
||||
Verfolgen des Avatars nicht möglich, da er sich außerhalb der Radar-Reichweite befindet.
|
||||
</notification>
|
||||
|
||||
<notification name="CacheEmpty">
|
||||
|
|
|
|||
|
|
@ -9493,7 +9493,7 @@ Cannot zoom to this avatar, because it is out of reach.
|
|||
icon="alertmodal.tga"
|
||||
name="TrackAvatarNotPossible"
|
||||
type="alertmodal">
|
||||
Cannot track this avatar, because it is out of reach.
|
||||
Cannot track this avatar, because it is beyond radar range.
|
||||
<tag>fail</tag>
|
||||
</notification>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue