From 01ec93945e69b2fbeabc8fedaec0c9c9224b442e Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Sun, 13 Sep 2009 13:56:09 +0900 Subject: Formatting cleanup. --- OpenSim/Region/Framework/Scenes/Scene.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d95d9d3..0c2f991 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3253,18 +3253,18 @@ namespace OpenSim.Region.Framework.Scenes if (AuthorizationService != null) { - if(!AuthorizationService.IsAuthorizedForRegion(agent.AgentID.ToString(), RegionInfo.RegionID.ToString())) - { - m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region", - agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); - return false; - } + if (!AuthorizationService.IsAuthorizedForRegion(agent.AgentID.ToString(), RegionInfo.RegionID.ToString())) + { + m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region", + agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); + return false; + } } if (m_regInfo.EstateSettings.IsBanned(agent.AgentID)) { m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", - agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); + agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); reason = String.Format("Denied access to region {0}: You have been banned from that region.", RegionInfo.RegionName); return false; -- cgit v1.1 From 4241cdc9291eb5beeaa3120bf3079541b6452410 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Sun, 13 Sep 2009 07:20:18 -0400 Subject: * More comments in the RegionCombinerModule * Changed the Destination ID to 0 in the TeleportFinish Event (why did we have it as 3?) * Added border based trigger teleports * Fix MakeRootAgent border cross tests for ensuring that the position is inside the region to use the borders to figure out if it's outside the Region --- .../Framework/Scenes/SceneCommunicationService.cs | 124 +++++++++++++++++++-- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 26 ++++- 2 files changed, 135 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 1c71a99..b38148b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -1074,7 +1074,7 @@ namespace OpenSim.Region.Framework.Scenes if (eq != null) { eq.TeleportFinishEvent(reg.RegionHandle, 13, endPoint, - 4, teleportFlags, capsPath, avatar.UUID); + 0, teleportFlags, capsPath, avatar.UUID); } else { @@ -1269,16 +1269,53 @@ namespace OpenSim.Region.Framework.Scenes if (scene.TestBorderCross(pos + northCross, Cardinals.N)) { Border b = scene.GetCrossedBorder(pos + northCross, Cardinals.N); - neighboury += (uint)(int)(b.BorderLine.Z/(int)Constants.RegionSize); + neighboury += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize); } else if (scene.TestBorderCross(pos + southCross, Cardinals.S)) { - neighboury--; - newpos.Y = Constants.RegionSize - enterDistance; + Border b = scene.GetCrossedBorder(pos + southCross, Cardinals.S); + if (b.TriggerRegionX == 0 && b.TriggerRegionY == 0) + { + neighboury--; + newpos.Y = Constants.RegionSize - enterDistance; + } + else + { + neighboury = b.TriggerRegionY; + neighbourx = b.TriggerRegionX; + + Vector3 newposition = pos; + newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize; + newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize; + agent.ControllingClient.SendAgentAlertMessage( + String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false); + InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene); + return; + } } - neighbourx--; - newpos.X = Constants.RegionSize - enterDistance; + Border ba = scene.GetCrossedBorder(pos + westCross, Cardinals.W); + if (ba.TriggerRegionX == 0 && ba.TriggerRegionY == 0) + { + neighbourx--; + newpos.X = Constants.RegionSize - enterDistance; + } + else + { + neighboury = ba.TriggerRegionY; + neighbourx = ba.TriggerRegionX; + + + Vector3 newposition = pos; + newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize; + newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize; + agent.ControllingClient.SendAgentAlertMessage( + String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false); + InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene); + + + return; + } } else if (scene.TestBorderCross(pos + eastCross, Cardinals.E)) @@ -1289,8 +1326,24 @@ namespace OpenSim.Region.Framework.Scenes if (scene.TestBorderCross(pos + southCross, Cardinals.S)) { - neighboury--; - newpos.Y = Constants.RegionSize - enterDistance; + Border ba = scene.GetCrossedBorder(pos + southCross, Cardinals.S); + if (ba.TriggerRegionX == 0 && ba.TriggerRegionY == 0) + { + neighboury--; + newpos.Y = Constants.RegionSize - enterDistance; + } + else + { + neighboury = ba.TriggerRegionY; + neighbourx = ba.TriggerRegionX; + Vector3 newposition = pos; + newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize; + newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize; + agent.ControllingClient.SendAgentAlertMessage( + String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false); + InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene); + return; + } } else if (scene.TestBorderCross(pos + northCross, Cardinals.N)) { @@ -1298,16 +1351,33 @@ namespace OpenSim.Region.Framework.Scenes neighboury += (uint)(int)(c.BorderLine.Z / (int)Constants.RegionSize); newpos.Y = enterDistance; } - + } else if (scene.TestBorderCross(pos + southCross, Cardinals.S)) { - neighboury--; - newpos.Y = Constants.RegionSize - enterDistance; + Border b = scene.GetCrossedBorder(pos + southCross, Cardinals.S); + if (b.TriggerRegionX == 0 && b.TriggerRegionY == 0) + { + neighboury--; + newpos.Y = Constants.RegionSize - enterDistance; + } + else + { + neighboury = b.TriggerRegionY; + neighbourx = b.TriggerRegionX; + Vector3 newposition = pos; + newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize; + newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize; + agent.ControllingClient.SendAgentAlertMessage( + String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false); + InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene); + return; + } } else if (scene.TestBorderCross(pos + northCross, Cardinals.N)) { + Border b = scene.GetCrossedBorder(pos + northCross, Cardinals.N); neighboury += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize); newpos.Y = enterDistance; @@ -1342,6 +1412,38 @@ namespace OpenSim.Region.Framework.Scenes d.BeginInvoke(agent, newpos, neighbourx, neighboury, isFlying, CrossAgentToNewRegionCompleted, d); } + public void InformClientToInitateTeleportToLocation(ScenePresence agent, uint regionX, uint regionY, Vector3 position, Scene initiatingScene) + { + Util.FireAndForget(delegate + { + Thread.Sleep(10000); + IMessageTransferModule im = initiatingScene.RequestModuleInterface(); + if (im != null) + { + UUID gotoLocation = Util.BuildFakeParcelID( + Util.UIntsToLong( + (regionX * + (uint)Constants.RegionSize), + (regionY * + (uint)Constants.RegionSize)), + (uint)(int)position.X, + (uint)(int)position.Y, + (uint)(int)position.Z); + GridInstantMessage m = new GridInstantMessage(initiatingScene, UUID.Zero, + "Region", agent.UUID, + (byte)InstantMessageDialog.GodLikeRequestTeleport, false, + "", gotoLocation, false, new Vector3(127, 0, 0), + new Byte[0]); + im.SendInstantMessage(m, delegate(bool success) + { + m_log.DebugFormat("[CLIENT]: Client Initiating Teleport sending IM success = {0}", success); + }); + + } + + }); + } + public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, bool isFlying); /// diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 1024857..23fe2d3 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -776,8 +776,20 @@ namespace OpenSim.Region.Framework.Scenes // before the inventory is processed in MakeRootAgent. This fixes a race condition // related to the handling of attachments //m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); + if (m_scene.TestBorderCross(pos, Cardinals.E)) + { + Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E); + pos.X = crossedBorder.BorderLine.Z - 1; + } + + if (m_scene.TestBorderCross(pos, Cardinals.N)) + { + Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.N); + pos.Y = crossedBorder.BorderLine.Z - 1; + } + - if (pos.X < 0 || pos.X >= (int)Constants.RegionSize || pos.Y < 0 || pos.Y >= (int)Constants.RegionSize || pos.Z < 0) + if (pos.X < 0 || pos.Y < 0 || pos.Z < 0) { Vector3 emergencyPos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128); @@ -795,7 +807,11 @@ namespace OpenSim.Region.Framework.Scenes localAVHeight = m_avHeight; } - float posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y]; + float posZLimit = 0; + + if (pos.X = (pos.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) { @@ -877,6 +893,7 @@ namespace OpenSim.Region.Framework.Scenes m_isChildAgent = true; m_scene.SwapRootAgentCount(true); RemoveFromPhysicalScene(); + m_scene.EventManager.TriggerOnMakeChildAgent(this); } @@ -904,7 +921,7 @@ namespace OpenSim.Region.Framework.Scenes bool isFlying = false; if (m_physicsActor != null) isFlying = m_physicsActor.Flying; - + RemoveFromPhysicalScene(); Velocity = new Vector3(0, 0, 0); AbsolutePosition = pos; @@ -2412,7 +2429,8 @@ namespace OpenSim.Region.Framework.Scenes } // followed suggestion from mic bowman. reversed the two lines below. - CheckForBorderCrossing(); + if (m_parentID == 0 && m_physicsActor != null || m_parentID != 0) // Check that we have a physics actor or we're sitting on something + CheckForBorderCrossing(); CheckForSignificantMovement(); // sends update to the modules. } } -- cgit v1.1 From efc43aa0d90e7e35408e7eb7fd475eaa3c3b0a31 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 13 Sep 2009 18:24:00 +0100 Subject: Change the type value for given folders to -1. Prevents inventory blowups --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 4ea283f..eb397f6 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1136,7 +1136,7 @@ namespace OpenSim.Region.Framework.Scenes UUID newFolderID = UUID.Random(); - InventoryFolderBase newFolder = new InventoryFolderBase(newFolderID, category, destID, 0xff, rootFolder.ID, rootFolder.Version); + InventoryFolderBase newFolder = new InventoryFolderBase(newFolderID, category, destID, -1, rootFolder.ID, rootFolder.Version); InventoryService.AddFolder(newFolder); foreach (UUID itemID in items) -- cgit v1.1 From ed475f21eee93210f1cdfcb9a9778da91f2b1d38 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Sun, 13 Sep 2009 18:28:45 -0400 Subject: * Use the BeginInvoke methodology instead of the FireAndForget methodology to try to mitigate a mono assert. Same functionality done a different way. --- .../Framework/Scenes/SceneCommunicationService.cs | 30 ++++++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index b38148b..204c319 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -1412,10 +1412,25 @@ namespace OpenSim.Region.Framework.Scenes d.BeginInvoke(agent, newpos, neighbourx, neighboury, isFlying, CrossAgentToNewRegionCompleted, d); } - public void InformClientToInitateTeleportToLocation(ScenePresence agent, uint regionX, uint regionY, Vector3 position, Scene initiatingScene) + public delegate void InformClientToInitateTeleportToLocationDelegate(ScenePresence agent, uint regionX, uint regionY, + Vector3 position, + Scene initiatingScene); + + public void InformClientToInitateTeleportToLocation(ScenePresence agent, uint regionX, uint regionY, Vector3 position, + Scene initiatingScene) + { + + // This assumes that we know what our neighbors are. + + InformClientToInitateTeleportToLocationDelegate d = InformClientToInitiateTeleportToLocationAsync; + d.BeginInvoke(agent,regionX,regionY,position,initiatingScene, + InformClientToInitiateTeleportToLocationCompleted, + d); + } + + public void InformClientToInitiateTeleportToLocationAsync(ScenePresence agent, uint regionX, uint regionY, Vector3 position, + Scene initiatingScene) { - Util.FireAndForget(delegate - { Thread.Sleep(10000); IMessageTransferModule im = initiatingScene.RequestModuleInterface(); if (im != null) @@ -1440,13 +1455,18 @@ namespace OpenSim.Region.Framework.Scenes }); } + } - }); + private void InformClientToInitiateTeleportToLocationCompleted(IAsyncResult iar) + { + InformClientToInitateTeleportToLocationDelegate icon = + (InformClientToInitateTeleportToLocationDelegate) iar.AsyncState; + icon.EndInvoke(iar); } public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, bool isFlying); - /// + /// /// This Closes child agents on neighboring regions /// Calls an asynchronous method to do so.. so it doesn't lag the sim. /// -- cgit v1.1