aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
authorMelanie2010-03-06 12:24:09 +0000
committerMelanie2010-03-06 12:24:09 +0000
commit1f7a0cf892bf23c5b8ba8e3ae1a9036de428db90 (patch)
tree69419084feb98d59888b59a643e5fa062314605d /OpenSim/Region/Framework/Scenes/ScenePresence.cs
parentRemove a superfluous array creation (diff)
parent- implementing server 1.38 functions (diff)
downloadopensim-SC_OLD-1f7a0cf892bf23c5b8ba8e3ae1a9036de428db90.zip
opensim-SC_OLD-1f7a0cf892bf23c5b8ba8e3ae1a9036de428db90.tar.gz
opensim-SC_OLD-1f7a0cf892bf23c5b8ba8e3ae1a9036de428db90.tar.bz2
opensim-SC_OLD-1f7a0cf892bf23c5b8ba8e3ae1a9036de428db90.tar.xz
Merge branch '0.6.9-post-fixes' into careminster
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs92
1 files changed, 82 insertions, 10 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 6a2ab02..123d6f3 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -167,6 +167,8 @@ namespace OpenSim.Region.Framework.Scenes
167 167
168 private Quaternion m_bodyRot= Quaternion.Identity; 168 private Quaternion m_bodyRot= Quaternion.Identity;
169 169
170 private Quaternion m_bodyRotPrevious = Quaternion.Identity;
171
170 private const int LAND_VELOCITYMAG_MAX = 12; 172 private const int LAND_VELOCITYMAG_MAX = 12;
171 173
172 public bool IsRestrictedToRegion; 174 public bool IsRestrictedToRegion;
@@ -233,7 +235,7 @@ namespace OpenSim.Region.Framework.Scenes
233 // Agent's Draw distance. 235 // Agent's Draw distance.
234 protected float m_DrawDistance; 236 protected float m_DrawDistance;
235 237
236 protected AvatarAppearance m_appearance; 238 protected AvatarAppearance m_appearance;
237 239
238 // neighbouring regions we have enabled a child agent in 240 // neighbouring regions we have enabled a child agent in
239 // holds the seed cap for the child agent in that region 241 // holds the seed cap for the child agent in that region
@@ -518,6 +520,12 @@ namespace OpenSim.Region.Framework.Scenes
518 set { m_bodyRot = value; } 520 set { m_bodyRot = value; }
519 } 521 }
520 522
523 public Quaternion PreviousRotation
524 {
525 get { return m_bodyRotPrevious; }
526 set { m_bodyRotPrevious = value; }
527 }
528
521 /// <summary> 529 /// <summary>
522 /// If this is true, agent doesn't have a representation in this scene. 530 /// If this is true, agent doesn't have a representation in this scene.
523 /// this is an agent 'looking into' this scene from a nearby scene(region) 531 /// this is an agent 'looking into' this scene from a nearby scene(region)
@@ -650,7 +658,7 @@ namespace OpenSim.Region.Framework.Scenes
650 #region Constructor(s) 658 #region Constructor(s)
651 659
652 public ScenePresence() 660 public ScenePresence()
653 { 661 {
654 m_sendCourseLocationsMethod = SendCoarseLocationsDefault; 662 m_sendCourseLocationsMethod = SendCoarseLocationsDefault;
655 CreateSceneViewer(); 663 CreateSceneViewer();
656 m_animator = new ScenePresenceAnimator(this); 664 m_animator = new ScenePresenceAnimator(this);
@@ -868,6 +876,31 @@ namespace OpenSim.Region.Framework.Scenes
868 if (pos.X < 0 || pos.Y < 0 || pos.Z < 0) 876 if (pos.X < 0 || pos.Y < 0 || pos.Z < 0)
869 { 877 {
870 Vector3 emergencyPos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128); 878 Vector3 emergencyPos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128);
879
880 if (pos.X < 0)
881 {
882 emergencyPos.X = (int)Constants.RegionSize + pos.X;
883 if (!(pos.Y < 0))
884 emergencyPos.Y = pos.Y;
885 if (!(pos.Z < 0))
886 emergencyPos.X = pos.X;
887 }
888 if (pos.Y < 0)
889 {
890 emergencyPos.Y = (int)Constants.RegionSize + pos.Y;
891 if (!(pos.X < 0))
892 emergencyPos.X = pos.X;
893 if (!(pos.Z < 0))
894 emergencyPos.Z = pos.Z;
895 }
896 if (pos.Z < 0)
897 {
898 if (!(pos.X < 0))
899 emergencyPos.X = pos.X;
900 if (!(pos.Y < 0))
901 emergencyPos.Y = pos.Y;
902 //Leave as 128
903 }
871 904
872 m_log.WarnFormat( 905 m_log.WarnFormat(
873 "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", 906 "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}",
@@ -2900,36 +2933,75 @@ namespace OpenSim.Region.Framework.Scenes
2900 { 2933 {
2901 // Checks if where it's headed exists a region 2934 // Checks if where it's headed exists a region
2902 2935
2936 bool needsTransit = false;
2903 if (m_scene.TestBorderCross(pos2, Cardinals.W)) 2937 if (m_scene.TestBorderCross(pos2, Cardinals.W))
2904 { 2938 {
2905 if (m_scene.TestBorderCross(pos2, Cardinals.S)) 2939 if (m_scene.TestBorderCross(pos2, Cardinals.S))
2940 {
2941 needsTransit = true;
2906 neighbor = HaveNeighbor(Cardinals.SW, ref fix); 2942 neighbor = HaveNeighbor(Cardinals.SW, ref fix);
2943 }
2907 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 2944 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
2945 {
2946 needsTransit = true;
2908 neighbor = HaveNeighbor(Cardinals.NW, ref fix); 2947 neighbor = HaveNeighbor(Cardinals.NW, ref fix);
2948 }
2909 else 2949 else
2950 {
2951 needsTransit = true;
2910 neighbor = HaveNeighbor(Cardinals.W, ref fix); 2952 neighbor = HaveNeighbor(Cardinals.W, ref fix);
2953 }
2911 } 2954 }
2912 else if (m_scene.TestBorderCross(pos2, Cardinals.E)) 2955 else if (m_scene.TestBorderCross(pos2, Cardinals.E))
2913 { 2956 {
2914 if (m_scene.TestBorderCross(pos2, Cardinals.S)) 2957 if (m_scene.TestBorderCross(pos2, Cardinals.S))
2958 {
2959 needsTransit = true;
2915 neighbor = HaveNeighbor(Cardinals.SE, ref fix); 2960 neighbor = HaveNeighbor(Cardinals.SE, ref fix);
2961 }
2916 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 2962 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
2963 {
2964 needsTransit = true;
2917 neighbor = HaveNeighbor(Cardinals.NE, ref fix); 2965 neighbor = HaveNeighbor(Cardinals.NE, ref fix);
2966 }
2918 else 2967 else
2968 {
2969 needsTransit = true;
2919 neighbor = HaveNeighbor(Cardinals.E, ref fix); 2970 neighbor = HaveNeighbor(Cardinals.E, ref fix);
2971 }
2920 } 2972 }
2921 else if (m_scene.TestBorderCross(pos2, Cardinals.S)) 2973 else if (m_scene.TestBorderCross(pos2, Cardinals.S))
2974 {
2975 needsTransit = true;
2922 neighbor = HaveNeighbor(Cardinals.S, ref fix); 2976 neighbor = HaveNeighbor(Cardinals.S, ref fix);
2977 }
2923 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 2978 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
2979 {
2980 needsTransit = true;
2924 neighbor = HaveNeighbor(Cardinals.N, ref fix); 2981 neighbor = HaveNeighbor(Cardinals.N, ref fix);
2982 }
2983
2925 2984
2926
2927 // Makes sure avatar does not end up outside region 2985 // Makes sure avatar does not end up outside region
2928 if (neighbor < 0) 2986 if (neighbor <= 0)
2929 AbsolutePosition = new Vector3( 2987 {
2930 AbsolutePosition.X + 3*fix[0], 2988 if (!needsTransit)
2931 AbsolutePosition.Y + 3*fix[1], 2989 {
2932 AbsolutePosition.Z); 2990 if (m_requestedSitTargetUUID == UUID.Zero)
2991 {
2992 Vector3 pos = AbsolutePosition;
2993 if (AbsolutePosition.X < 0)
2994 pos.X += Velocity.X;
2995 else if (AbsolutePosition.X > Constants.RegionSize)
2996 pos.X -= Velocity.X;
2997 if (AbsolutePosition.Y < 0)
2998 pos.Y += Velocity.Y;
2999 else if (AbsolutePosition.Y > Constants.RegionSize)
3000 pos.Y -= Velocity.Y;
3001 AbsolutePosition = pos;
3002 }
3003 }
3004 }
2933 else if (neighbor > 0) 3005 else if (neighbor > 0)
2934 CrossToNewRegion(); 3006 CrossToNewRegion();
2935 } 3007 }
@@ -3400,7 +3472,7 @@ namespace OpenSim.Region.Framework.Scenes
3400 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; 3472 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
3401 m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong 3473 m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong
3402 m_physicsActor.SubscribeEvents(500); 3474 m_physicsActor.SubscribeEvents(500);
3403 m_physicsActor.LocalID = LocalId; 3475 m_physicsActor.LocalID = LocalId;
3404 } 3476 }
3405 3477
3406 private void OutOfBoundsCall(Vector3 pos) 3478 private void OutOfBoundsCall(Vector3 pos)
@@ -3503,7 +3575,7 @@ namespace OpenSim.Region.Framework.Scenes
3503 } 3575 }
3504 if (m_health <= 0) 3576 if (m_health <= 0)
3505 m_scene.EventManager.TriggerAvatarKill(killerObj, this); 3577 m_scene.EventManager.TriggerAvatarKill(killerObj, this);
3506 } 3578 }
3507 } 3579 }
3508 3580
3509 public void setHealthWithUpdate(float health) 3581 public void setHealthWithUpdate(float health)