mirror of
https://github.com/opensim/opensim.git
synced 2026-07-31 05:45:37 +08:00
replace lightshare early work
This commit is contained in:
@@ -62,9 +62,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
internal bool m_LSFunctionsEnabled = false;
|
||||
internal IScriptModuleComms m_comms = null;
|
||||
internal IConfig m_osslconfig;
|
||||
internal IEnvironmentModule m_enviroment = null;
|
||||
|
||||
public void Initialize(
|
||||
IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item)
|
||||
public void Initialize(IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item)
|
||||
{
|
||||
m_ScriptEngine = scriptEngine;
|
||||
m_host = host;
|
||||
@@ -79,6 +79,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
m_comms = m_ScriptEngine.World.RequestModuleInterface<IScriptModuleComms>();
|
||||
if (m_comms == null)
|
||||
m_LSFunctionsEnabled = false;
|
||||
|
||||
m_enviroment = m_ScriptEngine.World.RequestModuleInterface<IEnvironmentModule>();
|
||||
}
|
||||
|
||||
public override Object InitializeLifetimeService()
|
||||
@@ -88,8 +90,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (lease.CurrentState == LeaseState.Initial)
|
||||
{
|
||||
lease.InitialLeaseTime = TimeSpan.FromMinutes(0);
|
||||
// lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0);
|
||||
// lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0);
|
||||
//lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0);
|
||||
//lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0);
|
||||
}
|
||||
return lease;
|
||||
}
|
||||
@@ -120,13 +122,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
/// <returns>List of windlight parameters</returns>
|
||||
public LSL_List lsGetWindlightScene(LSL_List rules)
|
||||
{
|
||||
if (!m_LSFunctionsEnabled)
|
||||
if (!m_LSFunctionsEnabled || m_enviroment == null)
|
||||
{
|
||||
LSShoutError("LightShare functions are not enabled.");
|
||||
return new LSL_List();
|
||||
}
|
||||
|
||||
m_host.AddScriptLPS(1);
|
||||
RegionLightShareData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings;
|
||||
|
||||
RegionLightShareData wl = m_enviroment.ToLightShare();
|
||||
|
||||
LSL_List values = new LSL_List();
|
||||
int idx = 0;
|
||||
@@ -264,9 +268,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
private RegionLightShareData getWindlightProfileFromRules(LSL_List rules)
|
||||
{
|
||||
RegionLightShareData wl = (RegionLightShareData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone();
|
||||
RegionLightShareData wl = m_enviroment.ToLightShare();
|
||||
|
||||
// LSL_List values = new LSL_List();
|
||||
int idx = 0;
|
||||
while (idx < rules.Length)
|
||||
{
|
||||
@@ -716,12 +719,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
/// <returns>success: true or false</returns>
|
||||
public int lsSetWindlightScene(LSL_List rules)
|
||||
{
|
||||
if (!m_LSFunctionsEnabled)
|
||||
if (!m_LSFunctionsEnabled || m_enviroment == null)
|
||||
{
|
||||
LSShoutError("LightShare functions are not enabled.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID))
|
||||
{
|
||||
ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
|
||||
@@ -733,42 +738,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
}
|
||||
|
||||
int success = 0;
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
if (LightShareModule.EnableWindlight)
|
||||
try
|
||||
{
|
||||
RegionLightShareData wl;
|
||||
try
|
||||
{
|
||||
wl = getWindlightProfileFromRules(rules);
|
||||
}
|
||||
catch(InvalidCastException e)
|
||||
{
|
||||
LSShoutError(e.Message);
|
||||
return 0;
|
||||
}
|
||||
wl.valid = true;
|
||||
m_host.ParentGroup.Scene.StoreWindlightProfile(wl);
|
||||
success = 1;
|
||||
RegionLightShareData wl = getWindlightProfileFromRules(rules);
|
||||
m_enviroment.FromLightShare(wl);
|
||||
}
|
||||
else
|
||||
catch(InvalidCastException e)
|
||||
{
|
||||
LSShoutError("Windlight module is disabled");
|
||||
LSShoutError(e.Message);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return success;
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void lsClearWindlightScene()
|
||||
{
|
||||
if (!m_LSFunctionsEnabled)
|
||||
if (!m_LSFunctionsEnabled || m_enviroment == null)
|
||||
{
|
||||
LSShoutError("LightShare functions are not enabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID))
|
||||
{
|
||||
ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
|
||||
@@ -780,11 +773,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
}
|
||||
|
||||
m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.valid = false;
|
||||
if (m_host.ParentGroup.Scene.SimulationDataService != null)
|
||||
m_host.ParentGroup.Scene.SimulationDataService.RemoveRegionWindlightSettings(m_host.ParentGroup.Scene.RegionInfo.RegionID);
|
||||
|
||||
m_host.ParentGroup.Scene.EventManager.TriggerOnSaveNewWindlightProfile();
|
||||
m_enviroment.ResetEnvironmentSettings(m_host.ParentGroup.Scene.RegionInfo.RegionID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -794,6 +783,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
/// <returns>success: true or false</returns>
|
||||
public int lsSetWindlightSceneTargeted(LSL_List rules, LSL_Key target)
|
||||
{
|
||||
LSShoutError("Function temporary not supported");
|
||||
return 0;
|
||||
|
||||
/* disabled code until we add force a WL into a single user
|
||||
if (!m_LSFunctionsEnabled)
|
||||
{
|
||||
LSShoutError("LightShare functions are not enabled.");
|
||||
@@ -814,7 +807,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
int success = 0;
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
if (LightShareModule.EnableWindlight)
|
||||
if (m_enviroment != null)
|
||||
{
|
||||
RegionLightShareData wl;
|
||||
try
|
||||
@@ -836,6 +829,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
|
||||
return success;
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user