From bfd36e2e836f92539e68bba077104d5016c5bf8b Mon Sep 17 00:00:00 2001 From: MW Date: Tue, 4 Sep 2007 13:43:56 +0000 Subject: 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 " 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) --- .../Framework/Communications/Cache/AssetCache.cs | 7 +- OpenSim/Region/Application/OpenSimMain.cs | 266 ++++++++++++--------- .../Interfaces/IDynamicTextureManager.cs | 26 ++ .../Region/Environment/Interfaces/IRegionModule.cs | 1 + OpenSim/Region/Environment/Interfaces/ISimChat.cs | 12 + OpenSim/Region/Environment/ModuleLoader.cs | 74 ++++-- .../Environment/Modules/AssetDownloadModule.cs | 5 + .../Environment/Modules/AvatarProfilesModule.cs | 10 + OpenSim/Region/Environment/Modules/ChatModule.cs | 11 +- .../Environment/Modules/DynamicTextureModule.cs | 136 +++++++++++ OpenSim/Region/Environment/Modules/EmailModule.cs | 10 + .../Region/Environment/Modules/FriendsModule.cs | 5 + OpenSim/Region/Environment/Modules/GroupsModule.cs | 5 + .../Environment/Modules/InstantMessageModule.cs | 5 + .../Region/Environment/Modules/InventoryModule.cs | 5 + .../Environment/Modules/ScriptsHttpRequests.cs | 10 + .../Region/Environment/Modules/TeleportModule.cs | 10 + .../Environment/Modules/TextureDownloadModule.cs | 5 + OpenSim/Region/Environment/Modules/XferModule.cs | 5 + .../Environment/Scenes/Scene.PacketHandlers.cs | 53 +--- OpenSim/Region/Environment/Scenes/Scene.cs | 137 ++++++++--- .../Region/Examples/SimpleApp/MyNpcCharacter.cs | 9 +- OpenSim/Region/Examples/SimpleApp/Program.cs | 30 ++- .../Region/ExtensionsScriptModule/ScriptManager.cs | 15 +- .../Common/LSL_BuiltIn_Commands_Interface.cs | 3 + .../DotNetEngine/Compiler/LSL/LSL2CSConverter.cs | 5 +- .../DotNetEngine/Compiler/LSL/LSL_BaseClass.cs | 6 +- .../Compiler/Server_API/LSL_BuiltIn_Commands.cs | 19 ++ 28 files changed, 659 insertions(+), 226 deletions(-) create mode 100644 OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs create mode 100644 OpenSim/Region/Environment/Interfaces/ISimChat.cs create mode 100644 OpenSim/Region/Environment/Modules/DynamicTextureModule.cs create mode 100644 OpenSim/Region/Environment/Modules/EmailModule.cs create mode 100644 OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs create mode 100644 OpenSim/Region/Environment/Modules/TeleportModule.cs 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 public void AddAsset(AssetBase asset) { - // Console.WriteLine("adding asset " + asset.FullID.ToStringHyphenated()); + System.Console.WriteLine("adding asset " + asset.FullID.ToStringHyphenated()); if (asset.Type == 0) { //Console.WriteLine("which is a texture"); @@ -161,6 +161,11 @@ namespace OpenSim.Framework.Communications.Caches this.Textures.Add(textur.FullID, textur); this._assetServer.UploadNewAsset(asset); } + else + { + TextureImage textur = new TextureImage(asset); + this.Textures[asset.FullID] = textur; + } } else { 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; using OpenSim.Region.Communications.OGS1; using OpenSim.Framework.Communications.Caches; using OpenSim.Region.Environment.Scenes; +using OpenSim.Region.Environment.Modules; using OpenSim.Region.Environment; using System.Text; using System.Collections.Generic; @@ -77,11 +78,17 @@ namespace OpenSim private string m_logFilename = ("region-console.log"); private bool m_permissions = false; + private bool m_DefaultModules = true; + private string m_exceptModules = ""; + private bool m_DefaultSharedModules = true; + private string m_exceptSharedModules = ""; + private bool standaloneAuthenticate = false; private string standaloneWelcomeMessage = null; private string standaloneInventoryPlugin = ""; private string standaloneUserPlugin = ""; - + + private Scene m_consoleRegion = null; public ConsoleCommand CreateAccount = null; @@ -104,12 +111,10 @@ namespace OpenSim } ReadConfigSettings(startupSource); - } protected void ReadConfigSettings(IConfigSource configSource) { - m_networkServersInfo = new NetworkServersInfo(); m_sandbox = !configSource.Configs["Startup"].GetBoolean("gridmode", false); m_physicsEngine = configSource.Configs["Startup"].GetString("physics", "basicphysics"); @@ -122,6 +127,11 @@ namespace OpenSim m_scriptEngine = configSource.Configs["Startup"].GetString("script_engine", "DotNetEngine"); + m_DefaultModules = configSource.Configs["Startup"].GetBoolean("default_modules", true); + m_DefaultSharedModules = configSource.Configs["Startup"].GetBoolean("default_shared_modules", true); + m_exceptModules = configSource.Configs["Startup"].GetString("except_modules", ""); + m_exceptSharedModules = configSource.Configs["Startup"].GetString("except_shared_modules", ""); + standaloneAuthenticate = configSource.Configs["StandAlone"].GetBoolean("accounts_authenticate", false); standaloneWelcomeMessage = configSource.Configs["StandAlone"].GetString("welcome_message", "Welcome to OpenSim"); standaloneInventoryPlugin = configSource.Configs["StandAlone"].GetString("inventory_plugin", "OpenSim.Framework.Data.SQLite.dll"); @@ -178,6 +188,8 @@ namespace OpenSim } m_moduleLoader = new ModuleLoader(); + MainLog.Instance.Verbose("Loading Shared Modules"); + m_moduleLoader.LoadDefaultSharedModules(m_exceptSharedModules); // Load all script engines found OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader ScriptEngineLoader = new OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader(m_log); @@ -191,6 +203,10 @@ namespace OpenSim UDPServer udpServer; Scene scene = SetupScene(regionInfo, out udpServer); + m_moduleLoader.InitialiseSharedModules(scene); + MainLog.Instance.Verbose("Loading Region's Modules"); + m_moduleLoader.CreateDefaultModules(scene, m_exceptModules); + scene.SetModuleInterfaces(); // Check if we have a script engine to load if (m_scriptEngine != null && m_scriptEngine != "") @@ -211,6 +227,9 @@ namespace OpenSim m_regionData.Add(regionInfo); } + m_moduleLoader.PostInitialise(); + m_moduleLoader.ClearCache(); + // Start UDP servers for (int i = 0; i < m_udpServers.Count; i++) { @@ -352,135 +371,154 @@ namespace OpenSim /// Additional arguments passed to the command public void RunCmd(string command, string[] cmdparams) { - switch (command) + if ((m_consoleRegion == null) || (command == "exit-region")) { - case "help": - m_log.Error("alert - send alert to a designated user or all users."); - m_log.Error(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive."); - m_log.Error(" alert general [Message] - send an alert to all users."); - m_log.Error("backup - trigger a simulator backup"); - m_log.Error("load-xml [filename] - load prims from XML"); - m_log.Error("save-xml [filename] - save prims to XML"); - m_log.Error("script - manually trigger scripts? or script commands?"); - m_log.Error("show uptime - show simulator startup and uptime."); - m_log.Error("show users - show info about connected users."); - m_log.Error("shutdown - disconnect all clients and shutdown."); - m_log.Error("terrain help - show help for terrain commands."); - m_log.Error("quit - equivalent to shutdown."); - break; - - case "show": - if (cmdparams.Length > 0) - { - Show(cmdparams[0]); - } - break; - - case "save-xml": - if (cmdparams.Length > 0) - { - m_localScenes[0].SavePrimsToXml(cmdparams[0]); - } - else - { - m_localScenes[0].SavePrimsToXml("test.xml"); - } - break; + switch (command) + { + case "help": + m_log.Error("alert - send alert to a designated user or all users."); + m_log.Error(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive."); + m_log.Error(" alert general [Message] - send an alert to all users."); + m_log.Error("backup - trigger a simulator backup"); + m_log.Error("load-xml [filename] - load prims from XML"); + m_log.Error("save-xml [filename] - save prims to XML"); + m_log.Error("script - manually trigger scripts? or script commands?"); + m_log.Error("show uptime - show simulator startup and uptime."); + m_log.Error("show users - show info about connected users."); + m_log.Error("shutdown - disconnect all clients and shutdown."); + m_log.Error("terrain help - show help for terrain commands."); + m_log.Error("quit - equivalent to shutdown."); + break; + + case "show": + if (cmdparams.Length > 0) + { + Show(cmdparams[0]); + } + break; - case "load-xml": - if (cmdparams.Length > 0) - { - m_localScenes[0].LoadPrimsFromXml(cmdparams[0]); - } - else - { - m_localScenes[0].LoadPrimsFromXml("test.xml"); - } - break; + case "save-xml": + if (cmdparams.Length > 0) + { + m_localScenes[0].SavePrimsToXml(cmdparams[0]); + } + else + { + m_localScenes[0].SavePrimsToXml("test.xml"); + } + break; - case "terrain": - string result = ""; - foreach (Scene scene in m_localScenes) - { - if (!scene.Terrain.RunTerrainCmd(cmdparams, ref result, scene.RegionInfo.RegionName)) + case "load-xml": + if (cmdparams.Length > 0) { - m_log.Error(result); + m_localScenes[0].LoadPrimsFromXml(cmdparams[0]); } - } - break; - case "terrain-sim": - string result2 = ""; - foreach (Scene scene in m_localScenes) - { - if (scene.RegionInfo.RegionName.ToLower() == cmdparams[0].ToLower()) + else { - string[] tmpCmdparams = new string[cmdparams.Length - 1]; - cmdparams.CopyTo(tmpCmdparams, 1); + m_localScenes[0].LoadPrimsFromXml("test.xml"); + } + break; - if (!scene.Terrain.RunTerrainCmd(tmpCmdparams, ref result2, scene.RegionInfo.RegionName)) + case "terrain": + string result = ""; + foreach (Scene scene in m_localScenes) + { + if (!scene.Terrain.RunTerrainCmd(cmdparams, ref result, scene.RegionInfo.RegionName)) { - m_log.Error(result2); + m_log.Error(result); } } - } - break; - case "script": - foreach (Scene scene in m_localScenes) - { - scene.SendCommandToScripts(cmdparams); - } - break; + break; + case "terrain-sim": + string result2 = ""; + foreach (Scene scene in m_localScenes) + { + if (scene.RegionInfo.RegionName.ToLower() == cmdparams[0].ToLower()) + { + string[] tmpCmdparams = new string[cmdparams.Length - 1]; + cmdparams.CopyTo(tmpCmdparams, 1); - case "command-script": - if (cmdparams.Length > 0) - { - RunCommandScript(cmdparams[0]); - } - break; + if (!scene.Terrain.RunTerrainCmd(tmpCmdparams, ref result2, scene.RegionInfo.RegionName)) + { + m_log.Error(result2); + } + } + } + break; + case "script": + foreach (Scene scene in m_localScenes) + { + scene.SendCommandToScripts(cmdparams); + } + break; - case "permissions": - // Treats each user as a super-admin when disabled - foreach (Scene scene in m_localScenes) - { - if (Convert.ToBoolean(cmdparams[0])) - scene.PermissionsMngr.EnablePermissions(); - else - scene.PermissionsMngr.DisablePermissions(); - } - break; + case "command-script": + if (cmdparams.Length > 0) + { + RunCommandScript(cmdparams[0]); + } + break; - case "backup": - foreach (Scene scene in m_localScenes) - { - scene.Backup(); - } - break; + case "permissions": + // Treats each user as a super-admin when disabled + foreach (Scene scene in m_localScenes) + { + if (Convert.ToBoolean(cmdparams[0])) + scene.PermissionsMngr.EnablePermissions(); + else + scene.PermissionsMngr.DisablePermissions(); + } + break; - case "alert": - foreach (Scene scene in m_localScenes) - { - scene.HandleAlertCommand(cmdparams); - } - break; + case "backup": + foreach (Scene scene in m_localScenes) + { + scene.Backup(); + } + break; - case "create": - if (CreateAccount != null) - { - CreateAccount(cmdparams); - } - break; + case "alert": + foreach (Scene scene in m_localScenes) + { + scene.HandleAlertCommand(cmdparams); + } + break; - case "set-time": - break; + case "create": + if (CreateAccount != null) + { + CreateAccount(cmdparams); + } + break; - case "quit": - case "shutdown": - Shutdown(); - break; + case "quit": + case "shutdown": + Shutdown(); + break; - default: - m_log.Error("Unknown command"); - break; + case "change-region": + foreach (Scene scene in m_localScenes) + { + if (scene.RegionInfo.RegionName.ToLower() == cmdparams[0].ToLower()) + { + m_consoleRegion = scene; + } + } + break; + + case "exit-region": + m_consoleRegion = null; + break; + + default: + m_log.Error("Unknown command"); + break; + } + } + else + { + //let the scene/region handle the command directly. + m_consoleRegion.ProcessConsoleCmd(command, cmdparams); } } 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 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using libsecondlife; + +namespace OpenSim.Region.Environment.Interfaces +{ + public interface IDynamicTextureManager + { + void RegisterRender(string handleType, IDynamicTextureRender render); + void ReturnData(LLUUID id, byte[] data); + LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams, int updateTimer); + } + + public interface IDynamicTextureRender + { + string GetName(); + string GetContentType(); + bool SupportsAsynchronous(); + byte[] ConvertUrl(string url, string extraParams); + byte[] ConvertStream(Stream data, string extraParams); + bool AsyncConvertUrl(LLUUID id, string url, string extraParams); + bool AsyncConvertStream(LLUUID id, Stream data, string extraParams); + } +} 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 void PostInitialise(); void CloseDown(); string GetName(); + bool IsSharedModule(); } } 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 @@ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; + +namespace OpenSim.Region.Environment.Interfaces +{ + public interface ISimChat + { + void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); + } +} 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 public Dictionary LoadedAssemblys = new Dictionary(); + public List LoadedModules = new List(); + public Dictionary LoadedSharedModules = new Dictionary(); + public ModuleLoader() { } /// - /// Really just a test method for loading a set of currently internal modules + /// Should have a module factory? /// /// - public void CreateDefaultModules(Scene scene) + public void CreateDefaultModules(Scene scene, string exceptModules) { - //Testing IRegionModule ideas XferModule xferManager = new XferModule(); xferManager.Initialise(scene); scene.AddModule(xferManager.GetName(), xferManager); + LoadedModules.Add(xferManager); ChatModule chatModule = new ChatModule(); chatModule.Initialise(scene); scene.AddModule(chatModule.GetName(), chatModule); + LoadedModules.Add(chatModule); AvatarProfilesModule avatarProfiles = new AvatarProfilesModule(); avatarProfiles.Initialise(scene); scene.AddModule(avatarProfiles.GetName(), avatarProfiles); + LoadedModules.Add(avatarProfiles); - this.LoadModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene); + this.LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene); + } - // Post Initialise Modules, which most likely shouldn't be here - // but should rather be in a separate method that is called after all modules are loaded/created/intialised - xferManager.PostInitialise(); - // chatModule.PostInitialise(); //for now leave this disabled as it would start up a partially working irc bot - avatarProfiles.PostInitialise(); + public void LoadDefaultSharedModules(string exceptModules) + { + DynamicTextureModule dynamicModule = new DynamicTextureModule(); + this.LoadedSharedModules.Add(dynamicModule.GetName(), dynamicModule); + } + + public void InitialiseSharedModules(Scene scene) + { + foreach (IRegionModule module in this.LoadedSharedModules.Values) + { + module.Initialise(scene); + scene.AddModule(module.GetName(), module); //should be doing this? + } } /// @@ -53,18 +67,33 @@ namespace OpenSim.Region.Environment /// /// /// - public void LoadSharedModule(string dllName, string moduleName, Scene scene) + public void LoadSharedModule(string dllName, string moduleName) { + IRegionModule module = this.LoadModule(dllName, moduleName); + if (module != null) + { + this.LoadedSharedModules.Add(module.GetName(), module); + } + } + public void LoadRegionModule(string dllName, string moduleName, Scene scene) + { + IRegionModule module = this.LoadModule(dllName, moduleName); + if (module != null) + { + module.Initialise(scene); + scene.AddModule(module.GetName(), module); + LoadedModules.Add(module); + } } /// - /// Loads a external Module (if not already loaded) and creates a new instance of it for the passed Scene. + /// Loads a external Module (if not already loaded) and creates a new instance of it. /// /// /// /// - public void LoadModule(string dllName, string moduleName, Scene scene) + public IRegionModule LoadModule(string dllName, string moduleName) { Assembly pluginAssembly = null; if (LoadedAssemblys.ContainsKey(dllName)) @@ -97,13 +126,26 @@ namespace OpenSim.Region.Environment } pluginAssembly = null; - if (module.GetName() == moduleName) + if ((module != null ) || (module.GetName() == moduleName)) { - module.Initialise(scene); - scene.AddModule(moduleName, module); - module.PostInitialise(); //shouldn't be done here + return module; + } + + return null; + + } + + public void PostInitialise() + { + foreach (IRegionModule module in this.LoadedSharedModules.Values) + { + module.PostInitialise(); } + foreach (IRegionModule module in this.LoadedModules) + { + module.PostInitialise(); + } } 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 return "AssetDownloadModule"; } + public bool IsSharedModule() + { + return false; + } + public void NewClient(IClientAPI client) { } 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 return "AvatarProfilesModule"; } + public bool IsSharedModule() + { + return false; + } + public void NewClient(IClientAPI client) { client.OnRequestAvatarProperties += RequestAvatarProperty; } + public void RemoveClient(IClientAPI client) + { + client.OnRequestAvatarProperties -= RequestAvatarProperty; + } + /// /// /// 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; namespace OpenSim.Region.Environment.Modules { - public class ChatModule : IRegionModule + public class ChatModule : IRegionModule, ISimChat { private Scene m_scene; @@ -45,11 +45,12 @@ namespace OpenSim.Region.Environment.Modules m_scene = scene; m_scene.EventManager.OnNewClient += NewClient; - //should register a optional API Method, so other modules can send chat messages using this module + m_scene.RegisterModuleInterface(this); } public void PostInitialise() { + /* try { m_irc = new TcpClient(m_server, m_port); @@ -75,6 +76,7 @@ namespace OpenSim.Region.Environment.Modules { Console.WriteLine(e.ToString()); } + */ } public void CloseDown() @@ -89,6 +91,11 @@ namespace OpenSim.Region.Environment.Modules return "ChatModule"; } + public bool IsSharedModule() + { + return false; + } + public void NewClient(IClientAPI client) { 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 @@ +using System.Text; +using System.Net; +using System.Net.Sockets; +using System.Threading; +using System.IO; +using System.Collections.Generic; +using libsecondlife; +using OpenJPEGNet; +using OpenSim.Region.Environment.Scenes; +using OpenSim.Region.Environment.Interfaces; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Utilities; +using OpenSim.Framework.Console; +using OpenSim.Framework.Types; + +namespace OpenSim.Region.Environment.Modules +{ + public class DynamicTextureModule :IRegionModule, IDynamicTextureManager + { + private Dictionary RegisteredScenes = new Dictionary(); + private Dictionary RenderPlugins= new Dictionary(); + private Dictionary Updaters = new Dictionary(); + + public void Initialise(Scene scene) + { + if (!RegisteredScenes.ContainsKey(scene.RegionInfo.SimUUID)) + { + RegisteredScenes.Add(scene.RegionInfo.SimUUID, scene); + scene.RegisterModuleInterface(this); + } + } + + public void PostInitialise() + { + + } + + public void CloseDown() + { + } + + public string GetName() + { + return "DynamicTextureModule"; + } + + public bool IsSharedModule() + { + return true; + } + + public void RegisterRender(string handleType, IDynamicTextureRender render) + { + if (!RenderPlugins.ContainsKey(handleType)) + { + RenderPlugins.Add(handleType, render); + } + } + + public void ReturnData(LLUUID id, byte[] data) + { + if (Updaters.ContainsKey(id)) + { + DynamicTextureUpdater updater = Updaters[id]; + if (RegisteredScenes.ContainsKey(updater.SimUUID)) + { + Scene scene = RegisteredScenes[updater.SimUUID]; + updater.DataReceived(data, scene); + } + } + } + + public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams, int updateTimer) + { + System.Console.WriteLine("dynamic texture being created " + url + " of type " + contentType); + if (this.RenderPlugins.ContainsKey(contentType)) + { + DynamicTextureUpdater updater = new DynamicTextureUpdater(); + updater.SimUUID = simID; + updater.PrimID = primID; + updater.ContentType = contentType; + updater.Url = url; + updater.UpdateTimer = updateTimer; + updater.UpdaterID = LLUUID.Random(); + updater.Params = extraParams; + + if (!this.Updaters.ContainsKey(updater.UpdaterID)) + { + Updaters.Add(updater.UpdaterID, updater); + } + + RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams); + return updater.UpdaterID; + } + return LLUUID.Zero; + } + + public class DynamicTextureUpdater + { + public LLUUID SimUUID; + public LLUUID UpdaterID; + public string ContentType; + public string Url; + public Stream StreamData; + public LLUUID PrimID; + public int UpdateTimer; + public LLUUID LastAssetID; + public string Params; + + public DynamicTextureUpdater() + { + LastAssetID = LLUUID.Zero; + UpdateTimer = 0; + StreamData = null; + } + + public void DataReceived(byte[] data, Scene scene) + { + //TODO delete the last asset(data), if it was a dynamic texture + + AssetBase asset = new AssetBase(); + asset.FullID = LLUUID.Random(); + asset.Data = data; + asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); + asset.Type = 0; + scene.commsManager.AssetCache.AddAsset(asset); + + this.LastAssetID = asset.FullID; + + SceneObjectPart part = scene.GetSceneObjectPart(PrimID); + part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes(); + part.ScheduleFullUpdate(); + } + } + } +} 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 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Region.Environment.Modules +{ + class EmailModule + { + } +} 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 { return "FriendsModule"; } + + public bool IsSharedModule() + { + return false; + } } } 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 { return "GroupsModule"; } + + public bool IsSharedModule() + { + return false; + } } } 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 { return "InstantMessageModule"; } + + public bool IsSharedModule() + { + return false; + } } } 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 { return "InventoryModule"; } + + public bool IsSharedModule() + { + return false; + } } } 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 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Region.Environment.Modules +{ + class ScriptsHttpRequests + { + } +} 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 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Region.Environment.Modules +{ + class TeleportModule + { + } +} 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 return "TextureDownloadModule"; } + public bool IsSharedModule() + { + return false; + } + public void NewClient(IClientAPI client) { } 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 return "XferModule"; } + public bool IsSharedModule() + { + return false; + } + public void NewClient(IClientAPI client) { 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; using OpenSim.Framework.Communications.Caches; using OpenSim.Framework.Data; using OpenSim.Framework.Utilities; +using OpenSim.Region.Environment.Interfaces; namespace OpenSim.Region.Environment.Scenes { @@ -94,7 +95,7 @@ namespace OpenSim.Region.Environment.Scenes } /// - /// Should be removed soon as the Chat modules should take over this function + /// /// /// /// @@ -103,56 +104,10 @@ namespace OpenSim.Region.Environment.Scenes /// public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { - ScenePresence avatar = null; - if (this.Avatars.ContainsKey(fromAgentID)) + if (m_simChatModule != null) { - avatar = this.Avatars[fromAgentID]; - fromPos = avatar.AbsolutePosition; - fromName = avatar.Firstname + " " + avatar.Lastname; - avatar = null; + m_simChatModule.SimChat(message, type, fromPos, fromName, fromAgentID); } - - this.ForEachScenePresence(delegate(ScenePresence presence) - { - int dis = -1000; - if (this.Avatars.ContainsKey(presence.ControllingClient.AgentId)) - { - avatar = this.Avatars[presence.ControllingClient.AgentId]; - dis = (int)avatar.AbsolutePosition.GetDistanceTo(fromPos); - } - - switch (type) - { - case 0: // Whisper - if ((dis < 10) && (dis > -10)) - { - //should change so the message is sent through the avatar rather than direct to the ClientView - presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName, - fromAgentID); - } - break; - case 1: // Say - if ((dis < 30) && (dis > -30)) - { - //Console.WriteLine("sending chat"); - presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName, - fromAgentID); - } - break; - case 2: // Shout - if ((dis < 100) && (dis > -100)) - { - presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName, - fromAgentID); - } - break; - - case 0xff: // Broadcast - presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName, - fromAgentID); - break; - } - }); } /// 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 protected StorageManager storageManager; protected AgentCircuitManager authenticateHandler; protected RegionCommsListener regionCommsHost; - protected CommunicationsManager commsManager; - // protected XferManager xferManager; + public CommunicationsManager commsManager; + // protected XferManager xferManager; protected Dictionary capsHandlers = new Dictionary(); protected BaseHttpServer httpListener; protected Dictionary Modules = new Dictionary(); - protected Dictionary APIMethods = new Dictionary(); + public Dictionary ModuleInterfaces = new Dictionary(); + protected Dictionary ModuleAPIMethods = new Dictionary(); - //API method Delegates + //API method Delegates and interfaces // this most likely shouldn't be handled as a API method like this, but doing it for testing purposes - public ModuleAPIMethod2AddXferFile = null; - + public ModuleAPIMethod2 AddXferFile = null; + + private ISimChat m_simChatModule = null; + #region Properties public AgentCircuitManager AuthenticateHandler @@ -152,7 +155,7 @@ namespace OpenSim.Region.Environment.Scenes AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer, ModuleLoader moduleLoader) { updateLock = new Mutex(false); - + m_moduleLoader = moduleLoader; authenticateHandler = authen; commsManager = commsMan; @@ -169,9 +172,6 @@ namespace OpenSim.Region.Environment.Scenes m_eventManager = new EventManager(); m_permissionManager = new PermissionManager(this); - MainLog.Instance.Verbose("Loading Region Modules"); - m_moduleLoader.CreateDefaultModules(this); - m_eventManager.OnParcelPrimCountAdd += m_LandManager.addPrimToLandPrimCounts; @@ -189,13 +189,15 @@ namespace OpenSim.Region.Environment.Scenes httpListener = httpServer; - SetMethodDelegates(); } #endregion - private void SetMethodDelegates() + public void SetModuleInterfaces() { + m_simChatModule = this.RequestModuleInterface(); + + //should change so it uses the module interface functions AddXferFile = (ModuleAPIMethod2)this.RequestAPIMethod("API_AddXferFile"); } @@ -526,7 +528,7 @@ namespace OpenSim.Region.Environment.Scenes MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); } - + /// /// Returns a new unallocated primitive ID @@ -635,12 +637,12 @@ namespace OpenSim.Region.Environment.Scenes //obj.RegenerateFullIDs(); AddEntity(obj); - SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); - rootPart.PhysActor = phyScene.AddPrim( - new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z), - new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), - new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, - rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); + SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); + rootPart.PhysActor = phyScene.AddPrim( + new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z), + new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), + new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, + rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); primCount++; } } @@ -692,7 +694,7 @@ namespace OpenSim.Region.Environment.Scenes protected virtual void SubscribeToClientEvents(IClientAPI client) { - // client.OnStartAnim += StartAnimation; + // client.OnStartAnim += StartAnimation; client.OnRegionHandShakeReply += SendLayerData; //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); client.OnModifyTerrain += ModifyTerrain; @@ -742,7 +744,7 @@ namespace OpenSim.Region.Environment.Scenes client.OnRezScript += RezScript; client.OnRemoveTaskItem += RemoveTaskInventory; - // client.OnRequestAvatarProperties += RequestAvatarProperty; + // client.OnRequestAvatarProperties += RequestAvatarProperty; client.OnGrabObject += ProcessObjectGrab; @@ -1071,13 +1073,12 @@ namespace OpenSim.Region.Environment.Scenes AgentCircuitData agent = remoteClient.RequestClientInfo(); agent.BaseFolder = LLUUID.Zero; agent.InventoryFolder = LLUUID.Zero; - // agent.startpos = new LLVector3(128, 128, 70); + // agent.startpos = new LLVector3(128, 128, 70); agent.startpos = position; agent.child = true; commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent); commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position, false); - //TODO: following line is hard coded to port 9000, really need to change this as soon as possible AgentCircuitData circuitdata = remoteClient.RequestClientInfo(); string capsPath = Util.GetCapsURL(remoteClient.AgentId); remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4), capsPath); @@ -1114,23 +1115,45 @@ namespace OpenSim.Region.Environment.Scenes } } + //following delegate methods will be removed, so use the interface methods (below these) public void RegisterAPIMethod(string name, object method) { - if (!this.APIMethods.ContainsKey(name)) + if (!this.ModuleAPIMethods.ContainsKey(name)) { - this.APIMethods.Add(name, method); + this.ModuleAPIMethods.Add(name, method); } } public object RequestAPIMethod(string name) { - if (this.APIMethods.ContainsKey(name)) + if (this.ModuleAPIMethods.ContainsKey(name)) { - return APIMethods[name]; + return ModuleAPIMethods[name]; } return false; } + public void RegisterModuleInterface( M mod) + { + //Console.WriteLine("registering module interface " + typeof(M)); + if (!this.ModuleInterfaces.ContainsKey(typeof(M))) + { + ModuleInterfaces.Add(typeof(M), mod); + } + } + + public T RequestModuleInterface() + { + if (ModuleInterfaces.ContainsKey(typeof(T))) + { + return (T)ModuleInterfaces[typeof(T)]; + } + else + { + return default(T); + } + } + public void SetTimePhase(int phase) { m_timePhase = phase; @@ -1205,6 +1228,49 @@ namespace OpenSim.Region.Environment.Scenes } #endregion + public void ProcessConsoleCmd(string command, string[] cmdparams) + { + switch (command) + { + case "save-xml": + if (cmdparams.Length > 0) + { + SavePrimsToXml(cmdparams[0]); + } + else + { + SavePrimsToXml("test.xml"); + } + break; + + case "load-xml": + if (cmdparams.Length > 0) + { + LoadPrimsFromXml(cmdparams[0]); + } + else + { + LoadPrimsFromXml("test.xml"); + } + break; + + case "set-time": + break; + + case "backup": + Backup(); + break; + + case "alert": + HandleAlertCommand(cmdparams); + break; + + default: + MainLog.Instance.Error("Unknown command: " + command); + break; + } + } + #region Script Engine private List ScriptEngines = new List(); public void AddScriptEngine(OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface ScriptEngine, LogBase m_logger) @@ -1248,5 +1314,22 @@ namespace OpenSim.Region.Environment.Scenes } return null; } + + public SceneObjectPart GetSceneObjectPart(LLUUID fullID) + { + bool hasPrim = false; + foreach (EntityBase ent in Entities.Values) + { + if (ent is SceneObjectGroup) + { + hasPrim = ((SceneObjectGroup)ent).HasChildPrim(fullID); + if (hasPrim != false) + { + return ((SceneObjectGroup)ent).GetChildPart(fullID); + } + } + } + return null; + } } } 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 private LLUUID myID = LLUUID.Random(); public MyNpcCharacter( EventManager eventManager ) { + // startPos = new LLVector3(128, (float)(Util.RandomClass.NextDouble()*100), 2); eventManager.OnFrame += Update; } + private LLVector3 startPos = new LLVector3(128, 128,2); public virtual LLVector3 StartPos { - get { return new LLVector3(128, 100, 2); } + get { return startPos; } set { } } @@ -122,9 +124,10 @@ namespace SimpleApp get { return "Annoying"; } } + private string lastName = "NPC" + Util.RandomClass.Next(1, 1000); public virtual string LastName { - get { return "NPC"; } + get { return lastName; } } public virtual void OutPacket(Packet newPack) { } @@ -203,7 +206,7 @@ namespace SimpleApp flyState = 0; } - if (count >= 40) + if (count >= 200) { if (OnChatFromViewer != null) { 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 @@ using System; +using System.Collections.Generic; using System.Net; using libsecondlife; using OpenSim.Framework; @@ -22,6 +23,7 @@ namespace SimpleApp { class Program : RegionApplicationBase, conscmd_callback { + private ModuleLoader m_moduleLoader; protected override LogBase CreateLog() { return new LogBase(null, "SimpleApp", this, false); @@ -59,8 +61,19 @@ namespace SimpleApp UDPServer udpServer; + m_moduleLoader = new ModuleLoader(); + m_moduleLoader.LoadDefaultSharedModules(""); + Scene scene = SetupScene(regionInfo, out udpServer); + + m_moduleLoader.InitialiseSharedModules(scene); + m_moduleLoader.CreateDefaultModules(scene, ""); + scene.SetModuleInterfaces(); + scene.StartTimer(); + + m_moduleLoader.PostInitialise(); + m_moduleLoader.ClearCache(); udpServer.ServerListener(); @@ -75,10 +88,21 @@ namespace SimpleApp ComplexObject complexObject = new ComplexObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(), pos + posOffset ); scene.AddEntity(complexObject); } - - MyNpcCharacter m_character = new MyNpcCharacter(scene.EventManager); - scene.AddNewClient(m_character, false); + + /*for (int i = 0; i < 500; i++) + { + MyNpcCharacter m_character = new MyNpcCharacter(scene.EventManager); + scene.AddNewClient(m_character, false); + } + + List avatars = scene.RequestAvatarList(); + foreach (ScenePresence avatar in avatars) + { + avatar.AbsolutePosition = new LLVector3((float)OpenSim.Framework.Utilities.Util.RandomClass.Next(100,200), (float)OpenSim.Framework.Utilities.Util.RandomClass.Next(30, 200), 2); + + }*/ + DirectoryInfo dirInfo = new DirectoryInfo( "." ); 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 { // Default Engines CSharpScriptEngine csharpCompiler = new CSharpScriptEngine(); - compilers.Add(csharpCompiler.FileExt(),csharpCompiler); + compilers.Add(csharpCompiler.FileExt(), csharpCompiler); JScriptEngine jscriptCompiler = new JScriptEngine(); compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler); @@ -72,8 +72,8 @@ namespace OpenSim.Region.ExtensionsScriptModule System.Console.WriteLine("Initialising Extensions Scripting Module"); m_scene = scene; - m_scene.RegisterAPIMethod("API_CompileExtensionScript", new ModuleAPIMethod1(Compile)); - m_scene.RegisterAPIMethod("API_AddExtensionScript", new ModuleAPIMethod1(AddPreCompiledScript)); + m_scene.RegisterAPIMethod("API_CompileExtensionScript", new ModuleAPIMethod1(Compile)); + m_scene.RegisterAPIMethod("API_AddExtensionScript", new ModuleAPIMethod1(AddPreCompiledScript)); } public void PostInitialise() @@ -91,6 +91,11 @@ namespace OpenSim.Region.ExtensionsScriptModule return "ExtensionsScriptingModule"; } + public bool IsSharedModule() + { + return false; + } + public bool Compile(string filename) { foreach (KeyValuePair compiler in compilers) @@ -121,7 +126,7 @@ namespace OpenSim.Region.ExtensionsScriptModule public bool AddPreCompiledScript(IScript script) { - MainLog.Instance.Verbose("Loading script " + script.Name); + MainLog.Instance.Verbose("Loading script " + script.Name); 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. script.Initialise(scriptInfo); scripts.Add(script); @@ -132,7 +137,7 @@ namespace OpenSim.Region.ExtensionsScriptModule interface IScriptCompiler { - Dictionary compile(string filename); + Dictionary compile(string filename); string FileExt(); } } 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 int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide); //wiki list llGetParcelDetails(vector pos, list params) List llGetParcelDetails(LSL_Types.Vector3 pos, List param); + + //OpenSim functions + string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer); } } 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 DataTypes.Add("null", "null"); } - - - - + public string Convert(string Script) { 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 public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) { return m_LSL_Functions.llGetParcelMaxPrims(pos, sim_wide); } public List llGetParcelDetails(LSL_Types.Vector3 pos, List param) { return m_LSL_Functions.llGetParcelDetails(pos, param); } - - + // + // OpenSim Functions + // + public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer) { return m_LSL_Functions.osSetDynamicTextureURL(dynamicID, contentType, url, extraParams, timer); } // LSL CONSTANTS 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; using libsecondlife; using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes.Scripting; +using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; using OpenSim.Region.ScriptEngine.Common; using OpenSim.Framework.Console; @@ -650,6 +651,24 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) { return 0; } public List llGetParcelDetails(LSL_Types.Vector3 pos, List param) { return new List(); } + // + // OpenSim functions + // + public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer) + { + if (dynamicID == "") + { + IDynamicTextureManager textureManager = this.World.RequestModuleInterface(); + LLUUID createdTexture = textureManager.AddDynamicTextureURL(World.RegionInfo.SimUUID, this.m_host.UUID, contentType, url, extraParams, timer); + return createdTexture.ToStringHyphenated(); + } + else + { + //TODO update existing dynamic textures + } + + return LLUUID.Zero.ToStringHyphenated(); + } } } -- cgit v1.1