[FIXED] @sittp should restrict local teleports in 3D space rather than only the xy-plane

--HG--
branch : RLVa
meow-7.2.2
Kitty Barnett 2018-06-18 01:02:15 +02:00
parent 820d1b78a4
commit 5882870409
1 changed files with 14 additions and 11 deletions

View File

@ -317,22 +317,25 @@ bool RlvActions::canJump()
bool RlvActions::canTeleportToLocal(const LLVector3d& posGlobal)
{
// 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)
// - not restricted from "sit teleporting" (or the destination is within the allowed xyz-radius)
// - not restricted from teleporting locally (or the destination is within the allowed xy-radius)
// 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, idRlvObjExcept)) || (gRlvHandler.hasBehaviourExcept(RLV_BHVR_TPLOCAL, idRlvObjExcept))) )
bool fCanTeleport = RlvActions::canStand(idRlvObjExcept);
if ( (fCanTeleport) && (gRlvHandler.hasBehaviourExcept(RLV_BHVR_SITTP, idRlvObjExcept)) )
{
// 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.hasBehaviourExcept(RLV_BHVR_SITTP, idRlvObjExcept))
nMaxDist = llmin(nMaxDist, RlvBehaviourDictionary::instance().getModifier(RLV_MODIFIER_SITTPDIST)->getValue<F32>());
return (nDistSq < nMaxDist * nMaxDist);
const F32 nDistSq = (posGlobal - gAgent.getPositionGlobal()).lengthSquared();
const F32 nSitTpDist = RlvBehaviourDictionary::instance().getModifier(RLV_MODIFIER_SITTPDIST)->getValue<F32>();
fCanTeleport = nDistSq < nSitTpDist * nSitTpDist;
}
return fCanStand;
if ( (fCanTeleport) && (gRlvHandler.hasBehaviourExcept(RLV_BHVR_TPLOCAL, idRlvObjExcept)) )
{
const F32 nDistSq = (LLVector2(posGlobal.mdV[0], posGlobal.mdV[1]) - LLVector2(gAgent.getPositionGlobal().mdV[0], gAgent.getPositionGlobal().mdV[1])).lengthSquared();
const F32 nTpLocalDist = llmin(RlvBehaviourDictionary::instance().getModifier(RLV_MODIFIER_TPLOCALDIST)->getValue<float>(), RLV_MODIFIER_TPLOCAL_DEFAULT);
fCanTeleport = nDistSq < nTpLocalDist * nTpLocalDist;
}
return fCanTeleport;
}
bool RlvActions::canTeleportToLocation()