diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
7 files changed, 94 insertions, 144 deletions
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 464d922..91d40ab 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -468,26 +468,20 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
468 | 468 | ||
469 | private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID) | 469 | private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID) |
470 | { | 470 | { |
471 | // Get a fresh list that will not change as people get teleported away | 471 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) |
472 | List<ScenePresence> presences = m_scene.GetScenePresences(); | ||
473 | |||
474 | foreach(ScenePresence p in presences) | ||
475 | { | 472 | { |
476 | if (p.UUID != senderID) | 473 | if (sp.UUID != senderID) |
477 | { | 474 | { |
475 | ScenePresence p = m_scene.GetScenePresence(sp.UUID); | ||
478 | // make sure they are still there, we could be working down a long list | 476 | // make sure they are still there, we could be working down a long list |
479 | ScenePresence s = m_scene.GetScenePresence(p.UUID); | 477 | // Also make sure they are actually in the region |
480 | if (s != null) | 478 | if (p != null && !p.IsChildAgent) |
481 | { | 479 | { |
482 | // Also make sure they are actually in the region | 480 | p.ControllingClient.SendTeleportLocationStart(); |
483 | if (!s.IsChildAgent) | 481 | m_scene.TeleportClientHome(p.UUID, p.ControllingClient); |
484 | { | ||
485 | s.ControllingClient.SendTeleportLocationStart(); | ||
486 | m_scene.TeleportClientHome(s.UUID, s.ControllingClient); | ||
487 | } | ||
488 | } | 482 | } |
489 | } | 483 | } |
490 | } | 484 | }); |
491 | } | 485 | } |
492 | private void AbortTerrainXferHandler(IClientAPI remoteClient, ulong XferID) | 486 | private void AbortTerrainXferHandler(IClientAPI remoteClient, ulong XferID) |
493 | { | 487 | { |
@@ -765,12 +759,11 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
765 | 759 | ||
766 | public void sendRegionInfoPacketToAll() | 760 | public void sendRegionInfoPacketToAll() |
767 | { | 761 | { |
768 | List<ScenePresence> avatars = m_scene.GetAvatars(); | 762 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) |
769 | |||
770 | for (int i = 0; i < avatars.Count; i++) | ||
771 | { | 763 | { |
772 | HandleRegionInfoRequest(avatars[i].ControllingClient); | 764 | if (!sp.IsChildAgent) |
773 | } | 765 | HandleRegionInfoRequest(sp.ControllingClient); |
766 | }); | ||
774 | } | 767 | } |
775 | 768 | ||
776 | public void sendRegionHandshake(IClientAPI remoteClient) | 769 | public void sendRegionHandshake(IClientAPI remoteClient) |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 1279ac1..5750aa4 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -191,9 +191,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
191 | forcedPosition = null; | 191 | forcedPosition = null; |
192 | } | 192 | } |
193 | //if we are far away, teleport | 193 | //if we are far away, teleport |
194 | else if (Vector3.Distance(clientAvatar.AbsolutePosition,forcedPosition.Value) > 3) | 194 | else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition.Value) > 3) |
195 | { | 195 | { |
196 | Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}",forcedPosition.Value,clientAvatar.AbsolutePosition)); | 196 | Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition.Value, clientAvatar.AbsolutePosition)); |
197 | clientAvatar.Teleport(forcedPosition.Value); | 197 | clientAvatar.Teleport(forcedPosition.Value); |
198 | forcedPosition = null; | 198 | forcedPosition = null; |
199 | } | 199 | } |
@@ -374,30 +374,27 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
374 | } | 374 | } |
375 | } | 375 | } |
376 | 376 | ||
377 | public void SendOutNearestBanLine(IClientAPI avatar) | 377 | public void SendOutNearestBanLine(IClientAPI client) |
378 | { | 378 | { |
379 | List<ScenePresence> avatars = m_scene.GetAvatars(); | 379 | ScenePresence sp = m_scene.GetScenePresence(client.AgentId); |
380 | foreach (ScenePresence presence in avatars) | 380 | if (sp == null || sp.IsChildAgent) |
381 | return; | ||
382 | |||
383 | List<ILandObject> checkLandParcels = ParcelsNearPoint(sp.AbsolutePosition); | ||
384 | foreach (ILandObject checkBan in checkLandParcels) | ||
381 | { | 385 | { |
382 | if (presence.UUID == avatar.AgentId) | 386 | if (checkBan.IsBannedFromLand(client.AgentId)) |
383 | { | 387 | { |
384 | List<ILandObject> checkLandParcels = ParcelsNearPoint(presence.AbsolutePosition); | 388 | checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionBanned, false, (int)ParcelResult.Single, client); |
385 | foreach (ILandObject checkBan in checkLandParcels) | 389 | return; //Only send one |
386 | { | 390 | } |
387 | if (checkBan.IsBannedFromLand(avatar.AgentId)) | 391 | if (checkBan.IsRestrictedFromLand(client.AgentId)) |
388 | { | 392 | { |
389 | checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionBanned, false, (int)ParcelResult.Single, avatar); | 393 | checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList, false, (int)ParcelResult.Single, client); |
390 | return; //Only send one | 394 | return; //Only send one |
391 | } | ||
392 | if (checkBan.IsRestrictedFromLand(avatar.AgentId)) | ||
393 | { | ||
394 | checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList, false, (int)ParcelResult.Single, avatar); | ||
395 | return; //Only send one | ||
396 | } | ||
397 | } | ||
398 | return; | ||
399 | } | 395 | } |
400 | } | 396 | } |
397 | return; | ||
401 | } | 398 | } |
402 | 399 | ||
403 | public void SendLandUpdate(ScenePresence avatar, bool force) | 400 | public void SendLandUpdate(ScenePresence avatar, bool force) |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index e85136a..b2d9b66 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -332,36 +332,38 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
332 | 332 | ||
333 | public void SendLandUpdateToAvatarsOverMe(bool snap_selection) | 333 | public void SendLandUpdateToAvatarsOverMe(bool snap_selection) |
334 | { | 334 | { |
335 | List<ScenePresence> avatars = m_scene.GetAvatars(); | 335 | m_scene.ForEachScenePresence(delegate(ScenePresence avatar) |
336 | ILandObject over = null; | ||
337 | for (int i = 0; i < avatars.Count; i++) | ||
338 | { | 336 | { |
337 | if (avatar.IsChildAgent) | ||
338 | return; | ||
339 | |||
340 | ILandObject over = null; | ||
339 | try | 341 | try |
340 | { | 342 | { |
341 | over = | 343 | over = |
342 | m_scene.LandChannel.GetLandObject(Util.Clamp<int>((int)Math.Round(avatars[i].AbsolutePosition.X), 0, ((int)Constants.RegionSize - 1)), | 344 | m_scene.LandChannel.GetLandObject(Util.Clamp<int>((int)Math.Round(avatar.AbsolutePosition.X), 0, ((int)Constants.RegionSize - 1)), |
343 | Util.Clamp<int>((int)Math.Round(avatars[i].AbsolutePosition.Y), 0, ((int)Constants.RegionSize - 1))); | 345 | Util.Clamp<int>((int)Math.Round(avatar.AbsolutePosition.Y), 0, ((int)Constants.RegionSize - 1))); |
344 | } | 346 | } |
345 | catch (Exception) | 347 | catch (Exception) |
346 | { | 348 | { |
347 | m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatars[i].AbsolutePosition.X) + " y: " + | 349 | m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatar.AbsolutePosition.X) + " y: " + |
348 | Math.Round(avatars[i].AbsolutePosition.Y)); | 350 | Math.Round(avatar.AbsolutePosition.Y)); |
349 | } | 351 | } |
350 | 352 | ||
351 | if (over != null) | 353 | if (over != null) |
352 | { | 354 | { |
353 | if (over.LandData.LocalID == LandData.LocalID) | 355 | if (over.LandData.LocalID == LandData.LocalID) |
354 | { | 356 | { |
355 | if (((over.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) && | 357 | if (((over.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) && |
356 | m_scene.RegionInfo.RegionSettings.AllowDamage) | 358 | m_scene.RegionInfo.RegionSettings.AllowDamage) |
357 | avatars[i].Invulnerable = false; | 359 | avatar.Invulnerable = false; |
358 | else | 360 | else |
359 | avatars[i].Invulnerable = true; | 361 | avatar.Invulnerable = true; |
360 | 362 | ||
361 | SendLandUpdateToClient(snap_selection, avatars[i].ControllingClient); | 363 | SendLandUpdateToClient(snap_selection, avatar.ControllingClient); |
362 | } | 364 | } |
363 | } | 365 | } |
364 | } | 366 | }); |
365 | } | 367 | } |
366 | 368 | ||
367 | #endregion | 369 | #endregion |
diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs index 1f5a4ff..a52fea4 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs | |||
@@ -62,40 +62,46 @@ namespace OpenSim.Region.CoreModules.World.Sound | |||
62 | public virtual void PlayAttachedSound( | 62 | public virtual void PlayAttachedSound( |
63 | UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius) | 63 | UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius) |
64 | { | 64 | { |
65 | foreach (ScenePresence p in m_scene.GetAvatars()) | 65 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) |
66 | { | 66 | { |
67 | double dis = Util.GetDistanceTo(p.AbsolutePosition, position); | 67 | if (sp.IsChildAgent) |
68 | return; | ||
69 | |||
70 | double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); | ||
68 | if (dis > 100.0) // Max audio distance | 71 | if (dis > 100.0) // Max audio distance |
69 | continue; | 72 | return; |
70 | 73 | ||
71 | // Scale by distance | 74 | // Scale by distance |
72 | if (radius == 0) | 75 | if (radius == 0) |
73 | gain = (float)((double)gain * ((100.0 - dis) / 100.0)); | 76 | gain = (float)((double)gain * ((100.0 - dis) / 100.0)); |
74 | else | 77 | else |
75 | gain = (float)((double)gain * ((radius - dis) / radius)); | 78 | gain = (float)((double)gain * ((radius - dis) / radius)); |
76 | 79 | ||
77 | p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags); | 80 | sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags); |
78 | } | 81 | }); |
79 | } | 82 | } |
80 | 83 | ||
81 | public virtual void TriggerSound( | 84 | public virtual void TriggerSound( |
82 | UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius) | 85 | UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius) |
83 | { | 86 | { |
84 | foreach (ScenePresence p in m_scene.GetAvatars()) | 87 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) |
85 | { | 88 | { |
86 | double dis = Util.GetDistanceTo(p.AbsolutePosition, position); | 89 | if (sp.IsChildAgent) |
90 | return; | ||
91 | |||
92 | double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); | ||
87 | if (dis > 100.0) // Max audio distance | 93 | if (dis > 100.0) // Max audio distance |
88 | continue; | 94 | return; |
89 | 95 | ||
90 | // Scale by distance | 96 | // Scale by distance |
91 | if (radius == 0) | 97 | if (radius == 0) |
92 | gain = (float)((double)gain * ((100.0 - dis) / 100.0)); | 98 | gain = (float)((double)gain * ((100.0 - dis) / 100.0)); |
93 | else | 99 | else |
94 | gain = (float)((double)gain * ((radius - dis) / radius)); | 100 | gain = (float)((double)gain * ((radius - dis) / radius)); |
95 | 101 | ||
96 | p.ControllingClient.SendTriggeredSound( | 102 | sp.ControllingClient.SendTriggeredSound( |
97 | soundId, ownerID, objectID, parentID, handle, position, (float)gain); | 103 | soundId, ownerID, objectID, parentID, handle, position, (float)gain); |
98 | } | 104 | }); |
99 | } | 105 | } |
100 | } | 106 | } |
101 | } | 107 | } |
diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs index 0712a7f..a6dc2ec 100644 --- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs +++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs | |||
@@ -509,14 +509,13 @@ namespace OpenSim.Region.CoreModules | |||
509 | 509 | ||
510 | private void SunUpdateToAllClients() | 510 | private void SunUpdateToAllClients() |
511 | { | 511 | { |
512 | List<ScenePresence> avatars = m_scene.GetAvatars(); | 512 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) |
513 | foreach (ScenePresence avatar in avatars) | ||
514 | { | 513 | { |
515 | if (!avatar.IsChildAgent) | 514 | if (!sp.IsChildAgent) |
516 | { | 515 | { |
517 | SunToClient(avatar.ControllingClient); | 516 | SunToClient(sp.ControllingClient); |
518 | } | 517 | } |
519 | } | 518 | }); |
520 | } | 519 | } |
521 | 520 | ||
522 | #region ISunModule Members | 521 | #region ISunModule Members |
diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs index 3283c1f..9736b73 100644 --- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs +++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs | |||
@@ -425,9 +425,7 @@ namespace OpenSim.Region.CoreModules | |||
425 | { | 425 | { |
426 | if (m_ready) | 426 | if (m_ready) |
427 | { | 427 | { |
428 | List<ScenePresence> avatars = m_scene.GetAvatars(); | 428 | if(m_scene.GetRootAgentCount() > 0) |
429 | |||
430 | if (avatars.Count > 0) | ||
431 | { | 429 | { |
432 | // Ask wind plugin to generate a LL wind array to be cached locally | 430 | // Ask wind plugin to generate a LL wind array to be cached locally |
433 | // Try not to update this too often, as it may involve array copies | 431 | // Try not to update this too often, as it may involve array copies |
@@ -437,11 +435,11 @@ namespace OpenSim.Region.CoreModules | |||
437 | m_frameLastUpdateClientArray = m_frame; | 435 | m_frameLastUpdateClientArray = m_frame; |
438 | } | 436 | } |
439 | 437 | ||
440 | foreach (ScenePresence avatar in avatars) | 438 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) |
441 | { | 439 | { |
442 | if (!avatar.IsChildAgent) | 440 | if (!sp.IsChildAgent) |
443 | avatar.ControllingClient.SendWindData(windSpeeds); | 441 | sp.ControllingClient.SendWindData(windSpeeds); |
444 | } | 442 | }); |
445 | } | 443 | } |
446 | } | 444 | } |
447 | } | 445 | } |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index b63d014..f1cc0dd 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -304,25 +304,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
304 | /// <param name="AgentId">AgentID that logged out</param> | 304 | /// <param name="AgentId">AgentID that logged out</param> |
305 | private void ClientLoggedOut(UUID AgentId, Scene scene) | 305 | private void ClientLoggedOut(UUID AgentId, Scene scene) |
306 | { | 306 | { |
307 | List<ScenePresence> presences = m_scene.GetAvatars(); | ||
308 | int rootcount = 0; | ||
309 | for (int i=0;i<presences.Count;i++) | ||
310 | { | ||
311 | if (presences[i] != null) | ||
312 | { | ||
313 | if (!presences[i].IsChildAgent) | ||
314 | rootcount++; | ||
315 | } | ||
316 | } | ||
317 | if (rootcount <= 1) | ||
318 | StopThread(); | ||
319 | |||
320 | lock (m_rootAgents) | 307 | lock (m_rootAgents) |
321 | { | 308 | { |
322 | if (m_rootAgents.Contains(AgentId)) | 309 | m_rootAgents.Remove(AgentId); |
323 | { | 310 | if(m_rootAgents.Count == 0) |
324 | m_rootAgents.Remove(AgentId); | 311 | StopThread(); |
325 | } | ||
326 | } | 312 | } |
327 | } | 313 | } |
328 | #endregion | 314 | #endregion |
@@ -375,11 +361,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
375 | if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle) | 361 | if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle) |
376 | { | 362 | { |
377 | // Local Map Item Request | 363 | // Local Map Item Request |
378 | List<ScenePresence> avatars = m_scene.GetAvatars(); | ||
379 | int tc = Environment.TickCount; | 364 | int tc = Environment.TickCount; |
380 | List<mapItemReply> mapitems = new List<mapItemReply>(); | 365 | List<mapItemReply> mapitems = new List<mapItemReply>(); |
381 | mapItemReply mapitem = new mapItemReply(); | 366 | mapItemReply mapitem = new mapItemReply(); |
382 | if (avatars.Count == 0 || avatars.Count == 1) | 367 | if (m_scene.GetRootAgentCount() <= 1) |
383 | { | 368 | { |
384 | mapitem = new mapItemReply(); | 369 | mapitem = new mapItemReply(); |
385 | mapitem.x = (uint)(xstart + 1); | 370 | mapitem.x = (uint)(xstart + 1); |
@@ -392,21 +377,21 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
392 | } | 377 | } |
393 | else | 378 | else |
394 | { | 379 | { |
395 | foreach (ScenePresence av in avatars) | 380 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) |
396 | { | 381 | { |
397 | // Don't send a green dot for yourself | 382 | // Don't send a green dot for yourself |
398 | if (av.UUID != remoteClient.AgentId) | 383 | if (!sp.IsChildAgent && sp.UUID != remoteClient.AgentId) |
399 | { | 384 | { |
400 | mapitem = new mapItemReply(); | 385 | mapitem = new mapItemReply(); |
401 | mapitem.x = (uint)(xstart + av.AbsolutePosition.X); | 386 | mapitem.x = (uint)(xstart + sp.AbsolutePosition.X); |
402 | mapitem.y = (uint)(ystart + av.AbsolutePosition.Y); | 387 | mapitem.y = (uint)(ystart + sp.AbsolutePosition.Y); |
403 | mapitem.id = UUID.Zero; | 388 | mapitem.id = UUID.Zero; |
404 | mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()); | 389 | mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()); |
405 | mapitem.Extra = 1; | 390 | mapitem.Extra = 1; |
406 | mapitem.Extra2 = 0; | 391 | mapitem.Extra2 = 0; |
407 | mapitems.Add(mapitem); | 392 | mapitems.Add(mapitem); |
408 | } | 393 | } |
409 | } | 394 | }); |
410 | } | 395 | } |
411 | remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags); | 396 | remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags); |
412 | } | 397 | } |
@@ -981,51 +966,35 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
981 | Utils.LongToUInts(m_scene.RegionInfo.RegionHandle,out xstart,out ystart); | 966 | Utils.LongToUInts(m_scene.RegionInfo.RegionHandle,out xstart,out ystart); |
982 | 967 | ||
983 | OSDMap responsemap = new OSDMap(); | 968 | OSDMap responsemap = new OSDMap(); |
984 | List<ScenePresence> avatars = m_scene.GetAvatars(); | ||
985 | OSDArray responsearr = new OSDArray(avatars.Count); | ||
986 | OSDMap responsemapdata = new OSDMap(); | ||
987 | int tc = Environment.TickCount; | 969 | int tc = Environment.TickCount; |
988 | /* | 970 | if (m_scene.GetRootAgentCount() == 0) |
989 | foreach (ScenePresence av in avatars) | ||
990 | { | ||
991 | responsemapdata = new OSDMap(); | ||
992 | responsemapdata["X"] = OSD.FromInteger((int)(xstart + av.AbsolutePosition.X)); | ||
993 | responsemapdata["Y"] = OSD.FromInteger((int)(ystart + av.AbsolutePosition.Y)); | ||
994 | responsemapdata["ID"] = OSD.FromUUID(UUID.Zero); | ||
995 | responsemapdata["Name"] = OSD.FromString("TH"); | ||
996 | responsemapdata["Extra"] = OSD.FromInteger(0); | ||
997 | responsemapdata["Extra2"] = OSD.FromInteger(0); | ||
998 | responsearr.Add(responsemapdata); | ||
999 | } | ||
1000 | responsemap["1"] = responsearr; | ||
1001 | */ | ||
1002 | if (avatars.Count == 0) | ||
1003 | { | 971 | { |
1004 | responsemapdata = new OSDMap(); | 972 | OSDMap responsemapdata = new OSDMap(); |
1005 | responsemapdata["X"] = OSD.FromInteger((int)(xstart + 1)); | 973 | responsemapdata["X"] = OSD.FromInteger((int)(xstart + 1)); |
1006 | responsemapdata["Y"] = OSD.FromInteger((int)(ystart + 1)); | 974 | responsemapdata["Y"] = OSD.FromInteger((int)(ystart + 1)); |
1007 | responsemapdata["ID"] = OSD.FromUUID(UUID.Zero); | 975 | responsemapdata["ID"] = OSD.FromUUID(UUID.Zero); |
1008 | responsemapdata["Name"] = OSD.FromString(Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString())); | 976 | responsemapdata["Name"] = OSD.FromString(Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString())); |
1009 | responsemapdata["Extra"] = OSD.FromInteger(0); | 977 | responsemapdata["Extra"] = OSD.FromInteger(0); |
1010 | responsemapdata["Extra2"] = OSD.FromInteger(0); | 978 | responsemapdata["Extra2"] = OSD.FromInteger(0); |
979 | OSDArray responsearr = new OSDArray(); | ||
1011 | responsearr.Add(responsemapdata); | 980 | responsearr.Add(responsemapdata); |
1012 | 981 | ||
1013 | responsemap["6"] = responsearr; | 982 | responsemap["6"] = responsearr; |
1014 | } | 983 | } |
1015 | else | 984 | else |
1016 | { | 985 | { |
1017 | responsearr = new OSDArray(avatars.Count); | 986 | OSDArray responsearr = new OSDArray(m_scene.GetRootAgentCount()); |
1018 | foreach (ScenePresence av in avatars) | 987 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) |
1019 | { | 988 | { |
1020 | responsemapdata = new OSDMap(); | 989 | OSDMap responsemapdata = new OSDMap(); |
1021 | responsemapdata["X"] = OSD.FromInteger((int)(xstart + av.AbsolutePosition.X)); | 990 | responsemapdata["X"] = OSD.FromInteger((int)(xstart + sp.AbsolutePosition.X)); |
1022 | responsemapdata["Y"] = OSD.FromInteger((int)(ystart + av.AbsolutePosition.Y)); | 991 | responsemapdata["Y"] = OSD.FromInteger((int)(ystart + sp.AbsolutePosition.Y)); |
1023 | responsemapdata["ID"] = OSD.FromUUID(UUID.Zero); | 992 | responsemapdata["ID"] = OSD.FromUUID(UUID.Zero); |
1024 | responsemapdata["Name"] = OSD.FromString(Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString())); | 993 | responsemapdata["Name"] = OSD.FromString(Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString())); |
1025 | responsemapdata["Extra"] = OSD.FromInteger(1); | 994 | responsemapdata["Extra"] = OSD.FromInteger(1); |
1026 | responsemapdata["Extra2"] = OSD.FromInteger(0); | 995 | responsemapdata["Extra2"] = OSD.FromInteger(0); |
1027 | responsearr.Add(responsemapdata); | 996 | responsearr.Add(responsemapdata); |
1028 | } | 997 | }); |
1029 | responsemap["6"] = responsearr; | 998 | responsemap["6"] = responsearr; |
1030 | } | 999 | } |
1031 | return responsemap; | 1000 | return responsemap; |
@@ -1107,25 +1076,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1107 | 1076 | ||
1108 | private void MakeChildAgent(ScenePresence avatar) | 1077 | private void MakeChildAgent(ScenePresence avatar) |
1109 | { | 1078 | { |
1110 | List<ScenePresence> presences = m_scene.GetAvatars(); | ||
1111 | int rootcount = 0; | ||
1112 | for (int i = 0; i < presences.Count; i++) | ||
1113 | { | ||
1114 | if (presences[i] != null) | ||
1115 | { | ||
1116 | if (!presences[i].IsChildAgent) | ||
1117 | rootcount++; | ||
1118 | } | ||
1119 | } | ||
1120 | if (rootcount <= 1) | ||
1121 | StopThread(); | ||
1122 | |||
1123 | lock (m_rootAgents) | 1079 | lock (m_rootAgents) |
1124 | { | 1080 | { |
1125 | if (m_rootAgents.Contains(avatar.UUID)) | 1081 | m_rootAgents.Remove(avatar.UUID); |
1126 | { | 1082 | if (m_rootAgents.Count == 0) |
1127 | m_rootAgents.Remove(avatar.UUID); | 1083 | StopThread(); |
1128 | } | ||
1129 | } | 1084 | } |
1130 | } | 1085 | } |
1131 | 1086 | ||