mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 03:45:35 +08:00
* 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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user