diff options
author | MW | 2007-09-04 13:43:56 +0000 |
---|---|---|
committer | MW | 2007-09-04 13:43:56 +0000 |
commit | bfd36e2e836f92539e68bba077104d5016c5bf8b (patch) | |
tree | 36491a61df9cb936500cf349fa7a1ac377b2f350 | |
parent | reverting opensim.ini to proper default state (diff) | |
download | opensim-SC_OLD-bfd36e2e836f92539e68bba077104d5016c5bf8b.zip opensim-SC_OLD-bfd36e2e836f92539e68bba077104d5016c5bf8b.tar.gz opensim-SC_OLD-bfd36e2e836f92539e68bba077104d5016c5bf8b.tar.bz2 opensim-SC_OLD-bfd36e2e836f92539e68bba077104d5016c5bf8b.tar.xz |
Some work on Module loading/management.
Some more modules templates classes (hoping that someone will pick some of these and work on implementing them).
Early version of the "Dynamic Texture Module", although currently there are no render modules included (so not really functional without them).
Added osSetDynamicTextureURL script function, for attaching a dynamic texture to a prim.
Some work on the console command handling. Added "change-region <regionname>" and "exit-region" so that after the use of change-region, the commands entered will apply to that region only. Then use exit-region to return to the top level (so commands then function as they did before and either apply to all regions or to the first region) (Note: this hasn't been tested very much)
28 files changed, 659 insertions, 226 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index 3f594af..d947228 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs | |||
@@ -151,7 +151,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
151 | 151 | ||
152 | public void AddAsset(AssetBase asset) | 152 | public void AddAsset(AssetBase asset) |
153 | { | 153 | { |
154 | // Console.WriteLine("adding asset " + asset.FullID.ToStringHyphenated()); | 154 | System.Console.WriteLine("adding asset " + asset.FullID.ToStringHyphenated()); |
155 | if (asset.Type == 0) | 155 | if (asset.Type == 0) |
156 | { | 156 | { |
157 | //Console.WriteLine("which is a texture"); | 157 | //Console.WriteLine("which is a texture"); |
@@ -161,6 +161,11 @@ namespace OpenSim.Framework.Communications.Caches | |||
161 | this.Textures.Add(textur.FullID, textur); | 161 | this.Textures.Add(textur.FullID, textur); |
162 | this._assetServer.UploadNewAsset(asset); | 162 | this._assetServer.UploadNewAsset(asset); |
163 | } | 163 | } |
164 | else | ||
165 | { | ||
166 | TextureImage textur = new TextureImage(asset); | ||
167 | this.Textures[asset.FullID] = textur; | ||
168 | } | ||
164 | } | 169 | } |
165 | else | 170 | else |
166 | { | 171 | { |
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; | |||
45 | using OpenSim.Region.Communications.OGS1; | 45 | using OpenSim.Region.Communications.OGS1; |
46 | using OpenSim.Framework.Communications.Caches; | 46 | using OpenSim.Framework.Communications.Caches; |
47 | using OpenSim.Region.Environment.Scenes; | 47 | using OpenSim.Region.Environment.Scenes; |
48 | using OpenSim.Region.Environment.Modules; | ||
48 | using OpenSim.Region.Environment; | 49 | using OpenSim.Region.Environment; |
49 | using System.Text; | 50 | using System.Text; |
50 | using System.Collections.Generic; | 51 | using 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 | ||
diff --git a/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs b/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs new file mode 100644 index 0000000..4da5a7e --- /dev/null +++ b/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs | |||
@@ -0,0 +1,26 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using System.IO; | ||
5 | using libsecondlife; | ||
6 | |||
7 | namespace OpenSim.Region.Environment.Interfaces | ||
8 | { | ||
9 | public interface IDynamicTextureManager | ||
10 | { | ||
11 | void RegisterRender(string handleType, IDynamicTextureRender render); | ||
12 | void ReturnData(LLUUID id, byte[] data); | ||
13 | LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams, int updateTimer); | ||
14 | } | ||
15 | |||
16 | public interface IDynamicTextureRender | ||
17 | { | ||
18 | string GetName(); | ||
19 | string GetContentType(); | ||
20 | bool SupportsAsynchronous(); | ||
21 | byte[] ConvertUrl(string url, string extraParams); | ||
22 | byte[] ConvertStream(Stream data, string extraParams); | ||
23 | bool AsyncConvertUrl(LLUUID id, string url, string extraParams); | ||
24 | bool AsyncConvertStream(LLUUID id, Stream data, string extraParams); | ||
25 | } | ||
26 | } | ||
diff --git a/OpenSim/Region/Environment/Interfaces/IRegionModule.cs b/OpenSim/Region/Environment/Interfaces/IRegionModule.cs index 84e156f..11989fe 100644 --- a/OpenSim/Region/Environment/Interfaces/IRegionModule.cs +++ b/OpenSim/Region/Environment/Interfaces/IRegionModule.cs | |||
@@ -10,5 +10,6 @@ namespace OpenSim.Region.Environment.Interfaces | |||
10 | void PostInitialise(); | 10 | void PostInitialise(); |
11 | void CloseDown(); | 11 | void CloseDown(); |
12 | string GetName(); | 12 | string GetName(); |
13 | bool IsSharedModule(); | ||
13 | } | 14 | } |
14 | } | 15 | } |
diff --git a/OpenSim/Region/Environment/Interfaces/ISimChat.cs b/OpenSim/Region/Environment/Interfaces/ISimChat.cs new file mode 100644 index 0000000..0b83b34 --- /dev/null +++ b/OpenSim/Region/Environment/Interfaces/ISimChat.cs | |||
@@ -0,0 +1,12 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | |||
6 | namespace OpenSim.Region.Environment.Interfaces | ||
7 | { | ||
8 | public interface ISimChat | ||
9 | { | ||
10 | void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); | ||
11 | } | ||
12 | } | ||
diff --git a/OpenSim/Region/Environment/ModuleLoader.cs b/OpenSim/Region/Environment/ModuleLoader.cs index 1787a57..e8e7bc2 100644 --- a/OpenSim/Region/Environment/ModuleLoader.cs +++ b/OpenSim/Region/Environment/ModuleLoader.cs | |||
@@ -14,37 +14,51 @@ namespace OpenSim.Region.Environment | |||
14 | 14 | ||
15 | public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>(); | 15 | public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>(); |
16 | 16 | ||
17 | public List<IRegionModule> LoadedModules = new List<IRegionModule>(); | ||
18 | public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>(); | ||
19 | |||
17 | public ModuleLoader() | 20 | public ModuleLoader() |
18 | { | 21 | { |
19 | 22 | ||
20 | } | 23 | } |
21 | 24 | ||
22 | /// <summary> | 25 | /// <summary> |
23 | /// Really just a test method for loading a set of currently internal modules | 26 | /// Should have a module factory? |
24 | /// </summary> | 27 | /// </summary> |
25 | /// <param name="scene"></param> | 28 | /// <param name="scene"></param> |
26 | public void CreateDefaultModules(Scene scene) | 29 | public void CreateDefaultModules(Scene scene, string exceptModules) |
27 | { | 30 | { |
28 | //Testing IRegionModule ideas | ||
29 | XferModule xferManager = new XferModule(); | 31 | XferModule xferManager = new XferModule(); |
30 | xferManager.Initialise(scene); | 32 | xferManager.Initialise(scene); |
31 | scene.AddModule(xferManager.GetName(), xferManager); | 33 | scene.AddModule(xferManager.GetName(), xferManager); |
34 | LoadedModules.Add(xferManager); | ||
32 | 35 | ||
33 | ChatModule chatModule = new ChatModule(); | 36 | ChatModule chatModule = new ChatModule(); |
34 | chatModule.Initialise(scene); | 37 | chatModule.Initialise(scene); |
35 | scene.AddModule(chatModule.GetName(), chatModule); | 38 | scene.AddModule(chatModule.GetName(), chatModule); |
39 | LoadedModules.Add(chatModule); | ||
36 | 40 | ||
37 | AvatarProfilesModule avatarProfiles = new AvatarProfilesModule(); | 41 | AvatarProfilesModule avatarProfiles = new AvatarProfilesModule(); |
38 | avatarProfiles.Initialise(scene); | 42 | avatarProfiles.Initialise(scene); |
39 | scene.AddModule(avatarProfiles.GetName(), avatarProfiles); | 43 | scene.AddModule(avatarProfiles.GetName(), avatarProfiles); |
44 | LoadedModules.Add(avatarProfiles); | ||
40 | 45 | ||
41 | this.LoadModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene); | 46 | this.LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene); |
47 | } | ||
42 | 48 | ||
43 | // Post Initialise Modules, which most likely shouldn't be here | 49 | public void LoadDefaultSharedModules(string exceptModules) |
44 | // but should rather be in a separate method that is called after all modules are loaded/created/intialised | 50 | { |
45 | xferManager.PostInitialise(); | 51 | DynamicTextureModule dynamicModule = new DynamicTextureModule(); |
46 | // chatModule.PostInitialise(); //for now leave this disabled as it would start up a partially working irc bot | 52 | this.LoadedSharedModules.Add(dynamicModule.GetName(), dynamicModule); |
47 | avatarProfiles.PostInitialise(); | 53 | } |
54 | |||
55 | public void InitialiseSharedModules(Scene scene) | ||
56 | { | ||
57 | foreach (IRegionModule module in this.LoadedSharedModules.Values) | ||
58 | { | ||
59 | module.Initialise(scene); | ||
60 | scene.AddModule(module.GetName(), module); //should be doing this? | ||
61 | } | ||
48 | } | 62 | } |
49 | 63 | ||
50 | /// <summary> | 64 | /// <summary> |
@@ -53,18 +67,33 @@ namespace OpenSim.Region.Environment | |||
53 | /// <param name="dllName"></param> | 67 | /// <param name="dllName"></param> |
54 | /// <param name="moduleName"></param> | 68 | /// <param name="moduleName"></param> |
55 | /// <param name="scene"></param> | 69 | /// <param name="scene"></param> |
56 | public void LoadSharedModule(string dllName, string moduleName, Scene scene) | 70 | public void LoadSharedModule(string dllName, string moduleName) |
57 | { | 71 | { |
72 | IRegionModule module = this.LoadModule(dllName, moduleName); | ||
73 | if (module != null) | ||
74 | { | ||
75 | this.LoadedSharedModules.Add(module.GetName(), module); | ||
76 | } | ||
77 | } | ||
58 | 78 | ||
79 | public void LoadRegionModule(string dllName, string moduleName, Scene scene) | ||
80 | { | ||
81 | IRegionModule module = this.LoadModule(dllName, moduleName); | ||
82 | if (module != null) | ||
83 | { | ||
84 | module.Initialise(scene); | ||
85 | scene.AddModule(module.GetName(), module); | ||
86 | LoadedModules.Add(module); | ||
87 | } | ||
59 | } | 88 | } |
60 | 89 | ||
61 | /// <summary> | 90 | /// <summary> |
62 | /// Loads a external Module (if not already loaded) and creates a new instance of it for the passed Scene. | 91 | /// Loads a external Module (if not already loaded) and creates a new instance of it. |
63 | /// </summary> | 92 | /// </summary> |
64 | /// <param name="dllName"></param> | 93 | /// <param name="dllName"></param> |
65 | /// <param name="moduleName"></param> | 94 | /// <param name="moduleName"></param> |
66 | /// <param name="scene"></param> | 95 | /// <param name="scene"></param> |
67 | public void LoadModule(string dllName, string moduleName, Scene scene) | 96 | public IRegionModule LoadModule(string dllName, string moduleName) |
68 | { | 97 | { |
69 | Assembly pluginAssembly = null; | 98 | Assembly pluginAssembly = null; |
70 | if (LoadedAssemblys.ContainsKey(dllName)) | 99 | if (LoadedAssemblys.ContainsKey(dllName)) |
@@ -97,13 +126,26 @@ namespace OpenSim.Region.Environment | |||
97 | } | 126 | } |
98 | pluginAssembly = null; | 127 | pluginAssembly = null; |
99 | 128 | ||
100 | if (module.GetName() == moduleName) | 129 | if ((module != null ) || (module.GetName() == moduleName)) |
101 | { | 130 | { |
102 | module.Initialise(scene); | 131 | return module; |
103 | scene.AddModule(moduleName, module); | 132 | } |
104 | module.PostInitialise(); //shouldn't be done here | 133 | |
134 | return null; | ||
135 | |||
136 | } | ||
137 | |||
138 | public void PostInitialise() | ||
139 | { | ||
140 | foreach (IRegionModule module in this.LoadedSharedModules.Values) | ||
141 | { | ||
142 | module.PostInitialise(); | ||
105 | } | 143 | } |
106 | 144 | ||
145 | foreach (IRegionModule module in this.LoadedModules) | ||
146 | { | ||
147 | module.PostInitialise(); | ||
148 | } | ||
107 | } | 149 | } |
108 | 150 | ||
109 | public void ClearCache() | 151 | public void ClearCache() |
diff --git a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs index 5d7e6a6..21a7e61 100644 --- a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs +++ b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs | |||
@@ -38,6 +38,11 @@ namespace OpenSim.Region.Environment.Modules | |||
38 | return "AssetDownloadModule"; | 38 | return "AssetDownloadModule"; |
39 | } | 39 | } |
40 | 40 | ||
41 | public bool IsSharedModule() | ||
42 | { | ||
43 | return false; | ||
44 | } | ||
45 | |||
41 | public void NewClient(IClientAPI client) | 46 | public void NewClient(IClientAPI client) |
42 | { | 47 | { |
43 | } | 48 | } |
diff --git a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs index 1427c58..1ad061a 100644 --- a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs +++ b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs | |||
@@ -39,11 +39,21 @@ namespace OpenSim.Region.Environment.Modules | |||
39 | return "AvatarProfilesModule"; | 39 | return "AvatarProfilesModule"; |
40 | } | 40 | } |
41 | 41 | ||
42 | public bool IsSharedModule() | ||
43 | { | ||
44 | return false; | ||
45 | } | ||
46 | |||
42 | public void NewClient(IClientAPI client) | 47 | public void NewClient(IClientAPI client) |
43 | { | 48 | { |
44 | client.OnRequestAvatarProperties += RequestAvatarProperty; | 49 | client.OnRequestAvatarProperties += RequestAvatarProperty; |
45 | } | 50 | } |
46 | 51 | ||
52 | public void RemoveClient(IClientAPI client) | ||
53 | { | ||
54 | client.OnRequestAvatarProperties -= RequestAvatarProperty; | ||
55 | } | ||
56 | |||
47 | /// <summary> | 57 | /// <summary> |
48 | /// | 58 | /// |
49 | /// </summary> | 59 | /// </summary> |
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs index 752cde4..ac91b78 100644 --- a/OpenSim/Region/Environment/Modules/ChatModule.cs +++ b/OpenSim/Region/Environment/Modules/ChatModule.cs | |||
@@ -14,7 +14,7 @@ using OpenSim.Framework.Console; | |||
14 | 14 | ||
15 | namespace OpenSim.Region.Environment.Modules | 15 | namespace OpenSim.Region.Environment.Modules |
16 | { | 16 | { |
17 | public class ChatModule : IRegionModule | 17 | public class ChatModule : IRegionModule, ISimChat |
18 | { | 18 | { |
19 | private Scene m_scene; | 19 | private Scene m_scene; |
20 | 20 | ||
@@ -45,11 +45,12 @@ namespace OpenSim.Region.Environment.Modules | |||
45 | m_scene = scene; | 45 | m_scene = scene; |
46 | m_scene.EventManager.OnNewClient += NewClient; | 46 | m_scene.EventManager.OnNewClient += NewClient; |
47 | 47 | ||
48 | //should register a optional API Method, so other modules can send chat messages using this module | 48 | m_scene.RegisterModuleInterface<ISimChat>(this); |
49 | } | 49 | } |
50 | 50 | ||
51 | public void PostInitialise() | 51 | public void PostInitialise() |
52 | { | 52 | { |
53 | /* | ||
53 | try | 54 | try |
54 | { | 55 | { |
55 | m_irc = new TcpClient(m_server, m_port); | 56 | m_irc = new TcpClient(m_server, m_port); |
@@ -75,6 +76,7 @@ namespace OpenSim.Region.Environment.Modules | |||
75 | { | 76 | { |
76 | Console.WriteLine(e.ToString()); | 77 | Console.WriteLine(e.ToString()); |
77 | } | 78 | } |
79 | */ | ||
78 | } | 80 | } |
79 | 81 | ||
80 | public void CloseDown() | 82 | public void CloseDown() |
@@ -89,6 +91,11 @@ namespace OpenSim.Region.Environment.Modules | |||
89 | return "ChatModule"; | 91 | return "ChatModule"; |
90 | } | 92 | } |
91 | 93 | ||
94 | public bool IsSharedModule() | ||
95 | { | ||
96 | return false; | ||
97 | } | ||
98 | |||
92 | public void NewClient(IClientAPI client) | 99 | public void NewClient(IClientAPI client) |
93 | { | 100 | { |
94 | client.OnChatFromViewer += SimChat; | 101 | client.OnChatFromViewer += SimChat; |
diff --git a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs new file mode 100644 index 0000000..6edebe7 --- /dev/null +++ b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs | |||
@@ -0,0 +1,136 @@ | |||
1 | using System.Text; | ||
2 | using System.Net; | ||
3 | using System.Net.Sockets; | ||
4 | using System.Threading; | ||
5 | using System.IO; | ||
6 | using System.Collections.Generic; | ||
7 | using libsecondlife; | ||
8 | using OpenJPEGNet; | ||
9 | using OpenSim.Region.Environment.Scenes; | ||
10 | using OpenSim.Region.Environment.Interfaces; | ||
11 | using OpenSim.Framework.Interfaces; | ||
12 | using OpenSim.Framework.Utilities; | ||
13 | using OpenSim.Framework.Console; | ||
14 | using OpenSim.Framework.Types; | ||
15 | |||
16 | namespace OpenSim.Region.Environment.Modules | ||
17 | { | ||
18 | public class DynamicTextureModule :IRegionModule, IDynamicTextureManager | ||
19 | { | ||
20 | private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>(); | ||
21 | private Dictionary<string, IDynamicTextureRender> RenderPlugins= new Dictionary<string, IDynamicTextureRender>(); | ||
22 | private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>(); | ||
23 | |||
24 | public void Initialise(Scene scene) | ||
25 | { | ||
26 | if (!RegisteredScenes.ContainsKey(scene.RegionInfo.SimUUID)) | ||
27 | { | ||
28 | RegisteredScenes.Add(scene.RegionInfo.SimUUID, scene); | ||
29 | scene.RegisterModuleInterface<IDynamicTextureManager>(this); | ||
30 | } | ||
31 | } | ||
32 | |||
33 | public void PostInitialise() | ||
34 | { | ||
35 | |||
36 | } | ||
37 | |||
38 | public void CloseDown() | ||
39 | { | ||
40 | } | ||
41 | |||
42 | public string GetName() | ||
43 | { | ||
44 | return "DynamicTextureModule"; | ||
45 | } | ||
46 | |||
47 | public bool IsSharedModule() | ||
48 | { | ||
49 | return true; | ||
50 | } | ||
51 | |||
52 | public void RegisterRender(string handleType, IDynamicTextureRender render) | ||
53 | { | ||
54 | if (!RenderPlugins.ContainsKey(handleType)) | ||
55 | { | ||
56 | RenderPlugins.Add(handleType, render); | ||
57 | } | ||
58 | } | ||
59 | |||
60 | public void ReturnData(LLUUID id, byte[] data) | ||
61 | { | ||
62 | if (Updaters.ContainsKey(id)) | ||
63 | { | ||
64 | DynamicTextureUpdater updater = Updaters[id]; | ||
65 | if (RegisteredScenes.ContainsKey(updater.SimUUID)) | ||
66 | { | ||
67 | Scene scene = RegisteredScenes[updater.SimUUID]; | ||
68 | updater.DataReceived(data, scene); | ||
69 | } | ||
70 | } | ||
71 | } | ||
72 | |||
73 | public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams, int updateTimer) | ||
74 | { | ||
75 | System.Console.WriteLine("dynamic texture being created " + url + " of type " + contentType); | ||
76 | if (this.RenderPlugins.ContainsKey(contentType)) | ||
77 | { | ||
78 | DynamicTextureUpdater updater = new DynamicTextureUpdater(); | ||
79 | updater.SimUUID = simID; | ||
80 | updater.PrimID = primID; | ||
81 | updater.ContentType = contentType; | ||
82 | updater.Url = url; | ||
83 | updater.UpdateTimer = updateTimer; | ||
84 | updater.UpdaterID = LLUUID.Random(); | ||
85 | updater.Params = extraParams; | ||
86 | |||
87 | if (!this.Updaters.ContainsKey(updater.UpdaterID)) | ||
88 | { | ||
89 | Updaters.Add(updater.UpdaterID, updater); | ||
90 | } | ||
91 | |||
92 | RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams); | ||
93 | return updater.UpdaterID; | ||
94 | } | ||
95 | return LLUUID.Zero; | ||
96 | } | ||
97 | |||
98 | public class DynamicTextureUpdater | ||
99 | { | ||
100 | public LLUUID SimUUID; | ||
101 | public LLUUID UpdaterID; | ||
102 | public string ContentType; | ||
103 | public string Url; | ||
104 | public Stream StreamData; | ||
105 | public LLUUID PrimID; | ||
106 | public int UpdateTimer; | ||
107 | public LLUUID LastAssetID; | ||
108 | public string Params; | ||
109 | |||
110 | public DynamicTextureUpdater() | ||
111 | { | ||
112 | LastAssetID = LLUUID.Zero; | ||
113 | UpdateTimer = 0; | ||
114 | StreamData = null; | ||
115 | } | ||
116 | |||
117 | public void DataReceived(byte[] data, Scene scene) | ||
118 | { | ||
119 | //TODO delete the last asset(data), if it was a dynamic texture | ||
120 | |||
121 | AssetBase asset = new AssetBase(); | ||
122 | asset.FullID = LLUUID.Random(); | ||
123 | asset.Data = data; | ||
124 | asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); | ||
125 | asset.Type = 0; | ||
126 | scene.commsManager.AssetCache.AddAsset(asset); | ||
127 | |||
128 | this.LastAssetID = asset.FullID; | ||
129 | |||
130 | SceneObjectPart part = scene.GetSceneObjectPart(PrimID); | ||
131 | part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes(); | ||
132 | part.ScheduleFullUpdate(); | ||
133 | } | ||
134 | } | ||
135 | } | ||
136 | } | ||
diff --git a/OpenSim/Region/Environment/Modules/EmailModule.cs b/OpenSim/Region/Environment/Modules/EmailModule.cs new file mode 100644 index 0000000..2a90dd3 --- /dev/null +++ b/OpenSim/Region/Environment/Modules/EmailModule.cs | |||
@@ -0,0 +1,10 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Region.Environment.Modules | ||
6 | { | ||
7 | class EmailModule | ||
8 | { | ||
9 | } | ||
10 | } | ||
diff --git a/OpenSim/Region/Environment/Modules/FriendsModule.cs b/OpenSim/Region/Environment/Modules/FriendsModule.cs index f952bb2..d46039c 100644 --- a/OpenSim/Region/Environment/Modules/FriendsModule.cs +++ b/OpenSim/Region/Environment/Modules/FriendsModule.cs | |||
@@ -31,5 +31,10 @@ namespace OpenSim.Region.Environment.Modules | |||
31 | { | 31 | { |
32 | return "FriendsModule"; | 32 | return "FriendsModule"; |
33 | } | 33 | } |
34 | |||
35 | public bool IsSharedModule() | ||
36 | { | ||
37 | return false; | ||
38 | } | ||
34 | } | 39 | } |
35 | } | 40 | } |
diff --git a/OpenSim/Region/Environment/Modules/GroupsModule.cs b/OpenSim/Region/Environment/Modules/GroupsModule.cs index 607b395..8e4b409 100644 --- a/OpenSim/Region/Environment/Modules/GroupsModule.cs +++ b/OpenSim/Region/Environment/Modules/GroupsModule.cs | |||
@@ -30,6 +30,11 @@ namespace OpenSim.Region.Environment.Modules | |||
30 | { | 30 | { |
31 | return "GroupsModule"; | 31 | return "GroupsModule"; |
32 | } | 32 | } |
33 | |||
34 | public bool IsSharedModule() | ||
35 | { | ||
36 | return false; | ||
37 | } | ||
33 | } | 38 | } |
34 | } | 39 | } |
35 | 40 | ||
diff --git a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs index 9c09c48..acf031b 100644 --- a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs +++ b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs | |||
@@ -31,5 +31,10 @@ namespace OpenSim.Region.Environment.Modules | |||
31 | { | 31 | { |
32 | return "InstantMessageModule"; | 32 | return "InstantMessageModule"; |
33 | } | 33 | } |
34 | |||
35 | public bool IsSharedModule() | ||
36 | { | ||
37 | return false; | ||
38 | } | ||
34 | } | 39 | } |
35 | } | 40 | } |
diff --git a/OpenSim/Region/Environment/Modules/InventoryModule.cs b/OpenSim/Region/Environment/Modules/InventoryModule.cs index 94e7ba7..00b4d8e 100644 --- a/OpenSim/Region/Environment/Modules/InventoryModule.cs +++ b/OpenSim/Region/Environment/Modules/InventoryModule.cs | |||
@@ -31,5 +31,10 @@ namespace OpenSim.Region.Environment.Modules | |||
31 | { | 31 | { |
32 | return "InventoryModule"; | 32 | return "InventoryModule"; |
33 | } | 33 | } |
34 | |||
35 | public bool IsSharedModule() | ||
36 | { | ||
37 | return false; | ||
38 | } | ||
34 | } | 39 | } |
35 | } | 40 | } |
diff --git a/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs b/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs new file mode 100644 index 0000000..11af718 --- /dev/null +++ b/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs | |||
@@ -0,0 +1,10 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Region.Environment.Modules | ||
6 | { | ||
7 | class ScriptsHttpRequests | ||
8 | { | ||
9 | } | ||
10 | } | ||
diff --git a/OpenSim/Region/Environment/Modules/TeleportModule.cs b/OpenSim/Region/Environment/Modules/TeleportModule.cs new file mode 100644 index 0000000..08fc202 --- /dev/null +++ b/OpenSim/Region/Environment/Modules/TeleportModule.cs | |||
@@ -0,0 +1,10 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Region.Environment.Modules | ||
6 | { | ||
7 | class TeleportModule | ||
8 | { | ||
9 | } | ||
10 | } | ||
diff --git a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs index a92566d..7d31644 100644 --- a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs +++ b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs | |||
@@ -37,6 +37,11 @@ namespace OpenSim.Region.Environment.Modules | |||
37 | return "TextureDownloadModule"; | 37 | return "TextureDownloadModule"; |
38 | } | 38 | } |
39 | 39 | ||
40 | public bool IsSharedModule() | ||
41 | { | ||
42 | return false; | ||
43 | } | ||
44 | |||
40 | public void NewClient(IClientAPI client) | 45 | public void NewClient(IClientAPI client) |
41 | { | 46 | { |
42 | } | 47 | } |
diff --git a/OpenSim/Region/Environment/Modules/XferModule.cs b/OpenSim/Region/Environment/Modules/XferModule.cs index a0327e9..eec9f97 100644 --- a/OpenSim/Region/Environment/Modules/XferModule.cs +++ b/OpenSim/Region/Environment/Modules/XferModule.cs | |||
@@ -45,6 +45,11 @@ namespace OpenSim.Region.Environment.Modules | |||
45 | return "XferModule"; | 45 | return "XferModule"; |
46 | } | 46 | } |
47 | 47 | ||
48 | public bool IsSharedModule() | ||
49 | { | ||
50 | return false; | ||
51 | } | ||
52 | |||
48 | public void NewClient(IClientAPI client) | 53 | public void NewClient(IClientAPI client) |
49 | { | 54 | { |
50 | client.OnRequestXfer += RequestXfer; | 55 | client.OnRequestXfer += RequestXfer; |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index a9ded3f..90e4a1f 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
@@ -35,6 +35,7 @@ using OpenSim.Framework.Types; | |||
35 | using OpenSim.Framework.Communications.Caches; | 35 | using OpenSim.Framework.Communications.Caches; |
36 | using OpenSim.Framework.Data; | 36 | using OpenSim.Framework.Data; |
37 | using OpenSim.Framework.Utilities; | 37 | using OpenSim.Framework.Utilities; |
38 | using OpenSim.Region.Environment.Interfaces; | ||
38 | 39 | ||
39 | namespace OpenSim.Region.Environment.Scenes | 40 | namespace OpenSim.Region.Environment.Scenes |
40 | { | 41 | { |
@@ -94,7 +95,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
94 | } | 95 | } |
95 | 96 | ||
96 | /// <summary> | 97 | /// <summary> |
97 | /// Should be removed soon as the Chat modules should take over this function | 98 | /// |
98 | /// </summary> | 99 | /// </summary> |
99 | /// <param name="message"></param> | 100 | /// <param name="message"></param> |
100 | /// <param name="type"></param> | 101 | /// <param name="type"></param> |
@@ -103,56 +104,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
103 | /// <param name="fromAgentID"></param> | 104 | /// <param name="fromAgentID"></param> |
104 | public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) | 105 | public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) |
105 | { | 106 | { |
106 | ScenePresence avatar = null; | 107 | if (m_simChatModule != null) |
107 | if (this.Avatars.ContainsKey(fromAgentID)) | ||
108 | { | 108 | { |
109 | avatar = this.Avatars[fromAgentID]; | 109 | m_simChatModule.SimChat(message, type, fromPos, fromName, fromAgentID); |
110 | fromPos = avatar.AbsolutePosition; | ||
111 | fromName = avatar.Firstname + " " + avatar.Lastname; | ||
112 | avatar = null; | ||
113 | } | 110 | } |
114 | |||
115 | this.ForEachScenePresence(delegate(ScenePresence presence) | ||
116 | { | ||
117 | int dis = -1000; | ||
118 | if (this.Avatars.ContainsKey(presence.ControllingClient.AgentId)) | ||
119 | { | ||
120 | avatar = this.Avatars[presence.ControllingClient.AgentId]; | ||
121 | dis = (int)avatar.AbsolutePosition.GetDistanceTo(fromPos); | ||
122 | } | ||
123 | |||
124 | switch (type) | ||
125 | { | ||
126 | case 0: // Whisper | ||
127 | if ((dis < 10) && (dis > -10)) | ||
128 | { | ||
129 | //should change so the message is sent through the avatar rather than direct to the ClientView | ||
130 | presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName, | ||
131 | fromAgentID); | ||
132 | } | ||
133 | break; | ||
134 | case 1: // Say | ||
135 | if ((dis < 30) && (dis > -30)) | ||
136 | { | ||
137 | //Console.WriteLine("sending chat"); | ||
138 | presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName, | ||
139 | fromAgentID); | ||
140 | } | ||
141 | break; | ||
142 | case 2: // Shout | ||
143 | if ((dis < 100) && (dis > -100)) | ||
144 | { | ||
145 | presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName, | ||
146 | fromAgentID); | ||
147 | } | ||
148 | break; | ||
149 | |||
150 | case 0xff: // Broadcast | ||
151 | presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName, | ||
152 | fromAgentID); | ||
153 | break; | ||
154 | } | ||
155 | }); | ||
156 | } | 111 | } |
157 | 112 | ||
158 | /// <summary> | 113 | /// <summary> |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 46fc86b..b92f8c8 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -78,20 +78,23 @@ namespace OpenSim.Region.Environment.Scenes | |||
78 | protected StorageManager storageManager; | 78 | protected StorageManager storageManager; |
79 | protected AgentCircuitManager authenticateHandler; | 79 | protected AgentCircuitManager authenticateHandler; |
80 | protected RegionCommsListener regionCommsHost; | 80 | protected RegionCommsListener regionCommsHost; |
81 | protected CommunicationsManager commsManager; | 81 | public CommunicationsManager commsManager; |
82 | // protected XferManager xferManager; | 82 | // protected XferManager xferManager; |
83 | 83 | ||
84 | protected Dictionary<LLUUID, Caps> capsHandlers = new Dictionary<LLUUID, Caps>(); | 84 | protected Dictionary<LLUUID, Caps> capsHandlers = new Dictionary<LLUUID, Caps>(); |
85 | protected BaseHttpServer httpListener; | 85 | protected BaseHttpServer httpListener; |
86 | 86 | ||
87 | protected Dictionary<string, IRegionModule> Modules = new Dictionary<string, IRegionModule>(); | 87 | protected Dictionary<string, IRegionModule> Modules = new Dictionary<string, IRegionModule>(); |
88 | protected Dictionary<string, object> APIMethods = new Dictionary<string, object>(); | 88 | public Dictionary<Type, object> ModuleInterfaces = new Dictionary<Type, object>(); |
89 | protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>(); | ||
89 | 90 | ||
90 | //API method Delegates | 91 | //API method Delegates and interfaces |
91 | 92 | ||
92 | // this most likely shouldn't be handled as a API method like this, but doing it for testing purposes | 93 | // this most likely shouldn't be handled as a API method like this, but doing it for testing purposes |
93 | public ModuleAPIMethod2<bool, string, byte[]>AddXferFile = null; | 94 | public ModuleAPIMethod2<bool, string, byte[]> AddXferFile = null; |
94 | 95 | ||
96 | private ISimChat m_simChatModule = null; | ||
97 | |||
95 | #region Properties | 98 | #region Properties |
96 | 99 | ||
97 | public AgentCircuitManager AuthenticateHandler | 100 | public AgentCircuitManager AuthenticateHandler |
@@ -152,7 +155,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
152 | AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer, ModuleLoader moduleLoader) | 155 | AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer, ModuleLoader moduleLoader) |
153 | { | 156 | { |
154 | updateLock = new Mutex(false); | 157 | updateLock = new Mutex(false); |
155 | 158 | ||
156 | m_moduleLoader = moduleLoader; | 159 | m_moduleLoader = moduleLoader; |
157 | authenticateHandler = authen; | 160 | authenticateHandler = authen; |
158 | commsManager = commsMan; | 161 | commsManager = commsMan; |
@@ -169,9 +172,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
169 | m_eventManager = new EventManager(); | 172 | m_eventManager = new EventManager(); |
170 | m_permissionManager = new PermissionManager(this); | 173 | m_permissionManager = new PermissionManager(this); |
171 | 174 | ||
172 | MainLog.Instance.Verbose("Loading Region Modules"); | ||
173 | m_moduleLoader.CreateDefaultModules(this); | ||
174 | |||
175 | m_eventManager.OnParcelPrimCountAdd += | 175 | m_eventManager.OnParcelPrimCountAdd += |
176 | m_LandManager.addPrimToLandPrimCounts; | 176 | m_LandManager.addPrimToLandPrimCounts; |
177 | 177 | ||
@@ -189,13 +189,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
189 | 189 | ||
190 | httpListener = httpServer; | 190 | httpListener = httpServer; |
191 | 191 | ||
192 | SetMethodDelegates(); | ||
193 | } | 192 | } |
194 | 193 | ||
195 | #endregion | 194 | #endregion |
196 | 195 | ||
197 | private void SetMethodDelegates() | 196 | public void SetModuleInterfaces() |
198 | { | 197 | { |
198 | m_simChatModule = this.RequestModuleInterface<ISimChat>(); | ||
199 | |||
200 | //should change so it uses the module interface functions | ||
199 | AddXferFile = (ModuleAPIMethod2<bool, string, byte[]>)this.RequestAPIMethod("API_AddXferFile"); | 201 | AddXferFile = (ModuleAPIMethod2<bool, string, byte[]>)this.RequestAPIMethod("API_AddXferFile"); |
200 | } | 202 | } |
201 | 203 | ||
@@ -526,7 +528,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
526 | MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); | 528 | MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); |
527 | } | 529 | } |
528 | 530 | ||
529 | 531 | ||
530 | 532 | ||
531 | /// <summary> | 533 | /// <summary> |
532 | /// Returns a new unallocated primitive ID | 534 | /// Returns a new unallocated primitive ID |
@@ -635,12 +637,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
635 | //obj.RegenerateFullIDs(); | 637 | //obj.RegenerateFullIDs(); |
636 | AddEntity(obj); | 638 | AddEntity(obj); |
637 | 639 | ||
638 | SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); | 640 | SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); |
639 | rootPart.PhysActor = phyScene.AddPrim( | 641 | rootPart.PhysActor = phyScene.AddPrim( |
640 | new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z), | 642 | new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z), |
641 | new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), | 643 | new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), |
642 | new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, | 644 | new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, |
643 | rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); | 645 | rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); |
644 | primCount++; | 646 | primCount++; |
645 | } | 647 | } |
646 | } | 648 | } |
@@ -692,7 +694,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
692 | 694 | ||
693 | protected virtual void SubscribeToClientEvents(IClientAPI client) | 695 | protected virtual void SubscribeToClientEvents(IClientAPI client) |
694 | { | 696 | { |
695 | // client.OnStartAnim += StartAnimation; | 697 | // client.OnStartAnim += StartAnimation; |
696 | client.OnRegionHandShakeReply += SendLayerData; | 698 | client.OnRegionHandShakeReply += SendLayerData; |
697 | //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); | 699 | //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); |
698 | client.OnModifyTerrain += ModifyTerrain; | 700 | client.OnModifyTerrain += ModifyTerrain; |
@@ -742,7 +744,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
742 | client.OnRezScript += RezScript; | 744 | client.OnRezScript += RezScript; |
743 | client.OnRemoveTaskItem += RemoveTaskInventory; | 745 | client.OnRemoveTaskItem += RemoveTaskInventory; |
744 | 746 | ||
745 | // client.OnRequestAvatarProperties += RequestAvatarProperty; | 747 | // client.OnRequestAvatarProperties += RequestAvatarProperty; |
746 | 748 | ||
747 | client.OnGrabObject += ProcessObjectGrab; | 749 | client.OnGrabObject += ProcessObjectGrab; |
748 | 750 | ||
@@ -1071,13 +1073,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
1071 | AgentCircuitData agent = remoteClient.RequestClientInfo(); | 1073 | AgentCircuitData agent = remoteClient.RequestClientInfo(); |
1072 | agent.BaseFolder = LLUUID.Zero; | 1074 | agent.BaseFolder = LLUUID.Zero; |
1073 | agent.InventoryFolder = LLUUID.Zero; | 1075 | agent.InventoryFolder = LLUUID.Zero; |
1074 | // agent.startpos = new LLVector3(128, 128, 70); | 1076 | // agent.startpos = new LLVector3(128, 128, 70); |
1075 | agent.startpos = position; | 1077 | agent.startpos = position; |
1076 | agent.child = true; | 1078 | agent.child = true; |
1077 | commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent); | 1079 | commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent); |
1078 | commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position, false); | 1080 | commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position, false); |
1079 | 1081 | ||
1080 | //TODO: following line is hard coded to port 9000, really need to change this as soon as possible | ||
1081 | AgentCircuitData circuitdata = remoteClient.RequestClientInfo(); | 1082 | AgentCircuitData circuitdata = remoteClient.RequestClientInfo(); |
1082 | string capsPath = Util.GetCapsURL(remoteClient.AgentId); | 1083 | string capsPath = Util.GetCapsURL(remoteClient.AgentId); |
1083 | remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4), capsPath); | 1084 | remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4), capsPath); |
@@ -1114,23 +1115,45 @@ namespace OpenSim.Region.Environment.Scenes | |||
1114 | } | 1115 | } |
1115 | } | 1116 | } |
1116 | 1117 | ||
1118 | //following delegate methods will be removed, so use the interface methods (below these) | ||
1117 | public void RegisterAPIMethod(string name, object method) | 1119 | public void RegisterAPIMethod(string name, object method) |
1118 | { | 1120 | { |
1119 | if (!this.APIMethods.ContainsKey(name)) | 1121 | if (!this.ModuleAPIMethods.ContainsKey(name)) |
1120 | { | 1122 | { |
1121 | this.APIMethods.Add(name, method); | 1123 | this.ModuleAPIMethods.Add(name, method); |
1122 | } | 1124 | } |
1123 | } | 1125 | } |
1124 | 1126 | ||
1125 | public object RequestAPIMethod(string name) | 1127 | public object RequestAPIMethod(string name) |
1126 | { | 1128 | { |
1127 | if (this.APIMethods.ContainsKey(name)) | 1129 | if (this.ModuleAPIMethods.ContainsKey(name)) |
1128 | { | 1130 | { |
1129 | return APIMethods[name]; | 1131 | return ModuleAPIMethods[name]; |
1130 | } | 1132 | } |
1131 | return false; | 1133 | return false; |
1132 | } | 1134 | } |
1133 | 1135 | ||
1136 | public void RegisterModuleInterface<M>( M mod) | ||
1137 | { | ||
1138 | //Console.WriteLine("registering module interface " + typeof(M)); | ||
1139 | if (!this.ModuleInterfaces.ContainsKey(typeof(M))) | ||
1140 | { | ||
1141 | ModuleInterfaces.Add(typeof(M), mod); | ||
1142 | } | ||
1143 | } | ||
1144 | |||
1145 | public T RequestModuleInterface<T>() | ||
1146 | { | ||
1147 | if (ModuleInterfaces.ContainsKey(typeof(T))) | ||
1148 | { | ||
1149 | return (T)ModuleInterfaces[typeof(T)]; | ||
1150 | } | ||
1151 | else | ||
1152 | { | ||
1153 | return default(T); | ||
1154 | } | ||
1155 | } | ||
1156 | |||
1134 | public void SetTimePhase(int phase) | 1157 | public void SetTimePhase(int phase) |
1135 | { | 1158 | { |
1136 | m_timePhase = phase; | 1159 | m_timePhase = phase; |
@@ -1205,6 +1228,49 @@ namespace OpenSim.Region.Environment.Scenes | |||
1205 | } | 1228 | } |
1206 | #endregion | 1229 | #endregion |
1207 | 1230 | ||
1231 | public void ProcessConsoleCmd(string command, string[] cmdparams) | ||
1232 | { | ||
1233 | switch (command) | ||
1234 | { | ||
1235 | case "save-xml": | ||
1236 | if (cmdparams.Length > 0) | ||
1237 | { | ||
1238 | SavePrimsToXml(cmdparams[0]); | ||
1239 | } | ||
1240 | else | ||
1241 | { | ||
1242 | SavePrimsToXml("test.xml"); | ||
1243 | } | ||
1244 | break; | ||
1245 | |||
1246 | case "load-xml": | ||
1247 | if (cmdparams.Length > 0) | ||
1248 | { | ||
1249 | LoadPrimsFromXml(cmdparams[0]); | ||
1250 | } | ||
1251 | else | ||
1252 | { | ||
1253 | LoadPrimsFromXml("test.xml"); | ||
1254 | } | ||
1255 | break; | ||
1256 | |||
1257 | case "set-time": | ||
1258 | break; | ||
1259 | |||
1260 | case "backup": | ||
1261 | Backup(); | ||
1262 | break; | ||
1263 | |||
1264 | case "alert": | ||
1265 | HandleAlertCommand(cmdparams); | ||
1266 | break; | ||
1267 | |||
1268 | default: | ||
1269 | MainLog.Instance.Error("Unknown command: " + command); | ||
1270 | break; | ||
1271 | } | ||
1272 | } | ||
1273 | |||
1208 | #region Script Engine | 1274 | #region Script Engine |
1209 | private List<OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface> ScriptEngines = new List<OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface>(); | 1275 | private List<OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface> ScriptEngines = new List<OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface>(); |
1210 | public void AddScriptEngine(OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface ScriptEngine, LogBase m_logger) | 1276 | public void AddScriptEngine(OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface ScriptEngine, LogBase m_logger) |
@@ -1248,5 +1314,22 @@ namespace OpenSim.Region.Environment.Scenes | |||
1248 | } | 1314 | } |
1249 | return null; | 1315 | return null; |
1250 | } | 1316 | } |
1317 | |||
1318 | public SceneObjectPart GetSceneObjectPart(LLUUID fullID) | ||
1319 | { | ||
1320 | bool hasPrim = false; | ||
1321 | foreach (EntityBase ent in Entities.Values) | ||
1322 | { | ||
1323 | if (ent is SceneObjectGroup) | ||
1324 | { | ||
1325 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(fullID); | ||
1326 | if (hasPrim != false) | ||
1327 | { | ||
1328 | return ((SceneObjectGroup)ent).GetChildPart(fullID); | ||
1329 | } | ||
1330 | } | ||
1331 | } | ||
1332 | return null; | ||
1333 | } | ||
1251 | } | 1334 | } |
1252 | } | 1335 | } |
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 003d3d4..4b05287 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | |||
@@ -98,12 +98,14 @@ namespace SimpleApp | |||
98 | private LLUUID myID = LLUUID.Random(); | 98 | private LLUUID myID = LLUUID.Random(); |
99 | public MyNpcCharacter( EventManager eventManager ) | 99 | public MyNpcCharacter( EventManager eventManager ) |
100 | { | 100 | { |
101 | // startPos = new LLVector3(128, (float)(Util.RandomClass.NextDouble()*100), 2); | ||
101 | eventManager.OnFrame += Update; | 102 | eventManager.OnFrame += Update; |
102 | } | 103 | } |
103 | 104 | ||
105 | private LLVector3 startPos = new LLVector3(128, 128,2); | ||
104 | public virtual LLVector3 StartPos | 106 | public virtual LLVector3 StartPos |
105 | { | 107 | { |
106 | get { return new LLVector3(128, 100, 2); } | 108 | get { return startPos; } |
107 | set { } | 109 | set { } |
108 | } | 110 | } |
109 | 111 | ||
@@ -122,9 +124,10 @@ namespace SimpleApp | |||
122 | get { return "Annoying"; } | 124 | get { return "Annoying"; } |
123 | } | 125 | } |
124 | 126 | ||
127 | private string lastName = "NPC" + Util.RandomClass.Next(1, 1000); | ||
125 | public virtual string LastName | 128 | public virtual string LastName |
126 | { | 129 | { |
127 | get { return "NPC"; } | 130 | get { return lastName; } |
128 | } | 131 | } |
129 | 132 | ||
130 | public virtual void OutPacket(Packet newPack) { } | 133 | public virtual void OutPacket(Packet newPack) { } |
@@ -203,7 +206,7 @@ namespace SimpleApp | |||
203 | flyState = 0; | 206 | flyState = 0; |
204 | } | 207 | } |
205 | 208 | ||
206 | if (count >= 40) | 209 | if (count >= 200) |
207 | { | 210 | { |
208 | if (OnChatFromViewer != null) | 211 | if (OnChatFromViewer != null) |
209 | { | 212 | { |
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index a1d331d..52e279b 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs | |||
@@ -1,4 +1,5 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | ||
2 | using System.Net; | 3 | using System.Net; |
3 | using libsecondlife; | 4 | using libsecondlife; |
4 | using OpenSim.Framework; | 5 | using OpenSim.Framework; |
@@ -22,6 +23,7 @@ namespace SimpleApp | |||
22 | { | 23 | { |
23 | class Program : RegionApplicationBase, conscmd_callback | 24 | class Program : RegionApplicationBase, conscmd_callback |
24 | { | 25 | { |
26 | private ModuleLoader m_moduleLoader; | ||
25 | protected override LogBase CreateLog() | 27 | protected override LogBase CreateLog() |
26 | { | 28 | { |
27 | return new LogBase(null, "SimpleApp", this, false); | 29 | return new LogBase(null, "SimpleApp", this, false); |
@@ -59,8 +61,19 @@ namespace SimpleApp | |||
59 | 61 | ||
60 | UDPServer udpServer; | 62 | UDPServer udpServer; |
61 | 63 | ||
64 | m_moduleLoader = new ModuleLoader(); | ||
65 | m_moduleLoader.LoadDefaultSharedModules(""); | ||
66 | |||
62 | Scene scene = SetupScene(regionInfo, out udpServer); | 67 | Scene scene = SetupScene(regionInfo, out udpServer); |
68 | |||
69 | m_moduleLoader.InitialiseSharedModules(scene); | ||
70 | m_moduleLoader.CreateDefaultModules(scene, ""); | ||
71 | scene.SetModuleInterfaces(); | ||
72 | |||
63 | scene.StartTimer(); | 73 | scene.StartTimer(); |
74 | |||
75 | m_moduleLoader.PostInitialise(); | ||
76 | m_moduleLoader.ClearCache(); | ||
64 | 77 | ||
65 | udpServer.ServerListener(); | 78 | udpServer.ServerListener(); |
66 | 79 | ||
@@ -75,10 +88,21 @@ namespace SimpleApp | |||
75 | ComplexObject complexObject = new ComplexObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(), pos + posOffset ); | 88 | ComplexObject complexObject = new ComplexObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(), pos + posOffset ); |
76 | scene.AddEntity(complexObject); | 89 | scene.AddEntity(complexObject); |
77 | } | 90 | } |
78 | 91 | ||
79 | MyNpcCharacter m_character = new MyNpcCharacter(scene.EventManager); | 92 | /*for (int i = 0; i < 500; i++) |
80 | scene.AddNewClient(m_character, false); | 93 | { |
94 | MyNpcCharacter m_character = new MyNpcCharacter(scene.EventManager); | ||
95 | scene.AddNewClient(m_character, false); | ||
96 | } | ||
97 | |||
98 | List<ScenePresence> avatars = scene.RequestAvatarList(); | ||
99 | foreach (ScenePresence avatar in avatars) | ||
100 | { | ||
101 | avatar.AbsolutePosition = new LLVector3((float)OpenSim.Framework.Utilities.Util.RandomClass.Next(100,200), (float)OpenSim.Framework.Utilities.Util.RandomClass.Next(30, 200), 2); | ||
102 | |||
103 | }*/ | ||
81 | 104 | ||
105 | |||
82 | DirectoryInfo dirInfo = new DirectoryInfo( "." ); | 106 | DirectoryInfo dirInfo = new DirectoryInfo( "." ); |
83 | 107 | ||
84 | float x = 0; | 108 | float x = 0; |
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs index 6cacf0c..fd59fd3 100644 --- a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs +++ b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs | |||
@@ -58,7 +58,7 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
58 | { | 58 | { |
59 | // Default Engines | 59 | // Default Engines |
60 | CSharpScriptEngine csharpCompiler = new CSharpScriptEngine(); | 60 | CSharpScriptEngine csharpCompiler = new CSharpScriptEngine(); |
61 | compilers.Add(csharpCompiler.FileExt(),csharpCompiler); | 61 | compilers.Add(csharpCompiler.FileExt(), csharpCompiler); |
62 | 62 | ||
63 | JScriptEngine jscriptCompiler = new JScriptEngine(); | 63 | JScriptEngine jscriptCompiler = new JScriptEngine(); |
64 | compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler); | 64 | compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler); |
@@ -72,8 +72,8 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
72 | System.Console.WriteLine("Initialising Extensions Scripting Module"); | 72 | System.Console.WriteLine("Initialising Extensions Scripting Module"); |
73 | m_scene = scene; | 73 | m_scene = scene; |
74 | 74 | ||
75 | m_scene.RegisterAPIMethod("API_CompileExtensionScript", new ModuleAPIMethod1<bool, string>(Compile)); | 75 | m_scene.RegisterAPIMethod("API_CompileExtensionScript", new ModuleAPIMethod1<bool, string>(Compile)); |
76 | m_scene.RegisterAPIMethod("API_AddExtensionScript", new ModuleAPIMethod1<bool, IScript>(AddPreCompiledScript)); | 76 | m_scene.RegisterAPIMethod("API_AddExtensionScript", new ModuleAPIMethod1<bool, IScript>(AddPreCompiledScript)); |
77 | } | 77 | } |
78 | 78 | ||
79 | public void PostInitialise() | 79 | public void PostInitialise() |
@@ -91,6 +91,11 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
91 | return "ExtensionsScriptingModule"; | 91 | return "ExtensionsScriptingModule"; |
92 | } | 92 | } |
93 | 93 | ||
94 | public bool IsSharedModule() | ||
95 | { | ||
96 | return false; | ||
97 | } | ||
98 | |||
94 | public bool Compile(string filename) | 99 | public bool Compile(string filename) |
95 | { | 100 | { |
96 | foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers) | 101 | foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers) |
@@ -121,7 +126,7 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
121 | 126 | ||
122 | public bool AddPreCompiledScript(IScript script) | 127 | public bool AddPreCompiledScript(IScript script) |
123 | { | 128 | { |
124 | MainLog.Instance.Verbose("Loading script " + script.Name); | 129 | MainLog.Instance.Verbose("Loading script " + script.Name); |
125 | ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. | 130 | ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. |
126 | script.Initialise(scriptInfo); | 131 | script.Initialise(scriptInfo); |
127 | scripts.Add(script); | 132 | scripts.Add(script); |
@@ -132,7 +137,7 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
132 | 137 | ||
133 | interface IScriptCompiler | 138 | interface IScriptCompiler |
134 | { | 139 | { |
135 | Dictionary<string,IScript> compile(string filename); | 140 | Dictionary<string, IScript> compile(string filename); |
136 | string FileExt(); | 141 | string FileExt(); |
137 | } | 142 | } |
138 | } | 143 | } |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs index f80898b..a7cce9f 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs | |||
@@ -628,5 +628,8 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
628 | int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide); | 628 | int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide); |
629 | //wiki list llGetParcelDetails(vector pos, list params) | 629 | //wiki list llGetParcelDetails(vector pos, list params) |
630 | List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param); | 630 | List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param); |
631 | |||
632 | //OpenSim functions | ||
633 | string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer); | ||
631 | } | 634 | } |
632 | } | 635 | } |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs index 3b7bd7b..9495888 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs | |||
@@ -25,10 +25,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
25 | DataTypes.Add("null", "null"); | 25 | DataTypes.Add("null", "null"); |
26 | 26 | ||
27 | } | 27 | } |
28 | 28 | ||
29 | |||
30 | |||
31 | |||
32 | public string Convert(string Script) | 29 | public string Convert(string Script) |
33 | { | 30 | { |
34 | string Return = ""; | 31 | string Return = ""; |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs index 90004b5..63f7260 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs | |||
@@ -465,8 +465,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
465 | public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) { return m_LSL_Functions.llGetParcelMaxPrims(pos, sim_wide); } | 465 | public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) { return m_LSL_Functions.llGetParcelMaxPrims(pos, sim_wide); } |
466 | public List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param) { return m_LSL_Functions.llGetParcelDetails(pos, param); } | 466 | public List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param) { return m_LSL_Functions.llGetParcelDetails(pos, param); } |
467 | 467 | ||
468 | 468 | // | |
469 | 469 | // OpenSim Functions | |
470 | // | ||
471 | public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer) { return m_LSL_Functions.osSetDynamicTextureURL(dynamicID, contentType, url, extraParams, timer); } | ||
470 | 472 | ||
471 | // LSL CONSTANTS | 473 | // LSL CONSTANTS |
472 | public const int TRUE = 1; | 474 | public const int TRUE = 1; |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs index 493a063..5d34229 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs | |||
@@ -4,6 +4,7 @@ using System.Text; | |||
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | using OpenSim.Region.Environment.Scenes; | 5 | using OpenSim.Region.Environment.Scenes; |
6 | using OpenSim.Region.Environment.Scenes.Scripting; | 6 | using OpenSim.Region.Environment.Scenes.Scripting; |
7 | using OpenSim.Region.Environment.Interfaces; | ||
7 | using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; | 8 | using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; |
8 | using OpenSim.Region.ScriptEngine.Common; | 9 | using OpenSim.Region.ScriptEngine.Common; |
9 | using OpenSim.Framework.Console; | 10 | using OpenSim.Framework.Console; |
@@ -650,6 +651,24 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
650 | public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) { return 0; } | 651 | public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) { return 0; } |
651 | public List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param) { return new List<string>(); } | 652 | public List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param) { return new List<string>(); } |
652 | 653 | ||
654 | // | ||
655 | // OpenSim functions | ||
656 | // | ||
657 | public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer) | ||
658 | { | ||
659 | if (dynamicID == "") | ||
660 | { | ||
661 | IDynamicTextureManager textureManager = this.World.RequestModuleInterface<IDynamicTextureManager>(); | ||
662 | LLUUID createdTexture = textureManager.AddDynamicTextureURL(World.RegionInfo.SimUUID, this.m_host.UUID, contentType, url, extraParams, timer); | ||
663 | return createdTexture.ToStringHyphenated(); | ||
664 | } | ||
665 | else | ||
666 | { | ||
667 | //TODO update existing dynamic textures | ||
668 | } | ||
669 | |||
670 | return LLUUID.Zero.ToStringHyphenated(); | ||
671 | } | ||
653 | 672 | ||
654 | } | 673 | } |
655 | } | 674 | } |