aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs105
1 files changed, 76 insertions, 29 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 3e278a9..045a450 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -838,22 +838,24 @@ namespace OpenSim.Region.Framework.Scenes
838 else 838 else
839 seeds = new Dictionary<ulong, string>(); 839 seeds = new Dictionary<ulong, string>();
840 840
841/* we can't do this anymore
841 List<ulong> old = new List<ulong>(); 842 List<ulong> old = new List<ulong>();
842 foreach (ulong handle in seeds.Keys) 843 foreach (ulong handle in seeds.Keys)
843 { 844 {
844 uint x, y; 845 uint x, y;
845 Util.RegionHandleToRegionLoc(handle, out x, out y); 846 Util.RegionHandleToRegionLoc(handle, out x, out y);
846 847no information to check this
847 if (Util.IsOutsideView(DrawDistance, x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY)) 848// if (Util.IsOutsideView(DrawDistance, x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY,))
848 { 849 {
849 old.Add(handle); 850 old.Add(handle);
850 } 851 }
851 } 852 }
853
852 DropOldNeighbours(old); 854 DropOldNeighbours(old);
853 855
854 if (Scene.CapsModule != null) 856 if (Scene.CapsModule != null)
855 Scene.CapsModule.SetChildrenSeed(UUID, seeds); 857 Scene.CapsModule.SetChildrenSeed(UUID, seeds);
856 858*/
857 KnownRegions = seeds; 859 KnownRegions = seeds;
858 //m_log.Debug(" ++++++++++AFTER+++++++++++++ "); 860 //m_log.Debug(" ++++++++++AFTER+++++++++++++ ");
859 //DumpKnownRegions(); 861 //DumpKnownRegions();
@@ -1517,15 +1519,46 @@ namespace OpenSim.Region.Framework.Scenes
1517 // holds the seed cap for the child agent in that region 1519 // holds the seed cap for the child agent in that region
1518 private Dictionary<ulong, string> m_knownChildRegions = new Dictionary<ulong, string>(); 1520 private Dictionary<ulong, string> m_knownChildRegions = new Dictionary<ulong, string>();
1519 1521
1520 public void AddNeighbourRegion(ulong regionHandle, string cap) 1522 struct spRegionSizeInfo
1523 {
1524 public int sizeX;
1525 public int sizeY;
1526 }
1527
1528 private Dictionary<ulong, spRegionSizeInfo> m_knownChildRegionsSizeInfo = new Dictionary<ulong, spRegionSizeInfo>();
1529
1530
1531 public void AddNeighbourRegionSizeInfo(GridRegion region)
1521 { 1532 {
1522 lock (m_knownChildRegions) 1533 lock (m_knownChildRegions)
1523 { 1534 {
1524 if (!m_knownChildRegions.ContainsKey(regionHandle)) 1535 spRegionSizeInfo sizeInfo = new spRegionSizeInfo();
1536 sizeInfo.sizeX = region.RegionSizeX;
1537 sizeInfo.sizeY = region.RegionSizeY;
1538 ulong regionHandle = region.RegionHandle;
1539
1540 if (!m_knownChildRegionsSizeInfo.ContainsKey(regionHandle))
1525 { 1541 {
1526 uint x, y; 1542 m_knownChildRegionsSizeInfo.Add(regionHandle, sizeInfo);
1527 Utils.LongToUInts(regionHandle, out x, out y); 1543
1528 m_knownChildRegions.Add(regionHandle, cap); 1544 }
1545 else
1546 m_knownChildRegionsSizeInfo[regionHandle] = sizeInfo;
1547 }
1548 }
1549
1550 public void SetNeighbourRegionSizeInfo(List<GridRegion> regionsList)
1551 {
1552 lock (m_knownChildRegions)
1553 {
1554 m_knownChildRegionsSizeInfo.Clear();
1555 foreach (GridRegion region in regionsList)
1556 {
1557 spRegionSizeInfo sizeInfo = new spRegionSizeInfo();
1558 sizeInfo.sizeX = region.RegionSizeX;
1559 sizeInfo.sizeY = region.RegionSizeY;
1560 ulong regionHandle = region.RegionHandle;
1561 m_knownChildRegionsSizeInfo.Add(regionHandle, sizeInfo);
1529 } 1562 }
1530 } 1563 }
1531 } 1564 }
@@ -1539,6 +1572,7 @@ namespace OpenSim.Region.Framework.Scenes
1539 //if (m_knownChildRegions.ContainsKey(regionHandle)) 1572 //if (m_knownChildRegions.ContainsKey(regionHandle))
1540 // m_log.DebugFormat(" !!! removing known region {0} in {1}. Count = {2}", regionHandle, Scene.RegionInfo.RegionName, m_knownChildRegions.Count); 1573 // m_log.DebugFormat(" !!! removing known region {0} in {1}. Count = {2}", regionHandle, Scene.RegionInfo.RegionName, m_knownChildRegions.Count);
1541 m_knownChildRegions.Remove(regionHandle); 1574 m_knownChildRegions.Remove(regionHandle);
1575 m_knownChildRegionsSizeInfo.Remove(regionHandle);
1542 } 1576 }
1543 } 1577 }
1544 1578
@@ -1558,7 +1592,6 @@ namespace OpenSim.Region.Framework.Scenes
1558 Scene.CapsModule.DropChildSeed(UUID, handle); 1592 Scene.CapsModule.DropChildSeed(UUID, handle);
1559 } 1593 }
1560 1594
1561
1562 public Dictionary<ulong, string> KnownRegions 1595 public Dictionary<ulong, string> KnownRegions
1563 { 1596 {
1564 get 1597 get
@@ -1804,7 +1837,7 @@ namespace OpenSim.Region.Framework.Scenes
1804 1837
1805 bool haveAnims = (animIDs != null && animseqs != null && animsobjs != null); 1838 bool haveAnims = (animIDs != null && animseqs != null && animsobjs != null);
1806 1839
1807 if(haveAnims) 1840 if (haveAnims)
1808 SendAnimPackToAgent(this, animIDs, animseqs, animsobjs); 1841 SendAnimPackToAgent(this, animIDs, animseqs, animsobjs);
1809 1842
1810 // we should be able to receive updates, etc 1843 // we should be able to receive updates, etc
@@ -1831,19 +1864,20 @@ namespace OpenSim.Region.Framework.Scenes
1831 } // greys if 1864 } // greys if
1832 1865
1833 m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 1866 m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1834 1867
1835 // attachments 1868 // attachments
1836 1869
1837 if (isNPC || (TeleportFlags & TeleportFlags.ViaLogin) != 0) 1870 if (isNPC || (TeleportFlags & TeleportFlags.ViaLogin) != 0)
1838 { 1871 {
1839 if (Scene.AttachmentsModule != null) 1872 if (Scene.AttachmentsModule != null)
1840 // Util.FireAndForget( 1873 // Util.FireAndForget(
1841 // o => 1874 // o =>
1842 // { 1875 // {
1843 if (!isNPC) 1876 if (!isNPC)
1844 Scene.AttachmentsModule.RezAttachments(this); 1877 Scene.AttachmentsModule.RezAttachments(this);
1845 else 1878 else
1846 Util.FireAndForget(x => { 1879 Util.FireAndForget(x =>
1880 {
1847 Scene.AttachmentsModule.RezAttachments(this); 1881 Scene.AttachmentsModule.RezAttachments(this);
1848 }); 1882 });
1849 // }); 1883 // });
@@ -1855,7 +1889,7 @@ namespace OpenSim.Region.Framework.Scenes
1855 m_log.DebugFormat( 1889 m_log.DebugFormat(
1856 "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); 1890 "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name);
1857 1891
1858 foreach(SceneObjectGroup sog in m_attachments) 1892 foreach (SceneObjectGroup sog in m_attachments)
1859 { 1893 {
1860 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); 1894 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource());
1861 sog.ResumeScripts(); 1895 sog.ResumeScripts();
@@ -1880,10 +1914,9 @@ namespace OpenSim.Region.Framework.Scenes
1880 } 1914 }
1881 1915
1882 m_log.DebugFormat("[CompleteMovement] attachments: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 1916 m_log.DebugFormat("[CompleteMovement] attachments: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1883
1884 // Create child agents in neighbouring regions
1885 if (openChildAgents) 1917 if (openChildAgents)
1886 { 1918 {
1919 // Create child agents in neighbouring regions
1887 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); 1920 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
1888 if (m_agentTransfer != null) 1921 if (m_agentTransfer != null)
1889 { 1922 {
@@ -3955,8 +3988,9 @@ namespace OpenSim.Region.Framework.Scenes
3955 /// <param name="newRegionX">The new region's x on the map</param> 3988 /// <param name="newRegionX">The new region's x on the map</param>
3956 /// <param name="newRegionY">The new region's y on the map</param> 3989 /// <param name="newRegionY">The new region's y on the map</param>
3957 /// <returns></returns> 3990 /// <returns></returns>
3958 public void CloseChildAgents(uint newRegionX, uint newRegionY) 3991 public void CloseChildAgents(ulong newRegionHandle, int newRegionSizeX, int newRegionSizeY)
3959 { 3992 {
3993 uint newRegionX, newRegionY;
3960 List<ulong> byebyeRegions = new List<ulong>(); 3994 List<ulong> byebyeRegions = new List<ulong>();
3961 List<ulong> knownRegions = KnownRegionHandles; 3995 List<ulong> knownRegions = KnownRegionHandles;
3962 m_log.DebugFormat( 3996 m_log.DebugFormat(
@@ -3964,19 +3998,35 @@ namespace OpenSim.Region.Framework.Scenes
3964 knownRegions.Count, Scene.RegionInfo.RegionName); 3998 knownRegions.Count, Scene.RegionInfo.RegionName);
3965 //DumpKnownRegions(); 3999 //DumpKnownRegions();
3966 4000
4001 Util.RegionHandleToRegionLoc(newRegionHandle, out newRegionX, out newRegionY);
4002
4003 uint x, y;
4004 spRegionSizeInfo regInfo;
4005
3967 foreach (ulong handle in knownRegions) 4006 foreach (ulong handle in knownRegions)
3968 { 4007 {
3969 // Don't close the agent on this region yet 4008 // Don't close the agent on this region yet
3970 if (handle != Scene.RegionInfo.RegionHandle) 4009 if (handle != Scene.RegionInfo.RegionHandle)
3971 { 4010 {
3972 uint x, y;
3973 Util.RegionHandleToRegionLoc(handle, out x, out y); 4011 Util.RegionHandleToRegionLoc(handle, out x, out y);
4012 if (m_knownChildRegionsSizeInfo.TryGetValue(handle, out regInfo))
4013 {
3974 4014
3975// m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); 4015 // m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX)));
3976// m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); 4016 // m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY)));
3977 if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY)) 4017 if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY,
4018 regInfo.sizeX, regInfo.sizeY, newRegionSizeX, newRegionSizeY))
4019 {
4020 byebyeRegions.Add(handle);
4021 }
4022 }
4023 else
3978 { 4024 {
3979 byebyeRegions.Add(handle); 4025 if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY,
4026 (int)Constants.RegionSize, (int)Constants.RegionSize, newRegionSizeX, newRegionSizeY))
4027 {
4028 byebyeRegions.Add(handle);
4029 }
3980 } 4030 }
3981 } 4031 }
3982 } 4032 }
@@ -5382,11 +5432,8 @@ namespace OpenSim.Region.Framework.Scenes
5382 SpawnPoint[] spawnPoints = m_scene.RegionInfo.RegionSettings.SpawnPoints().ToArray(); 5432 SpawnPoint[] spawnPoints = m_scene.RegionInfo.RegionSettings.SpawnPoints().ToArray();
5383 if (spawnPoints.Length == 0) 5433 if (spawnPoints.Length == 0)
5384 { 5434 {
5385 if(m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) 5435 pos.X = 128.0f;
5386 { 5436 pos.Y = 128.0f;
5387 pos.X = 128.0f;
5388 pos.Y = 128.0f;
5389 }
5390 return; 5437 return;
5391 } 5438 }
5392 5439