fix enable from config on some legacy modules

This commit is contained in:
UbitUmarov
2024-04-15 01:59:50 +01:00
parent 92bf9224de
commit c1c19784ff
3 changed files with 34 additions and 12 deletions

View File

@@ -55,6 +55,8 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
private Scene m_scene;
private bool m_Enabled = false;
private Dictionary<UUID, Dictionary<int, FloaterData>> m_floaters = new Dictionary<UUID, Dictionary<int, FloaterData>>();
public string Name
@@ -69,6 +71,11 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
public void Initialise(IConfigSource config)
{
IConfig moduleConfig = config.Configs["DynamicFloaterModule"];
if (moduleConfig != null)
{
m_Enabled = moduleConfig.GetBoolean("enabled", false);
}
}
public void Close()
@@ -77,10 +84,13 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
public void AddRegion(Scene scene)
{
m_scene = scene;
scene.EventManager.OnNewClient += OnNewClient;
scene.EventManager.OnClientClosed += OnClientClosed;
m_scene.RegisterModuleInterface<IDynamicFloaterModule>(this);
if(m_Enabled)
{
m_scene = scene;
scene.EventManager.OnNewClient += OnNewClient;
scene.EventManager.OnClientClosed += OnClientClosed;
m_scene.RegisterModuleInterface<IDynamicFloaterModule>(this);
}
}
public void RegionLoaded(Scene scene)

View File

@@ -49,6 +49,7 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private bool m_Enabled = false;
private class MenuItemData
{
public string Title;
@@ -75,6 +76,11 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
public void Initialise(IConfigSource config)
{
IConfig moduleConfig = config.Configs["DynamicMenuModule"];
if (moduleConfig != null)
{
m_Enabled = moduleConfig.GetBoolean("enabled", false);
}
}
public void Close()
@@ -83,17 +89,22 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
public void AddRegion(Scene scene)
{
m_scene = scene;
scene.EventManager.OnRegisterCaps += OnRegisterCaps;
m_scene.RegisterModuleInterface<IDynamicMenuModule>(this);
if (m_Enabled)
{
m_scene = scene;
scene.EventManager.OnRegisterCaps += OnRegisterCaps;
m_scene.RegisterModuleInterface<IDynamicMenuModule>(this);
}
}
public void RegionLoaded(Scene scene)
{
ISimulatorFeaturesModule featuresModule = m_scene.RequestModuleInterface<ISimulatorFeaturesModule>();
if (featuresModule != null)
featuresModule.OnSimulatorFeaturesRequest += OnSimulatorFeaturesRequest;
if (m_Enabled)
{
ISimulatorFeaturesModule featuresModule = m_scene.RequestModuleInterface<ISimulatorFeaturesModule>();
if (featuresModule != null)
featuresModule.OnSimulatorFeaturesRequest += OnSimulatorFeaturesRequest;
}
}
public void RemoveRegion(Scene scene)

View File

@@ -54,11 +54,12 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
public class SpecialUIModule : INonSharedRegionModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private const string VIEWER_SUPPORT_DIR = "ViewerSupport";
private Scene m_scene;
private SimulatorFeaturesHelper m_Helper;
private bool m_Enabled;
private bool m_Enabled = false;
private int m_UserLevel;
public string Name