* moved SceneManager to RegionApplicationBase

* Implemented SceneManager.StopScene() and Scene.Stop()
* Some SimpleApping
afrisby
lbsa71 2007-09-20 07:49:11 +00:00
parent 3c7161d128
commit 14d5a2e9b7
6 changed files with 49 additions and 25 deletions

View File

@ -67,7 +67,6 @@ namespace OpenSim
protected List<UDPServer> m_udpServers = new List<UDPServer>(); protected List<UDPServer> m_udpServers = new List<UDPServer>();
protected List<RegionInfo> m_regionData = new List<RegionInfo>(); protected List<RegionInfo> m_regionData = new List<RegionInfo>();
protected SceneManager m_localScenes = new SceneManager();
private bool m_silent; private bool m_silent;
private readonly string m_logFilename = ("region-console.log"); private readonly string m_logFilename = ("region-console.log");
@ -215,7 +214,7 @@ namespace OpenSim
//Server side object editing permissions checking //Server side object editing permissions checking
scene.PermissionsMngr.BypassPermissions = !m_permissions; scene.PermissionsMngr.BypassPermissions = !m_permissions;
m_localScenes.Add(scene); m_sceneManager.Add(scene);
m_udpServers.Add(udpServer); m_udpServers.Add(udpServer);
m_regionData.Add(regionInfo); m_regionData.Add(regionInfo);
@ -332,7 +331,7 @@ namespace OpenSim
// IMPLEMENT THIS // IMPLEMENT THIS
m_log.Verbose("Closing console and terminating"); m_log.Verbose("Closing console and terminating");
m_localScenes.Close(); m_sceneManager.Close();
m_log.Close(); m_log.Close();
Environment.Exit(0); Environment.Exit(0);
@ -377,19 +376,19 @@ namespace OpenSim
switch (command) switch (command)
{ {
case "set-time": case "set-time":
m_localScenes.SetCurrentSceneTimePhase(Convert.ToInt32(cmdparams[0])); m_sceneManager.SetCurrentSceneTimePhase(Convert.ToInt32(cmdparams[0]));
break; break;
case "force-update": case "force-update":
Console.WriteLine("Updating all clients"); Console.WriteLine("Updating all clients");
m_localScenes.ForceCurrentSceneClientUpdate(); m_sceneManager.ForceCurrentSceneClientUpdate();
break; break;
case "edit-scale": case "edit-scale":
if (cmdparams.Length == 4) if (cmdparams.Length == 4)
{ {
m_localScenes.HandleEditCommandOnCurrentScene(cmdparams); m_sceneManager.HandleEditCommandOnCurrentScene(cmdparams);
} }
break; break;
@ -427,34 +426,34 @@ namespace OpenSim
case "save-xml": case "save-xml":
if (cmdparams.Length > 0) if (cmdparams.Length > 0)
{ {
m_localScenes.SaveCurrentSceneToXml(cmdparams[0]); m_sceneManager.SaveCurrentSceneToXml(cmdparams[0]);
} }
else else
{ {
m_localScenes.SaveCurrentSceneToXml(DEFAULT_PRIM_BACKUP_FILENAME); m_sceneManager.SaveCurrentSceneToXml(DEFAULT_PRIM_BACKUP_FILENAME);
} }
break; break;
case "load-xml": case "load-xml":
if (cmdparams.Length > 0) if (cmdparams.Length > 0)
{ {
m_localScenes.LoadCurrentSceneFromXml(cmdparams[0]); m_sceneManager.LoadCurrentSceneFromXml(cmdparams[0]);
} }
else else
{ {
m_localScenes.LoadCurrentSceneFromXml(DEFAULT_PRIM_BACKUP_FILENAME); m_sceneManager.LoadCurrentSceneFromXml(DEFAULT_PRIM_BACKUP_FILENAME);
} }
break; break;
case "terrain": case "terrain":
if (!m_localScenes.RunTerrainCmdOnCurrentScene(cmdparams, ref result)) if (!m_sceneManager.RunTerrainCmdOnCurrentScene(cmdparams, ref result))
{ {
m_log.Error(result); m_log.Error(result);
} }
break; break;
case "script": case "script":
m_localScenes.SendCommandToCurrentSceneScripts(cmdparams); m_sceneManager.SendCommandToCurrentSceneScripts(cmdparams);
break; break;
case "command-script": case "command-script":
@ -468,16 +467,16 @@ namespace OpenSim
// Treats each user as a super-admin when disabled // Treats each user as a super-admin when disabled
bool permissions = Convert.ToBoolean(cmdparams[0]); bool permissions = Convert.ToBoolean(cmdparams[0]);
m_localScenes.SetBypassPermissionsOnCurrentScene(!permissions); m_sceneManager.SetBypassPermissionsOnCurrentScene(!permissions);
break; break;
case "backup": case "backup":
m_localScenes.BackupCurrentScene(); m_sceneManager.BackupCurrentScene();
break; break;
case "alert": case "alert":
m_localScenes.HandleAlertCommandOnCurrentScene(cmdparams); m_sceneManager.HandleAlertCommandOnCurrentScene(cmdparams);
break; break;
case "create": case "create":
@ -497,7 +496,7 @@ namespace OpenSim
{ {
string regionName = this.CombineParams(cmdparams, 0); string regionName = this.CombineParams(cmdparams, 0);
if (m_localScenes.TrySetCurrentScene(regionName)) if (m_sceneManager.TrySetCurrentScene(regionName))
{ {
} }
@ -507,13 +506,13 @@ namespace OpenSim
} }
} }
if (m_localScenes.CurrentScene == null) if (m_sceneManager.CurrentScene == null)
{ {
MainLog.Instance.Verbose("Currently at Root level. To change region please use 'change-region <regioname>'"); MainLog.Instance.Verbose("Currently at Root level. To change region please use 'change-region <regioname>'");
} }
else else
{ {
MainLog.Instance.Verbose("Current Region: " + m_localScenes.CurrentScene.RegionInfo.RegionName + ". To change region please use 'change-region <regioname>'"); MainLog.Instance.Verbose("Current Region: " + m_sceneManager.CurrentScene.RegionInfo.RegionName + ". To change region please use 'change-region <regioname>'");
} }
break; break;
@ -535,7 +534,7 @@ namespace OpenSim
int newDebug; int newDebug;
if (int.TryParse(args[1], out newDebug)) if (int.TryParse(args[1], out newDebug))
{ {
m_localScenes.SetDebugPacketOnCurrentScene(m_log, newDebug); m_sceneManager.SetDebugPacketOnCurrentScene(m_log, newDebug);
} }
else else
{ {
@ -568,11 +567,11 @@ namespace OpenSim
case "users": case "users":
m_log.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP", "World")); m_log.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP", "World"));
List<ScenePresence> avatars = m_localScenes.GetCurrentSceneAvatars(); List<ScenePresence> avatars = m_sceneManager.GetCurrentSceneAvatars();
foreach (ScenePresence avatar in avatars) foreach (ScenePresence avatar in avatars)
{ {
RegionInfo regionInfo = m_localScenes.GetRegionInfo(avatar.RegionHandle); RegionInfo regionInfo = m_sceneManager.GetRegionInfo(avatar.RegionHandle);
string regionName; string regionName;
if (regionInfo == null) if (regionInfo == null)

View File

@ -56,6 +56,8 @@ namespace OpenSim.Region.ClientStack
protected LogBase m_log; protected LogBase m_log;
protected CommunicationsManager m_commsManager; protected CommunicationsManager m_commsManager;
protected SceneManager m_sceneManager = new SceneManager();
public RegionApplicationBase() public RegionApplicationBase()
{ {
m_startuptime = DateTime.Now; m_startuptime = DateTime.Now;

View File

@ -1416,5 +1416,12 @@ namespace OpenSim.Region.Environment.Scenes
avatar = null; avatar = null;
return false; return false;
} }
public override void Close()
{
m_heartbeatTimer.Close();
base.Close();
}
} }
} }

View File

@ -227,5 +227,11 @@ namespace OpenSim.Region.Environment.Scenes
avatar = null; avatar = null;
return false; return false;
} }
public void CloseScene(Scene scene)
{
m_localScenes.Remove(scene);
scene.Close();
}
} }
} }

View File

@ -178,10 +178,17 @@ namespace SimpleApp
public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url) { } public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url) { }
public virtual void SendRegionHandshake(RegionInfo regionInfo) public virtual void SendRegionHandshake(RegionInfo regionInfo)
{
if (OnRegionHandShakeReply != null)
{ {
this.OnRegionHandShakeReply(this); this.OnRegionHandShakeReply(this);
}
if (OnCompleteMovementToRegion != null)
{
this.OnCompleteMovementToRegion(); this.OnCompleteMovementToRegion();
} }
}
private void Update( ) private void Update( )
{ {

View File

@ -72,6 +72,8 @@ namespace SimpleApp
scene.StartTimer(); scene.StartTimer();
m_sceneManager.Add(scene);
m_moduleLoader.PostInitialise(); m_moduleLoader.PostInitialise();
m_moduleLoader.ClearCache(); m_moduleLoader.ClearCache();
@ -89,7 +91,7 @@ namespace SimpleApp
scene.AddEntity(complexObject); scene.AddEntity(complexObject);
} }
/*for (int i = 0; i < 500; i++) for (int i = 0; i < 2; i++)
{ {
MyNpcCharacter m_character = new MyNpcCharacter(scene.EventManager); MyNpcCharacter m_character = new MyNpcCharacter(scene.EventManager);
scene.AddNewClient(m_character, false); scene.AddNewClient(m_character, false);
@ -100,7 +102,8 @@ namespace SimpleApp
{ {
avatar.AbsolutePosition = new LLVector3((float)OpenSim.Framework.Utilities.Util.RandomClass.Next(100,200), (float)OpenSim.Framework.Utilities.Util.RandomClass.Next(30, 200), 2); avatar.AbsolutePosition = new LLVector3((float)OpenSim.Framework.Utilities.Util.RandomClass.Next(100,200), (float)OpenSim.Framework.Utilities.Util.RandomClass.Next(30, 200), 2);
}*/ }
DirectoryInfo dirInfo = new DirectoryInfo( "." ); DirectoryInfo dirInfo = new DirectoryInfo( "." );