From 0edffae7e42c0705303e015036fa85687508ecf0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 30 Aug 2015 19:17:35 +0100 Subject: more on tps and crossings --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 105 ++++++++++++++++------- 1 file changed, 76 insertions(+), 29 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs') 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 else seeds = new Dictionary(); +/* we can't do this anymore List old = new List(); foreach (ulong handle in seeds.Keys) { uint x, y; Util.RegionHandleToRegionLoc(handle, out x, out y); - - if (Util.IsOutsideView(DrawDistance, x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY)) +no information to check this +// if (Util.IsOutsideView(DrawDistance, x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY,)) { old.Add(handle); } } + DropOldNeighbours(old); if (Scene.CapsModule != null) Scene.CapsModule.SetChildrenSeed(UUID, seeds); - +*/ KnownRegions = seeds; //m_log.Debug(" ++++++++++AFTER+++++++++++++ "); //DumpKnownRegions(); @@ -1517,15 +1519,46 @@ namespace OpenSim.Region.Framework.Scenes // holds the seed cap for the child agent in that region private Dictionary m_knownChildRegions = new Dictionary(); - public void AddNeighbourRegion(ulong regionHandle, string cap) + struct spRegionSizeInfo + { + public int sizeX; + public int sizeY; + } + + private Dictionary m_knownChildRegionsSizeInfo = new Dictionary(); + + + public void AddNeighbourRegionSizeInfo(GridRegion region) { lock (m_knownChildRegions) { - if (!m_knownChildRegions.ContainsKey(regionHandle)) + spRegionSizeInfo sizeInfo = new spRegionSizeInfo(); + sizeInfo.sizeX = region.RegionSizeX; + sizeInfo.sizeY = region.RegionSizeY; + ulong regionHandle = region.RegionHandle; + + if (!m_knownChildRegionsSizeInfo.ContainsKey(regionHandle)) { - uint x, y; - Utils.LongToUInts(regionHandle, out x, out y); - m_knownChildRegions.Add(regionHandle, cap); + m_knownChildRegionsSizeInfo.Add(regionHandle, sizeInfo); + + } + else + m_knownChildRegionsSizeInfo[regionHandle] = sizeInfo; + } + } + + public void SetNeighbourRegionSizeInfo(List regionsList) + { + lock (m_knownChildRegions) + { + m_knownChildRegionsSizeInfo.Clear(); + foreach (GridRegion region in regionsList) + { + spRegionSizeInfo sizeInfo = new spRegionSizeInfo(); + sizeInfo.sizeX = region.RegionSizeX; + sizeInfo.sizeY = region.RegionSizeY; + ulong regionHandle = region.RegionHandle; + m_knownChildRegionsSizeInfo.Add(regionHandle, sizeInfo); } } } @@ -1539,6 +1572,7 @@ namespace OpenSim.Region.Framework.Scenes //if (m_knownChildRegions.ContainsKey(regionHandle)) // m_log.DebugFormat(" !!! removing known region {0} in {1}. Count = {2}", regionHandle, Scene.RegionInfo.RegionName, m_knownChildRegions.Count); m_knownChildRegions.Remove(regionHandle); + m_knownChildRegionsSizeInfo.Remove(regionHandle); } } @@ -1558,7 +1592,6 @@ namespace OpenSim.Region.Framework.Scenes Scene.CapsModule.DropChildSeed(UUID, handle); } - public Dictionary KnownRegions { get @@ -1804,7 +1837,7 @@ namespace OpenSim.Region.Framework.Scenes bool haveAnims = (animIDs != null && animseqs != null && animsobjs != null); - if(haveAnims) + if (haveAnims) SendAnimPackToAgent(this, animIDs, animseqs, animsobjs); // we should be able to receive updates, etc @@ -1831,19 +1864,20 @@ namespace OpenSim.Region.Framework.Scenes } // greys if m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - + // attachments if (isNPC || (TeleportFlags & TeleportFlags.ViaLogin) != 0) { if (Scene.AttachmentsModule != null) - // Util.FireAndForget( - // o => - // { + // Util.FireAndForget( + // o => + // { if (!isNPC) Scene.AttachmentsModule.RezAttachments(this); else - Util.FireAndForget(x => { + Util.FireAndForget(x => + { Scene.AttachmentsModule.RezAttachments(this); }); // }); @@ -1855,7 +1889,7 @@ namespace OpenSim.Region.Framework.Scenes m_log.DebugFormat( "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); - foreach(SceneObjectGroup sog in m_attachments) + foreach (SceneObjectGroup sog in m_attachments) { sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); sog.ResumeScripts(); @@ -1880,10 +1914,9 @@ namespace OpenSim.Region.Framework.Scenes } m_log.DebugFormat("[CompleteMovement] attachments: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - - // Create child agents in neighbouring regions if (openChildAgents) { + // Create child agents in neighbouring regions IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); if (m_agentTransfer != null) { @@ -3955,8 +3988,9 @@ namespace OpenSim.Region.Framework.Scenes /// The new region's x on the map /// The new region's y on the map /// - public void CloseChildAgents(uint newRegionX, uint newRegionY) + public void CloseChildAgents(ulong newRegionHandle, int newRegionSizeX, int newRegionSizeY) { + uint newRegionX, newRegionY; List byebyeRegions = new List(); List knownRegions = KnownRegionHandles; m_log.DebugFormat( @@ -3964,19 +3998,35 @@ namespace OpenSim.Region.Framework.Scenes knownRegions.Count, Scene.RegionInfo.RegionName); //DumpKnownRegions(); + Util.RegionHandleToRegionLoc(newRegionHandle, out newRegionX, out newRegionY); + + uint x, y; + spRegionSizeInfo regInfo; + foreach (ulong handle in knownRegions) { // Don't close the agent on this region yet if (handle != Scene.RegionInfo.RegionHandle) { - uint x, y; Util.RegionHandleToRegionLoc(handle, out x, out y); + if (m_knownChildRegionsSizeInfo.TryGetValue(handle, out regInfo)) + { -// m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); -// m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); - if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY)) + // m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); + // m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); + if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY, + regInfo.sizeX, regInfo.sizeY, newRegionSizeX, newRegionSizeY)) + { + byebyeRegions.Add(handle); + } + } + else { - byebyeRegions.Add(handle); + if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY, + (int)Constants.RegionSize, (int)Constants.RegionSize, newRegionSizeX, newRegionSizeY)) + { + byebyeRegions.Add(handle); + } } } } @@ -5382,11 +5432,8 @@ namespace OpenSim.Region.Framework.Scenes SpawnPoint[] spawnPoints = m_scene.RegionInfo.RegionSettings.SpawnPoints().ToArray(); if (spawnPoints.Length == 0) { - if(m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) - { - pos.X = 128.0f; - pos.Y = 128.0f; - } + pos.X = 128.0f; + pos.Y = 128.0f; return; } -- cgit v1.1