aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-01-18 01:36:40 +0000
committerJustin Clark-Casey (justincc)2014-01-18 01:36:40 +0000
commite9454d4672782647247db36e0d5e18b82cad58f0 (patch)
treeb6079f3d35411618c3c915315c57e13272545afb /OpenSim/Region/ScriptEngine/Shared/Api/Implementation
parentFixed: Windlight functions caused an error if called when the script's owner ... (diff)
downloadopensim-SC-e9454d4672782647247db36e0d5e18b82cad58f0.zip
opensim-SC-e9454d4672782647247db36e0d5e18b82cad58f0.tar.gz
opensim-SC-e9454d4672782647247db36e0d5e18b82cad58f0.tar.bz2
opensim-SC-e9454d4672782647247db36e0d5e18b82cad58f0.tar.xz
Following on from 50ea2e0, only fetch scene presence for check if lightscript function has failed initial IsEstateManagerOrOwner() check
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs55
1 files changed, 38 insertions, 17 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
index 30eed40..b13a5ae 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
@@ -434,6 +434,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
434 } 434 }
435 return wl; 435 return wl;
436 } 436 }
437
437 /// <summary> 438 /// <summary>
438 /// Set the current Windlight scene 439 /// Set the current Windlight scene
439 /// </summary> 440 /// </summary>
@@ -447,14 +448,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
447 return 0; 448 return 0;
448 } 449 }
449 450
450 ScenePresence sp = World.GetScenePresence(m_host.OwnerID); 451 if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID))
451 if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && (sp == null || sp.GodLevel < 200))
452 { 452 {
453 LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); 453 ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
454 return 0; 454
455 if (sp == null || sp.GodLevel < 200)
456 {
457 LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
458 return 0;
459 }
455 } 460 }
461
456 int success = 0; 462 int success = 0;
457 m_host.AddScriptLPS(1); 463 m_host.AddScriptLPS(1);
464
458 if (LightShareModule.EnableWindlight) 465 if (LightShareModule.EnableWindlight)
459 { 466 {
460 RegionLightShareData wl = getWindlightProfileFromRules(rules); 467 RegionLightShareData wl = getWindlightProfileFromRules(rules);
@@ -467,8 +474,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
467 LSShoutError("Windlight module is disabled"); 474 LSShoutError("Windlight module is disabled");
468 return 0; 475 return 0;
469 } 476 }
477
470 return success; 478 return success;
471 } 479 }
480
472 public void lsClearWindlightScene() 481 public void lsClearWindlightScene()
473 { 482 {
474 if (!m_LSFunctionsEnabled) 483 if (!m_LSFunctionsEnabled)
@@ -476,19 +485,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
476 LSShoutError("LightShare functions are not enabled."); 485 LSShoutError("LightShare functions are not enabled.");
477 return; 486 return;
478 } 487 }
479 488
480 ScenePresence sp = World.GetScenePresence(m_host.OwnerID); 489 if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID))
481 if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && (sp == null || sp.GodLevel < 200))
482 { 490 {
483 LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); 491 ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
484 return; 492
493 if (sp == null || sp.GodLevel < 200)
494 {
495 LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
496 return;
497 }
485 } 498 }
486 499
487 m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.valid = false; 500 m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.valid = false;
488 if (m_host.ParentGroup.Scene.SimulationDataService != null) 501 if (m_host.ParentGroup.Scene.SimulationDataService != null)
489 m_host.ParentGroup.Scene.SimulationDataService.RemoveRegionWindlightSettings(m_host.ParentGroup.Scene.RegionInfo.RegionID); 502 m_host.ParentGroup.Scene.SimulationDataService.RemoveRegionWindlightSettings(m_host.ParentGroup.Scene.RegionInfo.RegionID);
503
490 m_host.ParentGroup.Scene.EventManager.TriggerOnSaveNewWindlightProfile(); 504 m_host.ParentGroup.Scene.EventManager.TriggerOnSaveNewWindlightProfile();
491 } 505 }
506
492 /// <summary> 507 /// <summary>
493 /// Set the current Windlight scene to a target avatar 508 /// Set the current Windlight scene to a target avatar
494 /// </summary> 509 /// </summary>
@@ -501,15 +516,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
501 LSShoutError("LightShare functions are not enabled."); 516 LSShoutError("LightShare functions are not enabled.");
502 return 0; 517 return 0;
503 } 518 }
504 519
505 ScenePresence sp = World.GetScenePresence(m_host.OwnerID); 520 if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID))
506 if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && (sp == null || sp.GodLevel < 200))
507 { 521 {
508 LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners."); 522 ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
509 return 0; 523
524 if (sp == null || sp.GodLevel < 200)
525 {
526 LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners.");
527 return 0;
528 }
510 } 529 }
530
511 int success = 0; 531 int success = 0;
512 m_host.AddScriptLPS(1); 532 m_host.AddScriptLPS(1);
533
513 if (LightShareModule.EnableWindlight) 534 if (LightShareModule.EnableWindlight)
514 { 535 {
515 RegionLightShareData wl = getWindlightProfileFromRules(rules); 536 RegionLightShareData wl = getWindlightProfileFromRules(rules);
@@ -521,8 +542,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
521 LSShoutError("Windlight module is disabled"); 542 LSShoutError("Windlight module is disabled");
522 return 0; 543 return 0;
523 } 544 }
545
524 return success; 546 return success;
525 } 547 }
526
527 } 548 }
528} 549} \ No newline at end of file