aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs55
1 files changed, 30 insertions, 25 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index f841707..a93fcb2 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -611,7 +611,7 @@ namespace OpenSim.Region.Framework.Scenes
611 m_controllingClient.OnRequestWearables += SendWearables; 611 m_controllingClient.OnRequestWearables += SendWearables;
612 m_controllingClient.OnSetAppearance += SetAppearance; 612 m_controllingClient.OnSetAppearance += SetAppearance;
613 m_controllingClient.OnCompleteMovementToRegion += CompleteMovement; 613 m_controllingClient.OnCompleteMovementToRegion += CompleteMovement;
614 m_controllingClient.OnCompleteMovementToRegion += SendInitialData; 614 //m_controllingClient.OnCompleteMovementToRegion += SendInitialData;
615 m_controllingClient.OnAgentUpdate += HandleAgentUpdate; 615 m_controllingClient.OnAgentUpdate += HandleAgentUpdate;
616 m_controllingClient.OnAgentRequestSit += HandleAgentRequestSit; 616 m_controllingClient.OnAgentRequestSit += HandleAgentRequestSit;
617 m_controllingClient.OnAgentSit += HandleAgentSit; 617 m_controllingClient.OnAgentSit += HandleAgentSit;
@@ -829,7 +829,6 @@ namespace OpenSim.Region.Framework.Scenes
829 pos = emergencyPos; 829 pos = emergencyPos;
830 } 830 }
831 831
832 m_isChildAgent = false;
833 832
834 float localAVHeight = 1.56f; 833 float localAVHeight = 1.56f;
835 if (m_avHeight != 127.0f) 834 if (m_avHeight != 127.0f)
@@ -845,8 +844,8 @@ namespace OpenSim.Region.Framework.Scenes
845 } 844 }
846 AbsolutePosition = pos; 845 AbsolutePosition = pos;
847 846
848 AddToPhysicalScene(); 847 AddToPhysicalScene(isFlying);
849 m_physicsActor.Flying = isFlying; 848 SetHeight(m_appearance.AvatarHeight);
850 849
851 // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying 850 // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying
852 // avatar to return to the standing position in mid-air. On login it looks like this is being sent 851 // avatar to return to the standing position in mid-air. On login it looks like this is being sent
@@ -861,13 +860,16 @@ namespace OpenSim.Region.Framework.Scenes
861 else 860 else
862 m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid); 861 m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid);
863 862
864 //m_scene.CapsModule.AddCapsHandler(m_uuid);
865
866 // On the next prim update, all objects will be sent 863 // On the next prim update, all objects will be sent
867 // 864 //
868 m_pendingObjects = null; 865 m_pendingObjects = null;
869 866
867 m_isChildAgent = false;
868
869 SendInitialData();
870
870 m_scene.EventManager.TriggerOnMakeRootAgent(this); 871 m_scene.EventManager.TriggerOnMakeRootAgent(this);
872
871 } 873 }
872 874
873 /// <summary> 875 /// <summary>
@@ -916,10 +918,14 @@ namespace OpenSim.Region.Framework.Scenes
916 /// <param name="pos"></param> 918 /// <param name="pos"></param>
917 public void Teleport(Vector3 pos) 919 public void Teleport(Vector3 pos)
918 { 920 {
921 bool isFlying = false;
922 if (m_physicsActor != null)
923 isFlying = m_physicsActor.Flying;
924
919 RemoveFromPhysicalScene(); 925 RemoveFromPhysicalScene();
920 Velocity = new Vector3(0, 0, 0); 926 Velocity = new Vector3(0, 0, 0);
921 AbsolutePosition = pos; 927 AbsolutePosition = pos;
922 AddToPhysicalScene(); 928 AddToPhysicalScene(isFlying);
923 SendTerseUpdateToAllClients(); 929 SendTerseUpdateToAllClients();
924 } 930 }
925 931
@@ -1021,8 +1027,8 @@ namespace OpenSim.Region.Framework.Scenes
1021 if (m_isChildAgent) 1027 if (m_isChildAgent)
1022 { 1028 {
1023 m_isChildAgent = false; 1029 m_isChildAgent = false;
1024 1030 bool m_flying = ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
1025 MakeRootAgent(AbsolutePosition, false); 1031 MakeRootAgent(AbsolutePosition, m_flying);
1026 1032
1027 if ((m_callbackURI != null) && !m_callbackURI.Equals("")) 1033 if ((m_callbackURI != null) && !m_callbackURI.Equals(""))
1028 { 1034 {
@@ -1068,7 +1074,7 @@ namespace OpenSim.Region.Framework.Scenes
1068 m_log.Error("[AVATAR]: NonFinite Avatar position detected... Reset Position. Mantis this please. Error# 9999903"); 1074 m_log.Error("[AVATAR]: NonFinite Avatar position detected... Reset Position. Mantis this please. Error# 9999903");
1069 } 1075 }
1070 1076
1071 AddToPhysicalScene(); 1077 AddToPhysicalScene(false);
1072 } 1078 }
1073 else 1079 else
1074 { 1080 {
@@ -1464,7 +1470,7 @@ namespace OpenSim.Region.Framework.Scenes
1464 1470
1465 if (m_physicsActor == null) 1471 if (m_physicsActor == null)
1466 { 1472 {
1467 AddToPhysicalScene(); 1473 AddToPhysicalScene(m_physicsActor.Flying);
1468 } 1474 }
1469 1475
1470 m_pos += m_parentPosition + new Vector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight); 1476 m_pos += m_parentPosition + new Vector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight);
@@ -2231,7 +2237,7 @@ namespace OpenSim.Region.Framework.Scenes
2231 // just to add it back again, but it saves us from having to update 2237 // just to add it back again, but it saves us from having to update
2232 // 3 variables 10 times a second. 2238 // 3 variables 10 times a second.
2233 m_scene.PhysicsScene.RemoveAvatar(m_physicsActor); 2239 m_scene.PhysicsScene.RemoveAvatar(m_physicsActor);
2234 AddToPhysicalScene(); 2240 AddToPhysicalScene(m_physicsActor.Flying);
2235 } 2241 }
2236 m_appearance.SetAppearance(texture, visualParam); 2242 m_appearance.SetAppearance(texture, visualParam);
2237 SetHeight(m_appearance.AvatarHeight); 2243 SetHeight(m_appearance.AvatarHeight);
@@ -2420,12 +2426,18 @@ namespace OpenSim.Region.Framework.Scenes
2420 protected void CrossToNewRegion() 2426 protected void CrossToNewRegion()
2421 { 2427 {
2422 m_inTransit = true; 2428 m_inTransit = true;
2429
2430 if ((m_physicsActor != null) && m_physicsActor.Flying)
2431 m_AgentControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
2432 else if ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0)
2433 m_AgentControlFlags &= ~(uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
2434
2423 m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying); 2435 m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying);
2424 } 2436 }
2425 2437
2426 public void RestoreInCurrentScene() 2438 public void RestoreInCurrentScene()
2427 { 2439 {
2428 AddToPhysicalScene(); 2440 AddToPhysicalScene(false); // not exactly false
2429 } 2441 }
2430 2442
2431 /// <summary> 2443 /// <summary>
@@ -2583,10 +2595,6 @@ namespace OpenSim.Region.Framework.Scenes
2583 cAgent.HeadRotation = m_headrotation; 2595 cAgent.HeadRotation = m_headrotation;
2584 cAgent.BodyRotation = m_bodyRot; 2596 cAgent.BodyRotation = m_bodyRot;
2585 cAgent.ControlFlags = m_AgentControlFlags; 2597 cAgent.ControlFlags = m_AgentControlFlags;
2586 if ((m_physicsActor != null) && (m_physicsActor.Flying))
2587 {
2588 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
2589 }
2590 2598
2591 if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) 2599 if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID)))
2592 cAgent.GodLevel = (byte)m_godlevel; 2600 cAgent.GodLevel = (byte)m_godlevel;
@@ -2625,10 +2633,7 @@ namespace OpenSim.Region.Framework.Scenes
2625 m_headrotation = cAgent.HeadRotation; 2633 m_headrotation = cAgent.HeadRotation;
2626 m_bodyRot = cAgent.BodyRotation; 2634 m_bodyRot = cAgent.BodyRotation;
2627 m_AgentControlFlags = cAgent.ControlFlags; // We need more flags! 2635 m_AgentControlFlags = cAgent.ControlFlags; // We need more flags!
2628 if (m_physicsActor != null) 2636
2629 {
2630 m_physicsActor.Flying = ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
2631 }
2632 if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) 2637 if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID)))
2633 m_godlevel = cAgent.GodLevel; 2638 m_godlevel = cAgent.GodLevel;
2634 m_setAlwaysRun = cAgent.AlwaysRun; 2639 m_setAlwaysRun = cAgent.AlwaysRun;
@@ -2755,7 +2760,7 @@ namespace OpenSim.Region.Framework.Scenes
2755 /// <summary> 2760 /// <summary>
2756 /// Adds a physical representation of the avatar to the Physics plugin 2761 /// Adds a physical representation of the avatar to the Physics plugin
2757 /// </summary> 2762 /// </summary>
2758 public void AddToPhysicalScene() 2763 public void AddToPhysicalScene(bool isFlying)
2759 { 2764 {
2760 PhysicsScene scene = m_scene.PhysicsScene; 2765 PhysicsScene scene = m_scene.PhysicsScene;
2761 2766
@@ -2765,13 +2770,13 @@ namespace OpenSim.Region.Framework.Scenes
2765 2770
2766 if (m_avHeight == 127.0f) 2771 if (m_avHeight == 127.0f)
2767 { 2772 {
2768 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, 1.56f)); 2773 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, 1.56f), isFlying);
2769 } 2774 }
2770 else 2775 else
2771 { 2776 {
2772 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, m_avHeight)); 2777 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, m_avHeight), isFlying);
2773 } 2778 }
2774 2779
2775 //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; 2780 //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
2776 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; 2781 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
2777 m_physicsActor.SubscribeEvents(1000); 2782 m_physicsActor.SubscribeEvents(1000);