aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
authorMelanie2010-02-15 00:20:48 +0000
committerMelanie2010-02-15 00:20:48 +0000
commitc033223c63274ebe41075b24d108ca952fbd242c (patch)
tree8c969a9643c469feb37133b175be18eb52fdff49 /OpenSim/Region/Framework/Scenes/ScenePresence.cs
parentExtraneous debug messages removed (diff)
parentPlug a small hole (diff)
downloadopensim-SC-c033223c63274ebe41075b24d108ca952fbd242c.zip
opensim-SC-c033223c63274ebe41075b24d108ca952fbd242c.tar.gz
opensim-SC-c033223c63274ebe41075b24d108ca952fbd242c.tar.bz2
opensim-SC-c033223c63274ebe41075b24d108ca952fbd242c.tar.xz
Merge branch 'master' into presence-refactor
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs91
1 files changed, 85 insertions, 6 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index b8a937a..6b6fa7c 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -164,6 +164,8 @@ namespace OpenSim.Region.Framework.Scenes
164 164
165 private Quaternion m_bodyRot= Quaternion.Identity; 165 private Quaternion m_bodyRot= Quaternion.Identity;
166 166
167 private Quaternion m_bodyRotPrevious = Quaternion.Identity;
168
167 private const int LAND_VELOCITYMAG_MAX = 12; 169 private const int LAND_VELOCITYMAG_MAX = 12;
168 170
169 public bool IsRestrictedToRegion; 171 public bool IsRestrictedToRegion;
@@ -510,6 +512,12 @@ namespace OpenSim.Region.Framework.Scenes
510 set { m_bodyRot = value; } 512 set { m_bodyRot = value; }
511 } 513 }
512 514
515 public Quaternion PreviousRotation
516 {
517 get { return m_bodyRotPrevious; }
518 set { m_bodyRotPrevious = value; }
519 }
520
513 /// <summary> 521 /// <summary>
514 /// If this is true, agent doesn't have a representation in this scene. 522 /// If this is true, agent doesn't have a representation in this scene.
515 /// this is an agent 'looking into' this scene from a nearby scene(region) 523 /// this is an agent 'looking into' this scene from a nearby scene(region)
@@ -826,6 +834,31 @@ namespace OpenSim.Region.Framework.Scenes
826 if (pos.X < 0 || pos.Y < 0 || pos.Z < 0) 834 if (pos.X < 0 || pos.Y < 0 || pos.Z < 0)
827 { 835 {
828 Vector3 emergencyPos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128); 836 Vector3 emergencyPos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128);
837
838 if (pos.X < 0)
839 {
840 emergencyPos.X = (int)Constants.RegionSize + pos.X;
841 if (!(pos.Y < 0))
842 emergencyPos.Y = pos.Y;
843 if (!(pos.Z < 0))
844 emergencyPos.X = pos.X;
845 }
846 if (pos.Y < 0)
847 {
848 emergencyPos.Y = (int)Constants.RegionSize + pos.Y;
849 if (!(pos.X < 0))
850 emergencyPos.X = pos.X;
851 if (!(pos.Z < 0))
852 emergencyPos.Z = pos.Z;
853 }
854 if (pos.Z < 0)
855 {
856 if (!(pos.X < 0))
857 emergencyPos.X = pos.X;
858 if (!(pos.Y < 0))
859 emergencyPos.Y = pos.Y;
860 //Leave as 128
861 }
829 862
830 m_log.WarnFormat( 863 m_log.WarnFormat(
831 "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", 864 "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}",
@@ -1208,6 +1241,14 @@ namespace OpenSim.Region.Framework.Scenes
1208 } 1241 }
1209 else 1242 else
1210 { 1243 {
1244 if (m_pos.X < 0)
1245 m_pos.X = 128;
1246 if (m_pos.Y < 0)
1247 m_pos.Y = 128;
1248 if (m_pos.X > Scene.WestBorders[0].BorderLine.X)
1249 m_pos.X = 128;
1250 if (m_pos.Y > Scene.NorthBorders[0].BorderLine.Y)
1251 m_pos.Y = 128;
1211 m_LastFinitePos = m_pos; 1252 m_LastFinitePos = m_pos;
1212 } 1253 }
1213 1254
@@ -2518,6 +2559,8 @@ namespace OpenSim.Region.Framework.Scenes
2518 /// </summary> 2559 /// </summary>
2519 public void SendWearables() 2560 public void SendWearables()
2520 { 2561 {
2562 m_log.DebugFormat("[SCENE]: Received request for wearables of {0}", Name);
2563
2521 ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++); 2564 ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++);
2522 } 2565 }
2523 2566
@@ -2721,36 +2764,72 @@ namespace OpenSim.Region.Framework.Scenes
2721 { 2764 {
2722 // Checks if where it's headed exists a region 2765 // Checks if where it's headed exists a region
2723 2766
2767 bool needsTransit = false;
2724 if (m_scene.TestBorderCross(pos2, Cardinals.W)) 2768 if (m_scene.TestBorderCross(pos2, Cardinals.W))
2725 { 2769 {
2726 if (m_scene.TestBorderCross(pos2, Cardinals.S)) 2770 if (m_scene.TestBorderCross(pos2, Cardinals.S))
2771 {
2772 needsTransit = true;
2727 neighbor = HaveNeighbor(Cardinals.SW, ref fix); 2773 neighbor = HaveNeighbor(Cardinals.SW, ref fix);
2774 }
2728 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 2775 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
2776 {
2777 needsTransit = true;
2729 neighbor = HaveNeighbor(Cardinals.NW, ref fix); 2778 neighbor = HaveNeighbor(Cardinals.NW, ref fix);
2779 }
2730 else 2780 else
2781 {
2782 needsTransit = true;
2731 neighbor = HaveNeighbor(Cardinals.W, ref fix); 2783 neighbor = HaveNeighbor(Cardinals.W, ref fix);
2784 }
2732 } 2785 }
2733 else if (m_scene.TestBorderCross(pos2, Cardinals.E)) 2786 else if (m_scene.TestBorderCross(pos2, Cardinals.E))
2734 { 2787 {
2735 if (m_scene.TestBorderCross(pos2, Cardinals.S)) 2788 if (m_scene.TestBorderCross(pos2, Cardinals.S))
2789 {
2790 needsTransit = true;
2736 neighbor = HaveNeighbor(Cardinals.SE, ref fix); 2791 neighbor = HaveNeighbor(Cardinals.SE, ref fix);
2792 }
2737 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 2793 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
2794 {
2795 needsTransit = true;
2738 neighbor = HaveNeighbor(Cardinals.NE, ref fix); 2796 neighbor = HaveNeighbor(Cardinals.NE, ref fix);
2797 }
2739 else 2798 else
2799 {
2800 needsTransit = true;
2740 neighbor = HaveNeighbor(Cardinals.E, ref fix); 2801 neighbor = HaveNeighbor(Cardinals.E, ref fix);
2802 }
2741 } 2803 }
2742 else if (m_scene.TestBorderCross(pos2, Cardinals.S)) 2804 else if (m_scene.TestBorderCross(pos2, Cardinals.S))
2805 {
2806 needsTransit = true;
2743 neighbor = HaveNeighbor(Cardinals.S, ref fix); 2807 neighbor = HaveNeighbor(Cardinals.S, ref fix);
2808 }
2744 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 2809 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
2810 {
2811 needsTransit = true;
2745 neighbor = HaveNeighbor(Cardinals.N, ref fix); 2812 neighbor = HaveNeighbor(Cardinals.N, ref fix);
2813 }
2814
2746 2815
2747
2748 // Makes sure avatar does not end up outside region 2816 // Makes sure avatar does not end up outside region
2749 if (neighbor < 0) 2817 if (neighbor <= 0)
2750 AbsolutePosition = new Vector3( 2818 {
2751 AbsolutePosition.X + 3*fix[0], 2819 if (!needsTransit)
2752 AbsolutePosition.Y + 3*fix[1], 2820 {
2753 AbsolutePosition.Z); 2821 Vector3 pos = AbsolutePosition;
2822 if (AbsolutePosition.X < 0)
2823 pos.X += Velocity.Y;
2824 else if (AbsolutePosition.X > Constants.RegionSize)
2825 pos.X -= Velocity.Y;
2826 if (AbsolutePosition.Y < 0)
2827 pos.Y += Velocity.Y;
2828 else if (AbsolutePosition.Y > Constants.RegionSize)
2829 pos.Y -= Velocity.Y;
2830 AbsolutePosition = pos;
2831 }
2832 }
2754 else if (neighbor > 0) 2833 else if (neighbor > 0)
2755 CrossToNewRegion(); 2834 CrossToNewRegion();
2756 } 2835 }