aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs575
1 files changed, 288 insertions, 287 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index f049b78..ce63946 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -100,16 +100,15 @@ namespace OpenSim.Region.Framework.Scenes
100 100
101 public UUID currentParcelUUID = UUID.Zero; 101 public UUID currentParcelUUID = UUID.Zero;
102 102
103 private ISceneViewer m_sceneViewer; 103 protected ScenePresenceAnimator m_animator;
104
105 /// <value> 104 /// <value>
106 /// The animator for this avatar 105 /// The animator for this avatar
107 /// </value> 106 /// </value>
108 public ScenePresenceAnimator Animator 107 public ScenePresenceAnimator Animator
109 { 108 {
110 get { return m_animator; } 109 get { return m_animator; }
110 private set { m_animator = value; }
111 } 111 }
112 protected ScenePresenceAnimator m_animator;
113 112
114 /// <summary> 113 /// <summary>
115 /// Attachments recorded on this avatar. 114 /// Attachments recorded on this avatar.
@@ -137,8 +136,6 @@ namespace OpenSim.Region.Framework.Scenes
137 private Vector3 m_lastVelocity; 136 private Vector3 m_lastVelocity;
138 //private int m_lastTerseSent; 137 //private int m_lastTerseSent;
139 138
140 private bool m_updateflag;
141 private byte m_movementflag;
142 private Vector3? m_forceToApply; 139 private Vector3? m_forceToApply;
143 private TeleportFlags m_teleportFlags; 140 private TeleportFlags m_teleportFlags;
144 public TeleportFlags TeleportFlags 141 public TeleportFlags TeleportFlags
@@ -159,25 +156,11 @@ namespace OpenSim.Region.Framework.Scenes
159 156
160 private float m_sitAvatarHeight = 2.0f; 157 private float m_sitAvatarHeight = 2.0f;
161 158
162 private int m_godLevel;
163 private int m_userLevel;
164
165 private bool m_invulnerable = true;
166
167 private Vector3 m_lastChildAgentUpdatePosition; 159 private Vector3 m_lastChildAgentUpdatePosition;
168 private Vector3 m_lastChildAgentUpdateCamPosition; 160 private Vector3 m_lastChildAgentUpdateCamPosition;
169 161
170 private int m_perfMonMS; 162 private int m_perfMonMS;
171 163
172 private bool m_setAlwaysRun;
173
174 private bool m_forceFly;
175 private bool m_flyDisabled;
176
177 private float m_speedModifier = 1.0f;
178
179 private Quaternion m_bodyRot = Quaternion.Identity;
180
181 private const int LAND_VELOCITYMAG_MAX = 12; 164 private const int LAND_VELOCITYMAG_MAX = 12;
182 165
183 public bool IsRestrictedToRegion; 166 public bool IsRestrictedToRegion;
@@ -190,22 +173,12 @@ namespace OpenSim.Region.Framework.Scenes
190 173
191 private readonly Vector3[] Dir_Vectors = new Vector3[9]; 174 private readonly Vector3[] Dir_Vectors = new Vector3[9];
192 175
193 // Position of agent's camera in world (region cordinates)
194 protected Vector3 m_CameraCenter;
195 protected Vector3 m_lastCameraCenter;
196 176
197 protected Timer m_reprioritization_timer; 177 protected Timer m_reprioritization_timer;
198 protected bool m_reprioritizing; 178 protected bool m_reprioritizing;
199 protected bool m_reprioritization_called; 179 protected bool m_reprioritization_called;
200 180
201 // Use these three vectors to figure out what the agent is looking at
202 // Convert it to a Matrix and/or Quaternion
203 protected Vector3 m_CameraAtAxis;
204 protected Vector3 m_CameraLeftAxis;
205 protected Vector3 m_CameraUpAxis;
206 private AgentManager.ControlFlags m_AgentControlFlags;
207 private Quaternion m_headrotation = Quaternion.Identity; 181 private Quaternion m_headrotation = Quaternion.Identity;
208 private byte m_state;
209 182
210 //Reuse the Vector3 instead of creating a new one on the UpdateMovement method 183 //Reuse the Vector3 instead of creating a new one on the UpdateMovement method
211// private Vector3 movementvector; 184// private Vector3 movementvector;
@@ -234,11 +207,19 @@ namespace OpenSim.Region.Framework.Scenes
234 //private int m_moveToPositionStateStatus; 207 //private int m_moveToPositionStateStatus;
235 //***************************************************** 208 //*****************************************************
236 209
237 // Agent's Draw distance.
238 protected float m_DrawDistance;
239
240 protected AvatarAppearance m_appearance; 210 protected AvatarAppearance m_appearance;
241 211
212 public AvatarAppearance Appearance
213 {
214 get { return m_appearance; }
215 set
216 {
217 m_appearance = value;
218// m_log.DebugFormat("[SCENE PRESENCE]: Set appearance for {0} to {1}", Name, value);
219 }
220 }
221
222
242 // neighbouring regions we have enabled a child agent in 223 // neighbouring regions we have enabled a child agent in
243 // holds the seed cap for the child agent in that region 224 // holds the seed cap for the child agent in that region
244 private Dictionary<ulong, string> m_knownChildRegions = new Dictionary<ulong, string>(); 225 private Dictionary<ulong, string> m_knownChildRegions = new Dictionary<ulong, string>();
@@ -250,6 +231,7 @@ namespace OpenSim.Region.Framework.Scenes
250 public List<string> InTransitScriptStates 231 public List<string> InTransitScriptStates
251 { 232 {
252 get { return m_InTransitScriptStates; } 233 get { return m_InTransitScriptStates; }
234 private set { m_InTransitScriptStates = value; }
253 } 235 }
254 private List<string> m_InTransitScriptStates = new List<string>(); 236 private List<string> m_InTransitScriptStates = new List<string>();
255 237
@@ -278,8 +260,6 @@ namespace OpenSim.Region.Framework.Scenes
278 string m_callbackURI; 260 string m_callbackURI;
279 UUID m_originRegionID; 261 UUID m_originRegionID;
280 262
281 ulong m_rootRegionHandle;
282
283 /// <value> 263 /// <value>
284 /// Script engines present in the scene 264 /// Script engines present in the scene
285 /// </value> 265 /// </value>
@@ -287,6 +267,8 @@ namespace OpenSim.Region.Framework.Scenes
287 267
288 #region Properties 268 #region Properties
289 269
270 protected PhysicsActor m_physicsActor;
271
290 /// <summary> 272 /// <summary>
291 /// Physical scene representation of this Avatar. 273 /// Physical scene representation of this Avatar.
292 /// </summary> 274 /// </summary>
@@ -296,69 +278,102 @@ namespace OpenSim.Region.Framework.Scenes
296 get { return m_physicsActor; } 278 get { return m_physicsActor; }
297 } 279 }
298 280
281 private byte m_movementflag;
282
299 public byte MovementFlag 283 public byte MovementFlag
300 { 284 {
301 set { m_movementflag = value; } 285 set { m_movementflag = value; }
302 get { return m_movementflag; } 286 get { return m_movementflag; }
303 } 287 }
304 288
289 private bool m_updateflag;
290
305 public bool Updated 291 public bool Updated
306 { 292 {
307 set { m_updateflag = value; } 293 set { m_updateflag = value; }
308 get { return m_updateflag; } 294 get { return m_updateflag; }
309 } 295 }
310 296
297 private bool m_invulnerable = true;
298
311 public bool Invulnerable 299 public bool Invulnerable
312 { 300 {
313 set { m_invulnerable = value; } 301 set { m_invulnerable = value; }
314 get { return m_invulnerable; } 302 get { return m_invulnerable; }
315 } 303 }
316 304
305 private int m_userLevel;
306
317 public int UserLevel 307 public int UserLevel
318 { 308 {
319 get { return m_userLevel; } 309 get { return m_userLevel; }
310 private set { m_userLevel = value; }
320 } 311 }
321 312
313 private int m_godLevel;
314
322 public int GodLevel 315 public int GodLevel
323 { 316 {
324 get { return m_godLevel; } 317 get { return m_godLevel; }
318 private set { m_godLevel = value; }
325 } 319 }
326 320
321 private ulong m_rootRegionHandle;
322
327 public ulong RegionHandle 323 public ulong RegionHandle
328 { 324 {
329 get { return m_rootRegionHandle; } 325 get { return m_rootRegionHandle; }
326 private set { m_rootRegionHandle = value; }
330 } 327 }
331 328
329 #region Client Camera
330 // Position of agent's camera in world (region cordinates)
331 protected Vector3 m_lastCameraPosition;
332
333 protected Vector3 m_CameraPosition;
334
332 public Vector3 CameraPosition 335 public Vector3 CameraPosition
333 { 336 {
334 get { return m_CameraCenter; } 337 get { return m_CameraPosition; }
338 private set { m_CameraPosition = value; }
335 } 339 }
336 340
337 public Quaternion CameraRotation 341 public Quaternion CameraRotation
338 { 342 {
339 get { return Util.Axes2Rot(m_CameraAtAxis, m_CameraLeftAxis, m_CameraUpAxis); } 343 get { return Util.Axes2Rot(CameraAtAxis, CameraLeftAxis, CameraUpAxis); }
340 } 344 }
341 345
346 // Use these three vectors to figure out what the agent is looking at
347 // Convert it to a Matrix and/or Quaternion
348 //
349 protected Vector3 m_CameraAtAxis;
350 protected Vector3 m_CameraLeftAxis;
351 protected Vector3 m_CameraUpAxis;
352
342 public Vector3 CameraAtAxis 353 public Vector3 CameraAtAxis
343 { 354 {
344 get { return m_CameraAtAxis; } 355 get { return m_CameraAtAxis; }
356 private set { m_CameraAtAxis = value; }
345 } 357 }
346 358
359
347 public Vector3 CameraLeftAxis 360 public Vector3 CameraLeftAxis
348 { 361 {
349 get { return m_CameraLeftAxis; } 362 get { return m_CameraLeftAxis; }
363 private set { m_CameraLeftAxis = value; }
350 } 364 }
351 365
352 public Vector3 CameraUpAxis 366 public Vector3 CameraUpAxis
353 { 367 {
354 get { return m_CameraUpAxis; } 368 get { return m_CameraUpAxis; }
369 private set { m_CameraUpAxis = value; }
355 } 370 }
356 371
357 public Vector3 Lookat 372 public Vector3 Lookat
358 { 373 {
359 get 374 get
360 { 375 {
361 Vector3 a = new Vector3(m_CameraAtAxis.X, m_CameraAtAxis.Y, 0); 376 Vector3 a = new Vector3(CameraAtAxis.X, CameraAtAxis.Y, 0);
362 377
363 if (a == Vector3.Zero) 378 if (a == Vector3.Zero)
364 return a; 379 return a;
@@ -366,20 +381,10 @@ namespace OpenSim.Region.Framework.Scenes
366 return Util.GetNormalizedVector(a); 381 return Util.GetNormalizedVector(a);
367 } 382 }
368 } 383 }
384 #endregion
369 385
370 private readonly string m_firstname; 386 public readonly string Firstname;
371 387 public readonly string Lastname;
372 public string Firstname
373 {
374 get { return m_firstname; }
375 }
376
377 private readonly string m_lastname;
378
379 public string Lastname
380 {
381 get { return m_lastname; }
382 }
383 388
384 private string m_grouptitle; 389 private string m_grouptitle;
385 390
@@ -389,9 +394,13 @@ namespace OpenSim.Region.Framework.Scenes
389 set { m_grouptitle = value; } 394 set { m_grouptitle = value; }
390 } 395 }
391 396
397 // Agent's Draw distance.
398 protected float m_DrawDistance;
399
392 public float DrawDistance 400 public float DrawDistance
393 { 401 {
394 get { return m_DrawDistance; } 402 get { return m_DrawDistance; }
403 private set { m_DrawDistance = value; }
395 } 404 }
396 405
397 protected bool m_allowMovement = true; 406 protected bool m_allowMovement = true;
@@ -402,6 +411,8 @@ namespace OpenSim.Region.Framework.Scenes
402 set { m_allowMovement = value; } 411 set { m_allowMovement = value; }
403 } 412 }
404 413
414 private bool m_setAlwaysRun;
415
405 public bool SetAlwaysRun 416 public bool SetAlwaysRun
406 { 417 {
407 get 418 get
@@ -425,12 +436,16 @@ namespace OpenSim.Region.Framework.Scenes
425 } 436 }
426 } 437 }
427 438
439 private byte m_state;
440
428 public byte State 441 public byte State
429 { 442 {
430 get { return m_state; } 443 get { return m_state; }
431 set { m_state = value; } 444 set { m_state = value; }
432 } 445 }
433 446
447 private AgentManager.ControlFlags m_AgentControlFlags;
448
434 public uint AgentControlFlags 449 public uint AgentControlFlags
435 { 450 {
436 get { return (uint)m_AgentControlFlags; } 451 get { return (uint)m_AgentControlFlags; }
@@ -442,11 +457,10 @@ namespace OpenSim.Region.Framework.Scenes
442 /// </summary> 457 /// </summary>
443 private IClientAPI m_controllingClient; 458 private IClientAPI m_controllingClient;
444 459
445 protected PhysicsActor m_physicsActor;
446
447 public IClientAPI ControllingClient 460 public IClientAPI ControllingClient
448 { 461 {
449 get { return m_controllingClient; } 462 get { return m_controllingClient; }
463 private set { m_controllingClient = value; }
450 } 464 }
451 465
452 public IClientCore ClientView 466 public IClientCore ClientView
@@ -455,6 +469,7 @@ namespace OpenSim.Region.Framework.Scenes
455 } 469 }
456 470
457 protected Vector3 m_parentPosition; 471 protected Vector3 m_parentPosition;
472
458 public Vector3 ParentPosition 473 public Vector3 ParentPosition
459 { 474 {
460 get { return m_parentPosition; } 475 get { return m_parentPosition; }
@@ -468,10 +483,9 @@ namespace OpenSim.Region.Framework.Scenes
468 { 483 {
469 get 484 get
470 { 485 {
471 PhysicsActor actor = m_physicsActor; 486 if (PhysicsActor != null)
472 if (actor != null)
473 { 487 {
474 m_pos = actor.Position; 488 m_pos = PhysicsActor.Position;
475 489
476// m_log.DebugFormat( 490// m_log.DebugFormat(
477// "[SCENE PRESENCE]: Set position {0} for {1} in {2} via getting AbsolutePosition!", 491// "[SCENE PRESENCE]: Set position {0} for {1} in {2} via getting AbsolutePosition!",
@@ -484,7 +498,7 @@ namespace OpenSim.Region.Framework.Scenes
484 // the avatar is seated, this value will also 498 // the avatar is seated, this value will also
485 // be used as the location to unsit to. 499 // be used as the location to unsit to.
486 // 500 //
487 // If m_parentID is not 0, assume we are a seated avatar 501 // If ParentID is not 0, assume we are a seated avatar
488 // and we should return the position based on the sittarget 502 // and we should return the position based on the sittarget
489 // offset and rotation of the prim we are seated on. 503 // offset and rotation of the prim we are seated on.
490 // 504 //
@@ -492,16 +506,16 @@ namespace OpenSim.Region.Framework.Scenes
492 // in the sim unless the avatar is on a sit target. While 506 // in the sim unless the avatar is on a sit target. While
493 // on a sit target, m_pos will contain the desired offset 507 // on a sit target, m_pos will contain the desired offset
494 // without the parent rotation applied. 508 // without the parent rotation applied.
495 if (m_parentID != 0) 509 if (ParentID != 0)
496 { 510 {
497 SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID); 511 SceneObjectPart part = m_scene.GetSceneObjectPart(ParentID);
498 if (part != null) 512 if (part != null)
499 { 513 {
500 return m_parentPosition + (m_pos * part.GetWorldRotation()); 514 return ParentPosition + (m_pos * part.GetWorldRotation());
501 } 515 }
502 else 516 else
503 { 517 {
504 return m_parentPosition + m_pos; 518 return ParentPosition + m_pos;
505 } 519 }
506 } 520 }
507 } 521 }
@@ -510,13 +524,12 @@ namespace OpenSim.Region.Framework.Scenes
510 } 524 }
511 set 525 set
512 { 526 {
513 PhysicsActor actor = m_physicsActor; 527 if (PhysicsActor != null)
514 if (actor != null)
515 { 528 {
516 try 529 try
517 { 530 {
518 lock (m_scene.SyncRoot) 531 lock (m_scene.SyncRoot)
519 m_physicsActor.Position = value; 532 PhysicsActor.Position = value;
520 } 533 }
521 catch (Exception e) 534 catch (Exception e)
522 { 535 {
@@ -525,7 +538,7 @@ namespace OpenSim.Region.Framework.Scenes
525 } 538 }
526 539
527 m_pos = value; 540 m_pos = value;
528 m_parentPosition = Vector3.Zero; 541 ParentPosition = Vector3.Zero;
529 542
530// m_log.DebugFormat( 543// m_log.DebugFormat(
531// "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}", 544// "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}",
@@ -549,10 +562,9 @@ namespace OpenSim.Region.Framework.Scenes
549 { 562 {
550 get 563 get
551 { 564 {
552 PhysicsActor actor = m_physicsActor; 565 if (PhysicsActor != null)
553 if (actor != null)
554 { 566 {
555 m_velocity = actor.Velocity; 567 m_velocity = PhysicsActor.Velocity;
556 568
557// m_log.DebugFormat( 569// m_log.DebugFormat(
558// "[SCENE PRESENCE]: Set velocity {0} for {1} in {2} via getting Velocity!", 570// "[SCENE PRESENCE]: Set velocity {0} for {1} in {2} via getting Velocity!",
@@ -563,13 +575,12 @@ namespace OpenSim.Region.Framework.Scenes
563 } 575 }
564 set 576 set
565 { 577 {
566 PhysicsActor actor = m_physicsActor; 578 if (PhysicsActor != null)
567 if (actor != null)
568 { 579 {
569 try 580 try
570 { 581 {
571 lock (m_scene.SyncRoot) 582 lock (m_scene.SyncRoot)
572 actor.Velocity = value; 583 PhysicsActor.Velocity = value;
573 } 584 }
574 catch (Exception e) 585 catch (Exception e)
575 { 586 {
@@ -585,6 +596,8 @@ namespace OpenSim.Region.Framework.Scenes
585 } 596 }
586 } 597 }
587 598
599 private Quaternion m_bodyRot = Quaternion.Identity;
600
588 public Quaternion Rotation 601 public Quaternion Rotation
589 { 602 {
590 get { return m_bodyRot; } 603 get { return m_bodyRot; }
@@ -645,9 +658,12 @@ namespace OpenSim.Region.Framework.Scenes
645 } 658 }
646 } 659 }
647 660
661 private ISceneViewer m_sceneViewer;
662
648 public ISceneViewer SceneViewer 663 public ISceneViewer SceneViewer
649 { 664 {
650 get { return m_sceneViewer; } 665 get { return m_sceneViewer; }
666 private set { m_sceneViewer = value; }
651 } 667 }
652 668
653 public void AdjustKnownSeeds() 669 public void AdjustKnownSeeds()
@@ -694,28 +710,35 @@ namespace OpenSim.Region.Framework.Scenes
694 } 710 }
695 } 711 }
696 712
697 private bool m_inTransit;
698 private bool m_mouseLook; 713 private bool m_mouseLook;
699 private bool m_leftButtonDown; 714 private bool m_leftButtonDown;
700 715
716 private bool m_inTransit;
717
701 public bool IsInTransit 718 public bool IsInTransit
702 { 719 {
703 get { return m_inTransit; } 720 get { return m_inTransit; }
704 set { m_inTransit = value; } 721 private set { m_inTransit = value; }
705 } 722 }
706 723
724 private float m_speedModifier = 1.0f;
725
707 public float SpeedModifier 726 public float SpeedModifier
708 { 727 {
709 get { return m_speedModifier; } 728 get { return m_speedModifier; }
710 set { m_speedModifier = value; } 729 set { m_speedModifier = value; }
711 } 730 }
712 731
732 private bool m_forceFly;
733
713 public bool ForceFly 734 public bool ForceFly
714 { 735 {
715 get { return m_forceFly; } 736 get { return m_forceFly; }
716 set { m_forceFly = value; } 737 set { m_forceFly = value; }
717 } 738 }
718 739
740 private bool m_flyDisabled;
741
719 public bool FlyDisabled 742 public bool FlyDisabled
720 { 743 {
721 get { return m_flyDisabled; } 744 get { return m_flyDisabled; }
@@ -737,15 +760,15 @@ namespace OpenSim.Region.Framework.Scenes
737 AttachmentsSyncLock = new Object(); 760 AttachmentsSyncLock = new Object();
738 761
739 m_sendCourseLocationsMethod = SendCoarseLocationsDefault; 762 m_sendCourseLocationsMethod = SendCoarseLocationsDefault;
740 m_sceneViewer = new SceneViewer(this); 763 SceneViewer = new SceneViewer(this);
741 m_animator = new ScenePresenceAnimator(this); 764 Animator = new ScenePresenceAnimator(this);
742 PresenceType = type; 765 PresenceType = type;
743 m_DrawDistance = world.DefaultDrawDistance; 766 DrawDistance = world.DefaultDrawDistance;
744 m_rootRegionHandle = world.RegionInfo.RegionHandle; 767 RegionHandle = world.RegionInfo.RegionHandle;
745 m_controllingClient = client; 768 ControllingClient = client;
746 m_firstname = m_controllingClient.FirstName; 769 Firstname = ControllingClient.FirstName;
747 m_lastname = m_controllingClient.LastName; 770 Lastname = ControllingClient.LastName;
748 m_name = String.Format("{0} {1}", m_firstname, m_lastname); 771 m_name = String.Format("{0} {1}", Firstname, Lastname);
749 m_scene = world; 772 m_scene = world;
750 m_uuid = client.AgentId; 773 m_uuid = client.AgentId;
751 m_localId = m_scene.AllocateLocalId(); 774 m_localId = m_scene.AllocateLocalId();
@@ -753,16 +776,16 @@ namespace OpenSim.Region.Framework.Scenes
753 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); 776 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid);
754 777
755 if (account != null) 778 if (account != null)
756 m_userLevel = account.UserLevel; 779 UserLevel = account.UserLevel;
757 780
758 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); 781 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
759 if (gm != null) 782 if (gm != null)
760 m_grouptitle = gm.GetGroupTitle(m_uuid); 783 Grouptitle = gm.GetGroupTitle(m_uuid);
761 784
762 m_scriptEngines = m_scene.RequestModuleInterfaces<IScriptModule>(); 785 m_scriptEngines = m_scene.RequestModuleInterfaces<IScriptModule>();
763 786
764 AbsolutePosition = posLastSignificantMove = m_CameraCenter = 787 AbsolutePosition = posLastSignificantMove = CameraPosition =
765 m_lastCameraCenter = m_controllingClient.StartPos; 788 m_lastCameraPosition = ControllingClient.StartPos;
766 789
767 m_reprioritization_timer = new Timer(world.ReprioritizationInterval); 790 m_reprioritization_timer = new Timer(world.ReprioritizationInterval);
768 m_reprioritization_timer.Elapsed += new ElapsedEventHandler(Reprioritize); 791 m_reprioritization_timer.Elapsed += new ElapsedEventHandler(Reprioritize);
@@ -785,21 +808,21 @@ namespace OpenSim.Region.Framework.Scenes
785 RegisterToEvents(); 808 RegisterToEvents();
786 SetDirectionVectors(); 809 SetDirectionVectors();
787 810
788 m_appearance = appearance; 811 Appearance = appearance;
789 } 812 }
790 813
791 public void RegisterToEvents() 814 public void RegisterToEvents()
792 { 815 {
793 m_controllingClient.OnCompleteMovementToRegion += CompleteMovement; 816 ControllingClient.OnCompleteMovementToRegion += CompleteMovement;
794 //m_controllingClient.OnCompleteMovementToRegion += SendInitialData; 817 //ControllingClient.OnCompleteMovementToRegion += SendInitialData;
795 m_controllingClient.OnAgentUpdate += HandleAgentUpdate; 818 ControllingClient.OnAgentUpdate += HandleAgentUpdate;
796 m_controllingClient.OnAgentRequestSit += HandleAgentRequestSit; 819 ControllingClient.OnAgentRequestSit += HandleAgentRequestSit;
797 m_controllingClient.OnAgentSit += HandleAgentSit; 820 ControllingClient.OnAgentSit += HandleAgentSit;
798 m_controllingClient.OnSetAlwaysRun += HandleSetAlwaysRun; 821 ControllingClient.OnSetAlwaysRun += HandleSetAlwaysRun;
799 m_controllingClient.OnStartAnim += HandleStartAnim; 822 ControllingClient.OnStartAnim += HandleStartAnim;
800 m_controllingClient.OnStopAnim += HandleStopAnim; 823 ControllingClient.OnStopAnim += HandleStopAnim;
801 m_controllingClient.OnForceReleaseControls += HandleForceReleaseControls; 824 ControllingClient.OnForceReleaseControls += HandleForceReleaseControls;
802 m_controllingClient.OnAutoPilotGo += MoveToTarget; 825 ControllingClient.OnAutoPilotGo += MoveToTarget;
803 826
804 // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); 827 // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
805 // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); 828 // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
@@ -821,15 +844,15 @@ namespace OpenSim.Region.Framework.Scenes
821 private Vector3[] GetWalkDirectionVectors() 844 private Vector3[] GetWalkDirectionVectors()
822 { 845 {
823 Vector3[] vector = new Vector3[9]; 846 Vector3[] vector = new Vector3[9];
824 vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD 847 vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD
825 vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK 848 vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK
826 vector[2] = Vector3.UnitY; //LEFT 849 vector[2] = Vector3.UnitY; //LEFT
827 vector[3] = -Vector3.UnitY; //RIGHT 850 vector[3] = -Vector3.UnitY; //RIGHT
828 vector[4] = new Vector3(m_CameraAtAxis.Z, 0f, m_CameraUpAxis.Z); //UP 851 vector[4] = new Vector3(CameraAtAxis.Z, 0f, m_CameraUpAxis.Z); //UP
829 vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN 852 vector[5] = new Vector3(-CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN
830 vector[8] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_Nudge 853 vector[8] = new Vector3(-CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_Nudge
831 vector[6] = (new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z) * 2); //FORWARD Nudge 854 vector[6] = (new Vector3(m_CameraUpAxis.Z, 0f, -CameraAtAxis.Z) * 2); //FORWARD Nudge
832 vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK Nudge 855 vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK Nudge
833 return vector; 856 return vector;
834 } 857 }
835 858
@@ -847,7 +870,7 @@ namespace OpenSim.Region.Framework.Scenes
847 /// </summary> 870 /// </summary>
848 public void SendPrimUpdates() 871 public void SendPrimUpdates()
849 { 872 {
850 m_sceneViewer.SendPrimUpdates(); 873 SceneViewer.SendPrimUpdates();
851 } 874 }
852 875
853 #region Status Methods 876 #region Status Methods
@@ -865,21 +888,21 @@ namespace OpenSim.Region.Framework.Scenes
865 888
866 //m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count); 889 //m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count);
867 890
868 bool wasChild = m_isChildAgent; 891 bool wasChild = IsChildAgent;
869 m_isChildAgent = false; 892 IsChildAgent = false;
870 893
871 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); 894 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
872 if (gm != null) 895 if (gm != null)
873 m_grouptitle = gm.GetGroupTitle(m_uuid); 896 Grouptitle = gm.GetGroupTitle(m_uuid);
874 897
875 m_rootRegionHandle = m_scene.RegionInfo.RegionHandle; 898 RegionHandle = m_scene.RegionInfo.RegionHandle;
876 899
877 m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); 900 m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene);
878 901
879 // Moved this from SendInitialData to ensure that m_appearance is initialized 902 // Moved this from SendInitialData to ensure that Appearance is initialized
880 // before the inventory is processed in MakeRootAgent. This fixes a race condition 903 // before the inventory is processed in MakeRootAgent. This fixes a race condition
881 // related to the handling of attachments 904 // related to the handling of attachments
882 //m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); 905 //m_scene.GetAvatarAppearance(ControllingClient, out Appearance);
883 if (m_scene.TestBorderCross(pos, Cardinals.E)) 906 if (m_scene.TestBorderCross(pos, Cardinals.E))
884 { 907 {
885 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E); 908 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E);
@@ -904,8 +927,8 @@ namespace OpenSim.Region.Framework.Scenes
904 } 927 }
905 928
906 float localAVHeight = 1.56f; 929 float localAVHeight = 1.56f;
907 if (m_appearance.AvatarHeight > 0) 930 if (Appearance.AvatarHeight > 0)
908 localAVHeight = m_appearance.AvatarHeight; 931 localAVHeight = Appearance.AvatarHeight;
909 932
910 float posZLimit = 0; 933 float posZLimit = 0;
911 934
@@ -921,13 +944,13 @@ namespace OpenSim.Region.Framework.Scenes
921 944
922 AddToPhysicalScene(isFlying); 945 AddToPhysicalScene(isFlying);
923 946
924 if (m_forceFly) 947 if (ForceFly)
925 { 948 {
926 m_physicsActor.Flying = true; 949 PhysicsActor.Flying = true;
927 } 950 }
928 else if (m_flyDisabled) 951 else if (FlyDisabled)
929 { 952 {
930 m_physicsActor.Flying = false; 953 PhysicsActor.Flying = false;
931 } 954 }
932 955
933 // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying 956 // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying
@@ -965,7 +988,7 @@ namespace OpenSim.Region.Framework.Scenes
965 // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will 988 // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will
966 // stall on the border crossing since the existing child agent will still have the last movement 989 // stall on the border crossing since the existing child agent will still have the last movement
967 // recorded, which stops the input from being processed. 990 // recorded, which stops the input from being processed.
968 m_movementflag = 0; 991 MovementFlag = 0;
969 992
970 m_scene.EventManager.TriggerOnMakeRootAgent(this); 993 m_scene.EventManager.TriggerOnMakeRootAgent(this);
971 } 994 }
@@ -995,12 +1018,12 @@ namespace OpenSim.Region.Framework.Scenes
995 { 1018 {
996 // Reset these so that teleporting in and walking out isn't seen 1019 // Reset these so that teleporting in and walking out isn't seen
997 // as teleporting back 1020 // as teleporting back
998 m_teleportFlags = TeleportFlags.Default; 1021 TeleportFlags = TeleportFlags.Default;
999 1022
1000 // It looks like m_animator is set to null somewhere, and MakeChild 1023 // It looks like Animator is set to null somewhere, and MakeChild
1001 // is called after that. Probably in aborted teleports. 1024 // is called after that. Probably in aborted teleports.
1002 if (m_animator == null) 1025 if (Animator == null)
1003 m_animator = new ScenePresenceAnimator(this); 1026 Animator = new ScenePresenceAnimator(this);
1004 else 1027 else
1005 Animator.ResetAnimations(); 1028 Animator.ResetAnimations();
1006 1029
@@ -1012,11 +1035,11 @@ namespace OpenSim.Region.Framework.Scenes
1012 // depending on the exact timing. This shouldn't matter anyway since child agent positions are not updated. 1035 // depending on the exact timing. This shouldn't matter anyway since child agent positions are not updated.
1013 //Velocity = new Vector3(0, 0, 0); 1036 //Velocity = new Vector3(0, 0, 0);
1014 1037
1015 m_isChildAgent = true; 1038 IsChildAgent = true;
1016 m_scene.SwapRootAgentCount(true); 1039 m_scene.SwapRootAgentCount(true);
1017 RemoveFromPhysicalScene(); 1040 RemoveFromPhysicalScene();
1018 1041
1019 // FIXME: Set m_rootRegionHandle to the region handle of the scene this agent is moving into 1042 // FIXME: Set RegionHandle to the region handle of the scene this agent is moving into
1020 1043
1021 m_scene.EventManager.TriggerOnMakeChildAgent(this); 1044 m_scene.EventManager.TriggerOnMakeChildAgent(this);
1022 } 1045 }
@@ -1028,11 +1051,11 @@ namespace OpenSim.Region.Framework.Scenes
1028 { 1051 {
1029 if (PhysicsActor != null) 1052 if (PhysicsActor != null)
1030 { 1053 {
1031 m_physicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; 1054 PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients;
1032 m_physicsActor.OnOutOfBounds -= OutOfBoundsCall; 1055 PhysicsActor.OnOutOfBounds -= OutOfBoundsCall;
1033 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); 1056 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor);
1034 m_physicsActor.UnSubscribeEvents(); 1057 PhysicsActor.UnSubscribeEvents();
1035 m_physicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; 1058 PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
1036 PhysicsActor = null; 1059 PhysicsActor = null;
1037 } 1060 }
1038 } 1061 }
@@ -1044,8 +1067,8 @@ namespace OpenSim.Region.Framework.Scenes
1044 public void Teleport(Vector3 pos) 1067 public void Teleport(Vector3 pos)
1045 { 1068 {
1046 bool isFlying = false; 1069 bool isFlying = false;
1047 if (m_physicsActor != null) 1070 if (PhysicsActor != null)
1048 isFlying = m_physicsActor.Flying; 1071 isFlying = PhysicsActor.Flying;
1049 1072
1050 RemoveFromPhysicalScene(); 1073 RemoveFromPhysicalScene();
1051 Velocity = Vector3.Zero; 1074 Velocity = Vector3.Zero;
@@ -1058,8 +1081,8 @@ namespace OpenSim.Region.Framework.Scenes
1058 public void TeleportWithMomentum(Vector3 pos) 1081 public void TeleportWithMomentum(Vector3 pos)
1059 { 1082 {
1060 bool isFlying = false; 1083 bool isFlying = false;
1061 if (m_physicsActor != null) 1084 if (PhysicsActor != null)
1062 isFlying = m_physicsActor.Flying; 1085 isFlying = PhysicsActor.Flying;
1063 1086
1064 RemoveFromPhysicalScene(); 1087 RemoveFromPhysicalScene();
1065 AbsolutePosition = pos; 1088 AbsolutePosition = pos;
@@ -1174,11 +1197,11 @@ namespace OpenSim.Region.Framework.Scenes
1174 1197
1175 //m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); 1198 //m_log.DebugFormat("[SCENE PRESENCE] Completed movement");
1176 1199
1177 m_controllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); 1200 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
1178 SendInitialData(); 1201 SendInitialData();
1179 1202
1180 // Create child agents in neighbouring regions 1203 // Create child agents in neighbouring regions
1181 if (openChildAgents && !m_isChildAgent) 1204 if (openChildAgents && !IsChildAgent)
1182 { 1205 {
1183 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); 1206 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
1184 if (m_agentTransfer != null) 1207 if (m_agentTransfer != null)
@@ -1222,7 +1245,7 @@ namespace OpenSim.Region.Framework.Scenes
1222 { 1245 {
1223 if (!m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || 1246 if (!m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) ||
1224 !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || 1247 !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) ||
1225 !m_bodyRot.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE)) 1248 !Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE))
1226 { 1249 {
1227 if (CameraConstraintActive) 1250 if (CameraConstraintActive)
1228 { 1251 {
@@ -1243,7 +1266,7 @@ namespace OpenSim.Region.Framework.Scenes
1243// "[SCENE PRESENCE]: In {0} received agent update from {1}", 1266// "[SCENE PRESENCE]: In {0} received agent update from {1}",
1244// Scene.RegionInfo.RegionName, remoteClient.Name); 1267// Scene.RegionInfo.RegionName, remoteClient.Name);
1245 1268
1246 //if (m_isChildAgent) 1269 //if (IsChildAgent)
1247 //{ 1270 //{
1248 // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); 1271 // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent");
1249 // return; 1272 // return;
@@ -1287,28 +1310,28 @@ namespace OpenSim.Region.Framework.Scenes
1287 1310
1288 // Camera location in world. We'll need to raytrace 1311 // Camera location in world. We'll need to raytrace
1289 // from this location from time to time. 1312 // from this location from time to time.
1290 m_CameraCenter = agentData.CameraCenter; 1313 CameraPosition = agentData.CameraCenter;
1291 if (Vector3.Distance(m_lastCameraCenter, m_CameraCenter) >= Scene.RootReprioritizationDistance) 1314 if (Vector3.Distance(m_lastCameraPosition, CameraPosition) >= Scene.RootReprioritizationDistance)
1292 { 1315 {
1293 ReprioritizeUpdates(); 1316 ReprioritizeUpdates();
1294 m_lastCameraCenter = m_CameraCenter; 1317 m_lastCameraPosition = CameraPosition;
1295 } 1318 }
1296 1319
1297 // Use these three vectors to figure out what the agent is looking at 1320 // Use these three vectors to figure out what the agent is looking at
1298 // Convert it to a Matrix and/or Quaternion 1321 // Convert it to a Matrix and/or Quaternion
1299 m_CameraAtAxis = agentData.CameraAtAxis; 1322 CameraAtAxis = agentData.CameraAtAxis;
1300 m_CameraLeftAxis = agentData.CameraLeftAxis; 1323 CameraLeftAxis = agentData.CameraLeftAxis;
1301 m_CameraUpAxis = agentData.CameraUpAxis; 1324 m_CameraUpAxis = agentData.CameraUpAxis;
1302 1325
1303 // The Agent's Draw distance setting 1326 // The Agent's Draw distance setting
1304 // When we get to the point of re-computing neighbors everytime this 1327 // When we get to the point of re-computing neighbors everytime this
1305 // changes, then start using the agent's drawdistance rather than the 1328 // changes, then start using the agent's drawdistance rather than the
1306 // region's draw distance. 1329 // region's draw distance.
1307 // m_DrawDistance = agentData.Far; 1330 // DrawDistance = agentData.Far;
1308 m_DrawDistance = Scene.DefaultDrawDistance; 1331 DrawDistance = Scene.DefaultDrawDistance;
1309 1332
1310 // Check if Client has camera in 'follow cam' or 'build' mode. 1333 // Check if Client has camera in 'follow cam' or 'build' mode.
1311 Vector3 camdif = (Vector3.One * m_bodyRot - Vector3.One * CameraRotation); 1334 Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation);
1312 1335
1313 m_followCamAuto = ((m_CameraUpAxis.Z > 0.959f && m_CameraUpAxis.Z < 0.98f) 1336 m_followCamAuto = ((m_CameraUpAxis.Z > 0.959f && m_CameraUpAxis.Z < 0.98f)
1314 && (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false; 1337 && (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false;
@@ -1330,7 +1353,7 @@ namespace OpenSim.Region.Framework.Scenes
1330 if (m_followCamAuto) 1353 if (m_followCamAuto)
1331 { 1354 {
1332 Vector3 posAdjusted = m_pos + HEAD_ADJUSTMENT; 1355 Vector3 posAdjusted = m_pos + HEAD_ADJUSTMENT;
1333 m_scene.PhysicsScene.RaycastWorld(m_pos, Vector3.Normalize(m_CameraCenter - posAdjusted), Vector3.Distance(m_CameraCenter, posAdjusted) + 0.3f, RayCastCameraCallback); 1356 m_scene.PhysicsScene.RaycastWorld(m_pos, Vector3.Normalize(CameraPosition - posAdjusted), Vector3.Distance(CameraPosition, posAdjusted) + 0.3f, RayCastCameraCallback);
1334 } 1357 }
1335 } 1358 }
1336 1359
@@ -1359,7 +1382,7 @@ namespace OpenSim.Region.Framework.Scenes
1359 // Here's where you get them. 1382 // Here's where you get them.
1360 m_AgentControlFlags = flags; 1383 m_AgentControlFlags = flags;
1361 m_headrotation = agentData.HeadRotation; 1384 m_headrotation = agentData.HeadRotation;
1362 m_state = agentData.State; 1385 State = agentData.State;
1363 1386
1364 PhysicsActor actor = PhysicsActor; 1387 PhysicsActor actor = PhysicsActor;
1365 if (actor == null) 1388 if (actor == null)
@@ -1367,12 +1390,12 @@ namespace OpenSim.Region.Framework.Scenes
1367 return; 1390 return;
1368 } 1391 }
1369 1392
1370 if (m_allowMovement && !SitGround) 1393 if (AllowMovement && !SitGround)
1371 { 1394 {
1372 Quaternion bodyRotation = agentData.BodyRotation; 1395 Quaternion bodyRotation = agentData.BodyRotation;
1373 bool update_rotation = false; 1396 bool update_rotation = false;
1374 1397
1375 if (bodyRotation != m_bodyRot) 1398 if (bodyRotation != Rotation)
1376 { 1399 {
1377 Rotation = bodyRotation; 1400 Rotation = bodyRotation;
1378 update_rotation = true; 1401 update_rotation = true;
@@ -1392,9 +1415,9 @@ namespace OpenSim.Region.Framework.Scenes
1392 1415
1393 bool oldflying = PhysicsActor.Flying; 1416 bool oldflying = PhysicsActor.Flying;
1394 1417
1395 if (m_forceFly) 1418 if (ForceFly)
1396 actor.Flying = true; 1419 actor.Flying = true;
1397 else if (m_flyDisabled) 1420 else if (FlyDisabled)
1398 actor.Flying = false; 1421 actor.Flying = false;
1399 else 1422 else
1400 actor.Flying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); 1423 actor.Flying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
@@ -1402,7 +1425,7 @@ namespace OpenSim.Region.Framework.Scenes
1402 if (actor.Flying != oldflying) 1425 if (actor.Flying != oldflying)
1403 update_movementflag = true; 1426 update_movementflag = true;
1404 1427
1405 if (m_parentID == 0) 1428 if (ParentID == 0)
1406 { 1429 {
1407 bool bAllowUpdateMoveToPosition = false; 1430 bool bAllowUpdateMoveToPosition = false;
1408 1431
@@ -1410,12 +1433,12 @@ namespace OpenSim.Region.Framework.Scenes
1410 1433
1411 // use camera up angle when in mouselook and not flying or when holding the left mouse button down and not flying 1434 // use camera up angle when in mouselook and not flying or when holding the left mouse button down and not flying
1412 // this prevents 'jumping' in inappropriate situations. 1435 // this prevents 'jumping' in inappropriate situations.
1413 if ((m_mouseLook && !m_physicsActor.Flying) || (m_leftButtonDown && !m_physicsActor.Flying)) 1436 if ((m_mouseLook && !PhysicsActor.Flying) || (m_leftButtonDown && !PhysicsActor.Flying))
1414 dirVectors = GetWalkDirectionVectors(); 1437 dirVectors = GetWalkDirectionVectors();
1415 else 1438 else
1416 dirVectors = Dir_Vectors; 1439 dirVectors = Dir_Vectors;
1417 1440
1418 // The fact that m_movementflag is a byte needs to be fixed 1441 // The fact that MovementFlag is a byte needs to be fixed
1419 // it really should be a uint 1442 // it really should be a uint
1420 // A DIR_CONTROL_FLAG occurs when the user is trying to move in a particular direction. 1443 // A DIR_CONTROL_FLAG occurs when the user is trying to move in a particular direction.
1421 uint nudgehack = 250; 1444 uint nudgehack = 250;
@@ -1435,32 +1458,32 @@ namespace OpenSim.Region.Framework.Scenes
1435 // Why did I get this? 1458 // Why did I get this?
1436 } 1459 }
1437 1460
1438 if ((m_movementflag & (byte)(uint)DCF) == 0) 1461 if ((MovementFlag & (byte)(uint)DCF) == 0)
1439 { 1462 {
1440 if (DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) 1463 if (DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE)
1441 { 1464 {
1442 m_movementflag |= (byte)nudgehack; 1465 MovementFlag |= (byte)nudgehack;
1443 } 1466 }
1444 1467
1445// m_log.DebugFormat("[SCENE PRESENCE]: Updating m_movementflag for {0} with {1}", Name, DCF); 1468// m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with {1}", Name, DCF);
1446 m_movementflag += (byte)(uint)DCF; 1469 MovementFlag += (byte)(uint)DCF;
1447 update_movementflag = true; 1470 update_movementflag = true;
1448 } 1471 }
1449 } 1472 }
1450 else 1473 else
1451 { 1474 {
1452 if ((m_movementflag & (byte)(uint)DCF) != 0 || 1475 if ((MovementFlag & (byte)(uint)DCF) != 0 ||
1453 ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) 1476 ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE)
1454 && ((m_movementflag & (byte)nudgehack) == nudgehack)) 1477 && ((MovementFlag & (byte)nudgehack) == nudgehack))
1455 ) // This or is for Nudge forward 1478 ) // This or is for Nudge forward
1456 { 1479 {
1457// m_log.DebugFormat("[SCENE PRESENCE]: Updating m_movementflag for {0} with lack of {1}", Name, DCF); 1480// m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with lack of {1}", Name, DCF);
1458 m_movementflag -= ((byte)(uint)DCF); 1481 MovementFlag -= ((byte)(uint)DCF);
1459 update_movementflag = true; 1482 update_movementflag = true;
1460 1483
1461 /* 1484 /*
1462 if ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) 1485 if ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE)
1463 && ((m_movementflag & (byte)nudgehack) == nudgehack)) 1486 && ((MovementFlag & (byte)nudgehack) == nudgehack))
1464 { 1487 {
1465 m_log.Debug("Removed Hack flag"); 1488 m_log.Debug("Removed Hack flag");
1466 } 1489 }
@@ -1495,7 +1518,7 @@ namespace OpenSim.Region.Framework.Scenes
1495 // with something with the down arrow pressed. 1518 // with something with the down arrow pressed.
1496 1519
1497 // Only do this if we're flying 1520 // Only do this if we're flying
1498 if (m_physicsActor != null && m_physicsActor.Flying && !m_forceFly) 1521 if (PhysicsActor != null && PhysicsActor.Flying && !ForceFly)
1499 { 1522 {
1500 // Landing detection code 1523 // Landing detection code
1501 1524
@@ -1503,10 +1526,7 @@ namespace OpenSim.Region.Framework.Scenes
1503 bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || 1526 bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) ||
1504 ((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); 1527 ((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0));
1505 1528
1506 // Are the collision requirements fulfilled? 1529 if (PhysicsActor.Flying && PhysicsActor.IsColliding && controlland)
1507 bool colliding = (m_physicsActor.IsColliding == true);
1508
1509 if (m_physicsActor.Flying && colliding && controlland)
1510 { 1530 {
1511 // nesting this check because LengthSquared() is expensive and we don't 1531 // nesting this check because LengthSquared() is expensive and we don't
1512 // want to do it every step when flying. 1532 // want to do it every step when flying.
@@ -1535,7 +1555,7 @@ namespace OpenSim.Region.Framework.Scenes
1535// } 1555// }
1536// } 1556// }
1537 1557
1538 if (update_movementflag && m_parentID == 0) 1558 if (update_movementflag && ParentID == 0)
1539 Animator.UpdateMovementAnimations(); 1559 Animator.UpdateMovementAnimations();
1540 } 1560 }
1541 1561
@@ -1617,26 +1637,26 @@ namespace OpenSim.Region.Framework.Scenes
1617 // one of left/right/back/forward. 1637 // one of left/right/back/forward.
1618 if (LocalVectorToTarget3D.X < 0) //MoveBack 1638 if (LocalVectorToTarget3D.X < 0) //MoveBack
1619 { 1639 {
1620 m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; 1640 MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK;
1621 AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; 1641 AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK;
1622 updated = true; 1642 updated = true;
1623 } 1643 }
1624 else if (LocalVectorToTarget3D.X > 0) //Move Forward 1644 else if (LocalVectorToTarget3D.X > 0) //Move Forward
1625 { 1645 {
1626 m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; 1646 MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD;
1627 AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; 1647 AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD;
1628 updated = true; 1648 updated = true;
1629 } 1649 }
1630 1650
1631 if (LocalVectorToTarget3D.Y > 0) //MoveLeft 1651 if (LocalVectorToTarget3D.Y > 0) //MoveLeft
1632 { 1652 {
1633 m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; 1653 MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT;
1634 AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; 1654 AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT;
1635 updated = true; 1655 updated = true;
1636 } 1656 }
1637 else if (LocalVectorToTarget3D.Y < 0) //MoveRight 1657 else if (LocalVectorToTarget3D.Y < 0) //MoveRight
1638 { 1658 {
1639 m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; 1659 MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT;
1640 AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; 1660 AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT;
1641 updated = true; 1661 updated = true;
1642 } 1662 }
@@ -1645,14 +1665,14 @@ namespace OpenSim.Region.Framework.Scenes
1645 { 1665 {
1646 // Don't set these flags for up or down - doing so will make the avatar crouch or 1666 // Don't set these flags for up or down - doing so will make the avatar crouch or
1647 // keep trying to jump even if walking along level ground 1667 // keep trying to jump even if walking along level ground
1648 //m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP; 1668 //MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP;
1649 //AgentControlFlags 1669 //AgentControlFlags
1650 //AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP; 1670 //AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP;
1651 updated = true; 1671 updated = true;
1652 } 1672 }
1653 else if (LocalVectorToTarget3D.Z < 0) //Down 1673 else if (LocalVectorToTarget3D.Z < 0) //Down
1654 { 1674 {
1655 //m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN; 1675 //MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN;
1656 //AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN; 1676 //AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN;
1657 updated = true; 1677 updated = true;
1658 } 1678 }
@@ -1815,10 +1835,10 @@ namespace OpenSim.Region.Framework.Scenes
1815 { 1835 {
1816 SitGround = false; 1836 SitGround = false;
1817 1837
1818 if (m_parentID != 0) 1838 if (ParentID != 0)
1819 { 1839 {
1820 m_log.Debug("StandupCode Executed"); 1840 m_log.Debug("StandupCode Executed");
1821 SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID); 1841 SceneObjectPart part = m_scene.GetSceneObjectPart(ParentID);
1822 if (part != null) 1842 if (part != null)
1823 { 1843 {
1824 TaskInventoryDictionary taskIDict = part.TaskInventory; 1844 TaskInventoryDictionary taskIDict = part.TaskInventory;
@@ -1841,19 +1861,19 @@ namespace OpenSim.Region.Framework.Scenes
1841 part.SitTargetAvatar = UUID.Zero; 1861 part.SitTargetAvatar = UUID.Zero;
1842 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); 1862 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
1843 1863
1844 m_parentPosition = part.GetWorldPosition(); 1864 ParentPosition = part.GetWorldPosition();
1845 ControllingClient.SendClearFollowCamProperties(part.ParentUUID); 1865 ControllingClient.SendClearFollowCamProperties(part.ParentUUID);
1846 } 1866 }
1847 1867
1848 if (m_physicsActor == null) 1868 if (PhysicsActor == null)
1849 { 1869 {
1850 AddToPhysicalScene(false); 1870 AddToPhysicalScene(false);
1851 } 1871 }
1852 1872
1853 m_pos += m_parentPosition + new Vector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight); 1873 m_pos += ParentPosition + new Vector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight);
1854 m_parentPosition = Vector3.Zero; 1874 ParentPosition = Vector3.Zero;
1855 1875
1856 m_parentID = 0; 1876 ParentID = 0;
1857 SendAvatarDataToAllAgents(); 1877 SendAvatarDataToAllAgents();
1858 m_requestedSitTargetID = 0; 1878 m_requestedSitTargetID = 0;
1859 } 1879 }
@@ -1951,11 +1971,11 @@ namespace OpenSim.Region.Framework.Scenes
1951 // offset = pos; 1971 // offset = pos;
1952 //autopilot = false; 1972 //autopilot = false;
1953 //} 1973 //}
1954 if (m_physicsActor != null) 1974 if (PhysicsActor != null)
1955 { 1975 {
1956 // If we're not using the client autopilot, we're immediately warping the avatar to the location 1976 // If we're not using the client autopilot, we're immediately warping the avatar to the location
1957 // We can remove the physicsActor until they stand up. 1977 // We can remove the physicsActor until they stand up.
1958 m_sitAvatarHeight = m_physicsActor.Size.Z; 1978 m_sitAvatarHeight = PhysicsActor.Size.Z;
1959 1979
1960 if (autopilot) 1980 if (autopilot)
1961 { 1981 {
@@ -1994,7 +2014,7 @@ namespace OpenSim.Region.Framework.Scenes
1994 // public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset, string sitAnimation) 2014 // public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset, string sitAnimation)
1995 public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset) 2015 public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset)
1996 { 2016 {
1997 if (m_parentID != 0) 2017 if (ParentID != 0)
1998 { 2018 {
1999 StandUp(); 2019 StandUp();
2000 } 2020 }
@@ -2263,16 +2283,16 @@ namespace OpenSim.Region.Framework.Scenes
2263 2283
2264 m_pos = new Vector3(sitTargetPos.X, sitTargetPos.Y, sitTargetPos.Z); 2284 m_pos = new Vector3(sitTargetPos.X, sitTargetPos.Y, sitTargetPos.Z);
2265 m_pos += SIT_TARGET_ADJUSTMENT; 2285 m_pos += SIT_TARGET_ADJUSTMENT;
2266 m_bodyRot = sitTargetOrient; 2286 Rotation = sitTargetOrient;
2267 //Rotation = sitTargetOrient; 2287 //Rotation = sitTargetOrient;
2268 m_parentPosition = part.AbsolutePosition; 2288 ParentPosition = part.AbsolutePosition;
2269 2289
2270 //SendTerseUpdateToAllClients(); 2290 //SendTerseUpdateToAllClients();
2271 } 2291 }
2272 else 2292 else
2273 { 2293 {
2274 m_pos -= part.AbsolutePosition; 2294 m_pos -= part.AbsolutePosition;
2275 m_parentPosition = part.AbsolutePosition; 2295 ParentPosition = part.AbsolutePosition;
2276 } 2296 }
2277 } 2297 }
2278 else 2298 else
@@ -2280,7 +2300,7 @@ namespace OpenSim.Region.Framework.Scenes
2280 return; 2300 return;
2281 } 2301 }
2282 } 2302 }
2283 m_parentID = m_requestedSitTargetID; 2303 ParentID = m_requestedSitTargetID;
2284 2304
2285 Velocity = Vector3.Zero; 2305 Velocity = Vector3.Zero;
2286 RemoveFromPhysicalScene(); 2306 RemoveFromPhysicalScene();
@@ -2299,11 +2319,7 @@ namespace OpenSim.Region.Framework.Scenes
2299 /// </summary> 2319 /// </summary>
2300 public void HandleSetAlwaysRun(IClientAPI remoteClient, bool pSetAlwaysRun) 2320 public void HandleSetAlwaysRun(IClientAPI remoteClient, bool pSetAlwaysRun)
2301 { 2321 {
2302 m_setAlwaysRun = pSetAlwaysRun; 2322 SetAlwaysRun = pSetAlwaysRun;
2303 if (PhysicsActor != null)
2304 {
2305 PhysicsActor.SetAlwaysRun = pSetAlwaysRun;
2306 }
2307 } 2323 }
2308 2324
2309 public void HandleStartAnim(IClientAPI remoteClient, UUID animID) 2325 public void HandleStartAnim(IClientAPI remoteClient, UUID animID)
@@ -2325,27 +2341,25 @@ namespace OpenSim.Region.Framework.Scenes
2325 Vector3 direc = vec * Rotation; 2341 Vector3 direc = vec * Rotation;
2326 direc.Normalize(); 2342 direc.Normalize();
2327 2343
2328 direc *= 0.03f * 128f * m_speedModifier; 2344 direc *= 0.03f * 128f * SpeedModifier;
2329 2345
2330 PhysicsActor actor = m_physicsActor; 2346 if (PhysicsActor != null)
2331 if (actor != null)
2332 { 2347 {
2333 if (actor.Flying) 2348 if (PhysicsActor.Flying)
2334 { 2349 {
2335 direc *= 4.0f; 2350 direc *= 4.0f;
2336 //bool controlland = (((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); 2351 //bool controlland = (((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0));
2337 //bool colliding = (m_physicsActor.IsColliding==true);
2338 //if (controlland) 2352 //if (controlland)
2339 // m_log.Info("[AGENT]: landCommand"); 2353 // m_log.Info("[AGENT]: landCommand");
2340 //if (colliding) 2354 //if (PhysicsActor.IsColliding)
2341 // m_log.Info("[AGENT]: colliding"); 2355 // m_log.Info("[AGENT]: colliding");
2342 //if (m_physicsActor.Flying && colliding && controlland) 2356 //if (PhysicsActor.Flying && PhysicsActor.IsColliding && controlland)
2343 //{ 2357 //{
2344 // StopFlying(); 2358 // StopFlying();
2345 // m_log.Info("[AGENT]: Stop FLying"); 2359 // m_log.Info("[AGENT]: Stop Flying");
2346 //} 2360 //}
2347 } 2361 }
2348 else if (!actor.Flying && actor.IsColliding) 2362 else if (!PhysicsActor.Flying && PhysicsActor.IsColliding)
2349 { 2363 {
2350 if (direc.Z > 2.0f) 2364 if (direc.Z > 2.0f)
2351 { 2365 {
@@ -2378,16 +2392,14 @@ namespace OpenSim.Region.Framework.Scenes
2378 if (!sendingPrims) 2392 if (!sendingPrims)
2379 Util.FireAndForget(delegate { sendingPrims = true; SendPrimUpdates(); sendingPrims = false; }); 2393 Util.FireAndForget(delegate { sendingPrims = true; SendPrimUpdates(); sendingPrims = false; });
2380 2394
2381 if (m_isChildAgent == false) 2395 if (IsChildAgent == false)
2382 { 2396 {
2383// PhysicsActor actor = m_physicsActor;
2384
2385 // NOTE: Velocity is not the same as m_velocity. Velocity will attempt to 2397 // NOTE: Velocity is not the same as m_velocity. Velocity will attempt to
2386 // grab the latest PhysicsActor velocity, whereas m_velocity is often 2398 // grab the latest PhysicsActor velocity, whereas m_velocity is often
2387 // storing a requested force instead of an actual traveling velocity 2399 // storing a requested force instead of an actual traveling velocity
2388 2400
2389 // Throw away duplicate or insignificant updates 2401 // Throw away duplicate or insignificant updates
2390 if (!m_bodyRot.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || 2402 if (!Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) ||
2391 !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || 2403 !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) ||
2392 !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE)) 2404 !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE))
2393 //Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) 2405 //Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
@@ -2396,13 +2408,13 @@ namespace OpenSim.Region.Framework.Scenes
2396 2408
2397 // Update the "last" values 2409 // Update the "last" values
2398 m_lastPosition = m_pos; 2410 m_lastPosition = m_pos;
2399 m_lastRotation = m_bodyRot; 2411 m_lastRotation = Rotation;
2400 m_lastVelocity = Velocity; 2412 m_lastVelocity = Velocity;
2401 //m_lastTerseSent = Environment.TickCount; 2413 //m_lastTerseSent = Environment.TickCount;
2402 } 2414 }
2403 2415
2404 // followed suggestion from mic bowman. reversed the two lines below. 2416 // followed suggestion from mic bowman. reversed the two lines below.
2405 if (m_parentID == 0 && m_physicsActor != null || m_parentID != 0) // Check that we have a physics actor or we're sitting on something 2417 if (ParentID == 0 && PhysicsActor != null || ParentID != 0) // Check that we have a physics actor or we're sitting on something
2406 CheckForBorderCrossing(); 2418 CheckForBorderCrossing();
2407 2419
2408 CheckForSignificantMovement(); // sends update to the modules. 2420 CheckForSignificantMovement(); // sends update to the modules.
@@ -2425,9 +2437,9 @@ namespace OpenSim.Region.Framework.Scenes
2425 if (remoteClient.IsActive) 2437 if (remoteClient.IsActive)
2426 { 2438 {
2427 Vector3 pos = m_pos; 2439 Vector3 pos = m_pos;
2428 pos.Z += m_appearance.HipOffset; 2440 pos.Z += Appearance.HipOffset;
2429 2441
2430 //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, m_bodyRot, m_velocity); 2442 //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity);
2431 2443
2432 remoteClient.SendPrimUpdate( 2444 remoteClient.SendPrimUpdate(
2433 this, 2445 this,
@@ -2499,7 +2511,7 @@ namespace OpenSim.Region.Framework.Scenes
2499 2511
2500 public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs) 2512 public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
2501 { 2513 {
2502 m_controllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); 2514 ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations);
2503 } 2515 }
2504 2516
2505 /// <summary> 2517 /// <summary>
@@ -2509,21 +2521,21 @@ namespace OpenSim.Region.Framework.Scenes
2509 private void SendInitialData() 2521 private void SendInitialData()
2510 { 2522 {
2511 //m_log.DebugFormat("[SCENE PRESENCE] SendInitialData: {0} ({1})", Name, UUID); 2523 //m_log.DebugFormat("[SCENE PRESENCE] SendInitialData: {0} ({1})", Name, UUID);
2512 // Moved this into CompleteMovement to ensure that m_appearance is initialized before 2524 // Moved this into CompleteMovement to ensure that Appearance is initialized before
2513 // the inventory arrives 2525 // the inventory arrives
2514 // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); 2526 // m_scene.GetAvatarAppearance(ControllingClient, out Appearance);
2515 2527
2516 bool cachedappearance = false; 2528 bool cachedappearance = false;
2517 2529
2518 // We have an appearance but we may not have the baked textures. Check the asset cache 2530 // We have an appearance but we may not have the baked textures. Check the asset cache
2519 // to see if all the baked textures are already here. 2531 // to see if all the baked textures are already here.
2520 if (m_scene.AvatarFactory != null) 2532 if (m_scene.AvatarFactory != null)
2521 cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient); 2533 cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(ControllingClient);
2522 2534
2523 // If we aren't using a cached appearance, then clear out the baked textures 2535 // If we aren't using a cached appearance, then clear out the baked textures
2524 if (!cachedappearance) 2536 if (!cachedappearance)
2525 { 2537 {
2526 m_appearance.ResetAppearance(); 2538 Appearance.ResetAppearance();
2527 if (m_scene.AvatarFactory != null) 2539 if (m_scene.AvatarFactory != null)
2528 m_scene.AvatarFactory.QueueAppearanceSave(UUID); 2540 m_scene.AvatarFactory.QueueAppearanceSave(UUID);
2529 } 2541 }
@@ -2671,17 +2683,7 @@ namespace OpenSim.Region.Framework.Scenes
2671// "[SCENE PRESENCE] Send appearance from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); 2683// "[SCENE PRESENCE] Send appearance from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID);
2672 2684
2673 avatar.ControllingClient.SendAppearance( 2685 avatar.ControllingClient.SendAppearance(
2674 UUID, m_appearance.VisualParams, m_appearance.Texture.GetBytes()); 2686 UUID, Appearance.VisualParams, Appearance.Texture.GetBytes());
2675 }
2676
2677 public AvatarAppearance Appearance
2678 {
2679 get { return m_appearance; }
2680 set
2681 {
2682 m_appearance = value;
2683// m_log.DebugFormat("[SCENE PRESENCE]: Set appearance for {0} to {1}", Name, value);
2684 }
2685 } 2687 }
2686 2688
2687 #endregion 2689 #endregion
@@ -2709,14 +2711,13 @@ namespace OpenSim.Region.Framework.Scenes
2709 ChildAgentDataUpdate cadu = new ChildAgentDataUpdate(); 2711 ChildAgentDataUpdate cadu = new ChildAgentDataUpdate();
2710 cadu.ActiveGroupID = UUID.Zero.Guid; 2712 cadu.ActiveGroupID = UUID.Zero.Guid;
2711 cadu.AgentID = UUID.Guid; 2713 cadu.AgentID = UUID.Guid;
2712 cadu.alwaysrun = m_setAlwaysRun; 2714 cadu.alwaysrun = SetAlwaysRun;
2713 cadu.AVHeight = m_appearance.AvatarHeight; 2715 cadu.AVHeight = Appearance.AvatarHeight;
2714 Vector3 tempCameraCenter = m_CameraCenter; 2716 cadu.cameraPosition = CameraPosition;
2715 cadu.cameraPosition = tempCameraCenter; 2717 cadu.drawdistance = DrawDistance;
2716 cadu.drawdistance = m_DrawDistance;
2717 cadu.GroupAccess = 0; 2718 cadu.GroupAccess = 0;
2718 cadu.Position = AbsolutePosition; 2719 cadu.Position = AbsolutePosition;
2719 cadu.regionHandle = m_rootRegionHandle; 2720 cadu.regionHandle = RegionHandle;
2720 2721
2721 // Throttles 2722 // Throttles
2722 float multiplier = 1; 2723 float multiplier = 1;
@@ -2822,7 +2823,7 @@ namespace OpenSim.Region.Framework.Scenes
2822 { 2823 {
2823 if (m_requestedSitTargetUUID == UUID.Zero) 2824 if (m_requestedSitTargetUUID == UUID.Zero)
2824 { 2825 {
2825 bool isFlying = m_physicsActor.Flying; 2826 bool isFlying = PhysicsActor.Flying;
2826 RemoveFromPhysicalScene(); 2827 RemoveFromPhysicalScene();
2827 2828
2828 Vector3 pos = AbsolutePosition; 2829 Vector3 pos = AbsolutePosition;
@@ -2847,7 +2848,7 @@ namespace OpenSim.Region.Framework.Scenes
2847 { 2848 {
2848 if (m_requestedSitTargetUUID == UUID.Zero) 2849 if (m_requestedSitTargetUUID == UUID.Zero)
2849 { 2850 {
2850 bool isFlying = m_physicsActor.Flying; 2851 bool isFlying = PhysicsActor.Flying;
2851 RemoveFromPhysicalScene(); 2852 RemoveFromPhysicalScene();
2852 2853
2853 Vector3 pos = AbsolutePosition; 2854 Vector3 pos = AbsolutePosition;
@@ -2937,7 +2938,7 @@ namespace OpenSim.Region.Framework.Scenes
2937 { 2938 {
2938 try 2939 try
2939 { 2940 {
2940 return m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying); 2941 return m_scene.CrossAgentToNewRegion(this, PhysicsActor.Flying);
2941 } 2942 }
2942 catch 2943 catch
2943 { 2944 {
@@ -2947,9 +2948,9 @@ namespace OpenSim.Region.Framework.Scenes
2947 2948
2948 public void InTransit() 2949 public void InTransit()
2949 { 2950 {
2950 m_inTransit = true; 2951 IsInTransit = true;
2951 2952
2952 if ((m_physicsActor != null) && m_physicsActor.Flying) 2953 if ((PhysicsActor != null) && PhysicsActor.Flying)
2953 m_AgentControlFlags |= AgentManager.ControlFlags.AGENT_CONTROL_FLY; 2954 m_AgentControlFlags |= AgentManager.ControlFlags.AGENT_CONTROL_FLY;
2954 else if ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0) 2955 else if ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0)
2955 m_AgentControlFlags &= ~AgentManager.ControlFlags.AGENT_CONTROL_FLY; 2956 m_AgentControlFlags &= ~AgentManager.ControlFlags.AGENT_CONTROL_FLY;
@@ -2957,7 +2958,7 @@ namespace OpenSim.Region.Framework.Scenes
2957 2958
2958 public void NotInTransit() 2959 public void NotInTransit()
2959 { 2960 {
2960 m_inTransit = false; 2961 IsInTransit = false;
2961 } 2962 }
2962 2963
2963 public void RestoreInCurrentScene() 2964 public void RestoreInCurrentScene()
@@ -3013,7 +3014,7 @@ namespace OpenSim.Region.Framework.Scenes
3013 if (byebyeRegions.Count > 0) 3014 if (byebyeRegions.Count > 0)
3014 { 3015 {
3015 m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents"); 3016 m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents");
3016 m_scene.SceneGridService.SendCloseChildAgentConnections(m_controllingClient.AgentId, byebyeRegions); 3017 m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, byebyeRegions);
3017 } 3018 }
3018 3019
3019 foreach (ulong handle in byebyeRegions) 3020 foreach (ulong handle in byebyeRegions)
@@ -3039,17 +3040,17 @@ namespace OpenSim.Region.Framework.Scenes
3039 if (account != null) 3040 if (account != null)
3040 { 3041 {
3041 if (account.UserLevel > 0) 3042 if (account.UserLevel > 0)
3042 m_godLevel = account.UserLevel; 3043 GodLevel = account.UserLevel;
3043 else 3044 else
3044 m_godLevel = 200; 3045 GodLevel = 200;
3045 } 3046 }
3046 } 3047 }
3047 else 3048 else
3048 { 3049 {
3049 m_godLevel = 0; 3050 GodLevel = 0;
3050 } 3051 }
3051 3052
3052 ControllingClient.SendAdminResponse(token, (uint)m_godLevel); 3053 ControllingClient.SendAdminResponse(token, (uint)GodLevel);
3053 } 3054 }
3054 3055
3055 #region Child Agent Updates 3056 #region Child Agent Updates
@@ -3081,8 +3082,8 @@ namespace OpenSim.Region.Framework.Scenes
3081 // When we get to the point of re-computing neighbors everytime this 3082 // When we get to the point of re-computing neighbors everytime this
3082 // changes, then start using the agent's drawdistance rather than the 3083 // changes, then start using the agent's drawdistance rather than the
3083 // region's draw distance. 3084 // region's draw distance.
3084 // m_DrawDistance = cAgentData.Far; 3085 // DrawDistance = cAgentData.Far;
3085 m_DrawDistance = Scene.DefaultDrawDistance; 3086 DrawDistance = Scene.DefaultDrawDistance;
3086 3087
3087 if (cAgentData.Position != new Vector3(-1f, -1f, -1f)) // UGH!! 3088 if (cAgentData.Position != new Vector3(-1f, -1f, -1f)) // UGH!!
3088 m_pos = cAgentData.Position + offset; 3089 m_pos = cAgentData.Position + offset;
@@ -3093,7 +3094,7 @@ namespace OpenSim.Region.Framework.Scenes
3093 ReprioritizeUpdates(); 3094 ReprioritizeUpdates();
3094 } 3095 }
3095 3096
3096 m_CameraCenter = cAgentData.Center + offset; 3097 CameraPosition = cAgentData.Center + offset;
3097 3098
3098 //SetHeight(cAgentData.AVHeight); 3099 //SetHeight(cAgentData.AVHeight);
3099 3100
@@ -3101,7 +3102,7 @@ namespace OpenSim.Region.Framework.Scenes
3101 ControllingClient.SetChildAgentThrottle(cAgentData.Throttles); 3102 ControllingClient.SetChildAgentThrottle(cAgentData.Throttles);
3102 3103
3103 //cAgentData.AVHeight; 3104 //cAgentData.AVHeight;
3104 m_rootRegionHandle = cAgentData.RegionHandle; 3105 RegionHandle = cAgentData.RegionHandle;
3105 //m_velocity = cAgentData.Velocity; 3106 //m_velocity = cAgentData.Velocity;
3106 } 3107 }
3107 3108
@@ -3114,12 +3115,12 @@ namespace OpenSim.Region.Framework.Scenes
3114 3115
3115 cAgent.Position = AbsolutePosition; 3116 cAgent.Position = AbsolutePosition;
3116 cAgent.Velocity = m_velocity; 3117 cAgent.Velocity = m_velocity;
3117 cAgent.Center = m_CameraCenter; 3118 cAgent.Center = CameraPosition;
3118 cAgent.AtAxis = m_CameraAtAxis; 3119 cAgent.AtAxis = CameraAtAxis;
3119 cAgent.LeftAxis = m_CameraLeftAxis; 3120 cAgent.LeftAxis = CameraLeftAxis;
3120 cAgent.UpAxis = m_CameraUpAxis; 3121 cAgent.UpAxis = m_CameraUpAxis;
3121 3122
3122 cAgent.Far = m_DrawDistance; 3123 cAgent.Far = DrawDistance;
3123 3124
3124 // Throttles 3125 // Throttles
3125 float multiplier = 1; 3126 float multiplier = 1;
@@ -3134,17 +3135,17 @@ namespace OpenSim.Region.Framework.Scenes
3134 cAgent.Throttles = ControllingClient.GetThrottlesPacked(multiplier); 3135 cAgent.Throttles = ControllingClient.GetThrottlesPacked(multiplier);
3135 3136
3136 cAgent.HeadRotation = m_headrotation; 3137 cAgent.HeadRotation = m_headrotation;
3137 cAgent.BodyRotation = m_bodyRot; 3138 cAgent.BodyRotation = Rotation;
3138 cAgent.ControlFlags = (uint)m_AgentControlFlags; 3139 cAgent.ControlFlags = (uint)m_AgentControlFlags;
3139 3140
3140 if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) 3141 if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID)))
3141 cAgent.GodLevel = (byte)m_godLevel; 3142 cAgent.GodLevel = (byte)GodLevel;
3142 else 3143 else
3143 cAgent.GodLevel = (byte) 0; 3144 cAgent.GodLevel = (byte) 0;
3144 3145
3145 cAgent.AlwaysRun = m_setAlwaysRun; 3146 cAgent.AlwaysRun = SetAlwaysRun;
3146 3147
3147 cAgent.Appearance = new AvatarAppearance(m_appearance); 3148 cAgent.Appearance = new AvatarAppearance(Appearance);
3148 3149
3149 lock (scriptedcontrols) 3150 lock (scriptedcontrols)
3150 { 3151 {
@@ -3173,7 +3174,7 @@ namespace OpenSim.Region.Framework.Scenes
3173 cAgent.AttachmentObjects = new List<ISceneObject>(); 3174 cAgent.AttachmentObjects = new List<ISceneObject>();
3174 cAgent.AttachmentObjectStates = new List<string>(); 3175 cAgent.AttachmentObjectStates = new List<string>();
3175 // IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>(); 3176 // IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>();
3176 m_InTransitScriptStates.Clear(); 3177 InTransitScriptStates.Clear();
3177 3178
3178 foreach (SceneObjectGroup sog in m_attachments) 3179 foreach (SceneObjectGroup sog in m_attachments)
3179 { 3180 {
@@ -3186,7 +3187,7 @@ namespace OpenSim.Region.Framework.Scenes
3186 cAgent.AttachmentObjects.Add(clone); 3187 cAgent.AttachmentObjects.Add(clone);
3187 string state = sog.GetStateSnapshot(); 3188 string state = sog.GetStateSnapshot();
3188 cAgent.AttachmentObjectStates.Add(state); 3189 cAgent.AttachmentObjectStates.Add(state);
3189 m_InTransitScriptStates.Add(state); 3190 InTransitScriptStates.Add(state);
3190 // Let's remove the scripts of the original object here 3191 // Let's remove the scripts of the original object here
3191 sog.RemoveScriptInstances(true); 3192 sog.RemoveScriptInstances(true);
3192 } 3193 }
@@ -3202,32 +3203,32 @@ namespace OpenSim.Region.Framework.Scenes
3202 3203
3203 m_pos = cAgent.Position; 3204 m_pos = cAgent.Position;
3204 m_velocity = cAgent.Velocity; 3205 m_velocity = cAgent.Velocity;
3205 m_CameraCenter = cAgent.Center; 3206 CameraPosition = cAgent.Center;
3206 m_CameraAtAxis = cAgent.AtAxis; 3207 CameraAtAxis = cAgent.AtAxis;
3207 m_CameraLeftAxis = cAgent.LeftAxis; 3208 CameraLeftAxis = cAgent.LeftAxis;
3208 m_CameraUpAxis = cAgent.UpAxis; 3209 m_CameraUpAxis = cAgent.UpAxis;
3209 3210
3210 // When we get to the point of re-computing neighbors everytime this 3211 // When we get to the point of re-computing neighbors everytime this
3211 // changes, then start using the agent's drawdistance rather than the 3212 // changes, then start using the agent's drawdistance rather than the
3212 // region's draw distance. 3213 // region's draw distance.
3213 // m_DrawDistance = cAgent.Far; 3214 // DrawDistance = cAgent.Far;
3214 m_DrawDistance = Scene.DefaultDrawDistance; 3215 DrawDistance = Scene.DefaultDrawDistance;
3215 3216
3216 if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0) 3217 if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0)
3217 ControllingClient.SetChildAgentThrottle(cAgent.Throttles); 3218 ControllingClient.SetChildAgentThrottle(cAgent.Throttles);
3218 3219
3219 m_headrotation = cAgent.HeadRotation; 3220 m_headrotation = cAgent.HeadRotation;
3220 m_bodyRot = cAgent.BodyRotation; 3221 Rotation = cAgent.BodyRotation;
3221 m_AgentControlFlags = (AgentManager.ControlFlags)cAgent.ControlFlags; 3222 m_AgentControlFlags = (AgentManager.ControlFlags)cAgent.ControlFlags;
3222 3223
3223 if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) 3224 if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID)))
3224 m_godLevel = cAgent.GodLevel; 3225 GodLevel = cAgent.GodLevel;
3225 m_setAlwaysRun = cAgent.AlwaysRun; 3226 SetAlwaysRun = cAgent.AlwaysRun;
3226 3227
3227 m_appearance = new AvatarAppearance(cAgent.Appearance); 3228 Appearance = new AvatarAppearance(cAgent.Appearance);
3228 if (m_physicsActor != null) 3229 if (PhysicsActor != null)
3229 { 3230 {
3230 bool isFlying = m_physicsActor.Flying; 3231 bool isFlying = PhysicsActor.Flying;
3231 RemoveFromPhysicalScene(); 3232 RemoveFromPhysicalScene();
3232 AddToPhysicalScene(isFlying); 3233 AddToPhysicalScene(isFlying);
3233 } 3234 }
@@ -3293,7 +3294,7 @@ namespace OpenSim.Region.Framework.Scenes
3293 { 3294 {
3294 Vector3 force = m_forceToApply.Value; 3295 Vector3 force = m_forceToApply.Value;
3295 3296
3296 m_updateflag = true; 3297 Updated = true;
3297 3298
3298 Velocity = force; 3299 Velocity = force;
3299 3300
@@ -3310,30 +3311,30 @@ namespace OpenSim.Region.Framework.Scenes
3310// "[SCENE PRESENCE]: Adding physics actor for {0}, ifFlying = {1} in {2}", 3311// "[SCENE PRESENCE]: Adding physics actor for {0}, ifFlying = {1} in {2}",
3311// Name, isFlying, Scene.RegionInfo.RegionName); 3312// Name, isFlying, Scene.RegionInfo.RegionName);
3312 3313
3313 if (m_appearance.AvatarHeight == 0) 3314 if (Appearance.AvatarHeight == 0)
3314 m_appearance.SetHeight(); 3315 Appearance.SetHeight();
3315 3316
3316 PhysicsScene scene = m_scene.PhysicsScene; 3317 PhysicsScene scene = m_scene.PhysicsScene;
3317 3318
3318 Vector3 pVec = AbsolutePosition; 3319 Vector3 pVec = AbsolutePosition;
3319 3320
3320 // Old bug where the height was in centimeters instead of meters 3321 // Old bug where the height was in centimeters instead of meters
3321 m_physicsActor = scene.AddAvatar(LocalId, Firstname + "." + Lastname, pVec, 3322 PhysicsActor = scene.AddAvatar(LocalId, Firstname + "." + Lastname, pVec,
3322 new Vector3(0f, 0f, m_appearance.AvatarHeight), isFlying); 3323 new Vector3(0f, 0f, Appearance.AvatarHeight), isFlying);
3323 3324
3324 scene.AddPhysicsActorTaint(m_physicsActor); 3325 scene.AddPhysicsActorTaint(PhysicsActor);
3325 //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; 3326 //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
3326 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; 3327 PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
3327 m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong 3328 PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong
3328 m_physicsActor.SubscribeEvents(500); 3329 PhysicsActor.SubscribeEvents(500);
3329 m_physicsActor.LocalID = LocalId; 3330 PhysicsActor.LocalID = LocalId;
3330 3331
3331 SetHeight(m_appearance.AvatarHeight); 3332 SetHeight(Appearance.AvatarHeight);
3332 } 3333 }
3333 3334
3334 private void OutOfBoundsCall(Vector3 pos) 3335 private void OutOfBoundsCall(Vector3 pos)
3335 { 3336 {
3336 //bool flying = m_physicsActor.Flying; 3337 //bool flying = PhysicsActor.Flying;
3337 //RemoveFromPhysicalScene(); 3338 //RemoveFromPhysicalScene();
3338 3339
3339 //AddToPhysicalScene(flying); 3340 //AddToPhysicalScene(flying);
@@ -3348,7 +3349,7 @@ namespace OpenSim.Region.Framework.Scenes
3348 return; 3349 return;
3349 3350
3350 //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) 3351 //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f))
3351 // The Physics Scene will send updates every 500 ms grep: m_physicsActor.SubscribeEvents( 3352 // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents(
3352 // as of this comment the interval is set in AddToPhysicalScene 3353 // as of this comment the interval is set in AddToPhysicalScene
3353 if (Animator != null) 3354 if (Animator != null)
3354 Animator.UpdateMovementAnimations(); 3355 Animator.UpdateMovementAnimations();
@@ -3387,7 +3388,7 @@ namespace OpenSim.Region.Framework.Scenes
3387 } 3388 }
3388 } 3389 }
3389 3390
3390 if (m_invulnerable) 3391 if (Invulnerable)
3391 return; 3392 return;
3392 3393
3393 float starthealth = Health; 3394 float starthealth = Health;
@@ -3412,13 +3413,13 @@ namespace OpenSim.Region.Framework.Scenes
3412 //m_log.Debug("[AVATAR]: Collision with localid: " + localid.ToString() + " at depth: " + coldata[localid].ToString()); 3413 //m_log.Debug("[AVATAR]: Collision with localid: " + localid.ToString() + " at depth: " + coldata[localid].ToString());
3413 } 3414 }
3414 //Health = 100; 3415 //Health = 100;
3415 if (!m_invulnerable) 3416 if (!Invulnerable)
3416 { 3417 {
3417 if (starthealth != Health) 3418 if (starthealth != Health)
3418 { 3419 {
3419 ControllingClient.SendHealth(Health); 3420 ControllingClient.SendHealth(Health);
3420 } 3421 }
3421 if (m_health <= 0) 3422 if (Health <= 0)
3422 m_scene.EventManager.TriggerAvatarKill(killerObj, this); 3423 m_scene.EventManager.TriggerAvatarKill(killerObj, this);
3423 } 3424 }
3424 } 3425 }
@@ -3449,11 +3450,11 @@ namespace OpenSim.Region.Framework.Scenes
3449 // unsetting the elapsed callback should be enough to allow for cleanup however. 3450 // unsetting the elapsed callback should be enough to allow for cleanup however.
3450 // m_reprioritizationTimer.Dispose(); 3451 // m_reprioritizationTimer.Dispose();
3451 3452
3452 m_sceneViewer.Close(); 3453 SceneViewer.Close();
3453 3454
3454 RemoveFromPhysicalScene(); 3455 RemoveFromPhysicalScene();
3455 m_animator.Close(); 3456 Animator.Close();
3456 m_animator = null; 3457 Animator = null;
3457 } 3458 }
3458 3459
3459 public void AddAttachment(SceneObjectGroup gobj) 3460 public void AddAttachment(SceneObjectGroup gobj)
@@ -3815,7 +3816,7 @@ namespace OpenSim.Region.Framework.Scenes
3815 3816
3816 private void Reprioritize(object sender, ElapsedEventArgs e) 3817 private void Reprioritize(object sender, ElapsedEventArgs e)
3817 { 3818 {
3818 m_controllingClient.ReprioritizeUpdates(); 3819 ControllingClient.ReprioritizeUpdates();
3819 3820
3820 lock (m_reprioritization_timer) 3821 lock (m_reprioritization_timer)
3821 { 3822 {