aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs266
1 files changed, 152 insertions, 114 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index 45032fc..05d79dd 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -45,6 +45,7 @@ using OpenSim.Region.Communications.Local;
45using OpenSim.Region.Communications.OGS1; 45using OpenSim.Region.Communications.OGS1;
46using OpenSim.Framework.Communications.Caches; 46using OpenSim.Framework.Communications.Caches;
47using OpenSim.Region.Environment.Scenes; 47using OpenSim.Region.Environment.Scenes;
48using OpenSim.Region.Environment.Modules;
48using OpenSim.Region.Environment; 49using OpenSim.Region.Environment;
49using System.Text; 50using System.Text;
50using System.Collections.Generic; 51using System.Collections.Generic;
@@ -77,11 +78,17 @@ namespace OpenSim
77 private string m_logFilename = ("region-console.log"); 78 private string m_logFilename = ("region-console.log");
78 private bool m_permissions = false; 79 private bool m_permissions = false;
79 80
81 private bool m_DefaultModules = true;
82 private string m_exceptModules = "";
83 private bool m_DefaultSharedModules = true;
84 private string m_exceptSharedModules = "";
85
80 private bool standaloneAuthenticate = false; 86 private bool standaloneAuthenticate = false;
81 private string standaloneWelcomeMessage = null; 87 private string standaloneWelcomeMessage = null;
82 private string standaloneInventoryPlugin = ""; 88 private string standaloneInventoryPlugin = "";
83 private string standaloneUserPlugin = ""; 89 private string standaloneUserPlugin = "";
84 90
91 private Scene m_consoleRegion = null;
85 92
86 public ConsoleCommand CreateAccount = null; 93 public ConsoleCommand CreateAccount = null;
87 94
@@ -104,12 +111,10 @@ namespace OpenSim
104 } 111 }
105 112
106 ReadConfigSettings(startupSource); 113 ReadConfigSettings(startupSource);
107
108 } 114 }
109 115
110 protected void ReadConfigSettings(IConfigSource configSource) 116 protected void ReadConfigSettings(IConfigSource configSource)
111 { 117 {
112
113 m_networkServersInfo = new NetworkServersInfo(); 118 m_networkServersInfo = new NetworkServersInfo();
114 m_sandbox = !configSource.Configs["Startup"].GetBoolean("gridmode", false); 119 m_sandbox = !configSource.Configs["Startup"].GetBoolean("gridmode", false);
115 m_physicsEngine = configSource.Configs["Startup"].GetString("physics", "basicphysics"); 120 m_physicsEngine = configSource.Configs["Startup"].GetString("physics", "basicphysics");
@@ -122,6 +127,11 @@ namespace OpenSim
122 127
123 m_scriptEngine = configSource.Configs["Startup"].GetString("script_engine", "DotNetEngine"); 128 m_scriptEngine = configSource.Configs["Startup"].GetString("script_engine", "DotNetEngine");
124 129
130 m_DefaultModules = configSource.Configs["Startup"].GetBoolean("default_modules", true);
131 m_DefaultSharedModules = configSource.Configs["Startup"].GetBoolean("default_shared_modules", true);
132 m_exceptModules = configSource.Configs["Startup"].GetString("except_modules", "");
133 m_exceptSharedModules = configSource.Configs["Startup"].GetString("except_shared_modules", "");
134
125 standaloneAuthenticate = configSource.Configs["StandAlone"].GetBoolean("accounts_authenticate", false); 135 standaloneAuthenticate = configSource.Configs["StandAlone"].GetBoolean("accounts_authenticate", false);
126 standaloneWelcomeMessage = configSource.Configs["StandAlone"].GetString("welcome_message", "Welcome to OpenSim"); 136 standaloneWelcomeMessage = configSource.Configs["StandAlone"].GetString("welcome_message", "Welcome to OpenSim");
127 standaloneInventoryPlugin = configSource.Configs["StandAlone"].GetString("inventory_plugin", "OpenSim.Framework.Data.SQLite.dll"); 137 standaloneInventoryPlugin = configSource.Configs["StandAlone"].GetString("inventory_plugin", "OpenSim.Framework.Data.SQLite.dll");
@@ -178,6 +188,8 @@ namespace OpenSim
178 } 188 }
179 189
180 m_moduleLoader = new ModuleLoader(); 190 m_moduleLoader = new ModuleLoader();
191 MainLog.Instance.Verbose("Loading Shared Modules");
192 m_moduleLoader.LoadDefaultSharedModules(m_exceptSharedModules);
181 193
182 // Load all script engines found 194 // Load all script engines found
183 OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader ScriptEngineLoader = new OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader(m_log); 195 OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader ScriptEngineLoader = new OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader(m_log);
@@ -191,6 +203,10 @@ namespace OpenSim
191 UDPServer udpServer; 203 UDPServer udpServer;
192 Scene scene = SetupScene(regionInfo, out udpServer); 204 Scene scene = SetupScene(regionInfo, out udpServer);
193 205
206 m_moduleLoader.InitialiseSharedModules(scene);
207 MainLog.Instance.Verbose("Loading Region's Modules");
208 m_moduleLoader.CreateDefaultModules(scene, m_exceptModules);
209 scene.SetModuleInterfaces();
194 210
195 // Check if we have a script engine to load 211 // Check if we have a script engine to load
196 if (m_scriptEngine != null && m_scriptEngine != "") 212 if (m_scriptEngine != null && m_scriptEngine != "")
@@ -211,6 +227,9 @@ namespace OpenSim
211 m_regionData.Add(regionInfo); 227 m_regionData.Add(regionInfo);
212 } 228 }
213 229
230 m_moduleLoader.PostInitialise();
231 m_moduleLoader.ClearCache();
232
214 // Start UDP servers 233 // Start UDP servers
215 for (int i = 0; i < m_udpServers.Count; i++) 234 for (int i = 0; i < m_udpServers.Count; i++)
216 { 235 {
@@ -352,135 +371,154 @@ namespace OpenSim
352 /// <param name="cmdparams">Additional arguments passed to the command</param> 371 /// <param name="cmdparams">Additional arguments passed to the command</param>
353 public void RunCmd(string command, string[] cmdparams) 372 public void RunCmd(string command, string[] cmdparams)
354 { 373 {
355 switch (command) 374 if ((m_consoleRegion == null) || (command == "exit-region"))
356 { 375 {
357 case "help": 376 switch (command)
358 m_log.Error("alert - send alert to a designated user or all users."); 377 {
359 m_log.Error(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive."); 378 case "help":
360 m_log.Error(" alert general [Message] - send an alert to all users."); 379 m_log.Error("alert - send alert to a designated user or all users.");
361 m_log.Error("backup - trigger a simulator backup"); 380 m_log.Error(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive.");
362 m_log.Error("load-xml [filename] - load prims from XML"); 381 m_log.Error(" alert general [Message] - send an alert to all users.");
363 m_log.Error("save-xml [filename] - save prims to XML"); 382 m_log.Error("backup - trigger a simulator backup");
364 m_log.Error("script - manually trigger scripts? or script commands?"); 383 m_log.Error("load-xml [filename] - load prims from XML");
365 m_log.Error("show uptime - show simulator startup and uptime."); 384 m_log.Error("save-xml [filename] - save prims to XML");
366 m_log.Error("show users - show info about connected users."); 385 m_log.Error("script - manually trigger scripts? or script commands?");
367 m_log.Error("shutdown - disconnect all clients and shutdown."); 386 m_log.Error("show uptime - show simulator startup and uptime.");
368 m_log.Error("terrain help - show help for terrain commands."); 387 m_log.Error("show users - show info about connected users.");
369 m_log.Error("quit - equivalent to shutdown."); 388 m_log.Error("shutdown - disconnect all clients and shutdown.");
370 break; 389 m_log.Error("terrain help - show help for terrain commands.");
371 390 m_log.Error("quit - equivalent to shutdown.");
372 case "show": 391 break;
373 if (cmdparams.Length > 0) 392
374 { 393 case "show":
375 Show(cmdparams[0]); 394 if (cmdparams.Length > 0)
376 } 395 {
377 break; 396 Show(cmdparams[0]);
378 397 }
379 case "save-xml": 398 break;
380 if (cmdparams.Length > 0)
381 {
382 m_localScenes[0].SavePrimsToXml(cmdparams[0]);
383 }
384 else
385 {
386 m_localScenes[0].SavePrimsToXml("test.xml");
387 }
388 break;
389 399
390 case "load-xml": 400 case "save-xml":
391 if (cmdparams.Length > 0) 401 if (cmdparams.Length > 0)
392 { 402 {
393 m_localScenes[0].LoadPrimsFromXml(cmdparams[0]); 403 m_localScenes[0].SavePrimsToXml(cmdparams[0]);
394 } 404 }
395 else 405 else
396 { 406 {
397 m_localScenes[0].LoadPrimsFromXml("test.xml"); 407 m_localScenes[0].SavePrimsToXml("test.xml");
398 } 408 }
399 break; 409 break;
400 410
401 case "terrain": 411 case "load-xml":
402 string result = ""; 412 if (cmdparams.Length > 0)
403 foreach (Scene scene in m_localScenes)
404 {
405 if (!scene.Terrain.RunTerrainCmd(cmdparams, ref result, scene.RegionInfo.RegionName))
406 { 413 {
407 m_log.Error(result); 414 m_localScenes[0].LoadPrimsFromXml(cmdparams[0]);
408 } 415 }
409 } 416 else
410 break;
411 case "terrain-sim":
412 string result2 = "";
413 foreach (Scene scene in m_localScenes)
414 {
415 if (scene.RegionInfo.RegionName.ToLower() == cmdparams[0].ToLower())
416 { 417 {
417 string[] tmpCmdparams = new string[cmdparams.Length - 1]; 418 m_localScenes[0].LoadPrimsFromXml("test.xml");
418 cmdparams.CopyTo(tmpCmdparams, 1); 419 }
420 break;
419 421
420 if (!scene.Terrain.RunTerrainCmd(tmpCmdparams, ref result2, scene.RegionInfo.RegionName)) 422 case "terrain":
423 string result = "";
424 foreach (Scene scene in m_localScenes)
425 {
426 if (!scene.Terrain.RunTerrainCmd(cmdparams, ref result, scene.RegionInfo.RegionName))
421 { 427 {
422 m_log.Error(result2); 428 m_log.Error(result);
423 } 429 }
424 } 430 }
425 } 431 break;
426 break; 432 case "terrain-sim":
427 case "script": 433 string result2 = "";
428 foreach (Scene scene in m_localScenes) 434 foreach (Scene scene in m_localScenes)
429 { 435 {
430 scene.SendCommandToScripts(cmdparams); 436 if (scene.RegionInfo.RegionName.ToLower() == cmdparams[0].ToLower())
431 } 437 {
432 break; 438 string[] tmpCmdparams = new string[cmdparams.Length - 1];
439 cmdparams.CopyTo(tmpCmdparams, 1);
433 440
434 case "command-script": 441 if (!scene.Terrain.RunTerrainCmd(tmpCmdparams, ref result2, scene.RegionInfo.RegionName))
435 if (cmdparams.Length > 0) 442 {
436 { 443 m_log.Error(result2);
437 RunCommandScript(cmdparams[0]); 444 }
438 } 445 }
439 break; 446 }
447 break;
448 case "script":
449 foreach (Scene scene in m_localScenes)
450 {
451 scene.SendCommandToScripts(cmdparams);
452 }
453 break;
440 454
441 case "permissions": 455 case "command-script":
442 // Treats each user as a super-admin when disabled 456 if (cmdparams.Length > 0)
443 foreach (Scene scene in m_localScenes) 457 {
444 { 458 RunCommandScript(cmdparams[0]);
445 if (Convert.ToBoolean(cmdparams[0])) 459 }
446 scene.PermissionsMngr.EnablePermissions(); 460 break;
447 else
448 scene.PermissionsMngr.DisablePermissions();
449 }
450 break;
451 461
452 case "backup": 462 case "permissions":
453 foreach (Scene scene in m_localScenes) 463 // Treats each user as a super-admin when disabled
454 { 464 foreach (Scene scene in m_localScenes)
455 scene.Backup(); 465 {
456 } 466 if (Convert.ToBoolean(cmdparams[0]))
457 break; 467 scene.PermissionsMngr.EnablePermissions();
468 else
469 scene.PermissionsMngr.DisablePermissions();
470 }
471 break;
458 472
459 case "alert": 473 case "backup":
460 foreach (Scene scene in m_localScenes) 474 foreach (Scene scene in m_localScenes)
461 { 475 {
462 scene.HandleAlertCommand(cmdparams); 476 scene.Backup();
463 } 477 }
464 break; 478 break;
465 479
466 case "create": 480 case "alert":
467 if (CreateAccount != null) 481 foreach (Scene scene in m_localScenes)
468 { 482 {
469 CreateAccount(cmdparams); 483 scene.HandleAlertCommand(cmdparams);
470 } 484 }
471 break; 485 break;
472 486
473 case "set-time": 487 case "create":
474 break; 488 if (CreateAccount != null)
489 {
490 CreateAccount(cmdparams);
491 }
492 break;
475 493
476 case "quit": 494 case "quit":
477 case "shutdown": 495 case "shutdown":
478 Shutdown(); 496 Shutdown();
479 break; 497 break;
480 498
481 default: 499 case "change-region":
482 m_log.Error("Unknown command"); 500 foreach (Scene scene in m_localScenes)
483 break; 501 {
502 if (scene.RegionInfo.RegionName.ToLower() == cmdparams[0].ToLower())
503 {
504 m_consoleRegion = scene;
505 }
506 }
507 break;
508
509 case "exit-region":
510 m_consoleRegion = null;
511 break;
512
513 default:
514 m_log.Error("Unknown command");
515 break;
516 }
517 }
518 else
519 {
520 //let the scene/region handle the command directly.
521 m_consoleRegion.ProcessConsoleCmd(command, cmdparams);
484 } 522 }
485 } 523 }
486 524