Newer
Older
name += gAgentAvatarp->getFullname();
BOOL LLAgent::isInGroup(const LLUUID& group_id, BOOL ignore_god_mode /* FALSE */) const
if (!ignore_god_mode && isGodlike())
Richard Linden
committed
U32 count = mGroups.size();
for(U32 i = 0; i < count; ++i)
Richard Linden
committed
if(mGroups[i].mID == group_id)
{
return TRUE;
}
}
return FALSE;
}
// This implementation should mirror LLAgentInfo::hasPowerInGroup
BOOL LLAgent::hasPowerInGroup(const LLUUID& group_id, U64 power) const
{
if (isGodlikeWithoutAdminMenuFakery())
// GP_NO_POWERS can also mean no power is enough to grant an ability.
if (GP_NO_POWERS == power) return FALSE;
Richard Linden
committed
U32 count = mGroups.size();
for(U32 i = 0; i < count; ++i)
Richard Linden
committed
if(mGroups[i].mID == group_id)
Richard Linden
committed
return (BOOL)((mGroups[i].mPowers & power) > 0);
}
}
return FALSE;
}
BOOL LLAgent::hasPowerInActiveGroup(U64 power) const
{
return (mGroupID.notNull() && (hasPowerInGroup(mGroupID, power)));
}
U64 LLAgent::getPowerInGroup(const LLUUID& group_id) const
{
Richard Linden
committed
U32 count = mGroups.size();
for(U32 i = 0; i < count; ++i)
Richard Linden
committed
if(mGroups[i].mID == group_id)
Richard Linden
committed
return (mGroups[i].mPowers);
}
}
return GP_NO_POWERS;
}
BOOL LLAgent::getGroupData(const LLUUID& group_id, LLGroupData& data) const
{
Richard Linden
committed
S32 count = mGroups.size();
Richard Linden
committed
if(mGroups[i].mID == group_id)
Richard Linden
committed
data = mGroups[i];
return TRUE;
}
}
return FALSE;
}
S32 LLAgent::getGroupContribution(const LLUUID& group_id) const
{
Richard Linden
committed
S32 count = mGroups.size();
Richard Linden
committed
if(mGroups[i].mID == group_id)
Richard Linden
committed
S32 contribution = mGroups[i].mContribution;
return contribution;
}
}
return 0;
}
BOOL LLAgent::setGroupContribution(const LLUUID& group_id, S32 contribution)
{
Richard Linden
committed
S32 count = mGroups.size();
Richard Linden
committed
if(mGroups[i].mID == group_id)
Richard Linden
committed
mGroups[i].mContribution = contribution;
LLMessageSystem* msg = gMessageSystem;
msg->newMessage("SetGroupContribution");
msg->nextBlock("AgentData");
msg->addUUID("AgentID", gAgentID);
msg->addUUID("SessionID", gAgentSessionID);
msg->nextBlock("Data");
msg->addUUID("GroupID", group_id);
msg->addS32("Contribution", contribution);
sendReliableMessage();
return TRUE;
}
}
return FALSE;
}
BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOOL list_in_profile)
Richard Linden
committed
S32 count = mGroups.size();
Richard Linden
committed
if(mGroups[i].mID == group_id)
Richard Linden
committed
mGroups[i].mAcceptNotices = accept_notices;
mGroups[i].mListInProfile = list_in_profile;
LLMessageSystem* msg = gMessageSystem;
msg->newMessage("SetGroupAcceptNotices");
msg->nextBlock("AgentData");
msg->addUUID("AgentID", gAgentID);
msg->addUUID("SessionID", gAgentSessionID);
msg->nextBlock("Data");
msg->addUUID("GroupID", group_id);
msg->addBOOL("AcceptNotices", accept_notices);
msg->nextBlock("NewData");
msg->addBOOL("ListInProfile", list_in_profile);
sendReliableMessage();
return TRUE;
}
}
return FALSE;
}
Vadim Savchuk
committed
BOOL LLAgent::canJoinGroups() const
{
return (S32)mGroups.size() < LLAgentBenefitsMgr::current().getGroupMembershipLimit();
Vadim Savchuk
committed
}
if (!isAgentAvatarValid() || !gAgentAvatarp->mPelvisp || !gAgentAvatarp->mHeadp)
if (!gAgentCamera.cameraMouselook())
return gAgentAvatarp->getRotation();
LLVector3 look_dir( LLViewerCamera::getInstance()->getAtAxis() );
LLVector3 up = look_dir % mFrameAgent.getLeftAxis();
LLVector3 left = up % look_dir;
LLQuaternion rot(look_dir, left, up);
if (gAgentAvatarp->getParent())
rot = rot * ~gAgentAvatarp->getParent()->getRotation();
Richard Linden
committed
void LLAgent::sendAnimationRequests(const std::vector<LLUUID> &anim_ids, EAnimRequest request)
{
if (gAgentID.isNull())
{
return;
}
S32 num_valid_anims = 0;
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_AgentAnimation);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, getID());
msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
Richard Linden
committed
for (S32 i = 0; i < anim_ids.size(); i++)
{
if (anim_ids[i].isNull())
{
continue;
}
msg->nextBlockFast(_PREHASH_AnimationList);
msg->addUUIDFast(_PREHASH_AnimID, (anim_ids[i]) );
msg->addBOOLFast(_PREHASH_StartAnim, (request == ANIM_REQUEST_START) ? TRUE : FALSE);
num_valid_anims++;
}
msg->nextBlockFast(_PREHASH_PhysicalAvatarEventList);
msg->addBinaryDataFast(_PREHASH_TypeData, NULL, 0);
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
if (num_valid_anims)
{
sendReliableMessage();
}
}
void LLAgent::sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request)
{
if (gAgentID.isNull() || anim_id.isNull() || !mRegionp)
{
return;
}
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_AgentAnimation);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, getID());
msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
msg->nextBlockFast(_PREHASH_AnimationList);
msg->addUUIDFast(_PREHASH_AnimID, (anim_id) );
msg->addBOOLFast(_PREHASH_StartAnim, (request == ANIM_REQUEST_START) ? TRUE : FALSE);
msg->nextBlockFast(_PREHASH_PhysicalAvatarEventList);
msg->addBinaryDataFast(_PREHASH_TypeData, NULL, 0);
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
// Send a message to the region to stop the NULL animation state
// This will reset animation state overrides for the agent.
void LLAgent::sendAnimationStateReset()
{
if (gAgentID.isNull() || !mRegionp)
{
return;
}
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_AgentAnimation);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, getID());
msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
msg->nextBlockFast(_PREHASH_AnimationList);
msg->addUUIDFast(_PREHASH_AnimID, LLUUID::null );
msg->addBOOLFast(_PREHASH_StartAnim, FALSE);
msg->nextBlockFast(_PREHASH_PhysicalAvatarEventList);
msg->addBinaryDataFast(_PREHASH_TypeData, NULL, 0);
sendReliableMessage();
}
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
// Send a message to the region to revoke sepecified permissions on ALL scripts in the region
// If the target is an object in the region, permissions in scripts on that object are cleared.
// If it is the region ID, all scripts clear the permissions for this agent
void LLAgent::sendRevokePermissions(const LLUUID & target, U32 permissions)
{
// Currently only the bits for SCRIPT_PERMISSION_TRIGGER_ANIMATION and SCRIPT_PERMISSION_OVERRIDE_ANIMATIONS
// are supported by the server. Sending any other bits will cause the message to be dropped without changing permissions
if (gAgentID.notNull() && gMessageSystem)
{
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_RevokePermissions);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, getID()); // Must be our ID
msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
msg->nextBlockFast(_PREHASH_Data);
msg->addUUIDFast(_PREHASH_ObjectID, target); // Must be in the region
msg->addS32Fast(_PREHASH_ObjectPermissions, (S32) permissions);
sendReliableMessage();
}
}
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
// [RLVa:KB] - Checked: 2011-05-11 (RLVa-1.3.0i) | Added: RLVa-1.3.0i
void LLAgent::setAlwaysRun()
{
mbAlwaysRun = (!rlv_handler_t::isEnabled()) || (!gRlvHandler.hasBehaviour(RLV_BHVR_ALWAYSRUN));
sendWalkRun();
}
void LLAgent::setTempRun()
{
mbTempRun = (!rlv_handler_t::isEnabled()) || (!gRlvHandler.hasBehaviour(RLV_BHVR_TEMPRUN));
sendWalkRun();
}
void LLAgent::clearAlwaysRun()
{
mbAlwaysRun = false;
sendWalkRun();
}
void LLAgent::clearTempRun()
{
mbTempRun = false;
sendWalkRun();
}
// [/RLVa:KB]
//void LLAgent::sendWalkRun(bool running)
// [RLVa:KB] - Checked: 2011-05-11 (RLVa-1.3.0i) | Added: RLVa-1.3.0i
void LLAgent::sendWalkRun()
// [/RLVa:KB]
{
LLMessageSystem* msgsys = gMessageSystem;
if (msgsys)
{
msgsys->newMessageFast(_PREHASH_SetAlwaysRun);
msgsys->nextBlockFast(_PREHASH_AgentData);
msgsys->addUUIDFast(_PREHASH_AgentID, getID());
msgsys->addUUIDFast(_PREHASH_SessionID, getSessionID());
// msgsys->addBOOLFast(_PREHASH_AlwaysRun, BOOL(running) );
// [RLVa:KB] - Checked: 2011-05-11 (RLVa-1.3.0i) | Added: RLVa-1.3.0i
msgsys->addBOOLFast(_PREHASH_AlwaysRun, BOOL(getRunning()) );
// [/RLVa:KB]
void LLAgent::friendsChanged()
{
LLCollectProxyBuddies collector;
LLAvatarTracker::instance().applyFunctor(collector);
mProxyForAgents = collector.mProxy;
}
BOOL LLAgent::isGrantedProxy(const LLPermissions& perm)
{
return (mProxyForAgents.count(perm.getOwner()) > 0);
}
BOOL LLAgent::allowOperation(PermissionBit op,
const LLPermissions& perm,
U64 group_proxy_power,
U8 god_minimum)
Josh Bell
committed
{
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
// Check god level.
if (getGodLevel() >= god_minimum) return TRUE;
if (!perm.isOwned()) return FALSE;
// A group member with group_proxy_power can act as owner.
BOOL is_group_owned;
LLUUID owner_id;
perm.getOwnership(owner_id, is_group_owned);
LLUUID group_id(perm.getGroup());
LLUUID agent_proxy(getID());
if (is_group_owned)
{
if (hasPowerInGroup(group_id, group_proxy_power))
{
// Let the member assume the group's id for permission requests.
agent_proxy = owner_id;
}
}
else
{
// Check for granted mod permissions.
if ((PERM_OWNER != op) && isGrantedProxy(perm))
{
agent_proxy = owner_id;
}
}
// This is the group id to use for permission requests.
// Only group members may use this field.
LLUUID group_proxy = LLUUID::null;
if (group_id.notNull() && isInGroup(group_id))
{
group_proxy = group_id;
}
// We now have max ownership information.
if (PERM_OWNER == op)
{
// This this was just a check for ownership, we can now return the answer.
return (agent_proxy == owner_id);
}
return perm.allowOperationBy(op, agent_proxy, group_proxy);
}
LLColor4 effect_color = *mEffectColor;
//<alchemy> Rainbow Particle Effects
static LLCachedControl<bool> AlchemyRainbowEffects(gSavedSettings, "AlchemyRainbowEffects");
if(AlchemyRainbowEffects)
{
LLColor3 rainbow;
rainbow.setHSL(fmodf((F32)LLFrameTimer::getElapsedSeconds()/4.f, 1.f), 1.f, 0.5f);
effect_color.set(rainbow, 1.0f);
}
return effect_color;
}
void LLAgent::setEffectColor(const LLColor4 &color)
{
brad kittenbrink
committed
*mEffectColor = color;
}
void LLAgent::initOriginGlobal(const LLVector3d &origin_global)
{
mAgentOriginGlobal = origin_global;
}
BOOL LLAgent::leftButtonGrabbed() const
const BOOL camera_mouse_look = gAgentCamera.cameraMouselook();
return (!camera_mouse_look && mControlsTakenCount[CONTROL_LBUTTON_DOWN_INDEX] > 0)
|| (camera_mouse_look && mControlsTakenCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0)
|| (!camera_mouse_look && mControlsTakenPassedOnCount[CONTROL_LBUTTON_DOWN_INDEX] > 0)
|| (camera_mouse_look && mControlsTakenPassedOnCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0);
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
}
BOOL LLAgent::rotateGrabbed() const
{
return (mControlsTakenCount[CONTROL_YAW_POS_INDEX] > 0)
|| (mControlsTakenCount[CONTROL_YAW_NEG_INDEX] > 0);
}
BOOL LLAgent::forwardGrabbed() const
{
return (mControlsTakenCount[CONTROL_AT_POS_INDEX] > 0);
}
BOOL LLAgent::backwardGrabbed() const
{
return (mControlsTakenCount[CONTROL_AT_NEG_INDEX] > 0);
}
BOOL LLAgent::upGrabbed() const
{
return (mControlsTakenCount[CONTROL_UP_POS_INDEX] > 0);
}
BOOL LLAgent::downGrabbed() const
{
return (mControlsTakenCount[CONTROL_UP_NEG_INDEX] > 0);
}
void update_group_floaters(const LLUUID& group_id)
{
LLGroupActions::refresh(group_id);
//*TODO Implement group update for Profile View
// still actual as of July 31, 2009 (DZ)
gAgent.fireEvent(new LLOldEvents::LLEvent(&gAgent, "new group"), "");
}
// static
void LLAgent::processAgentDropGroup(LLMessageSystem *msg, void **)
{
LLUUID agent_id;
msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
if (agent_id != gAgentID)
{
LL_WARNS() << "processAgentDropGroup for agent other than me" << LL_ENDL;
return;
}
LLUUID group_id;
msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_GroupID, group_id );
// Remove the group if it already exists remove it and add the new data to pick up changes.
LLGroupData gd;
gd.mID = group_id;
Richard Linden
committed
std::vector<LLGroupData>::iterator found_it = std::find(gAgent.mGroups.begin(), gAgent.mGroups.end(), gd);
if (found_it != gAgent.mGroups.end())
Richard Linden
committed
gAgent.mGroups.erase(found_it);
// [SL:KB] - Patch: Chat-GroupOptions | Checked: 2012-06-21 (Catznip-3.3)
LLGroupOptionsMgr::instance().clearOptions(group_id);
// [/SL:KB]
if (gAgent.getGroupID() == group_id)
{
gAgent.mGroupID.setNull();
gAgent.mGroupPowers = 0;
gAgent.mGroupName.clear();
gAgent.mGroupTitle.clear();
}
// refresh all group information
gAgent.sendAgentDataUpdateRequest();
LLGroupMgr::getInstance()->clearGroupData(group_id);
LLGroupActions::closeGroup(group_id);
LL_WARNS() << "processAgentDropGroup, agent is not part of group " << group_id << LL_ENDL;
class LLAgentDropGroupViewerNode : public LLHTTPNode
{
virtual void post(
LLHTTPNode::ResponsePtr response,
const LLSD& context,
const LLSD& input) const
{
if (
!input.isMap() ||
!input.has("body") )
{
//what to do with badly formed message?
Don Kjer
committed
response->extendedResult(HTTP_BAD_REQUEST, LLSD("Invalid message parameters"));
}
LLSD body = input["body"];
if ( body.has("body") )
{
//stupid message system doubles up the "body"s
body = body["body"];
}
if (
body.has("AgentData") &&
body["AgentData"].isArray() &&
body["AgentData"][0].isMap() )
{
LL_INFOS() << "VALID DROP GROUP" << LL_ENDL;
//there is only one set of data in the AgentData block
LLSD agent_data = body["AgentData"][0];
LLUUID agent_id;
LLUUID group_id;
agent_id = agent_data["AgentID"].asUUID();
group_id = agent_data["GroupID"].asUUID();
if (agent_id != gAgentID)
{
LL_WARNS()
<< "AgentDropGroup for agent other than me" << LL_ENDL;
response->notFound();
return;
}
// Remove the group if it already exists remove it
// and add the new data to pick up changes.
LLGroupData gd;
gd.mID = group_id;
Richard Linden
committed
std::vector<LLGroupData>::iterator found_it = std::find(gAgent.mGroups.begin(), gAgent.mGroups.end(), gd);
if (found_it != gAgent.mGroups.end())
Richard Linden
committed
gAgent.mGroups.erase(found_it);
// [SL:KB] - Patch: Chat-GroupOptions | Checked: 2012-06-21 (Catznip-3.3)
LLGroupOptionsMgr::instance().clearOptions(group_id);
// [/SL:KB]
if (gAgent.getGroupID() == group_id)
{
gAgent.mGroupID.setNull();
gAgent.mGroupPowers = 0;
gAgent.mGroupName.clear();
gAgent.mGroupTitle.clear();
}
// refresh all group information
gAgent.sendAgentDataUpdateRequest();
LLGroupMgr::getInstance()->clearGroupData(group_id);
LLGroupActions::closeGroup(group_id);
<< "AgentDropGroup, agent is not part of group "
}
response->result(LLSD());
}
else
{
//what to do with badly formed message?
Don Kjer
committed
response->extendedResult(HTTP_BAD_REQUEST, LLSD("Invalid message parameters"));
}
}
};
LLHTTPRegistration<LLAgentDropGroupViewerNode>
gHTTPRegistrationAgentDropGroupViewerNode(
"/message/AgentDropGroup");
// static
void LLAgent::processAgentGroupDataUpdate(LLMessageSystem *msg, void **)
{
LLUUID agent_id;
msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
if (agent_id != gAgentID)
{
LL_WARNS() << "processAgentGroupDataUpdate for agent other than me" << LL_ENDL;
return;
}
S32 count = msg->getNumberOfBlocksFast(_PREHASH_GroupData);
LLGroupData group;
bool need_floater_update = false;
for(S32 i = 0; i < count; ++i)
{
msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group.mID, i);
msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupInsigniaID, group.mInsigniaID, i);
msg->getU64(_PREHASH_GroupData, "GroupPowers", group.mPowers, i);
msg->getBOOL(_PREHASH_GroupData, "AcceptNotices", group.mAcceptNotices, i);
msg->getS32(_PREHASH_GroupData, "Contribution", group.mContribution, i);
msg->getStringFast(_PREHASH_GroupData, _PREHASH_GroupName, group.mName, i);
if(group.mID.notNull())
{
need_floater_update = true;
// Remove the group if it already exists remove it and add the new data to pick up changes.
Richard Linden
committed
std::vector<LLGroupData>::iterator found_it = std::find(gAgent.mGroups.begin(), gAgent.mGroups.end(), group);
if (found_it != gAgent.mGroups.end())
Richard Linden
committed
gAgent.mGroups.erase(found_it);
Richard Linden
committed
gAgent.mGroups.push_back(group);
}
if (need_floater_update)
{
update_group_floaters(group.mID);
}
}
}
class LLAgentGroupDataUpdateViewerNode : public LLHTTPNode
{
virtual void post(
LLHTTPNode::ResponsePtr response,
const LLSD& context,
const LLSD& input) const
{
LLSD body = input["body"];
if(body.has("body"))
body = body["body"];
LLUUID agent_id = body["AgentData"][0]["AgentID"].asUUID();
if (agent_id != gAgentID)
{
LL_WARNS() << "processAgentGroupDataUpdate for agent other than me" << LL_ENDL;
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
return;
}
LLSD group_data = body["GroupData"];
LLSD::array_iterator iter_group =
group_data.beginArray();
LLSD::array_iterator end_group =
group_data.endArray();
int group_index = 0;
for(; iter_group != end_group; ++iter_group)
{
LLGroupData group;
bool need_floater_update = false;
group.mID = (*iter_group)["GroupID"].asUUID();
group.mPowers = ll_U64_from_sd((*iter_group)["GroupPowers"]);
group.mAcceptNotices = (*iter_group)["AcceptNotices"].asBoolean();
group.mListInProfile = body["NewGroupData"][group_index]["ListInProfile"].asBoolean();
group.mInsigniaID = (*iter_group)["GroupInsigniaID"].asUUID();
group.mName = (*iter_group)["GroupName"].asString();
group.mContribution = (*iter_group)["Contribution"].asInteger();
group_index++;
if(group.mID.notNull())
{
need_floater_update = true;
// Remove the group if it already exists remove it and add the new data to pick up changes.
Richard Linden
committed
std::vector<LLGroupData>::iterator found_it = std::find(gAgent.mGroups.begin(), gAgent.mGroups.end(), group);
if (found_it != gAgent.mGroups.end())
Richard Linden
committed
gAgent.mGroups.erase(found_it);
Richard Linden
committed
gAgent.mGroups.push_back(group);
}
if (need_floater_update)
{
update_group_floaters(group.mID);
}
}
}
};
LLHTTPRegistration<LLAgentGroupDataUpdateViewerNode >
gHTTPRegistrationAgentGroupDataUpdateViewerNode ("/message/AgentGroupDataUpdate");
// static
void LLAgent::processAgentDataUpdate(LLMessageSystem *msg, void **)
{
LLUUID agent_id;
msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
if (agent_id != gAgentID)
{
LL_WARNS() << "processAgentDataUpdate for agent other than me" << LL_ENDL;
msg->getStringFast(_PREHASH_AgentData, _PREHASH_GroupTitle, gAgent.mGroupTitle);
LLUUID active_id;
msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_ActiveGroupID, active_id);
if(active_id.notNull())
{
gAgent.mGroupID = active_id;
msg->getU64(_PREHASH_AgentData, "GroupPowers", gAgent.mGroupPowers);
msg->getString(_PREHASH_AgentData, _PREHASH_GroupName, gAgent.mGroupName);
}
else
{
gAgent.mGroupID.setNull();
gAgent.mGroupPowers = 0;
gAgent.mGroupName.clear();
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
}
update_group_floaters(active_id);
}
// static
void LLAgent::processScriptControlChange(LLMessageSystem *msg, void **)
{
S32 block_count = msg->getNumberOfBlocks("Data");
for (S32 block_index = 0; block_index < block_count; block_index++)
{
BOOL take_controls;
U32 controls;
BOOL passon;
U32 i;
msg->getBOOL("Data", "TakeControls", take_controls, block_index);
if (take_controls)
{
// take controls
msg->getU32("Data", "Controls", controls, block_index );
msg->getBOOL("Data", "PassToAgent", passon, block_index );
U32 total_count = 0;
for (i = 0; i < TOTAL_CONTROLS; i++)
{
if (controls & ( 1 << i))
{
if (passon)
{
gAgent.mControlsTakenPassedOnCount[i]++;
}
else
{
gAgent.mControlsTakenCount[i]++;
}
total_count++;
}
}
}
else
{
// release controls
msg->getU32("Data", "Controls", controls, block_index );
msg->getBOOL("Data", "PassToAgent", passon, block_index );
for (i = 0; i < TOTAL_CONTROLS; i++)
{
if (controls & ( 1 << i))
{
if (passon)
{
gAgent.mControlsTakenPassedOnCount[i]--;
if (gAgent.mControlsTakenPassedOnCount[i] < 0)
{
gAgent.mControlsTakenPassedOnCount[i] = 0;
}
}
else
{
gAgent.mControlsTakenCount[i]--;
if (gAgent.mControlsTakenCount[i] < 0)
{
gAgent.mControlsTakenCount[i] = 0;
}
}
}
}
}
}
}
/*
// static
void LLAgent::processControlTake(LLMessageSystem *msg, void **)
{
U32 controls;
msg->getU32("Data", "Controls", controls );
U32 passon;
msg->getBOOL("Data", "PassToAgent", passon );
S32 i;
S32 total_count = 0;
for (i = 0; i < TOTAL_CONTROLS; i++)
{
if (controls & ( 1 << i))
{
if (passon)
{
gAgent.mControlsTakenPassedOnCount[i]++;
}
else
{
gAgent.mControlsTakenCount[i]++;
}
total_count++;
}
}
// Any control taken? If so, might be first time.
if (total_count > 0)
{
LLFirstUse::useOverrideKeys();
}
}
// static
void LLAgent::processControlRelease(LLMessageSystem *msg, void **)
{
U32 controls;
msg->getU32("Data", "Controls", controls );
U32 passon;
msg->getBOOL("Data", "PassToAgent", passon );
S32 i;
for (i = 0; i < TOTAL_CONTROLS; i++)
{
if (controls & ( 1 << i))
{
if (passon)
{
gAgent.mControlsTakenPassedOnCount[i]--;
if (gAgent.mControlsTakenPassedOnCount[i] < 0)
{
gAgent.mControlsTakenPassedOnCount[i] = 0;
}
}
else
{
gAgent.mControlsTakenCount[i]--;
if (gAgent.mControlsTakenCount[i] < 0)
{
gAgent.mControlsTakenCount[i] = 0;
}
}
}
}
}
*/
BOOL LLAgent::anyControlGrabbed() const
{
for (U32 i = 0; i < TOTAL_CONTROLS; i++)
{
if (gAgent.mControlsTakenCount[i] > 0)
return TRUE;
if (gAgent.mControlsTakenPassedOnCount[i] > 0)
return TRUE;
}
return FALSE;
}
BOOL LLAgent::isControlGrabbed(S32 control_index) const
{
return mControlsTakenCount[control_index] > 0;
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
}
void LLAgent::forceReleaseControls()
{
gMessageSystem->newMessage("ForceScriptControlRelease");
gMessageSystem->nextBlock("AgentData");
gMessageSystem->addUUID("AgentID", getID());
gMessageSystem->addUUID("SessionID", getSessionID());
sendReliableMessage();
}
void LLAgent::setHomePosRegion( const U64& region_handle, const LLVector3& pos_region)
{
mHaveHomePosition = TRUE;
mHomeRegionHandle = region_handle;
mHomePosRegion = pos_region;
}
BOOL LLAgent::getHomePosGlobal( LLVector3d* pos_global )
{
if(!mHaveHomePosition)
{
return FALSE;
}
F32 x = 0;
F32 y = 0;
from_region_handle( mHomeRegionHandle, &x, &y);
pos_global->setVec( x + mHomePosRegion.mV[VX], y + mHomePosRegion.mV[VY], mHomePosRegion.mV[VZ] );
return TRUE;
}
bool LLAgent::isInHomeRegion()
{
if(!mHaveHomePosition)
{
return false;
}
if (!getRegion())
{
return false;
}
if (getRegion()->getHandle() != mHomeRegionHandle)
{
return false;
}
return true;
}
gAgentAvatarp->clearVisualParamWeights();
gAgentAvatarp->updateVisualParams();
}
}
//---------------------------------------------------------------------------
// Teleport
//---------------------------------------------------------------------------
// teleportCore() - stuff to do on any teleport
// protected
bool LLAgent::teleportCore(bool is_local)
{
LL_DEBUGS("Teleport") << "In teleport core" << LL_ENDL;
Todd Stinson
committed
if ((TELEPORT_NONE != mTeleportState) && (mTeleportState != TELEPORT_PENDING))
LL_WARNS() << "Attempt to teleport when already teleporting." << LL_ENDL;
andreylproductengine
committed
// force stand up and stop a sitting animation (if any), see MAINT-3969
if (isAgentAvatarValid() && gAgentAvatarp->getParent() && gAgentAvatarp->isSitting())
{
gAgentAvatarp->getOffObject();
}
#if 0
// This should not exist. It has been added, removed, added, and now removed again.
// This change needs to come from the simulator. Otherwise, the agent ends up out of
// sync with other viewers. Discuss in DEV-14145/VWR-6744 before reenabling.
// Stop all animation before actual teleporting
for ( LLVOAvatar::AnimIterator anim_it= gAgentAvatarp->mPlayingAnimations.begin();
anim_it != gAgentAvatarp->mPlayingAnimations.end();
Melinda Green
committed
++anim_it)
{
gAgentAvatarp->stopMotion(anim_it->first);
Melinda Green
committed
}
gAgentAvatarp->processAnimationStateChanges();
Melinda Green
committed
}
// Don't call LLFirstUse::useTeleport because we don't know
// yet if the teleport will succeed. Look in
// process_teleport_location_reply
Eugene Mutavchi
committed
// close the map panel so we can see our destination.
// we don't close search floater, see EXT-5840.
LLFloaterReg::hideInstance("world_map");
James Cook
committed
LLFloaterReg::hideInstance("about_land");
// hide the Region/Estate floater
LLFloaterReg::hideInstance("region_info");