* Allow corner prim crossings. Previously this was only on a single cardinal direction

* Some leg work in getting avatar teleports into 'virtual regions' moved to the proper region.
remotes/origin/0.6.7-post-fixes
Teravus Ovares (Dan Olivares) 2009-08-28 14:45:17 -04:00
parent 65dda8a795
commit ac718843d9
3 changed files with 202 additions and 33 deletions

View File

@ -216,9 +216,9 @@ namespace OpenSim.Region.CoreModules.World.Land
//xxy
//xxx
if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd
== (regionConnections.X * (int)Constants.RegionSize))
>= (regionConnections.X * (int)Constants.RegionSize))
&& (((int)conn.Y * (int)Constants.RegionSize)
== (regionConnections.Y * (int)Constants.RegionSize)))
>= (regionConnections.Y * (int)Constants.RegionSize)))
{
Vector3 offset = Vector3.Zero;
offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
@ -262,9 +262,9 @@ namespace OpenSim.Region.CoreModules.World.Land
//xxx
//xxx
if ((((int)conn.X * (int)Constants.RegionSize)
== (regionConnections.X * (int)Constants.RegionSize))
>= (regionConnections.X * (int)Constants.RegionSize))
&& (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
== (regionConnections.Y * (int)Constants.RegionSize)))
>= (regionConnections.Y * (int)Constants.RegionSize)))
{
Vector3 offset = Vector3.Zero;
offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
@ -303,9 +303,9 @@ namespace OpenSim.Region.CoreModules.World.Land
//xxx
//xxx
if ((((int)conn.X * (int)Constants.RegionSize) + conn.YEnd
== (regionConnections.X * (int)Constants.RegionSize))
>= (regionConnections.X * (int)Constants.RegionSize))
&& (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
== (regionConnections.Y * (int)Constants.RegionSize)))
>= (regionConnections.Y * (int)Constants.RegionSize)))
{
Vector3 offset = Vector3.Zero;
offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
@ -315,13 +315,58 @@ namespace OpenSim.Region.CoreModules.World.Land
Vector3 extents = Vector3.Zero;
extents.Y = regionConnections.YEnd + conn.YEnd;
extents.X = conn.XEnd + conn.XEnd;
extents.X = regionConnections.XEnd + conn.XEnd;
conn.UpdateExtents(extents);
m_log.DebugFormat("Scene: {0} to the south of Scene{1} Offset: {2}. Extents:{3}",
conn.RegionScene.RegionInfo.RegionName,
regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
m_log.DebugFormat("Scene: {0} to the NorthEast of Scene{1} Offset: {2}. Extents:{3}",
conn.RegionScene.RegionInfo.RegionName,
regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents);
if (conn.RegionScene.NorthBorders.Count == 1)// && 2)
{
//compound border
conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
}
scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south
if (conn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2)
{
conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
}
scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West
/*
else
{
conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south
}
*/
// Reset Terrain.. since terrain normally loads first.
//conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
//conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
connectedYN = true;
//scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents);
break;
}

View File

@ -34,7 +34,7 @@ namespace OpenSim.Region.Framework.Scenes
{
public class Border
{
/// <summary>
/// Line perpendicular to the Direction Cardinal. Z value is the
/// </summary>
@ -125,6 +125,25 @@ namespace OpenSim.Region.Framework.Scenes
return result;
}
public float Extent
{
get
{
switch (CrossDirection)
{
case Cardinals.N:
break;
case Cardinals.S:
break;
case Cardinals.W:
break;
case Cardinals.E:
break;
}
return 0;
}
}
}

View File

@ -1706,30 +1706,71 @@ namespace OpenSim.Region.Framework.Scenes
ulong newRegionHandle = 0;
Vector3 pos = attemptedPosition;
if (TestBorderCross(attemptedPosition, Cardinals.E))
if (TestBorderCross(attemptedPosition, Cardinals.W))
{
pos.X = ((pos.X - Constants.RegionSize));
newRegionHandle
= Util.UIntsToLong((uint)((thisx + 1) * Constants.RegionSize), (uint)(thisy * Constants.RegionSize));
// x + 1
if (TestBorderCross(attemptedPosition, Cardinals.S))
{
//Border crossedBorderx = GetCrossedBorder(attemptedPosition,Cardinals.W);
//Border crossedBordery = GetCrossedBorder(attemptedPosition, Cardinals.S);
//(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
pos.X = ((pos.X + Constants.RegionSize));
pos.Y = ((pos.Y + Constants.RegionSize));
newRegionHandle
= Util.UIntsToLong((uint)((thisx - 1) * Constants.RegionSize),
(uint)((thisy - 1) * Constants.RegionSize));
// x - 1
// y - 1
}
else if (TestBorderCross(attemptedPosition, Cardinals.N))
{
pos.X = ((pos.X + Constants.RegionSize));
pos.Y = ((pos.Y - Constants.RegionSize));
newRegionHandle
= Util.UIntsToLong((uint)((thisx - 1) * Constants.RegionSize),
(uint)((thisy + 1) * Constants.RegionSize));
// x - 1
// y + 1
}
else
{
pos.X = ((pos.X + Constants.RegionSize));
newRegionHandle
= Util.UIntsToLong((uint) ((thisx - 1)*Constants.RegionSize),
(uint) (thisy*Constants.RegionSize));
// x - 1
}
}
else if (TestBorderCross(attemptedPosition, Cardinals.W))
else if (TestBorderCross(attemptedPosition, Cardinals.E))
{
pos.X = ((pos.X + Constants.RegionSize));
newRegionHandle
= Util.UIntsToLong((uint)((thisx - 1) * Constants.RegionSize), (uint)(thisy * Constants.RegionSize));
// x - 1
}
if (TestBorderCross(attemptedPosition, Cardinals.N))
{
pos.Y = ((pos.Y - Constants.RegionSize));
newRegionHandle
= Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + 1) * Constants.RegionSize));
// y + 1
}
if (TestBorderCross(attemptedPosition, Cardinals.S))
{
pos.X = ((pos.X - Constants.RegionSize));
pos.Y = ((pos.Y + Constants.RegionSize));
newRegionHandle
= Util.UIntsToLong((uint)((thisx + 1) * Constants.RegionSize),
(uint)((thisy - 1) * Constants.RegionSize));
// x + 1
// y - 1
}
else if (TestBorderCross(attemptedPosition, Cardinals.N))
{
pos.X = ((pos.X - Constants.RegionSize));
pos.Y = ((pos.Y - Constants.RegionSize));
newRegionHandle
= Util.UIntsToLong((uint)((thisx + 1) * Constants.RegionSize),
(uint)((thisy + 1) * Constants.RegionSize));
// x + 1
// y + 1
}
else
{
pos.X = ((pos.X - Constants.RegionSize));
newRegionHandle
= Util.UIntsToLong((uint) ((thisx + 1)*Constants.RegionSize),
(uint) (thisy*Constants.RegionSize));
// x + 1
}
}
else if (TestBorderCross(attemptedPosition, Cardinals.S))
{
pos.Y = ((pos.Y + Constants.RegionSize));
@ -1737,6 +1778,14 @@ namespace OpenSim.Region.Framework.Scenes
= Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - 1) * Constants.RegionSize));
// y - 1
}
else if (TestBorderCross(attemptedPosition, Cardinals.N))
{
pos.Y = ((pos.Y - Constants.RegionSize));
newRegionHandle
= Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + 1) * Constants.RegionSize));
// y + 1
}
// Offset the positions for the new region across the border
Vector3 oldGroupPosition = grp.RootPart.GroupPosition;
@ -1750,6 +1799,62 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public Border GetCrossedBorder(Vector3 position, Cardinals gridline)
{
switch (gridline)
{
case Cardinals.N:
lock (NorthBorders)
{
foreach (Border b in NorthBorders)
{
if (b.TestCross(position))
return b;
}
}
break;
case Cardinals.S:
lock (SouthBorders)
{
foreach (Border b in SouthBorders)
{
if (b.TestCross(position))
return b;
}
}
break;
case Cardinals.E:
lock (EastBorders)
{
foreach (Border b in EastBorders)
{
if (b.TestCross(position))
return b;
}
}
break;
case Cardinals.W:
lock (WestBorders)
{
foreach (Border b in WestBorders)
{
if (b.TestCross(position))
return b;
}
}
break;
}
return null;
}
public bool TestBorderCross(Vector3 position, Cardinals border)
{
switch (border)