1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
|
/**
* @file llagent.h
* @brief LLAgent class header file
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLAGENT_H
#define LL_LLAGENT_H
#include "indra_constants.h"
#include "llevent.h" // LLObservable base class
#include "llagentdata.h" // gAgentID, gAgentSessionID
#include "llcharacter.h"
#include "llcoordframe.h" // for mFrameAgent
#include "llavatarappearancedefines.h"
#include "llpermissionsflags.h"
#include "llevents.h"
#include "v3dmath.h"
#include "httprequest.h"
#include "llcorehttputil.h"
#include <boost/function.hpp>
#include <boost/signals2.hpp>
extern const bool ANIMATE;
extern const U8 AGENT_STATE_TYPING; // Typing indication
extern const U8 AGENT_STATE_EDITING; // Set when agent has objects selected
class LLViewerRegion;
class LLMotion;
class LLMessageSystem;
class LLPermissions;
class LLHost;
class LLFriendObserver;
class LLAgentDropGroupViewerNode;
class LLAgentAccess;
class LLSLURL;
class LLUIColor;
class LLTeleportRequest;
typedef std::shared_ptr<LLTeleportRequest> LLTeleportRequestPtr;
//--------------------------------------------------------------------
// Types
//--------------------------------------------------------------------
enum EAnimRequest
{
ANIM_REQUEST_START,
ANIM_REQUEST_STOP
};
struct LLGroupData
{
LLUUID mID;
LLUUID mInsigniaID;
U64 mPowers;
bool mAcceptNotices;
bool mListInProfile;
S32 mContribution;
std::string mName;
};
class LLAgentListener;
//------------------------------------------------------------------------
// LLAgent
//------------------------------------------------------------------------
class LLAgent : public LLOldEvents::LLObservable
{
LOG_CLASS(LLAgent);
public:
friend class LLAgentDropGroupViewerNode;
/********************************************************************************
** **
** INITIALIZATION
**/
//--------------------------------------------------------------------
// Constructors / Destructors
//--------------------------------------------------------------------
public:
LLAgent();
virtual ~LLAgent();
void init();
void cleanup();
private:
//--------------------------------------------------------------------
// Login
//--------------------------------------------------------------------
public:
void onAppFocusGained();
void setFirstLogin(bool b);
// Return true if the database reported this login as the first for this particular user.
bool isFirstLogin() const { return mFirstLogin; }
bool isInitialized() const { return mInitialized; }
void setFeatureVersion(S32 version, S32 flags);
S32 getFeatureVersion();
void getFeatureVersionAndFlags(S32 &version, S32 &flags);
void showLatestFeatureNotification(const std::string key);
public:
std::string mMOTD; // Message of the day
private:
bool mInitialized;
bool mFirstLogin;
std::shared_ptr<LLAgentListener> mListener;
//--------------------------------------------------------------------
// Session
//--------------------------------------------------------------------
public:
const LLUUID& getID() const { return gAgentID; }
const LLUUID& getSessionID() const { return gAgentSessionID; }
// Note: NEVER send this value in the clear or over any weakly
// encrypted channel (such as simple XOR masking). If you are unsure
// ask Aaron or MarkL.
const LLUUID& getSecureSessionID() const { return mSecureSessionID; }
public:
LLUUID mSecureSessionID; // Secure token for this login session
/** Initialization
** **
*******************************************************************************/
/********************************************************************************
** **
** IDENTITY
**/
//--------------------------------------------------------------------
// Name
//--------------------------------------------------------------------
public:
//*TODO remove, is not used as of August 20, 2009
void buildFullnameAndTitle(std::string &name) const;
//--------------------------------------------------------------------
// Gender
//--------------------------------------------------------------------
public:
// On the very first login, outfit needs to be chosen by some
// mechanism, usually by loading the requested initial outfit. We
// don't render the avatar until the choice is made.
bool isOutfitChosen() const { return mOutfitChosen; }
void setOutfitChosen(bool b) { mOutfitChosen = b; }
private:
bool mOutfitChosen;
/** Identity
** **
*******************************************************************************/
/********************************************************************************
** **
** POSITION
**/
//--------------------------------------------------------------------
// Position
//--------------------------------------------------------------------
public:
typedef boost::signals2::signal<void(const LLVector3 &position_local, const LLVector3d &position_global)> position_signal_t;
LLVector3 getPosAgentFromGlobal(const LLVector3d &pos_global) const;
LLVector3d getPosGlobalFromAgent(const LLVector3 &pos_agent) const;
const LLVector3d &getPositionGlobal() const;
const LLVector3 &getPositionAgent();
// Call once per frame to update position, angles (radians).
void updateAgentPosition(const F32 dt, const F32 yaw, const S32 mouse_x, const S32 mouse_y);
void setPositionAgent(const LLVector3 ¢er);
boost::signals2::connection whenPositionChanged(position_signal_t::slot_type fn);
protected:
void propagate(const F32 dt); // ! BUG ! Should roll into updateAgentPosition
private:
mutable LLVector3d mPositionGlobal;
position_signal_t mOnPositionChanged;
LLVector3d mLastTestGlobal;
//--------------------------------------------------------------------
// Velocity
//--------------------------------------------------------------------
public:
LLVector3 getVelocity() const;
F32 getVelocityZ() const { return getVelocity().mV[VZ]; } // ! HACK !
//--------------------------------------------------------------------
// Coordinate System
//--------------------------------------------------------------------
public:
const LLCoordFrame& getFrameAgent() const { return mFrameAgent; }
void initOriginGlobal(const LLVector3d &origin_global); // Only to be used in ONE place
void resetAxes();
void resetAxes(const LLVector3 &look_at); // Makes reasonable left and up
// The following three get*Axis functions return direction avatar is looking, not camera.
const LLVector3& getAtAxis() const { return mFrameAgent.getAtAxis(); }
const LLVector3& getUpAxis() const { return mFrameAgent.getUpAxis(); }
const LLVector3& getLeftAxis() const { return mFrameAgent.getLeftAxis(); }
LLQuaternion getQuat() const; // Returns the quat that represents the rotation of the agent in the absolute frame
private:
LLVector3d mAgentOriginGlobal; // Origin of agent coords from global coords
LLCoordFrame mFrameAgent; // Agent position and view, agent-region coordinates
//--------------------------------------------------------------------
// Home
//--------------------------------------------------------------------
public:
void setStartPosition(U32 location_id); // Marks current location as start, sends information to servers
void setHomePosRegion(const U64& region_handle, const LLVector3& pos_region);
bool getHomePosGlobal(LLVector3d* pos_global);
bool isInHomeRegion();
private:
void setStartPositionSuccess(const LLSD &result);
bool mHaveHomePosition;
U64 mHomeRegionHandle;
LLVector3 mHomePosRegion;
//--------------------------------------------------------------------
// Parcel
//--------------------------------------------------------------------
public:
void changeParcels(); // called by LLViewerParcelMgr when we cross a parcel boundary
// Register a boost callback to be called when the agent changes parcels
typedef boost::function<void()> parcel_changed_callback_t;
boost::signals2::connection addParcelChangedCallback(parcel_changed_callback_t);
private:
static void capabilityReceivedCallback(const LLUUID ®ion_id, LLViewerRegion *regionp);
typedef boost::signals2::signal<void()> parcel_changed_signal_t;
parcel_changed_signal_t mParcelChangedSignal;
//--------------------------------------------------------------------
// Region
//--------------------------------------------------------------------
public:
void setRegion(LLViewerRegion *regionp);
LLViewerRegion *getRegion() const;
LLHost getRegionHost() const;
bool inPrelude();
// Capability
std::string getRegionCapability(const std::string &name); // short hand for if (getRegion()) { getRegion()->getCapability(name) }
/**
* Register a boost callback to be called when the agent changes regions
* Note that if you need to access a capability for the region, you may need to wait
* for the capabilities to be received, since in some cases your region changed
* callback will be called before the capabilities have been received. Your callback
* may need to look something like:
*
* LLViewerRegion* region = gAgent.getRegion();
* if (region->capabilitiesReceived())
* {
* useCapability(region);
* }
* else // Need to handle via callback after caps arrive.
* {
* region->setCapabilitiesReceivedCallback(boost::bind(&useCapability,region,_1));
* // you may or may not want to remove that callback
* }
*/
typedef boost::signals2::signal<void()> region_changed_signal_t;
boost::signals2::connection addRegionChangedCallback(const region_changed_signal_t::slot_type& cb);
void removeRegionChangedCallback(boost::signals2::connection callback);
void changeInterestListMode(const std::string & new_mode);
const std::string & getInterestListMode() const { return mInterestListMode; }
private:
LLViewerRegion *mRegionp;
region_changed_signal_t mRegionChangedSignal;
std::string mInterestListMode; // How agent wants regions to send updates
//--------------------------------------------------------------------
// History
//--------------------------------------------------------------------
public:
S32 getRegionsVisited() const;
F64 getDistanceTraveled() const;
void setDistanceTraveled(F64 dist) { mDistanceTraveled = dist; }
const LLVector3d &getLastPositionGlobal() const { return mLastPositionGlobal; }
void setLastPositionGlobal(const LLVector3d &pos) { mLastPositionGlobal = pos; }
private:
std::set<U64> mRegionsVisited; // Stat - what distinct regions has the avatar been to?
F64 mDistanceTraveled; // Stat - how far has the avatar moved?
LLVector3d mLastPositionGlobal; // Used to calculate travel distance
/** Position
** **
*******************************************************************************/
/********************************************************************************
** **
** ACTIONS
**/
//--------------------------------------------------------------------
// Fidget
//--------------------------------------------------------------------
// Trigger random fidget animations
public:
void fidget();
static void stopFidget();
private:
LLFrameTimer mFidgetTimer;
LLFrameTimer mFocusObjectFadeTimer;
LLFrameTimer mMoveTimer;
F32 mNextFidgetTime;
S32 mCurrentFidget;
//--------------------------------------------------------------------
// Fly
//--------------------------------------------------------------------
public:
bool getFlying() const;
void setFlying(bool fly, bool fail_sound = false);
static void toggleFlying();
static bool enableFlying();
bool canFly(); // Does this parcel allow you to fly?
static bool isSitting();
//--------------------------------------------------------------------
// Voice
//--------------------------------------------------------------------
public:
bool isVoiceConnected() const { return mVoiceConnected; }
void setVoiceConnected(const bool b) { mVoiceConnected = b; }
static void pressMicrophone(const LLSD& name);
static void releaseMicrophone(const LLSD& name);
static void toggleMicrophone(const LLSD& name);
static bool isMicrophoneOn(const LLSD& sdname);
static bool isActionAllowed(const LLSD& sdname);
private:
bool mVoiceConnected;
//--------------------------------------------------------------------
// Chat
//--------------------------------------------------------------------
public:
void heardChat(const LLUUID& id);
F32 getTypingTime() { return mTypingTimer.getElapsedTimeF32(); }
LLUUID getLastChatter() const { return mLastChatterID; }
F32 getNearChatRadius() { return mNearChatRadius; }
protected:
void ageChat(); // Helper function to prematurely age chat when agent is moving
private:
LLFrameTimer mChatTimer;
LLUUID mLastChatterID;
F32 mNearChatRadius;
//--------------------------------------------------------------------
// Typing
//--------------------------------------------------------------------
public:
void startTyping();
void stopTyping();
public:
// When the agent hasn't typed anything for this duration, it leaves the
// typing state (for both chat and IM).
static const F32 TYPING_TIMEOUT_SECS;
private:
LLFrameTimer mTypingTimer;
//--------------------------------------------------------------------
// AFK
//--------------------------------------------------------------------
public:
void setAFK();
void clearAFK();
bool getAFK() const;
static const F32 MIN_AFK_TIME;
//--------------------------------------------------------------------
// Run
//--------------------------------------------------------------------
public:
enum EDoubleTapRunMode
{
DOUBLETAP_NONE,
DOUBLETAP_FORWARD,
DOUBLETAP_BACKWARD,
DOUBLETAP_SLIDELEFT,
DOUBLETAP_SLIDERIGHT
};
void setAlwaysRun() { mbAlwaysRun = true; }
void clearAlwaysRun() { mbAlwaysRun = false; }
void setRunning() { mbRunning = true; }
void clearRunning() { mbRunning = false; }
void sendWalkRun(bool running);
bool getAlwaysRun() const { return mbAlwaysRun; }
bool getRunning() const { return mbRunning; }
public:
LLFrameTimer mDoubleTapRunTimer;
EDoubleTapRunMode mDoubleTapRunMode;
private:
bool mbAlwaysRun; // Should the avatar run by default rather than walk?
bool mbRunning; // Is the avatar trying to run right now?
bool mbTeleportKeepsLookAt; // Try to keep look-at after teleport is complete
//--------------------------------------------------------------------
// Sit and stand
//--------------------------------------------------------------------
public:
void standUp();
/// @brief ground-sit at agent's current position
void sitDown();
//--------------------------------------------------------------------
// Do Not Disturb
//--------------------------------------------------------------------
public:
void setDoNotDisturb(bool pIsDoNotDisturb);
bool isDoNotDisturb() const;
private:
bool mIsDoNotDisturb;
//--------------------------------------------------------------------
// Grab
//--------------------------------------------------------------------
public:
bool leftButtonGrabbed() const;
bool rotateGrabbed() const;
bool forwardGrabbed() const;
bool backwardGrabbed() const;
bool upGrabbed() const;
bool downGrabbed() const;
//--------------------------------------------------------------------
// Controls
//--------------------------------------------------------------------
public:
U32 getControlFlags();
void setControlFlags(U32 mask); // Performs bitwise mControlFlags |= mask
void clearControlFlags(U32 mask); // Performs bitwise mControlFlags &= ~mask
bool controlFlagsDirty() const;
void enableControlFlagReset();
void resetControlFlags();
bool anyControlGrabbed() const; // True iff a script has taken over a control
bool isControlGrabbed(S32 control_index) const;
// Send message to simulator to force grabbed controls to be
// released, in case of a poorly written script.
void forceReleaseControls();
void setFlagsDirty() { mbFlagsDirty = true; }
private:
S32 mControlsTakenCount[TOTAL_CONTROLS];
S32 mControlsTakenPassedOnCount[TOTAL_CONTROLS];
U32 mControlFlags; // Replacement for the mFooKey's
bool mbFlagsDirty;
bool mbFlagsNeedReset; // ! HACK ! For preventing incorrect flags sent when crossing region boundaries
//--------------------------------------------------------------------
// Animations
//--------------------------------------------------------------------
public:
void stopCurrentAnimations();
void requestStopMotion(LLMotion* motion);
void onAnimStop(const LLUUID& id);
void sendAnimationRequests(const std::vector<LLUUID> &anim_ids, EAnimRequest request);
void sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request);
void sendAnimationStateReset();
void sendRevokePermissions(const LLUUID & target, U32 permissions);
void endAnimationUpdateUI();
void unpauseAnimation() { mPauseRequest = NULL; }
bool getCustomAnim() const { return mCustomAnim; }
void setCustomAnim(bool anim) { mCustomAnim = anim; }
typedef boost::signals2::signal<void ()> camera_signal_t;
boost::signals2::connection setMouselookModeInCallback( const camera_signal_t::slot_type& cb );
boost::signals2::connection setMouselookModeOutCallback( const camera_signal_t::slot_type& cb );
private:
camera_signal_t* mMouselookModeInSignal;
camera_signal_t* mMouselookModeOutSignal;
bool mCustomAnim; // Current animation is ANIM_AGENT_CUSTOMIZE ?
LLPointer<LLPauseRequestHandle> mPauseRequest;
bool mViewsPushed; // Keep track of whether or not we have pushed views
/** Animation
** **
*******************************************************************************/
/********************************************************************************
** **
** MOVEMENT
**/
//--------------------------------------------------------------------
// Movement from user input
//--------------------------------------------------------------------
// All set the appropriate animation flags.
// All turn off autopilot and make sure the camera is behind the avatar.
// Direction is either positive, zero, or negative
public:
void moveAt(S32 direction, bool reset_view = true);
void moveAtNudge(S32 direction);
void moveLeft(S32 direction);
void moveLeftNudge(S32 direction);
void moveUp(S32 direction);
void moveYaw(F32 mag, bool reset_view = true);
void movePitch(F32 mag);
bool isMovementLocked() const { return mMovementKeysLocked; }
void setMovementLocked(bool set_locked) { mMovementKeysLocked = set_locked; }
//--------------------------------------------------------------------
// Move the avatar's frame
//--------------------------------------------------------------------
public:
void rotate(F32 angle, const LLVector3 &axis);
void rotate(F32 angle, F32 x, F32 y, F32 z);
void rotate(const LLMatrix3 &matrix);
void rotate(const LLQuaternion &quaternion);
void pitch(F32 angle);
void roll(F32 angle);
void yaw(F32 angle);
LLVector3 getReferenceUpVector();
//--------------------------------------------------------------------
// Autopilot
//--------------------------------------------------------------------
public:
bool getAutoPilot() const { return mAutoPilot; }
LLVector3d getAutoPilotTargetGlobal() const { return mAutoPilotTargetGlobal; }
LLUUID getAutoPilotLeaderID() const { return mLeaderID; }
F32 getAutoPilotStopDistance() const { return mAutoPilotStopDistance; }
F32 getAutoPilotTargetDist() const { return mAutoPilotTargetDist; }
bool getAutoPilotUseRotation() const { return mAutoPilotUseRotation; }
LLVector3 getAutoPilotTargetFacing() const { return mAutoPilotTargetFacing; }
F32 getAutoPilotRotationThreshold() const { return mAutoPilotRotationThreshold; }
std::string getAutoPilotBehaviorName() const { return mAutoPilotBehaviorName; }
void startAutoPilotGlobal(const LLVector3d &pos_global,
const std::string& behavior_name = std::string(),
const LLQuaternion *target_rotation = NULL,
void (*finish_callback)(bool, void *) = NULL, void *callback_data = NULL,
F32 stop_distance = 0.f, F32 rotation_threshold = 0.03f,
bool allow_flying = true);
void startFollowPilot(const LLUUID &leader_id, bool allow_flying = true, F32 stop_distance = 0.5f);
void stopAutoPilot(bool user_cancel = false);
void setAutoPilotTargetGlobal(const LLVector3d &target_global);
void autoPilot(F32 *delta_yaw); // Autopilot walking action, angles in radians
void renderAutoPilotTarget();
private:
bool mAutoPilot;
bool mAutoPilotFlyOnStop;
bool mAutoPilotAllowFlying;
LLVector3d mAutoPilotTargetGlobal;
F32 mAutoPilotStopDistance;
bool mAutoPilotUseRotation;
LLVector3 mAutoPilotTargetFacing;
F32 mAutoPilotTargetDist;
S32 mAutoPilotNoProgressFrameCount;
F32 mAutoPilotRotationThreshold;
std::string mAutoPilotBehaviorName;
void (*mAutoPilotFinishedCallback)(bool, void *);
void* mAutoPilotCallbackData;
LLUUID mLeaderID;
bool mMovementKeysLocked;
/** Movement
** **
*******************************************************************************/
/********************************************************************************
** **
** TELEPORT
**/
public:
enum ETeleportState
{
TELEPORT_NONE = 0, // No teleport in progress
TELEPORT_START = 1, // Transition to REQUESTED. Viewer has sent a TeleportRequest to the source simulator
TELEPORT_REQUESTED = 2, // Waiting for source simulator to respond
TELEPORT_MOVING = 3, // Viewer has received destination location from source simulator
TELEPORT_START_ARRIVAL = 4, // Transition to ARRIVING. Viewer has received avatar update, etc., from destination simulator
TELEPORT_ARRIVING = 5, // Make the user wait while content "pre-caches"
TELEPORT_LOCAL = 6, // Teleporting in-sim without showing the progress screen
TELEPORT_PENDING = 7
};
static std::map<S32, std::string> sTeleportStateName;
static const std::string& teleportStateName(S32);
const std::string& getTeleportStateName() const;
public:
static void parseTeleportMessages(const std::string& xml_filename);
const void getTeleportSourceSLURL(LLSLURL& slurl) const;
public:
// ! TODO ! Define ERROR and PROGRESS enums here instead of exposing the mappings.
static std::map<std::string, std::string> sTeleportErrorMessages;
static std::map<std::string, std::string> sTeleportProgressMessages;
private:
LLSLURL * mTeleportSourceSLURL; // SLURL where last TP began
//--------------------------------------------------------------------
// Teleport Actions
//--------------------------------------------------------------------
public:
void teleportViaLandmark(const LLUUID& landmark_id); // Teleport to a landmark
void teleportHome() { teleportViaLandmark(LLUUID::null); } // Go home
void teleportViaLure(const LLUUID& lure_id, bool godlike); // To an invited location
void teleportViaLocation(const LLVector3d& pos_global); // To a global location - this will probably need to be deprecated
void teleportViaLocationLookAt(const LLVector3d& pos_global);// To a global location, preserving camera rotation
void teleportCancel(); // May or may not be allowed by server
void restoreCanceledTeleportRequest();
bool canRestoreCanceledTeleport() { return mTeleportCanceled != NULL; }
bool getTeleportKeepsLookAt() { return mbTeleportKeepsLookAt; } // Whether look-at reset after teleport
protected:
bool teleportCore(bool is_local = false); // Stuff for all teleports; returns true if the teleport can proceed
//--------------------------------------------------------------------
// Teleport State
//--------------------------------------------------------------------
public:
bool hasRestartableFailedTeleportRequest();
void restartFailedTeleportRequest();
void clearTeleportRequest();
void setMaturityRatingChangeDuringTeleport(U8 pMaturityRatingChange);
void sheduleTeleportIM();
private:
friend class LLTeleportRequest;
friend class LLTeleportRequestViaLandmark;
friend class LLTeleportRequestViaLure;
friend class LLTeleportRequestViaLocation;
friend class LLTeleportRequestViaLocationLookAt;
LLTeleportRequestPtr mTeleportRequest;
LLTeleportRequestPtr mTeleportCanceled;
boost::signals2::connection mTeleportFinishedSlot;
boost::signals2::connection mTeleportFailedSlot;
bool mIsMaturityRatingChangingDuringTeleport;
bool mTPNeedsNeabyChatSeparator;
U8 mMaturityRatingChange;
bool hasPendingTeleportRequest();
void startTeleportRequest();
void teleportRequest(const U64& region_handle,
const LLVector3& pos_local, // Go to a named location home
bool look_at_from_camera = false);
void doTeleportViaLandmark(const LLUUID& landmark_id); // Teleport to a landmark
void doTeleportViaLure(const LLUUID& lure_id, bool godlike); // To an invited location
void doTeleportViaLocation(const LLVector3d& pos_global); // To a global location - this will probably need to be deprecated
void doTeleportViaLocationLookAt(const LLVector3d& pos_global);// To a global location, preserving camera rotation
void handleTeleportFinished();
void handleTeleportFailed();
static void addTPNearbyChatSeparator();
static void onCapabilitiesReceivedAfterTeleport();
//--------------------------------------------------------------------
// Teleport State
//--------------------------------------------------------------------
public:
ETeleportState getTeleportState() const;
void setTeleportState(ETeleportState state);
private:
ETeleportState mTeleportState;
//--------------------------------------------------------------------
// Teleport Message
//--------------------------------------------------------------------
public:
const std::string& getTeleportMessage() const { return mTeleportMessage; }
void setTeleportMessage(const std::string& message) { mTeleportMessage = message; }
private:
std::string mTeleportMessage;
/** Teleport
** **
*******************************************************************************/
// Build
public:
bool canEditParcel() const { return mCanEditParcel; }
private:
static void setCanEditParcel();
bool mCanEditParcel;
/********************************************************************************
** **
** ACCESS
**/
public:
// Checks if agent can modify an object based on the permissions and the agent's proxy status.
bool isGrantedProxy(const LLPermissions& perm);
bool allowOperation(PermissionBit op,
const LLPermissions& perm,
U64 group_proxy_power = 0,
U8 god_minimum = GOD_MAINTENANCE);
const LLAgentAccess& getAgentAccess();
bool canManageEstate() const;
bool getAdminOverride() const;
private:
LLAgentAccess * mAgentAccess;
//--------------------------------------------------------------------
// God
//--------------------------------------------------------------------
public:
bool isGodlike() const;
bool isGodlikeWithoutAdminMenuFakery() const;
U8 getGodLevel() const;
void setAdminOverride(bool b);
void setGodLevel(U8 god_level);
void requestEnterGodMode();
void requestLeaveGodMode();
typedef boost::function<void (U8)> god_level_change_callback_t;
typedef boost::signals2::signal<void (U8)> god_level_change_signal_t;
typedef boost::signals2::connection god_level_change_slot_t;
god_level_change_slot_t registerGodLevelChanageListener(god_level_change_callback_t pGodLevelChangeCallback);
private:
god_level_change_signal_t mGodLevelChangeSignal;
//--------------------------------------------------------------------
// Maturity
//--------------------------------------------------------------------
public:
// Note: this is a prime candidate for pulling out into a Maturity class.
// Rather than just expose the preference setting, we're going to actually
// expose what the client code cares about -- what the user should see
// based on a combination of the is* and prefers* flags, combined with god bit.
bool wantsPGOnly() const;
bool canAccessMature() const;
bool canAccessAdult() const;
bool canAccessMaturityInRegion( U64 region_handle ) const;
bool canAccessMaturityAtGlobal( LLVector3d pos_global ) const;
bool prefersPG() const;
bool prefersMature() const;
bool prefersAdult() const;
bool isTeen() const;
bool isMature() const;
bool isAdult() const;
void setMaturity(char text);
static int convertTextToMaturity(char text);
private:
bool mIsDoSendMaturityPreferenceToServer;
unsigned int mMaturityPreferenceRequestId;
unsigned int mMaturityPreferenceResponseId;
unsigned int mMaturityPreferenceNumRetries;
U8 mLastKnownRequestMaturity;
U8 mLastKnownResponseMaturity;
LLCore::HttpRequest::policy_t mHttpPolicy;
bool isMaturityPreferenceSyncedWithServer() const;
void sendMaturityPreferenceToServer(U8 pPreferredMaturity);
void processMaturityPreferenceFromServer(const LLSD &result, U8 perferredMaturity);
void handlePreferredMaturityResult(U8 pServerMaturity);
void handlePreferredMaturityError();
void reportPreferredMaturitySuccess();
void reportPreferredMaturityError();
// Maturity callbacks for PreferredMaturity control variable
void handleMaturity(const LLSD &pNewValue);
bool validateMaturity(const LLSD& newvalue);
/** Access
** **
*******************************************************************************/
/********************************************************************************
** **
** RENDERING
**/
public:
LLQuaternion getHeadRotation();
bool needsRenderAvatar(); // true when camera mode is such that your own avatar should draw
bool needsRenderHead();
void setShowAvatar(bool show) { mShowAvatar = show; }
bool getShowAvatar() const { return mShowAvatar; }
private:
bool mShowAvatar; // Should we render the avatar?
//--------------------------------------------------------------------
// Rendering state bitmap helpers
//--------------------------------------------------------------------
public:
void setRenderState(U8 newstate);
void clearRenderState(U8 clearstate);
U8 getRenderState();
private:
U8 mRenderState; // Current behavior state of agent
//--------------------------------------------------------------------
// HUD
//--------------------------------------------------------------------
public:
const LLColor4 &getEffectColor();
void setEffectColor(const LLColor4 &color);
private:
LLUIColor * mEffectColor;
/** Rendering
** **
*******************************************************************************/
/********************************************************************************
** **
** GROUPS
**/
public:
const LLUUID &getGroupID() const { return mGroupID; }
// Get group information by group_id, or false if not in group.
bool getGroupData(const LLUUID& group_id, LLGroupData& data) const;
// Get just the agent's contribution to the given group.
S32 getGroupContribution(const LLUUID& group_id) const;
// Update internal datastructures and update the server.
bool setGroupContribution(const LLUUID& group_id, S32 contribution);
bool setUserGroupFlags(const LLUUID& group_id, bool accept_notices, bool list_in_profile);
const std::string &getGroupName() const { return mGroupName; }
bool canJoinGroups() const;
private:
std::string mGroupName;
LLUUID mGroupID;
//--------------------------------------------------------------------
// Group Membership
//--------------------------------------------------------------------
public:
// Checks against all groups in the entire agent group list.
bool isInGroup(const LLUUID& group_id, bool ingnore_God_mod = false) const;
protected:
// Only used for building titles.
bool isGroupMember() const { return !mGroupID.isNull(); }
public:
std::vector<LLGroupData> mGroups;
//--------------------------------------------------------------------
// Group Title
//--------------------------------------------------------------------
public:
void setHideGroupTitle(bool hide) { mHideGroupTitle = hide; }
bool isGroupTitleHidden() const { return mHideGroupTitle; }
private:
std::string mGroupTitle; // Honorific, like "Sir"
bool mHideGroupTitle;
//--------------------------------------------------------------------
// Group Powers
//--------------------------------------------------------------------
public:
bool hasPowerInGroup(const LLUUID& group_id, U64 power) const;
bool hasPowerInActiveGroup(const U64 power) const;
U64 getPowerInGroup(const LLUUID& group_id) const;
U64 mGroupPowers;
//--------------------------------------------------------------------
// Friends
//--------------------------------------------------------------------
public:
void observeFriends();
void friendsChanged();
private:
LLFriendObserver* mFriendObserver;
std::set<LLUUID> mProxyForAgents;
/** Groups
** **
*******************************************************************************/
/********************************************************************************
** **
** MESSAGING
**/
//--------------------------------------------------------------------
// Send
//--------------------------------------------------------------------
public:
void sendMessage(); // Send message to this agent's region
void sendReliableMessage();
void sendAgentDataUpdateRequest();
void sendAgentUserInfoRequest();
// IM to Email and Online visibility
void sendAgentUpdateUserInfo(const std::string& directory_visibility);
private:
void requestAgentUserInfoCoro(std::string capurl);
void updateAgentUserInfoCoro(std::string capurl, std::string directory_visibility);
// DEPRECATED: may be removed when User Info cap propagates
void sendAgentUserInfoRequestMessage();
void sendAgentUpdateUserInfoMessage(const std::string& directory_visibility);
//--------------------------------------------------------------------
// Receive
//--------------------------------------------------------------------
public:
static void processAgentDataUpdate(LLMessageSystem *msg, void **);
static void processAgentGroupDataUpdate(LLMessageSystem *msg, void **);
static void processAgentDropGroup(LLMessageSystem *msg, void **);
static void processScriptControlChange(LLMessageSystem *msg, void **);
/** Messaging
** **
*******************************************************************************/
/********************************************************************************
** **
** UTILITY
**/
public:
typedef LLCoreHttpUtil::HttpCoroutineAdapter::completionCallback_t httpCallback_t;
/// Utilities for allowing the the agent sub managers to post and get via
/// HTTP using the agent's policy settings and headers.
bool requestPostCapability(const std::string &capName, LLSD &postData, httpCallback_t cbSuccess = NULL, httpCallback_t cbFailure = NULL);
bool requestGetCapability(const std::string &capName, httpCallback_t cbSuccess = NULL, httpCallback_t cbFailure = NULL);
LLCore::HttpRequest::policy_t getAgentPolicy() const { return mHttpPolicy; }
/** Utility
** **
*******************************************************************************/
/********************************************************************************
** **
** DEBUGGING
**/
public:
static void dumpGroupInfo();
static void clearVisualParams(void *);
friend std::ostream& operator<<(std::ostream &s, const LLAgent &sphere);
/** Debugging
** **
*******************************************************************************/
};
extern LLAgent gAgent;
inline bool operator==(const LLGroupData &a, const LLGroupData &b)
{
return (a.mID == b.mID);
}
#endif
|