From 0ff3c28f903f38f5bbc681c9ba9f810ae25dbd8f Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Sun, 22 Nov 2009 20:21:33 -0500 Subject: [PATCH] * This doesn't fix mantis 3522, but it should mitigate it. * If the start position is outside of the region on the X and Y, put the user in the center of the region and then damp the Z position at 720 if necessary. If the start position is not outside of the region on the X or Y, then don't check the Z. --- OpenSim/Region/Framework/Scenes/Scene.cs | 43 ++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a430b1e709..f444e51348 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3470,6 +3470,49 @@ namespace OpenSim.Region.Framework.Scenes agent.startpos.Y = crossedBorder.BorderLine.Z - 1; } + //Mitigate http://opensimulator.org/mantis/view.php?id=3522 + // Check if start position is outside of region + // If it is, check the Z start position also.. if not, leave it alone. + if (BordersLocked) + { + lock (EastBorders) + { + if (agent.startpos.X > EastBorders[0].BorderLine.Z) + { + m_log.Warn("FIX AGENT POSITION"); + agent.startpos.X = EastBorders[0].BorderLine.Z * 0.5f; + if (agent.startpos.Z > 720) + agent.startpos.Z = 720; + } + } + lock (NorthBorders) + { + if (agent.startpos.Y > NorthBorders[0].BorderLine.Z) + { + m_log.Warn("FIX Agent POSITION"); + agent.startpos.Y = NorthBorders[0].BorderLine.Z * 0.5f; + if (agent.startpos.Z > 720) + agent.startpos.Z = 720; + } + } + } + else + { + if (agent.startpos.X > EastBorders[0].BorderLine.Z) + { + m_log.Warn("FIX AGENT POSITION"); + agent.startpos.X = EastBorders[0].BorderLine.Z * 0.5f; + if (agent.startpos.Z > 720) + agent.startpos.Z = 720; + } + if (agent.startpos.Y > NorthBorders[0].BorderLine.Z) + { + m_log.Warn("FIX Agent POSITION"); + agent.startpos.Y = NorthBorders[0].BorderLine.Z * 0.5f; + if (agent.startpos.Z > 720) + agent.startpos.Z = 720; + } + } // Honor parcel landing type and position. ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); if (land != null)