aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs91
1 files changed, 42 insertions, 49 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d2a8ad0..9bca654 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -864,16 +864,16 @@ namespace OpenSim.Region.Framework.Scenes
864 try 864 try
865 { 865 {
866 ForEachRootScenePresence(delegate(ScenePresence agent) 866 ForEachRootScenePresence(delegate(ScenePresence agent)
867 { 867 {
868 //agent.ControllingClient.new 868 //agent.ControllingClient.new
869 //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); 869 //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo());
870 870
871 List<ulong> old = new List<ulong>(); 871 List<ulong> old = new List<ulong>();
872 old.Add(otherRegion.RegionHandle); 872 old.Add(otherRegion.RegionHandle);
873 agent.DropOldNeighbours(old); 873 agent.DropOldNeighbours(old);
874 if (m_teleportModule != null) 874 if (m_teleportModule != null && agent.PresenceType != PresenceType.Npc)
875 m_teleportModule.EnableChildAgent(agent, otherRegion); 875 m_teleportModule.EnableChildAgent(agent, otherRegion);
876 }); 876 });
877 } 877 }
878 catch (NullReferenceException) 878 catch (NullReferenceException)
879 { 879 {
@@ -881,7 +881,6 @@ namespace OpenSim.Region.Framework.Scenes
881 // This shouldn't happen too often anymore. 881 // This shouldn't happen too often anymore.
882 m_log.Error("[SCENE]: Couldn't inform client of regionup because we got a null reference exception"); 882 m_log.Error("[SCENE]: Couldn't inform client of regionup because we got a null reference exception");
883 } 883 }
884
885 } 884 }
886 else 885 else
887 { 886 {
@@ -1009,10 +1008,10 @@ namespace OpenSim.Region.Framework.Scenes
1009 try 1008 try
1010 { 1009 {
1011 ForEachRootScenePresence(delegate(ScenePresence agent) 1010 ForEachRootScenePresence(delegate(ScenePresence agent)
1012 { 1011 {
1013 if (m_teleportModule != null) 1012 if (m_teleportModule != null && agent.PresenceType != PresenceType.Npc)
1014 m_teleportModule.EnableChildAgent(agent, r); 1013 m_teleportModule.EnableChildAgent(agent, r);
1015 }); 1014 });
1016 } 1015 }
1017 catch (NullReferenceException) 1016 catch (NullReferenceException)
1018 { 1017 {
@@ -1141,7 +1140,7 @@ namespace OpenSim.Region.Framework.Scenes
1141 1140
1142 HeartbeatThread 1141 HeartbeatThread
1143 = Watchdog.StartThread( 1142 = Watchdog.StartThread(
1144 Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false); 1143 Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false);
1145 } 1144 }
1146 1145
1147 /// <summary> 1146 /// <summary>
@@ -1179,6 +1178,13 @@ namespace OpenSim.Region.Framework.Scenes
1179 try 1178 try
1180 { 1179 {
1181 m_eventManager.TriggerOnRegionStarted(this); 1180 m_eventManager.TriggerOnRegionStarted(this);
1181
1182 // The first frame can take a very long time due to physics actors being added on startup. Therefore,
1183 // don't turn on the watchdog alarm for this thread until the second frame, in order to prevent false
1184 // alarms for scenes with many objects.
1185 Update();
1186 Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true;
1187
1182 while (!shuttingdown) 1188 while (!shuttingdown)
1183 Update(); 1189 Update();
1184 1190
@@ -1207,7 +1213,7 @@ namespace OpenSim.Region.Framework.Scenes
1207 1213
1208 ++Frame; 1214 ++Frame;
1209 1215
1210// m_log.DebugFormat("[SCENE]: Processing frame {0}", Frame); 1216// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName);
1211 1217
1212 try 1218 try
1213 { 1219 {
@@ -1362,26 +1368,10 @@ namespace OpenSim.Region.Framework.Scenes
1362 { 1368 {
1363 throw; 1369 throw;
1364 } 1370 }
1365 catch (AccessViolationException e)
1366 {
1367 m_log.ErrorFormat(
1368 "[REGION]: Failed on region {0} with exception {1}{2}",
1369 RegionInfo.RegionName, e.Message, e.StackTrace);
1370 }
1371 //catch (NullReferenceException e)
1372 //{
1373 // m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
1374 //}
1375 catch (InvalidOperationException e)
1376 {
1377 m_log.ErrorFormat(
1378 "[REGION]: Failed on region {0} with exception {1}{2}",
1379 RegionInfo.RegionName, e.Message, e.StackTrace);
1380 }
1381 catch (Exception e) 1371 catch (Exception e)
1382 { 1372 {
1383 m_log.ErrorFormat( 1373 m_log.ErrorFormat(
1384 "[REGION]: Failed on region {0} with exception {1}{2}", 1374 "[SCENE]: Failed on region {0} with exception {1}{2}",
1385 RegionInfo.RegionName, e.Message, e.StackTrace); 1375 RegionInfo.RegionName, e.Message, e.StackTrace);
1386 } 1376 }
1387 1377
@@ -1419,7 +1409,6 @@ namespace OpenSim.Region.Framework.Scenes
1419 entry.checkAtTargets(); 1409 entry.checkAtTargets();
1420 } 1410 }
1421 1411
1422
1423 /// <summary> 1412 /// <summary>
1424 /// Send out simstats data to all clients 1413 /// Send out simstats data to all clients
1425 /// </summary> 1414 /// </summary>
@@ -2318,7 +2307,7 @@ namespace OpenSim.Region.Framework.Scenes
2318 /// </summary> 2307 /// </summary>
2319 /// <param name="sog"></param> 2308 /// <param name="sog"></param>
2320 /// <returns></returns> 2309 /// <returns></returns>
2321 public bool IncomingCreateObject(ISceneObject sog) 2310 public bool IncomingCreateObject(Vector3 newPosition, ISceneObject sog)
2322 { 2311 {
2323 //m_log.DebugFormat(" >>> IncomingCreateObject(sog) <<< {0} deleted? {1} isAttach? {2}", ((SceneObjectGroup)sog).AbsolutePosition, 2312 //m_log.DebugFormat(" >>> IncomingCreateObject(sog) <<< {0} deleted? {1} isAttach? {2}", ((SceneObjectGroup)sog).AbsolutePosition,
2324 // ((SceneObjectGroup)sog).IsDeleted, ((SceneObjectGroup)sog).RootPart.IsAttachment); 2313 // ((SceneObjectGroup)sog).IsDeleted, ((SceneObjectGroup)sog).RootPart.IsAttachment);
@@ -2334,6 +2323,9 @@ namespace OpenSim.Region.Framework.Scenes
2334 return false; 2323 return false;
2335 } 2324 }
2336 2325
2326 if (newPosition != Vector3.Zero)
2327 newObject.RootPart.GroupPosition = newPosition;
2328
2337 if (!AddSceneObject(newObject)) 2329 if (!AddSceneObject(newObject))
2338 { 2330 {
2339 m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName); 2331 m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName);
@@ -4258,10 +4250,7 @@ namespace OpenSim.Region.Framework.Scenes
4258 /// <param name="action"></param> 4250 /// <param name="action"></param>
4259 public void ForEachRootScenePresence(Action<ScenePresence> action) 4251 public void ForEachRootScenePresence(Action<ScenePresence> action)
4260 { 4252 {
4261 if (m_sceneGraph != null) 4253 m_sceneGraph.ForEachAvatar(action);
4262 {
4263 m_sceneGraph.ForEachAvatar(action);
4264 }
4265 } 4254 }
4266 4255
4267 /// <summary> 4256 /// <summary>
@@ -4270,10 +4259,7 @@ namespace OpenSim.Region.Framework.Scenes
4270 /// <param name="action"></param> 4259 /// <param name="action"></param>
4271 public void ForEachScenePresence(Action<ScenePresence> action) 4260 public void ForEachScenePresence(Action<ScenePresence> action)
4272 { 4261 {
4273 if (m_sceneGraph != null) 4262 m_sceneGraph.ForEachScenePresence(action);
4274 {
4275 m_sceneGraph.ForEachScenePresence(action);
4276 }
4277 } 4263 }
4278 4264
4279 /// <summary> 4265 /// <summary>
@@ -4703,7 +4689,10 @@ namespace OpenSim.Region.Framework.Scenes
4703 Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); 4689 Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel);
4704 if (nearestPoint != null) 4690 if (nearestPoint != null)
4705 { 4691 {
4706 Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString()); 4692// m_log.DebugFormat(
4693// "[SCENE]: Found a sane previous position based on velocity for {0}, sending them to {1} in {2}",
4694// avatar.Name, nearestPoint, nearestParcel.LandData.Name);
4695
4707 return nearestPoint.Value; 4696 return nearestPoint.Value;
4708 } 4697 }
4709 4698
@@ -4713,12 +4702,16 @@ namespace OpenSim.Region.Framework.Scenes
4713 nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); 4702 nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel);
4714 if (nearestPoint != null) 4703 if (nearestPoint != null)
4715 { 4704 {
4716 Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString()); 4705// m_log.DebugFormat(
4706// "[SCENE]: {0} had a zero velocity, sending them to {1}", avatar.Name, nearestPoint);
4707
4717 return nearestPoint.Value; 4708 return nearestPoint.Value;
4718 } 4709 }
4719 4710
4720 //Ultimate backup if we have no idea where they are 4711 //Ultimate backup if we have no idea where they are
4721 Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); 4712// m_log.DebugFormat(
4713// "[SCENE]: No idea where {0} is, sending them to {1}", avatar.Name, avatar.lastKnownAllowedPosition);
4714
4722 return avatar.lastKnownAllowedPosition; 4715 return avatar.lastKnownAllowedPosition;
4723 } 4716 }
4724 4717
@@ -5124,7 +5117,7 @@ namespace OpenSim.Region.Framework.Scenes
5124// presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget); 5117// presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget);
5125 5118
5126 Vector3 agent_control_v3 = new Vector3(); 5119 Vector3 agent_control_v3 = new Vector3();
5127 presence.HandleMoveToTargetUpdate(ref agent_control_v3); 5120 presence.HandleMoveToTargetUpdate(1, ref agent_control_v3);
5128 presence.AddNewMovement(agent_control_v3); 5121 presence.AddNewMovement(agent_control_v3);
5129 } 5122 }
5130 } 5123 }