aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
authorlbsa712007-12-27 21:41:48 +0000
committerlbsa712007-12-27 21:41:48 +0000
commitefd90b56b761219af6425b1c7a2cdd3b6ffb4de2 (patch)
treebf5b897e1e3c13211e3e2fc61d30508b94c928c0 /OpenSim/Region/Environment/Scenes/ScenePresence.cs
parent* removed always true if (diff)
downloadopensim-SC_OLD-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.zip
opensim-SC_OLD-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.gz
opensim-SC_OLD-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.bz2
opensim-SC_OLD-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.xz
* Optimized usings
* shortened references * Removed redundant 'this' * Normalized EOF
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs132
1 files changed, 69 insertions, 63 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 9a937a2..9454de0 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -32,7 +32,6 @@ using libsecondlife;
32using libsecondlife.Packets; 32using libsecondlife.Packets;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
35using OpenSim.Framework.Communications;
36using OpenSim.Region.Environment.Types; 35using OpenSim.Region.Environment.Types;
37using OpenSim.Region.Physics.Manager; 36using OpenSim.Region.Physics.Manager;
38 37
@@ -60,14 +59,14 @@ namespace OpenSim.Region.Environment.Scenes
60 private bool m_setAlwaysRun = false; 59 private bool m_setAlwaysRun = false;
61 60
62 private Quaternion m_bodyRot; 61 private Quaternion m_bodyRot;
63 62
64 public bool IsRestrictedToRegion = false; 63 public bool IsRestrictedToRegion = false;
65 64
66 // Agent moves with a PID controller causing a force to be exerted. 65 // Agent moves with a PID controller causing a force to be exerted.
67 private bool m_newForce = false; 66 private bool m_newForce = false;
68 private bool m_newCoarseLocations = true; 67 private bool m_newCoarseLocations = true;
69 private bool m_gotAllObjectsInScene = false; 68 private bool m_gotAllObjectsInScene = false;
70 69
71 // Default AV Height 70 // Default AV Height
72 private float m_avHeight = 127.0f; 71 private float m_avHeight = 127.0f;
73 72
@@ -76,7 +75,7 @@ namespace OpenSim.Region.Environment.Scenes
76 75
77 private readonly Vector3[] Dir_Vectors = new Vector3[6]; 76 private readonly Vector3[] Dir_Vectors = new Vector3[6];
78 private LLVector3 lastPhysPos = new LLVector3(); 77 private LLVector3 lastPhysPos = new LLVector3();
79 78
80 // Position of agent's camera in world (region cordinates) 79 // Position of agent's camera in world (region cordinates)
81 protected Vector3 m_CameraCenter = new Vector3(0, 0, 0); 80 protected Vector3 m_CameraCenter = new Vector3(0, 0, 0);
82 81
@@ -85,17 +84,18 @@ namespace OpenSim.Region.Environment.Scenes
85 protected Vector3 m_CameraAtAxis = new Vector3(0, 0, 0); 84 protected Vector3 m_CameraAtAxis = new Vector3(0, 0, 0);
86 protected Vector3 m_CameraLeftAxis = new Vector3(0, 0, 0); 85 protected Vector3 m_CameraLeftAxis = new Vector3(0, 0, 0);
87 protected Vector3 m_CameraUpAxis = new Vector3(0, 0, 0); 86 protected Vector3 m_CameraUpAxis = new Vector3(0, 0, 0);
88 private uint m_AgentControlFlags = (uint)0; 87 private uint m_AgentControlFlags = (uint) 0;
89 private LLQuaternion m_headrotation = new LLQuaternion(); 88 private LLQuaternion m_headrotation = new LLQuaternion();
90 private byte m_state = (byte)0; 89 private byte m_state = (byte) 0;
91 90
92 // Agent's Draw distance. 91 // Agent's Draw distance.
93 protected float m_DrawDistance = 0f; 92 protected float m_DrawDistance = 0f;
94 93
95 protected AvatarAppearance m_appearance; 94 protected AvatarAppearance m_appearance;
96 95
97 private readonly List<ulong> m_knownChildRegions = new List<ulong>(); //neighbouring regions we have enabled a child agent in 96 private readonly List<ulong> m_knownChildRegions = new List<ulong>();
98 97 //neighbouring regions we have enabled a child agent in
98
99 99
100 /// <summary> 100 /// <summary>
101 /// Implemented Control Flags 101 /// Implemented Control Flags
@@ -172,6 +172,7 @@ namespace OpenSim.Region.Environment.Scenes
172 } 172 }
173 173
174 protected bool m_allowMovement = true; 174 protected bool m_allowMovement = true;
175
175 public bool AllowMovement 176 public bool AllowMovement
176 { 177 {
177 get { return m_allowMovement; } 178 get { return m_allowMovement; }
@@ -181,8 +182,8 @@ namespace OpenSim.Region.Environment.Scenes
181 /// <summary> 182 /// <summary>
182 /// This works out to be the ClientView object associated with this avatar, or it's UDP connection manager 183 /// This works out to be the ClientView object associated with this avatar, or it's UDP connection manager
183 /// </summary> 184 /// </summary>
184
185 private readonly IClientAPI m_controllingClient; 185 private readonly IClientAPI m_controllingClient;
186
186 protected PhysicsActor m_physicsActor; 187 protected PhysicsActor m_physicsActor;
187 188
188 public IClientAPI ControllingClient 189 public IClientAPI ControllingClient
@@ -228,6 +229,7 @@ namespace OpenSim.Region.Environment.Scenes
228 m_pos = value; 229 m_pos = value;
229 } 230 }
230 } 231 }
232
231 /// <summary> 233 /// <summary>
232 /// Current Velocity of the avatar. 234 /// Current Velocity of the avatar.
233 /// </summary> 235 /// </summary>
@@ -294,6 +296,7 @@ namespace OpenSim.Region.Environment.Scenes
294 { 296 {
295 get { return m_knownChildRegions; } 297 get { return m_knownChildRegions; }
296 } 298 }
299
297 #endregion 300 #endregion
298 301
299 #region Constructor(s) 302 #region Constructor(s)
@@ -336,7 +339,7 @@ namespace OpenSim.Region.Environment.Scenes
336 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance) 339 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance)
337 : this(client, world, reginfo) 340 : this(client, world, reginfo)
338 { 341 {
339 m_appearance = appearance; 342 m_appearance = appearance;
340 } 343 }
341 344
342 private void RegisterToEvents() 345 private void RegisterToEvents()
@@ -366,6 +369,7 @@ namespace OpenSim.Region.Environment.Scenes
366 Dir_Vectors[5] = new Vector3(0, 0, -1); //DOWN 369 Dir_Vectors[5] = new Vector3(0, 0, -1); //DOWN
367 Dir_Vectors[5] = new Vector3(0, 0, -0.5f); //DOWN_Nudge 370 Dir_Vectors[5] = new Vector3(0, 0, -0.5f); //DOWN_Nudge
368 } 371 }
372
369 #endregion 373 #endregion
370 374
371 public void QueuePartForUpdate(SceneObjectPart part) 375 public void QueuePartForUpdate(SceneObjectPart part)
@@ -381,7 +385,7 @@ namespace OpenSim.Region.Environment.Scenes
381 385
382 public uint GenerateClientFlags(LLUUID ObjectID) 386 public uint GenerateClientFlags(LLUUID ObjectID)
383 { 387 {
384 return m_scene.PermissionsMngr.GenerateClientFlags(this.m_uuid, ObjectID); 388 return m_scene.PermissionsMngr.GenerateClientFlags(m_uuid, ObjectID);
385 } 389 }
386 390
387 public void SendPrimUpdates() 391 public void SendPrimUpdates()
@@ -461,6 +465,7 @@ namespace OpenSim.Region.Environment.Scenes
461 } 465 }
462 466
463 #region Status Methods 467 #region Status Methods
468
464 /// <summary> 469 /// <summary>
465 /// This turns a child agent, into a root agent 470 /// This turns a child agent, into a root agent
466 /// This is called when an agent teleports into a region, or if an 471 /// This is called when an agent teleports into a region, or if an
@@ -531,6 +536,7 @@ namespace OpenSim.Region.Environment.Scenes
531 public void StopMovement() 536 public void StopMovement()
532 { 537 {
533 } 538 }
539
534 public void StopFlying() 540 public void StopFlying()
535 { 541 {
536 // It turns out to get the agent to stop flying, you have to feed it stop flying velocities 542 // It turns out to get the agent to stop flying, you have to feed it stop flying velocities
@@ -560,9 +566,11 @@ namespace OpenSim.Region.Environment.Scenes
560 m_knownChildRegions.Remove(regionHandle); 566 m_knownChildRegions.Remove(regionHandle);
561 } 567 }
562 } 568 }
569
563 #endregion 570 #endregion
564 571
565 #region Event Handlers 572 #region Event Handlers
573
566 /// <summary> 574 /// <summary>
567 /// Sets avatar height in the phyiscs plugin 575 /// Sets avatar height in the phyiscs plugin
568 /// </summary> 576 /// </summary>
@@ -603,7 +611,6 @@ namespace OpenSim.Region.Environment.Scenes
603 /// </summary> 611 /// </summary>
604 public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdatePacket agentData) 612 public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdatePacket agentData)
605 { 613 {
606
607 //if (m_isChildAgent) 614 //if (m_isChildAgent)
608 //{ 615 //{
609 // // Console.WriteLine("DEBUG: HandleAgentUpdate: child agent"); 616 // // Console.WriteLine("DEBUG: HandleAgentUpdate: child agent");
@@ -639,7 +646,7 @@ namespace OpenSim.Region.Environment.Scenes
639 // The Agent's Draw distance setting 646 // The Agent's Draw distance setting
640 m_DrawDistance = agentData.AgentData.Far; 647 m_DrawDistance = agentData.AgentData.Far;
641 648
642 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) 649 if ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0)
643 { 650 {
644 StandUp(); 651 StandUp();
645 } 652 }
@@ -649,7 +656,7 @@ namespace OpenSim.Region.Environment.Scenes
649 return; 656 return;
650 } 657 }
651 658
652 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0) 659 if ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0)
653 { 660 {
654 // TODO: This doesn't quite work yet -- probably a parent ID problem 661 // TODO: This doesn't quite work yet -- probably a parent ID problem
655 // m_parentID = (what should this be?) 662 // m_parentID = (what should this be?)
@@ -672,7 +679,7 @@ namespace OpenSim.Region.Environment.Scenes
672 Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); 679 Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
673 bool oldflying = PhysicsActor.Flying; 680 bool oldflying = PhysicsActor.Flying;
674 681
675 PhysicsActor.Flying = ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); 682 PhysicsActor.Flying = ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
676 if (PhysicsActor.Flying != oldflying) 683 if (PhysicsActor.Flying != oldflying)
677 { 684 {
678 update_movementflag = true; 685 update_movementflag = true;
@@ -686,23 +693,23 @@ namespace OpenSim.Region.Environment.Scenes
686 693
687 if (m_parentID == 0) 694 if (m_parentID == 0)
688 { 695 {
689 foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags))) 696 foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof (Dir_ControlFlags)))
690 { 697 {
691 if ((flags & (uint)DCF) != 0) 698 if ((flags & (uint) DCF) != 0)
692 { 699 {
693 DCFlagKeyPressed = true; 700 DCFlagKeyPressed = true;
694 agent_control_v3 += Dir_Vectors[i]; 701 agent_control_v3 += Dir_Vectors[i];
695 if ((m_movementflag & (uint)DCF) == 0) 702 if ((m_movementflag & (uint) DCF) == 0)
696 { 703 {
697 m_movementflag += (byte)(uint)DCF; 704 m_movementflag += (byte) (uint) DCF;
698 update_movementflag = true; 705 update_movementflag = true;
699 } 706 }
700 } 707 }
701 else 708 else
702 { 709 {
703 if ((m_movementflag & (uint)DCF) != 0) 710 if ((m_movementflag & (uint) DCF) != 0)
704 { 711 {
705 m_movementflag -= (byte)(uint)DCF; 712 m_movementflag -= (byte) (uint) DCF;
706 update_movementflag = true; 713 update_movementflag = true;
707 } 714 }
708 } 715 }
@@ -719,8 +726,9 @@ namespace OpenSim.Region.Environment.Scenes
719 if (m_physicsActor.Flying) 726 if (m_physicsActor.Flying)
720 { 727 {
721 // Are the landing controls requirements filled? 728 // Are the landing controls requirements filled?
722 bool controlland = (((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); 729 bool controlland = (((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) ||
723 730 ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0));
731
724 // Are the collision requirements fulfilled? 732 // Are the collision requirements fulfilled?
725 bool colliding = (m_physicsActor.IsColliding == true); 733 bool colliding = (m_physicsActor.IsColliding == true);
726 734
@@ -748,7 +756,6 @@ namespace OpenSim.Region.Environment.Scenes
748 { 756 {
749 if (m_parentID != 0) 757 if (m_parentID != 0)
750 { 758 {
751
752 SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID); 759 SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID);
753 if (part != null) 760 if (part != null)
754 { 761 {
@@ -757,7 +764,7 @@ namespace OpenSim.Region.Environment.Scenes
757 part.SetAvatarOnSitTarget(LLUUID.Zero); 764 part.SetAvatarOnSitTarget(LLUUID.Zero);
758 } 765 }
759 766
760 m_pos += m_parentPosition + new LLVector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight); 767 m_pos += m_parentPosition + new LLVector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight);
761 m_parentPosition = new LLVector3(); 768 m_parentPosition = new LLVector3();
762 769
763 if (m_physicsActor == null) 770 if (m_physicsActor == null)
@@ -778,14 +785,14 @@ namespace OpenSim.Region.Environment.Scenes
778 785
779 bool autopilot = true; 786 bool autopilot = true;
780 LLVector3 pos = new LLVector3(); 787 LLVector3 pos = new LLVector3();
781 LLQuaternion sitOrientation = new LLQuaternion(0,0,0,1); 788 LLQuaternion sitOrientation = new LLQuaternion(0, 0, 0, 1);
782 789
783 SceneObjectPart part = m_scene.GetSceneObjectPart(targetID); 790 SceneObjectPart part = m_scene.GetSceneObjectPart(targetID);
784 if (part != null) 791 if (part != null)
785 { 792 {
786 // TODO: determine position to sit at based on scene geometry; don't trust offset from client 793 // TODO: determine position to sit at based on scene geometry; don't trust offset from client
787 // see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it 794 // see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it
788 795
789 796
790 // Is a sit target available? 797 // Is a sit target available?
791 Vector3 avSitOffSet = part.GetSitTargetPosition(); 798 Vector3 avSitOffSet = part.GetSitTargetPosition();
@@ -793,15 +800,17 @@ namespace OpenSim.Region.Environment.Scenes
793 LLUUID avOnTargetAlready = part.GetAvatarOnSitTarget(); 800 LLUUID avOnTargetAlready = part.GetAvatarOnSitTarget();
794 801
795 bool SitTargetUnOccupied = (!(avOnTargetAlready != LLUUID.Zero)); 802 bool SitTargetUnOccupied = (!(avOnTargetAlready != LLUUID.Zero));
796 bool SitTargetisSet = (!(avSitOffSet.x == 0 && avSitOffSet.y == 0 && avSitOffSet.z == 0 && avSitOrientation.w == 0 && avSitOrientation.x == 0 && avSitOrientation.y == 0 && avSitOrientation.z == 1)); 803 bool SitTargetisSet =
804 (!(avSitOffSet.x == 0 && avSitOffSet.y == 0 && avSitOffSet.z == 0 && avSitOrientation.w == 0 &&
805 avSitOrientation.x == 0 && avSitOrientation.y == 0 && avSitOrientation.z == 1));
797 806
798 if (SitTargetisSet && SitTargetUnOccupied) 807 if (SitTargetisSet && SitTargetUnOccupied)
799 { 808 {
800 part.SetAvatarOnSitTarget(UUID); 809 part.SetAvatarOnSitTarget(UUID);
801 offset = new LLVector3(avSitOffSet.x,avSitOffSet.y,avSitOffSet.z); 810 offset = new LLVector3(avSitOffSet.x, avSitOffSet.y, avSitOffSet.z);
802 sitOrientation = new LLQuaternion(avSitOrientation.w,avSitOrientation.x,avSitOrientation.y,avSitOrientation.z); 811 sitOrientation =
812 new LLQuaternion(avSitOrientation.w, avSitOrientation.x, avSitOrientation.y, avSitOrientation.z);
803 autopilot = false; 813 autopilot = false;
804
805 } 814 }
806 815
807 816
@@ -817,43 +826,37 @@ namespace OpenSim.Region.Environment.Scenes
817 826
818 if (autopilot) 827 if (autopilot)
819 { 828 {
820
821 if (Util.GetDistanceTo(AbsolutePosition, pos) < 4.5) 829 if (Util.GetDistanceTo(AbsolutePosition, pos) < 4.5)
822 { 830 {
823 autopilot = false; 831 autopilot = false;
824 832
825 RemoveFromPhysicalScene(); 833 RemoveFromPhysicalScene();
826 AbsolutePosition = pos + new LLVector3(0.0f, 0.0f, m_sitAvatarHeight); 834 AbsolutePosition = pos + new LLVector3(0.0f, 0.0f, m_sitAvatarHeight);
827
828 } 835 }
829 else 836 else
830 { 837 {
831
832 } 838 }
833 } 839 }
834 else 840 else
835 { 841 {
836 RemoveFromPhysicalScene(); 842 RemoveFromPhysicalScene();
837
838
839 } 843 }
840 } // Physactor != null 844 } // Physactor != null
841 } // part != null 845 } // part != null
842 846
843 847
844 avatarSitResponse.SitTransform.AutoPilot = autopilot; 848 avatarSitResponse.SitTransform.AutoPilot = autopilot;
845 avatarSitResponse.SitTransform.SitPosition = offset; 849 avatarSitResponse.SitTransform.SitPosition = offset;
846 avatarSitResponse.SitTransform.SitRotation = sitOrientation; 850 avatarSitResponse.SitTransform.SitRotation = sitOrientation;
847 851
848 remoteClient.OutPacket(avatarSitResponse, ThrottleOutPacketType.Task); 852 remoteClient.OutPacket(avatarSitResponse, ThrottleOutPacketType.Task);
849 853
850 // This calls HandleAgentSit twice, once from here, and the client calls 854 // This calls HandleAgentSit twice, once from here, and the client calls
851 // HandleAgentSit itself after it gets to the location 855 // HandleAgentSit itself after it gets to the location
852 // It doesn't get to the location until we've moved them there though 856 // It doesn't get to the location until we've moved them there though
853 // which happens in HandleAgentSit :P 857 // which happens in HandleAgentSit :P
854 if (!autopilot) 858 if (!autopilot)
855 HandleAgentSit(remoteClient, UUID); 859 HandleAgentSit(remoteClient, UUID);
856
857 } 860 }
858 861
859 public void HandleAgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID, LLVector3 offset) 862 public void HandleAgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID, LLVector3 offset)
@@ -863,7 +866,6 @@ namespace OpenSim.Region.Environment.Scenes
863 StandUp(); 866 StandUp();
864 } 867 }
865 868
866
867 869
868 SceneObjectPart part = m_scene.GetSceneObjectPart(targetID); 870 SceneObjectPart part = m_scene.GetSceneObjectPart(targetID);
869 871
@@ -919,7 +921,6 @@ namespace OpenSim.Region.Environment.Scenes
919 // This may seem stupid, but Our Full updates don't send avatar rotation :P 921 // This may seem stupid, but Our Full updates don't send avatar rotation :P
920 // So we're also sending a terse update (which has avatar rotation) 922 // So we're also sending a terse update (which has avatar rotation)
921 SendTerseUpdateToAllClients(); 923 SendTerseUpdateToAllClients();
922
923 } 924 }
924 925
925 /// <summary> 926 /// <summary>
@@ -1003,7 +1004,7 @@ namespace OpenSim.Region.Environment.Scenes
1003 // We are flying 1004 // We are flying
1004 SetMovementAnimation(Animations.AnimsLLUUID["FLY"], 1); 1005 SetMovementAnimation(Animations.AnimsLLUUID["FLY"], 1);
1005 } 1006 }
1006 else if (((m_movementflag & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) && 1007 else if (((m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) &&
1007 PhysicsActor.IsColliding) 1008 PhysicsActor.IsColliding)
1008 { 1009 {
1009 // Client is pressing the page down button and moving and is colliding with something 1010 // Client is pressing the page down button and moving and is colliding with something
@@ -1014,7 +1015,8 @@ namespace OpenSim.Region.Environment.Scenes
1014 // Client is moving and falling at a velocity greater then 6 meters per unit 1015 // Client is moving and falling at a velocity greater then 6 meters per unit
1015 SetMovementAnimation(Animations.AnimsLLUUID["FALLDOWN"], 1); 1016 SetMovementAnimation(Animations.AnimsLLUUID["FALLDOWN"], 1);
1016 } 1017 }
1017 else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && (m_movementflag & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0) 1018 else if (!PhysicsActor.IsColliding && Velocity.Z > 0 &&
1019 (m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0)
1018 { 1020 {
1019 // Client is moving, and colliding and pressing the page up button but isn't flying 1021 // Client is moving, and colliding and pressing the page up button but isn't flying
1020 SetMovementAnimation(Animations.AnimsLLUUID["JUMP"], 1); 1022 SetMovementAnimation(Animations.AnimsLLUUID["JUMP"], 1);
@@ -1034,7 +1036,7 @@ namespace OpenSim.Region.Environment.Scenes
1034 { 1036 {
1035 // Not moving 1037 // Not moving
1036 1038
1037 if (((m_movementflag & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) && 1039 if (((m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) &&
1038 PhysicsActor.IsColliding) 1040 PhysicsActor.IsColliding)
1039 { 1041 {
1040 // Client pressing the page down button 1042 // Client pressing the page down button
@@ -1045,7 +1047,8 @@ namespace OpenSim.Region.Environment.Scenes
1045 // Not colliding and not flying, and we're falling at high speed 1047 // Not colliding and not flying, and we're falling at high speed
1046 SetMovementAnimation(Animations.AnimsLLUUID["FALLDOWN"], 1); 1048 SetMovementAnimation(Animations.AnimsLLUUID["FALLDOWN"], 1);
1047 } 1049 }
1048 else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && !m_physicsActor.Flying && (m_movementflag & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0) 1050 else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && !m_physicsActor.Flying &&
1051 (m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0)
1049 { 1052 {
1050 // This is the standing jump 1053 // This is the standing jump
1051 SetMovementAnimation(Animations.AnimsLLUUID["JUMP"], 1); 1054 SetMovementAnimation(Animations.AnimsLLUUID["JUMP"], 1);
@@ -1063,6 +1066,7 @@ namespace OpenSim.Region.Environment.Scenes
1063 } 1066 }
1064 } 1067 }
1065 } 1068 }
1069
1066 /// <summary> 1070 /// <summary>
1067 /// Adds a new movement 1071 /// Adds a new movement
1068 /// </summary> 1072 /// </summary>
@@ -1075,10 +1079,10 @@ namespace OpenSim.Region.Environment.Scenes
1075 } 1079 }
1076 m_rotation = rotation; 1080 m_rotation = rotation;
1077 NewForce newVelocity = new NewForce(); 1081 NewForce newVelocity = new NewForce();
1078 Vector3 direc = rotation * vec; 1082 Vector3 direc = rotation*vec;
1079 direc.Normalize(); 1083 direc.Normalize();
1080 1084
1081 direc *= 0.03f * 128f; 1085 direc *= 0.03f*128f;
1082 if (m_physicsActor.Flying) 1086 if (m_physicsActor.Flying)
1083 { 1087 {
1084 direc *= 4; 1088 direc *= 4;
@@ -1108,7 +1112,6 @@ namespace OpenSim.Region.Environment.Scenes
1108 SetMovementAnimation(Animations.AnimsLLUUID["JUMP"], 1); 1112 SetMovementAnimation(Animations.AnimsLLUUID["JUMP"], 1);
1109 } 1113 }
1110 } 1114 }
1111
1112 } 1115 }
1113 1116
1114 newVelocity.X = direc.x; 1117 newVelocity.X = direc.x;
@@ -1173,7 +1176,7 @@ namespace OpenSim.Region.Environment.Scenes
1173 { 1176 {
1174 LLVector3 pos = m_pos; 1177 LLVector3 pos = m_pos;
1175 LLVector3 vel = Velocity; 1178 LLVector3 vel = Velocity;
1176 LLQuaternion rot=new LLQuaternion(m_bodyRot.x, m_bodyRot.y, m_bodyRot.z, m_bodyRot.w); 1179 LLQuaternion rot = new LLQuaternion(m_bodyRot.x, m_bodyRot.y, m_bodyRot.z, m_bodyRot.w);
1177 remoteClient.SendAvatarTerseUpdate(m_regionHandle, 64096, LocalId, new LLVector3(pos.X, pos.Y, pos.Z), 1180 remoteClient.SendAvatarTerseUpdate(m_regionHandle, 64096, LocalId, new LLVector3(pos.X, pos.Y, pos.Z),
1178 new LLVector3(vel.X, vel.Y, vel.Z), rot); 1181 new LLVector3(vel.X, vel.Y, vel.Z), rot);
1179 } 1182 }
@@ -1213,7 +1216,8 @@ namespace OpenSim.Region.Environment.Scenes
1213 public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) 1216 public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar)
1214 { 1217 {
1215 remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, 1218 remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid,
1216 LocalId, m_pos, m_appearance.TextureEntry.ToBytes(), m_parentID); 1219 LocalId, m_pos, m_appearance.TextureEntry.ToBytes(),
1220 m_parentID);
1217 } 1221 }
1218 1222
1219 /// <summary> 1223 /// <summary>
@@ -1303,10 +1307,8 @@ namespace OpenSim.Region.Environment.Scenes
1303 /// <param name="seqs"></param> 1307 /// <param name="seqs"></param>
1304 public void SendAnimPack(LLUUID[] animations, int[] seqs) 1308 public void SendAnimPack(LLUUID[] animations, int[] seqs)
1305 { 1309 {
1306 m_scene.Broadcast(delegate(IClientAPI client) 1310 m_scene.Broadcast(
1307 { 1311 delegate(IClientAPI client) { client.SendAnimations(animations, seqs, m_controllingClient.AgentId); });
1308 client.SendAnimations(animations, seqs, m_controllingClient.AgentId);
1309 });
1310 } 1312 }
1311 1313
1312 /// <summary> 1314 /// <summary>
@@ -1320,6 +1322,7 @@ namespace OpenSim.Region.Environment.Scenes
1320 #endregion 1322 #endregion
1321 1323
1322 #region Significant Movement Method 1324 #region Significant Movement Method
1325
1323 /// <summary> 1326 /// <summary>
1324 /// This checks for a significant movement and sends a courselocationchange update 1327 /// This checks for a significant movement and sends a courselocationchange update
1325 /// </summary> 1328 /// </summary>
@@ -1349,9 +1352,9 @@ namespace OpenSim.Region.Environment.Scenes
1349 LLVector3 vel = Velocity; 1352 LLVector3 vel = Velocity;
1350 1353
1351 float timeStep = 0.1f; 1354 float timeStep = 0.1f;
1352 pos2.X = pos2.X + (vel.X * timeStep); 1355 pos2.X = pos2.X + (vel.X*timeStep);
1353 pos2.Y = pos2.Y + (vel.Y * timeStep); 1356 pos2.Y = pos2.Y + (vel.Y*timeStep);
1354 pos2.Z = pos2.Z + (vel.Z * timeStep); 1357 pos2.Z = pos2.Z + (vel.Z*timeStep);
1355 1358
1356 if ((pos2.X < 0) || (pos2.X > 256)) 1359 if ((pos2.X < 0) || (pos2.X > 256))
1357 { 1360 {
@@ -1411,7 +1414,7 @@ namespace OpenSim.Region.Environment.Scenes
1411 } 1414 }
1412 1415
1413 LLVector3 vel = m_velocity; 1416 LLVector3 vel = m_velocity;
1414 ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury * 256)); 1417 ulong neighbourHandle = Helpers.UIntsToLong((uint) (neighbourx*256), (uint) (neighboury*256));
1415 SimpleRegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle); 1418 SimpleRegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle);
1416 if (neighbourRegion != null) 1419 if (neighbourRegion != null)
1417 { 1420 {
@@ -1432,6 +1435,7 @@ namespace OpenSim.Region.Environment.Scenes
1432 } 1435 }
1433 1436
1434 #endregion 1437 #endregion
1438
1435 /// <summary> 1439 /// <summary>
1436 /// This allows the Sim owner the abiility to kick users from their sim currently. 1440 /// This allows the Sim owner the abiility to kick users from their sim currently.
1437 /// It tells the client that the agent has permission to do so. 1441 /// It tells the client that the agent has permission to do so.
@@ -1445,7 +1449,7 @@ namespace OpenSim.Region.Environment.Scenes
1445 adb.AgentID = agentID; 1449 adb.AgentID = agentID;
1446 adb.SessionID = sessionID; // More security 1450 adb.SessionID = sessionID; // More security
1447 1451
1448 gdb.GodLevel = (byte)100; 1452 gdb.GodLevel = (byte) 100;
1449 gdb.Token = token; 1453 gdb.Token = token;
1450 //respondPacket.AgentData = (GrantGodlikePowersPacket.AgentDataBlock)ablock; 1454 //respondPacket.AgentData = (GrantGodlikePowersPacket.AgentDataBlock)ablock;
1451 respondPacket.GrantData = gdb; 1455 respondPacket.GrantData = gdb;
@@ -1462,7 +1466,8 @@ namespace OpenSim.Region.Environment.Scenes
1462 // 1466 //
1463 m_DrawDistance = cAgentData.drawdistance; 1467 m_DrawDistance = cAgentData.drawdistance;
1464 m_pos = new LLVector3(cAgentData.Position.x, cAgentData.Position.y, cAgentData.Position.z); 1468 m_pos = new LLVector3(cAgentData.Position.x, cAgentData.Position.y, cAgentData.Position.z);
1465 m_CameraCenter = new Vector3(cAgentData.cameraPosition.x, cAgentData.cameraPosition.y, cAgentData.cameraPosition.z); 1469 m_CameraCenter =
1470 new Vector3(cAgentData.cameraPosition.x, cAgentData.cameraPosition.y, cAgentData.cameraPosition.z);
1466 m_godlevel = cAgentData.godlevel; 1471 m_godlevel = cAgentData.godlevel;
1467 ControllingClient.SetChildAgentThrottle(cAgentData.throttles); 1472 ControllingClient.SetChildAgentThrottle(cAgentData.throttles);
1468 //cAgentData.AVHeight; 1473 //cAgentData.AVHeight;
@@ -1555,6 +1560,7 @@ namespace OpenSim.Region.Environment.Scenes
1555 m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; 1560 m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
1556 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; 1561 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
1557 } 1562 }
1563
1558 // Event called by the physics plugin to tell the avatar about a collision. 1564 // Event called by the physics plugin to tell the avatar about a collision.
1559 private void PhysicsCollisionUpdate(EventArgs e) 1565 private void PhysicsCollisionUpdate(EventArgs e)
1560 { 1566 {
@@ -1567,4 +1573,4 @@ namespace OpenSim.Region.Environment.Scenes
1567 RemoveFromPhysicalScene(); 1573 RemoveFromPhysicalScene();
1568 } 1574 }
1569 } 1575 }
1570} 1576} \ No newline at end of file