Following on from 50ea2e0, only fetch scene presence for check if lightscript function has failed initial IsEstateManagerOrOwner() check

master-beforevarregion
Justin Clark-Casey (justincc) 2014-01-18 01:36:40 +00:00
parent 50ea2e0d67
commit e9454d4672
1 changed files with 38 additions and 17 deletions

View File

@ -434,6 +434,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
return wl; return wl;
} }
/// <summary> /// <summary>
/// Set the current Windlight scene /// Set the current Windlight scene
/// </summary> /// </summary>
@ -447,14 +448,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return 0; return 0;
} }
ScenePresence sp = World.GetScenePresence(m_host.OwnerID); if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID))
if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && (sp == null || sp.GodLevel < 200))
{ {
LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
return 0;
if (sp == null || sp.GodLevel < 200)
{
LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
return 0;
}
} }
int success = 0; int success = 0;
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (LightShareModule.EnableWindlight) if (LightShareModule.EnableWindlight)
{ {
RegionLightShareData wl = getWindlightProfileFromRules(rules); RegionLightShareData wl = getWindlightProfileFromRules(rules);
@ -467,8 +474,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSShoutError("Windlight module is disabled"); LSShoutError("Windlight module is disabled");
return 0; return 0;
} }
return success; return success;
} }
public void lsClearWindlightScene() public void lsClearWindlightScene()
{ {
if (!m_LSFunctionsEnabled) if (!m_LSFunctionsEnabled)
@ -477,18 +486,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return; return;
} }
ScenePresence sp = World.GetScenePresence(m_host.OwnerID); if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID))
if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && (sp == null || sp.GodLevel < 200))
{ {
LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
return;
if (sp == null || sp.GodLevel < 200)
{
LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
return;
}
} }
m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.valid = false; m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.valid = false;
if (m_host.ParentGroup.Scene.SimulationDataService != null) if (m_host.ParentGroup.Scene.SimulationDataService != null)
m_host.ParentGroup.Scene.SimulationDataService.RemoveRegionWindlightSettings(m_host.ParentGroup.Scene.RegionInfo.RegionID); m_host.ParentGroup.Scene.SimulationDataService.RemoveRegionWindlightSettings(m_host.ParentGroup.Scene.RegionInfo.RegionID);
m_host.ParentGroup.Scene.EventManager.TriggerOnSaveNewWindlightProfile(); m_host.ParentGroup.Scene.EventManager.TriggerOnSaveNewWindlightProfile();
} }
/// <summary> /// <summary>
/// Set the current Windlight scene to a target avatar /// Set the current Windlight scene to a target avatar
/// </summary> /// </summary>
@ -502,14 +517,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return 0; return 0;
} }
ScenePresence sp = World.GetScenePresence(m_host.OwnerID); if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID))
if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && (sp == null || sp.GodLevel < 200))
{ {
LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners."); ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
return 0;
if (sp == null || sp.GodLevel < 200)
{
LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners.");
return 0;
}
} }
int success = 0; int success = 0;
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (LightShareModule.EnableWindlight) if (LightShareModule.EnableWindlight)
{ {
RegionLightShareData wl = getWindlightProfileFromRules(rules); RegionLightShareData wl = getWindlightProfileFromRules(rules);
@ -521,8 +542,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSShoutError("Windlight module is disabled"); LSShoutError("Windlight module is disabled");
return 0; return 0;
} }
return success; return success;
} }
} }
} }