Refactor avatar track and teleport to code and make the features available in LLAvatarActions for convenience

master
Ansariel 2014-03-06 13:49:59 +01:00
parent 44e89efb8c
commit 1b43e16363
10 changed files with 56 additions and 62 deletions

View File

@ -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

View File

@ -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")
{

View File

@ -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()

View File

@ -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()

View File

@ -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;

View File

@ -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;

View File

@ -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
//

View File

@ -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()

View File

@ -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">

View File

@ -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>