public void Initialise(Scene scene, IConfigSource config) { IConfig windConfig = config.Configs["Wind"]; string desiredWindPlugin = m_dWindPluginName; if (windConfig != null) { m_enabled = windConfig.GetBoolean("enabled", true); m_frameUpdateRate = windConfig.GetInt("wind_update_rate", 150); // Determine which wind model plugin is desired if (windConfig.Contains("wind_plugin")) { desiredWindPlugin = windConfig.GetString("wind_plugin"); } } if (m_enabled) { m_log.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate); m_scene = scene; m_frame = 0; // Register all the Wind Model Plug-ins foreach (IWindModelPlugin windPlugin in AddinManager.GetExtensionObjects("/OpenSim/WindModule", false)) { m_log.InfoFormat("[WIND] Found Plugin: {0}", windPlugin.Name); m_availableWindPlugins.Add(windPlugin.Name, windPlugin); } // Check for desired plugin if (m_availableWindPlugins.ContainsKey(desiredWindPlugin)) { m_activeWindPlugin = m_availableWindPlugins[desiredWindPlugin]; m_log.InfoFormat("[WIND] {0} plugin found, initializing.", desiredWindPlugin); if (windConfig != null) { m_activeWindPlugin.Initialise(); m_activeWindPlugin.WindConfig(m_scene, windConfig); } } // if the plug-in wasn't found, default to no wind. if (m_activeWindPlugin == null) { m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", desiredWindPlugin); m_log.ErrorFormat("[WIND] Defaulting to no wind."); } // This one puts an entry in the main help screen m_scene.AddCommand(this, String.Empty, "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null); // This one enables the ability to type just the base command without any parameters m_scene.AddCommand(this, "wind", "", "", HandleConsoleCommand); // Get a list of the parameters for each plugin foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values) { m_scene.AddCommand(this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand); m_scene.AddCommand(this, String.Format("wind base wind_update_rate"), "Change the wind update rate.", "", HandleConsoleBaseCommand); foreach (KeyValuePair<string, string> kvp in windPlugin.WindParams()) { m_scene.AddCommand(this, String.Format("wind {0} {1}", windPlugin.Name, kvp.Key), String.Format("{0} : {1} - {2}", windPlugin.Name, kvp.Key, kvp.Value), "", HandleConsoleParamCommand); } } // Register event handlers for when Avatars enter the region, and frame ticks m_scene.EventManager.OnFrame += WindUpdate; m_scene.EventManager.OnMakeRootAgent += OnAgentEnteredRegion; // Register the wind module m_scene.RegisterModuleInterface<IWindModule>(this); // Generate initial wind values GenWindPos(); // Mark Module Ready for duty m_ready = true; } }
public void AddRegion(Scene scene) { if (!m_enabled) { return; } m_scene = scene; m_frame = 0; // Register all the Wind Model Plug-ins foreach (IWindModelPlugin windPlugin in AddinManager.GetExtensionObjects("/OpenSim/WindModule", false)) { m_log.InfoFormat("[WIND] Found Plugin: {0}", windPlugin.Name); m_availableWindPlugins.Add(windPlugin.Name, windPlugin); } // Check for desired plugin if (m_availableWindPlugins.ContainsKey(m_dWindPluginName)) { m_activeWindPlugin = m_availableWindPlugins[m_dWindPluginName]; m_log.InfoFormat("[WIND] {0} plugin found, initializing.", m_dWindPluginName); if (m_windConfig != null) { m_activeWindPlugin.Initialise(); m_activeWindPlugin.WindConfig(m_scene, m_windConfig); } } // if the plug-in wasn't found, default to no wind. if (m_activeWindPlugin == null) { m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", m_dWindPluginName); m_log.ErrorFormat("[WIND] Defaulting to no wind."); } // This one puts an entry in the main help screen // m_scene.AddCommand("Regions", this, "wind", "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null); // This one enables the ability to type just the base command without any parameters // m_scene.AddCommand("Regions", this, "wind", "", "", HandleConsoleCommand); // Get a list of the parameters for each plugin foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values) { // m_scene.AddCommand("Regions", this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand); m_scene.AddCommand( "Regions", this, "wind base wind_update_rate", "wind base wind_update_rate [<value>]", "Get or set the wind update rate.", "", HandleConsoleBaseCommand); foreach (KeyValuePair <string, string> kvp in windPlugin.WindParams()) { string windCommand = String.Format("wind {0} {1}", windPlugin.Name, kvp.Key); m_scene.AddCommand("Regions", this, windCommand, string.Format("{0} [<value>]", windCommand), kvp.Value, "", HandleConsoleParamCommand); } } // Register event handlers for when Avatars enter the region, and frame ticks m_scene.EventManager.OnFrame += WindUpdate; // Register the wind module m_scene.RegisterModuleInterface <IWindModule>(this); // Generate initial wind values GenWind(); // hopefully this will not be the same for all regions on same instance m_dataVersion = m_scene.AllocateIntId(); // Mark Module Ready for duty m_ready = true; }
public void AddRegion(IScene scene) { m_scene = scene; if (m_enabled) { //MainConsole.Instance.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate); m_frame = 0; // Register all the Wind Model Plug-ins foreach (IWindModelPlugin windPlugin in WhiteCoreModuleLoader.PickupModules<IWindModelPlugin>()) { //MainConsole.Instance.InfoFormat("[WIND] Found Plugin: {0}", windPlugin.Name); m_availableWindPlugins.Add(windPlugin.Name, windPlugin); } // Check for desired plugin if (m_availableWindPlugins.ContainsKey(desiredWindPlugin)) { m_activeWindPlugin = m_availableWindPlugins[desiredWindPlugin]; //MainConsole.Instance.InfoFormat("[WIND] {0} plugin found, initializing.", desiredWindPlugin); if (windConfig != null) { m_activeWindPlugin.Initialise(); m_activeWindPlugin.WindConfig(m_scene, windConfig); } } // if the plug-in wasn't found, default to no wind. if (m_activeWindPlugin == null) { MainConsole.Instance.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", desiredWindPlugin); MainConsole.Instance.ErrorFormat("[WIND] Defaulting to no wind."); } if (MainConsole.Instance != null) { // Get a list of the parameters for each plugin foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values) { MainConsole.Instance.Commands.AddCommand( String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand, true, false); MainConsole.Instance.Commands.AddCommand( String.Format("wind base wind_update_rate"), "Change the wind update rate.", "", HandleConsoleBaseCommand, true, false); foreach (KeyValuePair<string, string> kvp in windPlugin.WindParams()) { MainConsole.Instance.Commands.AddCommand( String.Format("wind {0} {1}", windPlugin.Name, kvp.Key), String.Format("{0} : {1} - {2}", windPlugin.Name, kvp.Key, kvp.Value), "", HandleConsoleParamCommand, true, false); } } } // Register event handlers for when Avatars enter the region, and frame ticks m_scene.EventManager.OnFrame += WindUpdate; m_scene.EventManager.OnMakeRootAgent += OnAgentEnteredRegion; // Register the wind module m_scene.RegisterModuleInterface<IWindModule>(this); // Generate initial wind values GenWindPos(); // Mark Module Ready for duty m_ready = true; } }
public void AddRegion(IScene scene) { m_scene = scene; if (m_enabled) { //MainConsole.Instance.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate); m_frame = 0; // Register all the Wind Model Plug-ins foreach (IWindModelPlugin windPlugin in AuroraModuleLoader.PickupModules <IWindModelPlugin>()) { //MainConsole.Instance.InfoFormat("[WIND] Found Plugin: {0}", windPlugin.Name); m_availableWindPlugins.Add(windPlugin.Name, windPlugin); } // Check for desired plugin if (m_availableWindPlugins.ContainsKey(desiredWindPlugin)) { m_activeWindPlugin = m_availableWindPlugins[desiredWindPlugin]; //MainConsole.Instance.InfoFormat("[WIND] {0} plugin found, initializing.", desiredWindPlugin); if (windConfig != null) { m_activeWindPlugin.Initialise(); m_activeWindPlugin.WindConfig(m_scene, windConfig); } } // if the plug-in wasn't found, default to no wind. if (m_activeWindPlugin == null) { MainConsole.Instance.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", desiredWindPlugin); MainConsole.Instance.ErrorFormat("[WIND] Defaulting to no wind."); } if (MainConsole.Instance != null) { // Get a list of the parameters for each plugin foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values) { MainConsole.Instance.Commands.AddCommand( String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand); MainConsole.Instance.Commands.AddCommand( String.Format("wind base wind_update_rate"), "Change the wind update rate.", "", HandleConsoleBaseCommand); foreach (KeyValuePair <string, string> kvp in windPlugin.WindParams()) { MainConsole.Instance.Commands.AddCommand( String.Format("wind {0} {1}", windPlugin.Name, kvp.Key), String.Format("{0} : {1} - {2}", windPlugin.Name, kvp.Key, kvp.Value), "", HandleConsoleParamCommand); } } } // Register event handlers for when Avatars enter the region, and frame ticks m_scene.EventManager.OnFrame += WindUpdate; m_scene.EventManager.OnMakeRootAgent += OnAgentEnteredRegion; // Register the wind module m_scene.RegisterModuleInterface <IWindModule>(this); // Generate initial wind values GenWindPos(); // Mark Module Ready for duty m_ready = true; } }
public void AddRegion(Scene scene) { if (!m_enabled) return; m_scene = scene; m_frame = 0; // Register all the Wind Model Plug-ins foreach (IWindModelPlugin windPlugin in AddinManager.GetExtensionObjects("/OpenSim/WindModule", false)) { m_log.InfoFormat("[WIND] Found Plugin: {0}", windPlugin.Name); m_availableWindPlugins.Add(windPlugin.Name, windPlugin); } // Check for desired plugin if (m_availableWindPlugins.ContainsKey(m_dWindPluginName)) { m_activeWindPlugin = m_availableWindPlugins[m_dWindPluginName]; m_log.InfoFormat("[WIND] {0} plugin found, initializing.", m_dWindPluginName); if (m_windConfig != null) { m_activeWindPlugin.Initialise(); m_activeWindPlugin.WindConfig(m_scene, m_windConfig); } } // if the plug-in wasn't found, default to no wind. if (m_activeWindPlugin == null) { m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", m_dWindPluginName); m_log.ErrorFormat("[WIND] Defaulting to no wind."); } // This one puts an entry in the main help screen // m_scene.AddCommand("Regions", this, "wind", "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null); // This one enables the ability to type just the base command without any parameters // m_scene.AddCommand("Regions", this, "wind", "", "", HandleConsoleCommand); // Get a list of the parameters for each plugin foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values) { // m_scene.AddCommand("Regions", this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand); m_scene.AddCommand( "Regions", this, "wind base wind_update_rate", "wind base wind_update_rate [<value>]", "Get or set the wind update rate.", "", HandleConsoleBaseCommand); foreach (KeyValuePair<string, string> kvp in windPlugin.WindParams()) { string windCommand = String.Format("wind {0} {1}", windPlugin.Name, kvp.Key); m_scene.AddCommand("Regions", this, windCommand, string.Format("{0} [<value>]", windCommand), kvp.Value, "", HandleConsoleParamCommand); } } // Register event handlers for when Avatars enter the region, and frame ticks m_scene.EventManager.OnFrame += WindUpdate; m_scene.EventManager.OnMakeRootAgent += OnAgentEnteredRegion; // Register the wind module m_scene.RegisterModuleInterface<IWindModule>(this); // Generate initial wind values GenWindPos(); // Mark Module Ready for duty m_ready = true; }
public void Initialise(Scene scene, IConfigSource config) { IConfig windConfig = config.Configs["Wind"]; string desiredWindPlugin = m_dWindPluginName; if (windConfig != null) { m_enabled = windConfig.GetBoolean("enabled", true); m_frameUpdateRate = windConfig.GetInt("wind_update_rate", 150); // Determine which wind model plugin is desired if (windConfig.Contains("wind_plugin")) { desiredWindPlugin = windConfig.GetString("wind_plugin"); } } if (m_enabled) { m_log.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate); m_scene = scene; m_frame = 0; // Register all the Wind Model Plug-ins foreach (IWindModelPlugin windPlugin in AddinManager.GetExtensionObjects("/OpenSim/WindModule", false)) { m_log.InfoFormat("[WIND] Found Plugin: {0}", windPlugin.Name); m_availableWindPlugins.Add(windPlugin.Name, windPlugin); } // Check for desired plugin if (m_availableWindPlugins.ContainsKey(desiredWindPlugin)) { m_activeWindPlugin = m_availableWindPlugins[desiredWindPlugin]; m_log.InfoFormat("[WIND] {0} plugin found, initializing.", desiredWindPlugin); if (windConfig != null) { m_activeWindPlugin.Initialise(); m_activeWindPlugin.WindConfig(m_scene, windConfig); } } // if the plug-in wasn't found, default to no wind. if (m_activeWindPlugin == null) { m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", desiredWindPlugin); m_log.ErrorFormat("[WIND] Defaulting to no wind."); } // This one puts an entry in the main help screen // m_scene.AddCommand("Regions", this, "wind", "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null); // This one enables the ability to type just the base command without any parameters // m_scene.AddCommand("Regions", this, "wind", "", "", HandleConsoleCommand); // Get a list of the parameters for each plugin foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values) { // m_scene.AddCommand("Regions", this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand); m_scene.AddCommand( "Regions", this, "wind base wind_update_rate", "wind base wind_update_rate [<value>]", "Get or set the wind update rate.", "", HandleConsoleBaseCommand); foreach (KeyValuePair <string, string> kvp in windPlugin.WindParams()) { string windCommand = String.Format("wind {0} {1}", windPlugin.Name, kvp.Key); m_scene.AddCommand("Regions", this, windCommand, string.Format("{0} [<value>]", windCommand), kvp.Value, "", HandleConsoleParamCommand); } } // Register event handlers for when Avatars enter the region, and frame ticks m_scene.EventManager.OnFrame += WindUpdate; m_scene.EventManager.OnMakeRootAgent += OnAgentEnteredRegion; // Register the wind module m_scene.RegisterModuleInterface <IWindModule>(this); // Generate initial wind values GenWindPos(); // Mark Module Ready for duty m_ready = true; } }
public void Initialise(Scene scene, IConfigSource config) { string desiredWindPlugin = DEFAULT_WIND_PLUGIN; IConfig windConfig = config.Configs["Wind"]; if (windConfig != null) { m_enabled = windConfig.GetBoolean("enabled", true); m_frameUpdateRate = windConfig.GetInt("wind_update_rate", 150); // Determine which wind model plugin is desired if (windConfig.Contains("wind_plugin")) { desiredWindPlugin = windConfig.GetString("wind_plugin"); } } if (m_enabled) { m_log.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate); m_scene = scene; m_frame = 0; if (windConfig != null) { CompositionContainer moduleContainer = scene.ModuleContainer; IEnumerable <Lazy <object, object> > exportEnumerable = moduleContainer.GetExports(typeof(IPlugin), null, null); foreach (Lazy <object, object> lazyExport in exportEnumerable) { IDictionary <string, object> metadata = (IDictionary <string, object>)lazyExport.Metadata; object nameObj; if (metadata.TryGetValue("Name", out nameObj)) { string name = (string)nameObj; if (name.Equals(desiredWindPlugin, StringComparison.InvariantCultureIgnoreCase) && lazyExport.Value is IWindModelPlugin) { m_log.InfoFormat("[WIND] {0} plugin found, initializing.", desiredWindPlugin); m_activeWindPlugin = (IWindModelPlugin)lazyExport.Value; m_activeWindPlugin.Initialise(); m_activeWindPlugin.WindConfig(m_scene, windConfig); break; } } } } // if the plug-in wasn't found, default to no wind. if (m_activeWindPlugin == null) { m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", desiredWindPlugin); m_log.ErrorFormat("[WIND] Defaulting to no wind."); } // This one puts an entry in the main help screen m_scene.AddCommand(this, String.Empty, "wind", "Usage: wind <param> [value] - Get or Update Wind paramaters", null); // This one enables the ability to type just the base command without any parameters m_scene.AddCommand(this, "wind", "", "", HandleConsoleCommand); // Get a list of the parameters for the plugin if (m_activeWindPlugin != null) { m_scene.AddCommand(this, String.Format("wind wind_update_rate"), "Change the wind update rate.", "", HandleConsoleBaseCommand); foreach (KeyValuePair <string, string> kvp in m_activeWindPlugin.WindParams()) { m_scene.AddCommand(this, String.Format("wind {0} {1}", m_activeWindPlugin.Name, kvp.Key), String.Format("{0} : {1} - {2}", m_activeWindPlugin.Name, kvp.Key, kvp.Value), "", HandleConsoleParamCommand); } } // Register event handlers for when Avatars enter the region, and frame ticks m_scene.EventManager.OnFrame += WindUpdate; m_scene.EventManager.OnMakeRootAgent += OnAgentEnteredRegion; // Register the wind module m_scene.RegisterModuleInterface <IWindModule>(this); // Generate initial wind values GenWindPos(); // Mark Module Ready for duty m_ready = true; } }
public void Initialise(Scene scene, IConfigSource config) { string desiredWindPlugin = DEFAULT_WIND_PLUGIN; IConfig windConfig = config.Configs["Wind"]; if (windConfig != null) { m_enabled = windConfig.GetBoolean("enabled", true); m_frameUpdateRate = windConfig.GetInt("wind_update_rate", 150); // Determine which wind model plugin is desired if (windConfig.Contains("wind_plugin")) desiredWindPlugin = windConfig.GetString("wind_plugin"); } if (m_enabled) { m_log.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate); m_scene = scene; m_frame = 0; if (windConfig != null) { CompositionContainer moduleContainer = scene.ModuleContainer; IEnumerable<Lazy<object, object>> exportEnumerable = moduleContainer.GetExports(typeof(IPlugin), null, null); foreach (Lazy<object, object> lazyExport in exportEnumerable) { IDictionary<string, object> metadata = (IDictionary<string, object>)lazyExport.Metadata; object nameObj; if (metadata.TryGetValue("Name", out nameObj)) { string name = (string)nameObj; if (name.Equals(desiredWindPlugin, StringComparison.InvariantCultureIgnoreCase) && lazyExport.Value is IWindModelPlugin) { m_log.InfoFormat("[WIND] {0} plugin found, initializing.", desiredWindPlugin); m_activeWindPlugin = (IWindModelPlugin)lazyExport.Value; m_activeWindPlugin.Initialise(); m_activeWindPlugin.WindConfig(m_scene, windConfig); break; } } } } // if the plug-in wasn't found, default to no wind. if (m_activeWindPlugin == null) { m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", desiredWindPlugin); m_log.ErrorFormat("[WIND] Defaulting to no wind."); } // This one puts an entry in the main help screen m_scene.AddCommand(this, String.Empty, "wind", "Usage: wind <param> [value] - Get or Update Wind paramaters", null); // This one enables the ability to type just the base command without any parameters m_scene.AddCommand(this, "wind", "", "", HandleConsoleCommand); // Get a list of the parameters for the plugin if (m_activeWindPlugin != null) { m_scene.AddCommand(this, String.Format("wind wind_update_rate"), "Change the wind update rate.", "", HandleConsoleBaseCommand); foreach (KeyValuePair<string, string> kvp in m_activeWindPlugin.WindParams()) { m_scene.AddCommand(this, String.Format("wind {0} {1}", m_activeWindPlugin.Name, kvp.Key), String.Format("{0} : {1} - {2}", m_activeWindPlugin.Name, kvp.Key, kvp.Value), "", HandleConsoleParamCommand); } } // Register event handlers for when Avatars enter the region, and frame ticks m_scene.EventManager.OnFrame += WindUpdate; m_scene.EventManager.OnMakeRootAgent += OnAgentEnteredRegion; // Register the wind module m_scene.RegisterModuleInterface<IWindModule>(this); // Generate initial wind values GenWindPos(); // Mark Module Ready for duty m_ready = true; } }