aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorlbsa712007-09-20 07:49:11 +0000
committerlbsa712007-09-20 07:49:11 +0000
commit14d5a2e9b757c258c6ad15f0939973ef172d2d1f (patch)
treee0eb78ae9b3d3dfcc1a811b127cdb968b3d625e1
parent* Rewired Touch to route to group/part (Still triggering EventManager as well) (diff)
downloadopensim-SC_OLD-14d5a2e9b757c258c6ad15f0939973ef172d2d1f.zip
opensim-SC_OLD-14d5a2e9b757c258c6ad15f0939973ef172d2d1f.tar.gz
opensim-SC_OLD-14d5a2e9b757c258c6ad15f0939973ef172d2d1f.tar.bz2
opensim-SC_OLD-14d5a2e9b757c258c6ad15f0939973ef172d2d1f.tar.xz
* moved SceneManager to RegionApplicationBase
* Implemented SceneManager.StopScene() and Scene.Stop() * Some SimpleApping
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs41
-rw-r--r--OpenSim/Region/ClientStack/RegionApplicationBase.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs7
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneManager.cs6
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs11
-rw-r--r--OpenSim/Region/Examples/SimpleApp/Program.cs7
6 files changed, 49 insertions, 25 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index a32b625..66ae987 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -67,7 +67,6 @@ namespace OpenSim
67 67
68 protected List<UDPServer> m_udpServers = new List<UDPServer>(); 68 protected List<UDPServer> m_udpServers = new List<UDPServer>();
69 protected List<RegionInfo> m_regionData = new List<RegionInfo>(); 69 protected List<RegionInfo> m_regionData = new List<RegionInfo>();
70 protected SceneManager m_localScenes = new SceneManager();
71 70
72 private bool m_silent; 71 private bool m_silent;
73 private readonly string m_logFilename = ("region-console.log"); 72 private readonly string m_logFilename = ("region-console.log");
@@ -215,7 +214,7 @@ namespace OpenSim
215 //Server side object editing permissions checking 214 //Server side object editing permissions checking
216 scene.PermissionsMngr.BypassPermissions = !m_permissions; 215 scene.PermissionsMngr.BypassPermissions = !m_permissions;
217 216
218 m_localScenes.Add(scene); 217 m_sceneManager.Add(scene);
219 218
220 m_udpServers.Add(udpServer); 219 m_udpServers.Add(udpServer);
221 m_regionData.Add(regionInfo); 220 m_regionData.Add(regionInfo);
@@ -332,7 +331,7 @@ namespace OpenSim
332 // IMPLEMENT THIS 331 // IMPLEMENT THIS
333 m_log.Verbose("Closing console and terminating"); 332 m_log.Verbose("Closing console and terminating");
334 333
335 m_localScenes.Close(); 334 m_sceneManager.Close();
336 335
337 m_log.Close(); 336 m_log.Close();
338 Environment.Exit(0); 337 Environment.Exit(0);
@@ -377,19 +376,19 @@ namespace OpenSim
377 switch (command) 376 switch (command)
378 { 377 {
379 case "set-time": 378 case "set-time":
380 m_localScenes.SetCurrentSceneTimePhase(Convert.ToInt32(cmdparams[0])); 379 m_sceneManager.SetCurrentSceneTimePhase(Convert.ToInt32(cmdparams[0]));
381 break; 380 break;
382 381
383 case "force-update": 382 case "force-update":
384 Console.WriteLine("Updating all clients"); 383 Console.WriteLine("Updating all clients");
385 m_localScenes.ForceCurrentSceneClientUpdate(); 384 m_sceneManager.ForceCurrentSceneClientUpdate();
386 break; 385 break;
387 386
388 387
389 case "edit-scale": 388 case "edit-scale":
390 if (cmdparams.Length == 4) 389 if (cmdparams.Length == 4)
391 { 390 {
392 m_localScenes.HandleEditCommandOnCurrentScene(cmdparams); 391 m_sceneManager.HandleEditCommandOnCurrentScene(cmdparams);
393 } 392 }
394 break; 393 break;
395 394
@@ -427,34 +426,34 @@ namespace OpenSim
427 case "save-xml": 426 case "save-xml":
428 if (cmdparams.Length > 0) 427 if (cmdparams.Length > 0)
429 { 428 {
430 m_localScenes.SaveCurrentSceneToXml(cmdparams[0]); 429 m_sceneManager.SaveCurrentSceneToXml(cmdparams[0]);
431 } 430 }
432 else 431 else
433 { 432 {
434 m_localScenes.SaveCurrentSceneToXml(DEFAULT_PRIM_BACKUP_FILENAME); 433 m_sceneManager.SaveCurrentSceneToXml(DEFAULT_PRIM_BACKUP_FILENAME);
435 } 434 }
436 break; 435 break;
437 436
438 case "load-xml": 437 case "load-xml":
439 if (cmdparams.Length > 0) 438 if (cmdparams.Length > 0)
440 { 439 {
441 m_localScenes.LoadCurrentSceneFromXml(cmdparams[0]); 440 m_sceneManager.LoadCurrentSceneFromXml(cmdparams[0]);
442 } 441 }
443 else 442 else
444 { 443 {
445 m_localScenes.LoadCurrentSceneFromXml(DEFAULT_PRIM_BACKUP_FILENAME); 444 m_sceneManager.LoadCurrentSceneFromXml(DEFAULT_PRIM_BACKUP_FILENAME);
446 } 445 }
447 break; 446 break;
448 447
449 case "terrain": 448 case "terrain":
450 if (!m_localScenes.RunTerrainCmdOnCurrentScene(cmdparams, ref result)) 449 if (!m_sceneManager.RunTerrainCmdOnCurrentScene(cmdparams, ref result))
451 { 450 {
452 m_log.Error(result); 451 m_log.Error(result);
453 } 452 }
454 break; 453 break;
455 454
456 case "script": 455 case "script":
457 m_localScenes.SendCommandToCurrentSceneScripts(cmdparams); 456 m_sceneManager.SendCommandToCurrentSceneScripts(cmdparams);
458 break; 457 break;
459 458
460 case "command-script": 459 case "command-script":
@@ -468,16 +467,16 @@ namespace OpenSim
468 // Treats each user as a super-admin when disabled 467 // Treats each user as a super-admin when disabled
469 bool permissions = Convert.ToBoolean(cmdparams[0]); 468 bool permissions = Convert.ToBoolean(cmdparams[0]);
470 469
471 m_localScenes.SetBypassPermissionsOnCurrentScene(!permissions); 470 m_sceneManager.SetBypassPermissionsOnCurrentScene(!permissions);
472 471
473 break; 472 break;
474 473
475 case "backup": 474 case "backup":
476 m_localScenes.BackupCurrentScene(); 475 m_sceneManager.BackupCurrentScene();
477 break; 476 break;
478 477
479 case "alert": 478 case "alert":
480 m_localScenes.HandleAlertCommandOnCurrentScene(cmdparams); 479 m_sceneManager.HandleAlertCommandOnCurrentScene(cmdparams);
481 break; 480 break;
482 481
483 case "create": 482 case "create":
@@ -497,7 +496,7 @@ namespace OpenSim
497 { 496 {
498 string regionName = this.CombineParams(cmdparams, 0); 497 string regionName = this.CombineParams(cmdparams, 0);
499 498
500 if (m_localScenes.TrySetCurrentScene(regionName)) 499 if (m_sceneManager.TrySetCurrentScene(regionName))
501 { 500 {
502 501
503 } 502 }
@@ -507,13 +506,13 @@ namespace OpenSim
507 } 506 }
508 } 507 }
509 508
510 if (m_localScenes.CurrentScene == null) 509 if (m_sceneManager.CurrentScene == null)
511 { 510 {
512 MainLog.Instance.Verbose("Currently at Root level. To change region please use 'change-region <regioname>'"); 511 MainLog.Instance.Verbose("Currently at Root level. To change region please use 'change-region <regioname>'");
513 } 512 }
514 else 513 else
515 { 514 {
516 MainLog.Instance.Verbose("Current Region: " + m_localScenes.CurrentScene.RegionInfo.RegionName + ". To change region please use 'change-region <regioname>'"); 515 MainLog.Instance.Verbose("Current Region: " + m_sceneManager.CurrentScene.RegionInfo.RegionName + ". To change region please use 'change-region <regioname>'");
517 } 516 }
518 517
519 break; 518 break;
@@ -535,7 +534,7 @@ namespace OpenSim
535 int newDebug; 534 int newDebug;
536 if (int.TryParse(args[1], out newDebug)) 535 if (int.TryParse(args[1], out newDebug))
537 { 536 {
538 m_localScenes.SetDebugPacketOnCurrentScene(m_log, newDebug); 537 m_sceneManager.SetDebugPacketOnCurrentScene(m_log, newDebug);
539 } 538 }
540 else 539 else
541 { 540 {
@@ -568,11 +567,11 @@ namespace OpenSim
568 case "users": 567 case "users":
569 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")); 568 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"));
570 569
571 List<ScenePresence> avatars = m_localScenes.GetCurrentSceneAvatars(); 570 List<ScenePresence> avatars = m_sceneManager.GetCurrentSceneAvatars();
572 571
573 foreach (ScenePresence avatar in avatars) 572 foreach (ScenePresence avatar in avatars)
574 { 573 {
575 RegionInfo regionInfo = m_localScenes.GetRegionInfo(avatar.RegionHandle); 574 RegionInfo regionInfo = m_sceneManager.GetRegionInfo(avatar.RegionHandle);
576 string regionName; 575 string regionName;
577 576
578 if (regionInfo == null) 577 if (regionInfo == null)
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
index 78d551a..df8d747 100644
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
@@ -56,6 +56,8 @@ namespace OpenSim.Region.ClientStack
56 protected LogBase m_log; 56 protected LogBase m_log;
57 protected CommunicationsManager m_commsManager; 57 protected CommunicationsManager m_commsManager;
58 58
59 protected SceneManager m_sceneManager = new SceneManager();
60
59 public RegionApplicationBase() 61 public RegionApplicationBase()
60 { 62 {
61 m_startuptime = DateTime.Now; 63 m_startuptime = DateTime.Now;
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 874bb41..a542ab0 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1416,5 +1416,12 @@ namespace OpenSim.Region.Environment.Scenes
1416 avatar = null; 1416 avatar = null;
1417 return false; 1417 return false;
1418 } 1418 }
1419
1420 public override void Close()
1421 {
1422 m_heartbeatTimer.Close();
1423
1424 base.Close();
1425 }
1419 } 1426 }
1420} \ No newline at end of file 1427} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs
index 0670fc7..a97020e 100644
--- a/OpenSim/Region/Environment/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs
@@ -227,5 +227,11 @@ namespace OpenSim.Region.Environment.Scenes
227 avatar = null; 227 avatar = null;
228 return false; 228 return false;
229 } 229 }
230
231 public void CloseScene(Scene scene)
232 {
233 m_localScenes.Remove(scene);
234 scene.Close();
235 }
230 } 236 }
231} \ No newline at end of file 237} \ No newline at end of file
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
index d2dce6b..7836199 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
@@ -179,8 +179,15 @@ namespace SimpleApp
179 179
180 public virtual void SendRegionHandshake(RegionInfo regionInfo) 180 public virtual void SendRegionHandshake(RegionInfo regionInfo)
181 { 181 {
182 this.OnRegionHandShakeReply(this); 182 if (OnRegionHandShakeReply != null)
183 this.OnCompleteMovementToRegion(); 183 {
184 this.OnRegionHandShakeReply(this);
185 }
186
187 if (OnCompleteMovementToRegion != null)
188 {
189 this.OnCompleteMovementToRegion();
190 }
184 } 191 }
185 192
186 private void Update( ) 193 private void Update( )
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs
index 52e279b..9892866 100644
--- a/OpenSim/Region/Examples/SimpleApp/Program.cs
+++ b/OpenSim/Region/Examples/SimpleApp/Program.cs
@@ -72,6 +72,8 @@ namespace SimpleApp
72 72
73 scene.StartTimer(); 73 scene.StartTimer();
74 74
75 m_sceneManager.Add(scene);
76
75 m_moduleLoader.PostInitialise(); 77 m_moduleLoader.PostInitialise();
76 m_moduleLoader.ClearCache(); 78 m_moduleLoader.ClearCache();
77 79
@@ -89,7 +91,7 @@ namespace SimpleApp
89 scene.AddEntity(complexObject); 91 scene.AddEntity(complexObject);
90 } 92 }
91 93
92 /*for (int i = 0; i < 500; i++) 94 for (int i = 0; i < 2; i++)
93 { 95 {
94 MyNpcCharacter m_character = new MyNpcCharacter(scene.EventManager); 96 MyNpcCharacter m_character = new MyNpcCharacter(scene.EventManager);
95 scene.AddNewClient(m_character, false); 97 scene.AddNewClient(m_character, false);
@@ -100,7 +102,8 @@ namespace SimpleApp
100 { 102 {
101 avatar.AbsolutePosition = new LLVector3((float)OpenSim.Framework.Utilities.Util.RandomClass.Next(100,200), (float)OpenSim.Framework.Utilities.Util.RandomClass.Next(30, 200), 2); 103 avatar.AbsolutePosition = new LLVector3((float)OpenSim.Framework.Utilities.Util.RandomClass.Next(100,200), (float)OpenSim.Framework.Utilities.Util.RandomClass.Next(30, 200), 2);
102 104
103 }*/ 105 }
106
104 107
105 108
106 DirectoryInfo dirInfo = new DirectoryInfo( "." ); 109 DirectoryInfo dirInfo = new DirectoryInfo( "." );