* Fixed neighbour range bug

* Various refactorings
afrisby
lbsa71 2007-11-29 15:27:57 +00:00
parent 4bd38fc65a
commit 7704bb6f63
9 changed files with 57 additions and 58 deletions

View File

@ -115,8 +115,8 @@ namespace OpenSim.Region.ClientStack
scene.LoadWorldMap();
scene.RegisterRegionWithGrid();
scene.PhysScene = GetPhysicsScene();
scene.PhysScene.SetTerrain(scene.Terrain.GetHeights1D());
scene.PhysicsScene = GetPhysicsScene();
scene.PhysicsScene.SetTerrain(scene.Terrain.GetHeights1D());
//Master Avatar Setup
UserProfileData masterAvatar;

View File

@ -47,7 +47,7 @@ namespace OpenSim.Region.Environment.Scenes
}
public PhysicsScene PhyScene
public PhysicsScene PhysicsScene
{
get
{ return _PhyScene; }

View File

@ -429,7 +429,7 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectPart rootPart = (group).GetChildPart(group.UUID);
if (rootPart.PhysActor != null)
{
phyScene.RemovePrim(rootPart.PhysActor);
PhysicsScene.RemovePrim(rootPart.PhysActor);
rootPart.PhysActor = null;
}
@ -482,7 +482,7 @@ namespace OpenSim.Region.Environment.Scenes
if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
{
PrimitiveBaseShape pbs = rootPart.Shape;
rootPart.PhysActor = phyScene.AddPrimShape(
rootPart.PhysActor = PhysicsScene.AddPrimShape(
rootPart.Name,
pbs,
new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,

View File

@ -74,7 +74,7 @@ namespace OpenSim.Region.Environment.Scenes
public bool m_physicalPrim;
public bool m_sendTasksToChild;
private int m_RestartTimerCounter;
private Timer t_restartTimer = new Timer(15000); // Wait before firing
private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing
private int m_incrementsof15seconds = 0;
protected ModuleLoader m_moduleLoader;
@ -137,16 +137,10 @@ namespace OpenSim.Region.Environment.Scenes
private readonly EstateManager m_estateManager;
private PhysicsScene phyScene
public PhysicsScene PhysicsScene
{
set { m_innerScene.PhyScene = value; }
get { return (m_innerScene.PhyScene); }
}
public PhysicsScene PhysScene
{
set { m_innerScene.PhyScene = value; }
get { return (m_innerScene.PhyScene); }
set { m_innerScene.PhysicsScene = value; }
get { return (m_innerScene.PhysicsScene); }
}
public object SyncRoot
@ -239,7 +233,7 @@ namespace OpenSim.Region.Environment.Scenes
//
// Out of memory
// Operating system has killed the plugin
m_innerScene.UnRecoverableError += restartNOW;
m_innerScene.UnRecoverableError += RestartNow;
m_sceneXmlLoader = new SceneXmlLoader(this, m_innerScene, m_regInfo);
@ -275,9 +269,10 @@ namespace OpenSim.Region.Environment.Scenes
{
// Another region is up. We have to tell all our ScenePresences about it
// This fails to get the desired effect and needs further work.
if (RegionInfo.RegionHandle != otherRegion.RegionHandle)
{
if (Math.Abs(otherRegion.RegionLocX - RegionInfo.RegionLocX) <= 1 || Math.Abs(otherRegion.RegionLocY - RegionInfo.RegionLocY) <= 1)
if ((Math.Abs(otherRegion.RegionLocX - RegionInfo.RegionLocX) <= 1) && (Math.Abs(otherRegion.RegionLocY - RegionInfo.RegionLocY) <= 1))
{
if (!(m_regionRestartNotifyList.Contains(otherRegion)))
{
@ -285,7 +280,7 @@ namespace OpenSim.Region.Environment.Scenes
m_restartWaitTimer.Interval= 50000;
m_restartWaitTimer.AutoReset = false;
m_restartWaitTimer.Elapsed += new ElapsedEventHandler(restart_Notify_Wait_Elapsed);
m_restartWaitTimer.Elapsed += new ElapsedEventHandler(RestartNotifyWaitElapsed);
m_restartWaitTimer.Start();
}
}
@ -302,25 +297,25 @@ namespace OpenSim.Region.Environment.Scenes
{
if (seconds < 15)
{
t_restartTimer.Stop();
m_restartTimer.Stop();
SendGeneralAlert("Restart Aborted");
}
else
{
t_restartTimer.Interval = 15000;
m_restartTimer.Interval = 15000;
m_incrementsof15seconds = (int) seconds/15;
m_RestartTimerCounter = 0;
t_restartTimer.AutoReset = true;
t_restartTimer.Elapsed += new ElapsedEventHandler(restartTimer_Elapsed);
m_restartTimer.AutoReset = true;
m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed);
MainLog.Instance.Error("REGION", "Restarting Region in " + (seconds / 60) + " minutes");
t_restartTimer.Start();
m_restartTimer.Start();
SendGeneralAlert(RegionInfo.RegionName + ": Restarting in 2 Minutes");
}
}
public void restartTimer_Elapsed(object sender, ElapsedEventArgs e)
public void RestartTimer_Elapsed(object sender, ElapsedEventArgs e)
{
m_RestartTimerCounter++;
if (m_RestartTimerCounter <= m_incrementsof15seconds)
@ -330,14 +325,14 @@ namespace OpenSim.Region.Environment.Scenes
}
else
{
t_restartTimer.Stop();
t_restartTimer.AutoReset = false;
restartNOW();
m_restartTimer.Stop();
m_restartTimer.AutoReset = false;
RestartNow();
}
}
public void restartNOW()
public void RestartNow()
{
MainLog.Instance.Error("REGION", "Closing");
Close();
@ -345,7 +340,7 @@ namespace OpenSim.Region.Environment.Scenes
base.Restart(0);
}
public void restart_Notify_Wait_Elapsed(object sender, ElapsedEventArgs e)
public void RestartNotifyWaitElapsed(object sender, ElapsedEventArgs e)
{
m_restartWaitTimer.Stop();
foreach (RegionInfo region in m_regionRestartNotifyList)
@ -551,7 +546,7 @@ namespace OpenSim.Region.Environment.Scenes
{
lock (SyncRoot)
{
phyScene.SetTerrain(Terrain.GetHeights1D());
PhysicsScene.SetTerrain(Terrain.GetHeights1D());
}
m_storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID);
@ -748,7 +743,7 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectPart rootPart = prim.GetChildPart(prim.UUID);
bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim);
if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0)
rootPart.PhysActor = phyScene.AddPrimShape(
rootPart.PhysActor = PhysicsScene.AddPrimShape(
rootPart.Name,
rootPart.Shape,
new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,
@ -852,7 +847,7 @@ namespace OpenSim.Region.Environment.Scenes
{
rootPart.PhysActor =
phyScene.AddPrimShape(
PhysicsScene.AddPrimShape(
rootPart.Name,
rootPart.Shape,
new PhysicsVector(pos.X, pos.Y, pos.Z),

View File

@ -93,12 +93,12 @@ namespace OpenSim.Region.Environment.Scenes
public void Add(Scene scene)
{
scene.OnRestart += handleRestart;
scene.OnRestart += HandleRestart;
m_localScenes.Add(scene);
}
public void handleRestart(RegionInfo rdata)
public void HandleRestart(RegionInfo rdata)
{
MainLog.Instance.Error("SCENEMANAGER", "Got Restart message for region:" + rdata.RegionName +" Sending up to main");
int RegionSceneElement = -1;
@ -106,14 +106,18 @@ namespace OpenSim.Region.Environment.Scenes
{
if (rdata.RegionName == m_localScenes[i].RegionInfo.RegionName)
{
RegionSceneElement = i;
}
}
// Now we make sure the region is no longer known about by the SceneManager
// Prevents Duplicates.
if (RegionSceneElement >= 0)
{
m_localScenes.RemoveAt(RegionSceneElement);
}
// Send signal to main that we're restarting this sim.
OnReStartSim(rdata);
@ -216,7 +220,7 @@ namespace OpenSim.Region.Environment.Scenes
public void RestartCurrentScene()
{
ForEachCurrentScene(delegate(Scene scene) { scene.restartNOW(); });
ForEachCurrentScene(delegate(Scene scene) { scene.RestartNow(); });
}

View File

@ -150,7 +150,7 @@ namespace OpenSim.Region.Environment.Scenes
m_rootPart.PhysActor.Position =
new PhysicsVector(m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y,
m_rootPart.GroupPosition.Z);
m_scene.PhysScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
}
}
}
@ -515,7 +515,7 @@ namespace OpenSim.Region.Environment.Scenes
{
PrimitiveBaseShape pbs = dupe.RootPart.Shape;
dupe.RootPart.PhysActor = m_scene.PhysScene.AddPrimShape(
dupe.RootPart.PhysActor = m_scene.PhysicsScene.AddPrimShape(
dupe.RootPart.Name,
pbs,
new PhysicsVector(dupe.RootPart.AbsolutePosition.X, dupe.RootPart.AbsolutePosition.Y,
@ -827,7 +827,7 @@ namespace OpenSim.Region.Environment.Scenes
if (linkPart.PhysActor != null)
{
m_scene.PhysScene.RemovePrim(linkPart.PhysActor);
m_scene.PhysicsScene.RemovePrim(linkPart.PhysActor);
linkPart.PhysActor = null;
}
@ -897,7 +897,7 @@ namespace OpenSim.Region.Environment.Scenes
// SceneObjectPart.UpdatePrimFlags()
if (m_rootPart.PhysActor != null)
{
linkPart.PhysActor = m_scene.PhysScene.AddPrimShape(
linkPart.PhysActor = m_scene.PhysicsScene.AddPrimShape(
linkPart.Name,
linkPart.Shape,
new PhysicsVector(linkPart.AbsolutePosition.X, linkPart.AbsolutePosition.Y,
@ -1205,8 +1205,8 @@ namespace OpenSim.Region.Environment.Scenes
}
if (m_rootPart.PhysActor != null)
{
m_scene.PhysScene.RemovePrim(m_rootPart.PhysActor);
m_rootPart.PhysActor = m_scene.PhysScene.AddPrimShape(
m_scene.PhysicsScene.RemovePrim(m_rootPart.PhysActor);
m_rootPart.PhysActor = m_scene.PhysicsScene.AddPrimShape(
m_rootPart.Name,
m_rootPart.Shape,
new PhysicsVector(m_rootPart.AbsolutePosition.X, m_rootPart.AbsolutePosition.Y,
@ -1242,7 +1242,7 @@ namespace OpenSim.Region.Environment.Scenes
{
m_rootPart.PhysActor.Size =
new PhysicsVector(m_rootPart.Scale.X, m_rootPart.Scale.Y, m_rootPart.Scale.Z);
m_scene.PhysScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
}
}
}
@ -1333,7 +1333,7 @@ namespace OpenSim.Region.Environment.Scenes
m_rootPart.PhysActor.Orientation =
new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
m_rootPart.RotationOffset.Z);
m_scene.PhysScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
}
ScheduleGroupForTerseUpdate();
}
@ -1351,7 +1351,7 @@ namespace OpenSim.Region.Environment.Scenes
m_rootPart.PhysActor.Orientation =
new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
m_rootPart.RotationOffset.Z);
m_scene.PhysScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
}
AbsolutePosition = pos;
ScheduleGroupForTerseUpdate();
@ -1395,7 +1395,7 @@ namespace OpenSim.Region.Environment.Scenes
m_rootPart.PhysActor.Orientation =
new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
m_rootPart.RotationOffset.Z);
m_scene.PhysScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
}
foreach (SceneObjectPart prim in m_parts.Values)

View File

@ -173,7 +173,7 @@ namespace OpenSim.Region.Environment.Scenes
//lock (m_parentGroup.m_scene.SyncRoot)
//{
PhysActor.Position = new PhysicsVector(value.X, value.Y, value.Z);
m_parentGroup.m_scene.PhysScene.AddPhysicsActorTaint(PhysActor);
m_parentGroup.m_scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
//}
}
catch (Exception e)
@ -226,7 +226,7 @@ namespace OpenSim.Region.Environment.Scenes
//lock (m_scene.SyncRoot)
//{
PhysActor.Orientation = new Quaternion(value.W, value.X, value.Y, value.Z);
m_parentGroup.m_scene.PhysScene.AddPhysicsActorTaint(PhysActor);
m_parentGroup.m_scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
//}
}
catch (Exception ex)
@ -961,7 +961,7 @@ namespace OpenSim.Region.Environment.Scenes
AddFlag(LLObject.ObjectFlags.Phantom);
if (PhysActor != null)
{
m_parentGroup.m_scene.PhysScene.RemovePrim(PhysActor);
m_parentGroup.m_scene.PhysicsScene.RemovePrim(PhysActor);
/// that's not wholesome. Had to make m_scene public
PhysActor = null;
}
@ -971,7 +971,7 @@ namespace OpenSim.Region.Environment.Scenes
RemFlag(LLObject.ObjectFlags.Phantom);
if (PhysActor == null)
{
PhysActor = m_parentGroup.m_scene.PhysScene.AddPrimShape(
PhysActor = m_parentGroup.m_scene.PhysicsScene.AddPrimShape(
Name,
Shape,
new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,
@ -1015,14 +1015,14 @@ namespace OpenSim.Region.Environment.Scenes
PhysActor.IsPhysical = UsePhysics;
// If we're not what we're supposed to be in the physics scene, recreate ourselves.
//m_parentGroup.m_scene.PhysScene.RemovePrim(PhysActor);
//m_parentGroup.m_scene.PhysicsScene.RemovePrim(PhysActor);
/// that's not wholesome. Had to make m_scene public
//PhysActor = null;
if ((ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0)
{
//PhysActor = m_parentGroup.m_scene.PhysScene.AddPrimShape(
//PhysActor = m_parentGroup.m_scene.PhysicsScene.AddPrimShape(
//Name,
//Shape,
//new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,
@ -1037,7 +1037,7 @@ namespace OpenSim.Region.Environment.Scenes
}
}
}
m_parentGroup.m_scene.PhysScene.AddPhysicsActorTaint(PhysActor);
m_parentGroup.m_scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
}
}
@ -1293,7 +1293,7 @@ namespace OpenSim.Region.Environment.Scenes
OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS", "Physical Object went out of bounds.");
RemFlag(LLObject.ObjectFlags.Physics);
doPhysicsPropertyUpdate(false,true);
m_parentGroup.m_scene.PhysScene.AddPhysicsActorTaint(PhysActor);
m_parentGroup.m_scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
}

View File

@ -453,7 +453,7 @@ namespace OpenSim.Region.Environment.Scenes
{
if (PhysicsActor != null)
{
m_scene.PhysScene.RemoveAvatar(PhysicsActor);
m_scene.PhysicsScene.RemoveAvatar(PhysicsActor);
m_physicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients;
m_physicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
PhysicsActor = null;
@ -1320,7 +1320,7 @@ namespace OpenSim.Region.Environment.Scenes
public void AddToPhysicalScene()
{
PhysicsScene scene = m_scene.PhysScene;
PhysicsScene scene = m_scene.PhysicsScene;
PhysicsVector pVec =
new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
@ -47,7 +47,7 @@ namespace OpenSim.Region.Environment.Scenes
bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_parentScene.m_physicalPrim);
if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0)
{
rootPart.PhysActor = m_innerScene.PhyScene.AddPrimShape(
rootPart.PhysActor = m_innerScene.PhysicsScene.AddPrimShape(
rootPart.Name,
rootPart.Shape,
new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,
@ -117,7 +117,7 @@ namespace OpenSim.Region.Environment.Scenes
bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_parentScene.m_physicalPrim);
if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0)
{
rootPart.PhysActor = m_innerScene.PhyScene.AddPrimShape(
rootPart.PhysActor = m_innerScene.PhysicsScene.AddPrimShape(
rootPart.Name,
rootPart.Shape,
new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,