* Only lock the Borders when they're being changed, otherwise one avatar's movement could hinder another avatar's movement.
parent
9eb8c14e87
commit
d45f871d8f
|
@ -236,20 +236,31 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
m_log.DebugFormat("Scene: {0} to the west of Scene{1} Offset: {2}. Extents:{3}",
|
||||
conn.RegionScene.RegionInfo.RegionName,
|
||||
regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
|
||||
|
||||
|
||||
|
||||
scene.BordersLocked = true;
|
||||
conn.RegionScene.BordersLocked = true;
|
||||
conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
|
||||
scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
|
||||
|
||||
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;
|
||||
lock (conn.RegionScene.EastBorders)
|
||||
conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
|
||||
|
||||
scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West
|
||||
lock (conn.RegionScene.NorthBorders)
|
||||
conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
|
||||
|
||||
lock (conn.RegionScene.SouthBorders)
|
||||
conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
|
||||
|
||||
lock (scene.WestBorders)
|
||||
scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West
|
||||
|
||||
// Reset Terrain.. since terrain normally loads first.
|
||||
//
|
||||
scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
|
||||
//conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
|
||||
conn.RegionScene.BordersLocked = false;
|
||||
scene.BordersLocked = false;
|
||||
|
||||
connectedYN = true;
|
||||
break;
|
||||
|
@ -277,23 +288,33 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
extents.X = conn.XEnd;
|
||||
conn.UpdateExtents(extents);
|
||||
|
||||
|
||||
scene.BordersLocked = true;
|
||||
conn.RegionScene.BordersLocked = true;
|
||||
|
||||
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);
|
||||
|
||||
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
|
||||
lock(conn.RegionScene.NorthBorders)
|
||||
conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
|
||||
lock(conn.RegionScene.EastBorders)
|
||||
conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
|
||||
lock(conn.RegionScene.WestBorders)
|
||||
conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
|
||||
lock(scene.SouthBorders)
|
||||
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());
|
||||
|
||||
scene.BordersLocked = false;
|
||||
conn.RegionScene.BordersLocked = false;
|
||||
|
||||
connectedYN = true;
|
||||
break;
|
||||
}
|
||||
|
@ -318,36 +339,48 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
extents.X = regionConnections.XEnd + conn.XEnd;
|
||||
conn.UpdateExtents(extents);
|
||||
|
||||
scene.BordersLocked = true;
|
||||
conn.RegionScene.BordersLocked = true;
|
||||
|
||||
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);
|
||||
|
||||
lock(conn.RegionScene.NorthBorders)
|
||||
if (conn.RegionScene.NorthBorders.Count == 1)// && 2)
|
||||
{
|
||||
//compound border
|
||||
// already locked above
|
||||
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;
|
||||
|
||||
lock(conn.RegionScene.EastBorders)
|
||||
conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
|
||||
lock(conn.RegionScene.WestBorders)
|
||||
conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south
|
||||
|
||||
lock(scene.SouthBorders)
|
||||
scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south
|
||||
|
||||
lock(conn.RegionScene.EastBorders)
|
||||
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;
|
||||
lock(conn.RegionScene.NorthBorders)
|
||||
conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
|
||||
lock(conn.RegionScene.SouthBorders)
|
||||
conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
|
||||
|
||||
|
||||
}
|
||||
scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West
|
||||
|
||||
lock (scene.WestBorders)
|
||||
scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West
|
||||
/*
|
||||
else
|
||||
{
|
||||
|
@ -363,6 +396,8 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
//conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
|
||||
scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
|
||||
//conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
|
||||
scene.BordersLocked = false;
|
||||
conn.RegionScene.BordersLocked = false;
|
||||
|
||||
connectedYN = true;
|
||||
|
||||
|
|
|
@ -81,6 +81,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>();
|
||||
protected List<RegionInfo> m_neighbours = new List<RegionInfo>();
|
||||
|
||||
public volatile bool BordersLocked = false;
|
||||
|
||||
public List<Border> NorthBorders = new List<Border>();
|
||||
public List<Border> EastBorders = new List<Border>();
|
||||
public List<Border> SouthBorders = new List<Border>();
|
||||
|
@ -331,6 +333,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_config = config;
|
||||
|
||||
Random random = new Random();
|
||||
|
||||
BordersLocked = true;
|
||||
|
||||
Border northBorder = new Border();
|
||||
northBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<---
|
||||
|
@ -352,6 +356,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
westBorder.CrossDirection = Cardinals.W;
|
||||
WestBorders.Add(westBorder);
|
||||
|
||||
BordersLocked = false;
|
||||
|
||||
m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue/2))+(uint)(uint.MaxValue/4);
|
||||
m_moduleLoader = moduleLoader;
|
||||
|
@ -482,6 +487,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="regInfo"></param>
|
||||
public Scene(RegionInfo regInfo)
|
||||
{
|
||||
BordersLocked = true;
|
||||
Border northBorder = new Border();
|
||||
northBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<---
|
||||
northBorder.CrossDirection = Cardinals.N;
|
||||
|
@ -501,6 +507,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
westBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, 0); //--->
|
||||
westBorder.CrossDirection = Cardinals.W;
|
||||
WestBorders.Add(westBorder);
|
||||
BordersLocked = false;
|
||||
|
||||
m_regInfo = regInfo;
|
||||
m_eventManager = new EventManager();
|
||||
|
@ -1801,105 +1808,179 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public Border GetCrossedBorder(Vector3 position, Cardinals gridline)
|
||||
{
|
||||
|
||||
switch (gridline)
|
||||
if (BordersLocked)
|
||||
{
|
||||
case Cardinals.N:
|
||||
lock (NorthBorders)
|
||||
{
|
||||
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;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (gridline)
|
||||
{
|
||||
case Cardinals.N:
|
||||
foreach (Border b in NorthBorders)
|
||||
{
|
||||
if (b.TestCross(position))
|
||||
return b;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Cardinals.S:
|
||||
|
||||
|
||||
lock (SouthBorders)
|
||||
{
|
||||
|
||||
break;
|
||||
case Cardinals.S:
|
||||
foreach (Border b in SouthBorders)
|
||||
{
|
||||
if (b.TestCross(position))
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case Cardinals.E:
|
||||
lock (EastBorders)
|
||||
{
|
||||
break;
|
||||
case Cardinals.E:
|
||||
foreach (Border b in EastBorders)
|
||||
{
|
||||
if (b.TestCross(position))
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case Cardinals.W:
|
||||
|
||||
lock (WestBorders)
|
||||
{
|
||||
break;
|
||||
case Cardinals.W:
|
||||
foreach (Border b in WestBorders)
|
||||
{
|
||||
if (b.TestCross(position))
|
||||
return b;
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool TestBorderCross(Vector3 position, Cardinals border)
|
||||
{
|
||||
switch (border)
|
||||
if (BordersLocked)
|
||||
{
|
||||
case Cardinals.N:
|
||||
lock (NorthBorders)
|
||||
{
|
||||
foreach(Border b in NorthBorders)
|
||||
switch (border)
|
||||
{
|
||||
case Cardinals.N:
|
||||
lock (NorthBorders)
|
||||
{
|
||||
foreach (Border b in NorthBorders)
|
||||
{
|
||||
if (b.TestCross(position))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Cardinals.E:
|
||||
lock (EastBorders)
|
||||
{
|
||||
foreach (Border b in EastBorders)
|
||||
{
|
||||
if (b.TestCross(position))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Cardinals.S:
|
||||
lock (SouthBorders)
|
||||
{
|
||||
foreach (Border b in SouthBorders)
|
||||
{
|
||||
if (b.TestCross(position))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Cardinals.W:
|
||||
lock (WestBorders)
|
||||
{
|
||||
foreach (Border b in WestBorders)
|
||||
{
|
||||
if (b.TestCross(position))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (border)
|
||||
{
|
||||
case Cardinals.N:
|
||||
foreach (Border b in NorthBorders)
|
||||
{
|
||||
if (b.TestCross(position))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Cardinals.E:
|
||||
lock (EastBorders)
|
||||
{
|
||||
break;
|
||||
case Cardinals.E:
|
||||
foreach (Border b in EastBorders)
|
||||
{
|
||||
if (b.TestCross(position))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Cardinals.S:
|
||||
lock (SouthBorders)
|
||||
{
|
||||
break;
|
||||
case Cardinals.S:
|
||||
foreach (Border b in SouthBorders)
|
||||
{
|
||||
if (b.TestCross(position))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Cardinals.W:
|
||||
lock (WestBorders)
|
||||
{
|
||||
break;
|
||||
case Cardinals.W:
|
||||
foreach (Border b in WestBorders)
|
||||
{
|
||||
if (b.TestCross(position))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue