Added variable sittp/tplocal distances (@sittp[:<dist>]=n|y and @tplocal[:<dist>]=n|y)
--HG-- branch : RLVamaster
parent
197c860366
commit
d36c0de9e6
|
|
@ -4158,7 +4158,7 @@ void LLAgent::teleportViaLocation(const LLVector3d& pos_global)
|
|||
// [RLVa:KB] - Checked: RLVa-2.0.0
|
||||
if ( (RlvActions::isRlvEnabled()) && (!RlvUtil::isForceTp()) )
|
||||
{
|
||||
if ( (RlvActions::isLocalTp(pos_global)) ? !RlvActions::canTeleportToLocal() : !RlvActions::canTeleportToLocation() )
|
||||
if ( (RlvActions::isLocalTp(pos_global)) ? !RlvActions::canTeleportToLocal(pos_global) : !RlvActions::canTeleportToLocation() )
|
||||
{
|
||||
RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_TELEPORT);
|
||||
return;
|
||||
|
|
@ -4228,7 +4228,7 @@ void LLAgent::teleportViaLocationLookAt(const LLVector3d& pos_global, const LLVe
|
|||
{
|
||||
if ( (RlvActions::isRlvEnabled()) && (!RlvUtil::isForceTp()) )
|
||||
{
|
||||
if ( (RlvActions::isLocalTp(pos_global)) ? !RlvActions::canTeleportToLocal() : !RlvActions::canTeleportToLocation() )
|
||||
if ( (RlvActions::isLocalTp(pos_global)) ? !RlvActions::canTeleportToLocal(pos_global) : !RlvActions::canTeleportToLocation() )
|
||||
{
|
||||
RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_TELEPORT);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ void LLAgentListener::requestSit(LLSD const & event_data) const
|
|||
|
||||
// [RLVa:KB] - Checked: 2010-03-06 (RLVa-1.2.0c) | Modified: RLVa-1.1.0j
|
||||
// TODO-RLVa: [RLVa-1.2.1] Figure out how to call this?
|
||||
if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canSit(object)) )
|
||||
if ( (rlv_handler_t::isEnabled()) && (!RlvActions::canSit(object)) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
#include "llviewermediafocus.h"
|
||||
#include "llviewerobjectlist.h" // to select the requested object
|
||||
// [RLVa:KB] - Checked: 2010-02-27 (RLVa-1.2.0c)
|
||||
#include "rlvactions.h"
|
||||
#include "rlvhandler.h"
|
||||
#include "lltoolpie.h"
|
||||
// [/RLVa:KB]
|
||||
|
|
@ -401,7 +402,7 @@ void LLInspectObject::updateSitLabel(LLSelectNode* nodep)
|
|||
if (rlv_handler_t::isEnabled())
|
||||
{
|
||||
const LLPickInfo& pick = LLToolPie::getInstance()->getPick();
|
||||
sit_btn->setEnabled( (pick.mObjectID.notNull()) && (gRlvHandler.canSit(pick.getObject(), pick.mObjectOffset)) );
|
||||
sit_btn->setEnabled( (pick.mObjectID.notNull()) && (RlvActions::canSit(pick.getObject(), pick.mObjectOffset)) );
|
||||
}
|
||||
// [/RLVa:KB]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@
|
|||
#include "llweb.h"
|
||||
#include "pipeline.h" // setHighlightObject
|
||||
// [RLVa:KB] - Checked: 2010-03-06 (RLVa-1.2.0c)
|
||||
#include "rlvactions.h"
|
||||
#include "rlvhandler.h"
|
||||
// [/RLVa:KB]
|
||||
|
||||
|
|
@ -461,7 +462,7 @@ ECursorType LLToolPie::cursorFromObject(LLViewerObject* object)
|
|||
// if (isAgentAvatarValid() && !gAgentAvatarp->isSitting()) // not already sitting?
|
||||
// [RLVa:KB] - Checked: 2010-03-06 (RLVa-1.2.0c) | Modified: RLVa-1.2.0g
|
||||
if ( (isAgentAvatarValid() && !gAgentAvatarp->isSitting()) &&
|
||||
((!rlv_handler_t::isEnabled()) || (gRlvHandler.canSit(object, LLToolPie::getInstance()->getHoverPick().mObjectOffset))) )
|
||||
((!rlv_handler_t::isEnabled()) || (RlvActions::canSit(object, LLToolPie::getInstance()->getHoverPick().mObjectOffset))) )
|
||||
// [/RLVa:KB]
|
||||
{
|
||||
cursor = UI_CURSOR_TOOLSIT;
|
||||
|
|
|
|||
|
|
@ -4093,7 +4093,7 @@ bool is_object_sittable()
|
|||
if (rlv_handler_t::isEnabled())
|
||||
{
|
||||
const LLPickInfo& pick = LLToolPie::getInstance()->getPick();
|
||||
if ( (pick.mObjectID.notNull()) && (!gRlvHandler.canSit(pick.getObject(), pick.mObjectOffset)) )
|
||||
if ( (pick.mObjectID.notNull()) && (!RlvActions::canSit(pick.getObject(), pick.mObjectOffset)) )
|
||||
return false;
|
||||
}
|
||||
// [/RLVa:KB]
|
||||
|
|
@ -4132,7 +4132,7 @@ void handle_object_sit_or_stand()
|
|||
// if (object && object->getPCode() == LL_PCODE_VOLUME)
|
||||
// [RLVa:KB] - Checked: 2010-03-06 (RLVa-1.2.0c) | Modified: RLVa-1.2.0c
|
||||
if ( (object && object->getPCode() == LL_PCODE_VOLUME) &&
|
||||
((!rlv_handler_t::isEnabled()) || (gRlvHandler.canSit(object, pick.mObjectOffset))) )
|
||||
((!rlv_handler_t::isEnabled()) || (RlvActions::canSit(object, pick.mObjectOffset))) )
|
||||
// [/RLVa:KB]
|
||||
{
|
||||
// [RLVa:KB] - Checked: 2010-08-29 (RLVa-1.2.1c) | Added: RLVa-1.2.1c
|
||||
|
|
@ -6338,7 +6338,7 @@ bool enable_object_sit(LLUICtrl* ctrl)
|
|||
{
|
||||
const LLPickInfo& pick = LLToolPie::getInstance()->getPick();
|
||||
if (pick.mObjectID.notNull())
|
||||
sitting_on_sel = !gRlvHandler.canSit(pick.getObject(), pick.mObjectOffset);
|
||||
sitting_on_sel = !RlvActions::canSit(pick.getObject(), pick.mObjectOffset);
|
||||
}
|
||||
// [/RLVa:KB]
|
||||
|
||||
|
|
|
|||
|
|
@ -105,28 +105,63 @@ bool RlvActions::autoAcceptTeleportRequest(const LLUUID& idRequester)
|
|||
// Teleporting
|
||||
//
|
||||
|
||||
bool RlvActions::canTeleportToLocal()
|
||||
bool RlvActions::canTeleportToLocal(const LLVector3d& posGlobal)
|
||||
{
|
||||
return (!gRlvHandler.hasBehaviour(RLV_BHVR_SITTP)) && (!gRlvHandler.hasBehaviour(RLV_BHVR_TPLOCAL)) && (RlvActions::canStand());
|
||||
// User can initiate a local teleport if:
|
||||
// - not restricted from "sit teleporting" (or the destination is within the allowed xy-radius)
|
||||
// - not restricted from teleporting locally (or the destination is within the allowed xy-radius)
|
||||
// - can stand up (or isn't sitting)
|
||||
// NOTE: if we're teleporting due to an active command we should disregard any restrictions from the same object
|
||||
const LLUUID& idRlvObjExcept = gRlvHandler.getCurrentObject();
|
||||
bool fCanStand = RlvActions::canStand(idRlvObjExcept);
|
||||
if ( (fCanStand) && ((gRlvHandler.hasBehaviourExcept(RLV_BHVR_SITTP, gRlvHandler.getCurrentObject())) || (gRlvHandler.hasBehaviourExcept(RLV_BHVR_TPLOCAL, gRlvHandler.getCurrentObject()))) )
|
||||
{
|
||||
// User can stand up but is either @sittp or @tplocal restricted so we need to distance check
|
||||
const F32 nDistSq = (LLVector2(posGlobal.mdV[0], posGlobal.mdV[1]) - LLVector2(gAgent.getPositionGlobal().mdV[0], gAgent.getPositionGlobal().mdV[1])).lengthSquared();
|
||||
F32 nMaxDist = llmin(RlvBehaviourDictionary::instance().getModifier(RLV_MODIFIER_TPLOCALDIST)->getValue<float>(), RLV_MODIFIER_TPLOCAL_DEFAULT);
|
||||
if (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP))
|
||||
nMaxDist = llmin(nMaxDist, RlvBehaviourDictionary::instance().getModifier(RLV_MODIFIER_SITTPDIST)->getValue<F32>());
|
||||
return (nDistSq < nMaxDist * nMaxDist);
|
||||
}
|
||||
return fCanStand;
|
||||
}
|
||||
|
||||
bool RlvActions::canTeleportToLocation()
|
||||
{
|
||||
// NOTE: if we're teleporting due to an active command we should disregard any restrictions from the same object
|
||||
const LLUUID& idRlvObjExcept = gRlvHandler.getCurrentObject();
|
||||
return (!gRlvHandler.hasBehaviourExcept(RLV_BHVR_TPLOC, idRlvObjExcept)) && (!gRlvHandler.hasBehaviourExcept(RLV_BHVR_TPLOCAL, idRlvObjExcept)) && (RlvActions::canStand(idRlvObjExcept));
|
||||
return (!gRlvHandler.hasBehaviourExcept(RLV_BHVR_TPLOC, idRlvObjExcept)) && (RlvActions::canStand(idRlvObjExcept));
|
||||
}
|
||||
|
||||
bool RlvActions::isLocalTp(const LLVector3d& posGlobal)
|
||||
{
|
||||
F32 nDistSq = (LLVector2(posGlobal.mdV[0], posGlobal.mdV[1]) - LLVector2(gAgent.getPositionGlobal().mdV[0], gAgent.getPositionGlobal().mdV[1])).lengthSquared();
|
||||
return nDistSq < RLV_TELEPORT_LOCAL_RADIUS * RLV_TELEPORT_LOCAL_RADIUS;
|
||||
const F32 nDistSq = (LLVector2(posGlobal.mdV[0], posGlobal.mdV[1]) - LLVector2(gAgent.getPositionGlobal().mdV[0], gAgent.getPositionGlobal().mdV[1])).lengthSquared();
|
||||
return nDistSq < RLV_MODIFIER_TPLOCAL_DEFAULT * RLV_MODIFIER_TPLOCAL_DEFAULT;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// World interaction
|
||||
//
|
||||
|
||||
bool RlvActions::canSit(LLViewerObject* pObj, const LLVector3& posOffset /*= LLVector3::zero*/)
|
||||
{
|
||||
// The user can sit on the specified object if:
|
||||
// - not prevented from sitting
|
||||
// - not prevented from standing up or not currently sitting
|
||||
// - not standtp restricted or not currently sitting (if the user is sitting and tried to sit elsewhere the tp would just kick in)
|
||||
// - not a regular sit (i.e. due to @sit:<uuid>=force)
|
||||
// - not @sittp=n or @fartouch=n restricted or if they clicked on a point within the allowed radius
|
||||
static RlvCachedBehaviourModifier<float> s_nSitTpDist(RLV_MODIFIER_SITTPDIST);
|
||||
return
|
||||
( (pObj) && (LL_PCODE_VOLUME == pObj->getPCode()) ) &&
|
||||
(!hasBehaviour(RLV_BHVR_SIT)) &&
|
||||
( ((!hasBehaviour(RLV_BHVR_UNSIT)) && (!hasBehaviour(RLV_BHVR_STANDTP))) ||
|
||||
((isAgentAvatarValid()) && (!gAgentAvatarp->isSitting())) ) &&
|
||||
( ( (NULL != gRlvHandler.getCurrentCommand()) && (RLV_BHVR_SIT == gRlvHandler.getCurrentCommand()->getBehaviourType()) ) ||
|
||||
( ((!hasBehaviour(RLV_BHVR_SITTP)) || (dist_vec_squared(gAgent.getPositionGlobal(), pObj->getPositionGlobal() + LLVector3d(posOffset)) < s_nSitTpDist * s_nSitTpDist)) &&
|
||||
((!hasBehaviour(RLV_BHVR_FARTOUCH)) || (dist_vec_squared(gAgent.getPositionGlobal(), pObj->getPositionGlobal() + LLVector3d(posOffset)) < RLV_MODIFIER_FARTOUCH_DEFAULT * RLV_MODIFIER_FARTOUCH_DEFAULT)) ) );
|
||||
}
|
||||
|
||||
bool RlvActions::canStand()
|
||||
{
|
||||
// NOTE: return FALSE only if we're @unsit=n restricted and the avie is currently sitting on something and TRUE for everything else
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ public:
|
|||
/*
|
||||
* Returns true if the user can teleport locally (short distances)
|
||||
*/
|
||||
static bool canTeleportToLocal();
|
||||
static bool canTeleportToLocal(const LLVector3d& posGlobal);
|
||||
|
||||
/*
|
||||
* Returns true if the user can teleport to a (remote) location
|
||||
|
|
@ -116,6 +116,11 @@ public:
|
|||
// World interaction
|
||||
// =================
|
||||
public:
|
||||
/*
|
||||
* Returns true if the user can sit up on the specified object
|
||||
*/
|
||||
static bool canSit(LLViewerObject* pObj, const LLVector3& posOffset = LLVector3::zero);
|
||||
|
||||
/*
|
||||
* Returns true if the user can stand up (returns true if the user isn't currently sitting)
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -66,13 +66,15 @@ const S32 RLVa_VERSION_BUILD = 0;
|
|||
|
||||
#define RLV_ROOT_FOLDER "#RLV"
|
||||
#define RLV_CMD_PREFIX '@'
|
||||
#define RLV_MODIFIER_TPLOCAL_DEFAULT 256.f // Any teleport that's more than a region away is non-local
|
||||
#define RLV_MODIFIER_FARTOUCH_DEFAULT 1.5f // Specifies the default @fartouch distance
|
||||
#define RLV_MODIFIER_SITTP_DEFAULT 1.5f // Specifies the default @sittp distance
|
||||
#define RLV_OPTION_SEPARATOR ";" // Default separator used in command options
|
||||
#define RLV_PUTINV_PREFIX "#RLV/~"
|
||||
#define RLV_PUTINV_SEPARATOR "/"
|
||||
#define RLV_PUTINV_MAXDEPTH 4
|
||||
#define RLV_SETROT_OFFSET F_PI_BY_TWO // @setrot is off by 90° with the rest of SL
|
||||
#define RLV_STRINGS_FILE "rlva_strings.xml"
|
||||
#define RLV_TELEPORT_LOCAL_RADIUS 256 // Any teleport that's more than a region away is non-local
|
||||
|
||||
#define RLV_FOLDER_FLAG_NOSTRIP "nostrip"
|
||||
#define RLV_FOLDER_PREFIX_HIDDEN '.'
|
||||
|
|
@ -196,6 +198,9 @@ enum ERlvBehaviour {
|
|||
|
||||
enum ERlvBehaviourModifier
|
||||
{
|
||||
RLV_MODIFIER_SITTPDIST,
|
||||
RLV_MODIFIER_TPLOCALDIST,
|
||||
|
||||
RLV_MODIFIER_COUNT,
|
||||
RLV_MODIFIER_UNKNOWN
|
||||
};
|
||||
|
|
|
|||
|
|
@ -684,25 +684,6 @@ void RlvHandler::onTeleportFinished(const LLVector3d& posArrival)
|
|||
// String/chat censoring functions
|
||||
//
|
||||
|
||||
// Checked: 2010-03-06 (RLVa-1.2.0c) | Added: RLVa-1.1.0j
|
||||
bool RlvHandler::canSit(LLViewerObject* pObj, const LLVector3& posOffset /*= LLVector3::zero*/) const
|
||||
{
|
||||
// The user can sit on the specified object if:
|
||||
// - not prevented from sitting
|
||||
// - not prevented from standing up or not currently sitting
|
||||
// - not standtp restricted or not currently sitting (if the user is sitting and tried to sit elsewhere the tp would just kick in)
|
||||
// - not a regular sit (i.e. due to @sit:<uuid>=force)
|
||||
// - not @sittp=n or @fartouch=n restricted or if they clicked on a point within 1.5m of the avie's current position
|
||||
return
|
||||
( (pObj) && (LL_PCODE_VOLUME == pObj->getPCode()) ) &&
|
||||
(!hasBehaviour(RLV_BHVR_SIT)) &&
|
||||
( ((!hasBehaviour(RLV_BHVR_UNSIT)) && (!hasBehaviour(RLV_BHVR_STANDTP))) ||
|
||||
((isAgentAvatarValid()) && (!gAgentAvatarp->isSitting())) ) &&
|
||||
( ( (NULL != getCurrentCommand()) && (RLV_BHVR_SIT == getCurrentCommand()->getBehaviourType()) ) ||
|
||||
( (!hasBehaviour(RLV_BHVR_SITTP)) && (!hasBehaviour(RLV_BHVR_FARTOUCH)) ) ||
|
||||
(dist_vec_squared(gAgent.getPositionGlobal(), pObj->getPositionGlobal() + LLVector3d(posOffset)) < 1.5f * 1.5f) );
|
||||
}
|
||||
|
||||
// Checked: 2010-04-11 (RLVa-1.3.0h) | Modified: RLVa-1.3.0h
|
||||
bool RlvHandler::canTouch(const LLViewerObject* pObj, const LLVector3& posOffset /*=LLVector3::zero*/) const
|
||||
{
|
||||
|
|
@ -1948,7 +1929,7 @@ ERlvCmdRet RlvForceHandler<RLV_BHVR_SIT>::onCommand(const RlvCommand& rlvCmd)
|
|||
if ( (idTarget.isNull()) || ((pObj = gObjectList.findObject(idTarget)) == NULL) || (LL_PCODE_VOLUME != pObj->getPCode()) )
|
||||
return RLV_RET_FAILED_OPTION;
|
||||
|
||||
if (!gRlvHandler.canSit(pObj))
|
||||
if (!RlvActions::canSit(pObj))
|
||||
return RLV_RET_FAILED_LOCK;
|
||||
else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_STANDTP)) && (isAgentAvatarValid()) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -96,7 +96,6 @@ public:
|
|||
// Command specific helper functions
|
||||
bool canEdit(const LLViewerObject* pObj) const; // @edit and @editobj
|
||||
bool canShowHoverText(const LLViewerObject* pObj) const; // @showhovertext* command family
|
||||
bool canSit(LLViewerObject* pObj, const LLVector3& posOffset = LLVector3::zero) const;
|
||||
bool canTouch(const LLViewerObject* pObj, const LLVector3& posOffset = LLVector3::zero) const; // @touch
|
||||
bool filterChat(std::string& strUTF8Text, bool fFilterEmote) const; // @sendchat, @recvchat and @redirchat
|
||||
bool redirectChatOrEmote(const std::string& strUTF8Test) const; // @redirchat and @rediremote
|
||||
|
|
|
|||
|
|
@ -139,7 +139,8 @@ RlvBehaviourDictionary::RlvBehaviourDictionary()
|
|||
addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE>("shownames", RLV_BHVR_SHOWNAMES));
|
||||
addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE>("showworldmap", RLV_BHVR_SHOWWORLDMAP));
|
||||
addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE>("sit", RLV_BHVR_SIT));
|
||||
addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE>("sittp", RLV_BHVR_SITTP));
|
||||
addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE_OR_MODIFIER>("sittp", RLV_BHVR_SITTP));
|
||||
addModifier(RLV_BHVR_SITTP, RLV_MODIFIER_SITTPDIST, new RlvBehaviourModifier(RLV_MODIFIER_SITTP_DEFAULT, true, &s_RlvBehaviourModifier_CompMin));
|
||||
addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE>("standtp", RLV_BHVR_STANDTP));
|
||||
addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE_OR_EXCEPTION>("startim", RLV_BHVR_STARTIM, RlvBehaviourInfo::BHVR_STRICT));
|
||||
addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_EXCEPTION>("startimto", RLV_BHVR_STARTIMTO, RlvBehaviourInfo::BHVR_STRICT));
|
||||
|
|
@ -155,7 +156,8 @@ RlvBehaviourDictionary::RlvBehaviourDictionary()
|
|||
addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE_OR_EXCEPTION>("touchworld", RLV_BHVR_TOUCHWORLD));
|
||||
addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE>("tplm", RLV_BHVR_TPLM));
|
||||
addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE>("tploc", RLV_BHVR_TPLOC));
|
||||
addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE>("tplocal", RLV_BHVR_TPLOCAL));
|
||||
addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE_OR_MODIFIER>("tplocal", RLV_BHVR_TPLOCAL));
|
||||
addModifier(RLV_BHVR_TPLOCAL, RLV_MODIFIER_TPLOCALDIST, new RlvBehaviourModifier(RLV_MODIFIER_TPLOCAL_DEFAULT, true, &s_RlvBehaviourModifier_CompMin));
|
||||
addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE_OR_EXCEPTION>("tplure", RLV_BHVR_TPLURE, RlvBehaviourInfo::BHVR_STRICT));
|
||||
addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE_OR_EXCEPTION>("tprequest", RLV_BHVR_TPREQUEST, RlvBehaviourInfo::BHVR_STRICT | RlvBehaviourInfo::BHVR_EXTENDED));
|
||||
addEntry(new RlvBehaviourInfo("unsharedunwear", RLV_BHVR_UNSHAREDUNWEAR, RLV_TYPE_ADDREM));
|
||||
|
|
|
|||
Loading…
Reference in New Issue