Fix automatic bridge detach

Thanks Aru
This commit is contained in:
Lirusaito
2019-02-17 12:54:16 -05:00
parent 8f96442cc7
commit 50f9fbd728
2 changed files with 10 additions and 17 deletions

View File

@@ -39,6 +39,7 @@
#include "rlvhandler.h"
#include "rlvlocks.h"
// [/RLVa:KB]
#include <boost/algorithm/string/predicate.hpp>
const F32 COF_LINK_BATCH_TIME = 5.0F;
const F32 MAX_ATTACHMENT_REQUEST_LIFETIME = 30.0F;
@@ -478,9 +479,17 @@ void LLAttachmentsMgr::onAttachmentArrived(const LLUUID& inv_item_id)
{
LLTimer timer;
bool expected = mAttachmentRequests.getTime(inv_item_id, timer);
LLInventoryItem *item = gInventory.getItem(inv_item_id);
if (item && boost::algorithm::contains(item->getName(), " Bridge v") && gSavedSettings.getBOOL("SGDetachBridge"))
{
LL_INFOS() << "Bridge detected! detaching" << LL_ENDL;
LLVOAvatarSelf::detachAttachmentIntoInventory(item->getUUID());
return;
}
if (!expected)
{
LLInventoryItem *item = gInventory.getItem(inv_item_id);
LL_WARNS() << "ATT Attachment was unexpected or arrived after " << MAX_ATTACHMENT_REQUEST_LIFETIME << " seconds: "
<< (item ? item->getName() : "UNKNOWN") << " id " << inv_item_id << LL_ENDL;
}

View File

@@ -7175,17 +7175,6 @@ void LLVOAvatar::removeChild(LLViewerObject *childp)
}
}
namespace
{
boost::signals2::connection sDetachBridgeConnection;
void detach_bridge(const LLViewerObject* obj, const LLViewerObject* bridge)
{
if (obj != bridge) return;
sDetachBridgeConnection.disconnect();
LLVOAvatarSelf::detachAttachmentIntoInventory(obj->getAttachmentItemID());
}
}
LLViewerJointAttachment* LLVOAvatar::getTargetAttachmentPoint(LLViewerObject* viewer_object)
{
S32 attachmentID = ATTACHMENT_ID_FROM_STATE(viewer_object->getState());
@@ -7206,11 +7195,6 @@ LLViewerJointAttachment* LLVOAvatar::getTargetAttachmentPoint(LLViewerObject* vi
<< " trying to use 1 (chest)"
<< LL_ENDL;
if (isSelf() && attachmentID == 127 && gSavedSettings.getBOOL("SGDetachBridge"))
{
LL_INFOS() << "Bridge detected! detaching" << LL_ENDL;
sDetachBridgeConnection = gAgentAvatarp->setAttachmentCallback(boost::bind(detach_bridge, _1, viewer_object));
}
attachment = get_if_there(mAttachmentPoints, 1, (LLViewerJointAttachment*)NULL); // Arbitrary using 1 (chest)
if (attachment)
{