aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs44
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs763
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs9
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs46
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs3
6 files changed, 500 insertions, 369 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index af88e4f..c13e8b2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3534,32 +3534,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3534 public void doObjectRez(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param, bool atRoot) 3534 public void doObjectRez(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param, bool atRoot)
3535 { 3535 {
3536 m_host.AddScriptLPS(1); 3536 m_host.AddScriptLPS(1);
3537 if (Double.IsNaN(rot.x) || Double.IsNaN(rot.y) || Double.IsNaN(rot.z) || Double.IsNaN(rot.s))
3538 return;
3537 3539
3538 Util.FireAndForget(x => 3540 float dist = (float)llVecDist(llGetPos(), pos);
3539 {
3540 if (Double.IsNaN(rot.x) || Double.IsNaN(rot.y) || Double.IsNaN(rot.z) || Double.IsNaN(rot.s))
3541 return;
3542 3541
3543 float dist = (float)llVecDist(llGetPos(), pos); 3542 if (dist > m_ScriptDistanceFactor * 10.0f)
3543 return;
3544 3544
3545 if (dist > m_ScriptDistanceFactor * 10.0f) 3545 TaskInventoryItem item = m_host.Inventory.GetInventoryItem(inventory);
3546 return;
3547 3546
3548 TaskInventoryItem item = m_host.Inventory.GetInventoryItem(inventory); 3547 if (item == null)
3548 {
3549 Error("llRez(AtRoot/Object)", "Can't find object '" + inventory + "'");
3550 return;
3551 }
3549 3552
3550 if (item == null) 3553 if (item.InvType != (int)InventoryType.Object)
3551 { 3554 {
3552 Error("llRez(AtRoot/Object)", "Can't find object '" + inventory + "'"); 3555 Error("llRez(AtRoot/Object)", "Can't create requested object; object is missing from database");
3553 return; 3556 return;
3554 } 3557 }
3555 3558
3556 if (item.InvType != (int)InventoryType.Object) 3559 Util.FireAndForget(x =>
3557 { 3560 {
3558 Error("llRez(AtRoot/Object)", "Can't create requested object; object is missing from database");
3559 return;
3560 }
3561 3561
3562 List<SceneObjectGroup> new_groups = World.RezObject(m_host, item, pos, rot, vel, param, atRoot); 3562 Quaternion wrot = rot;
3563 wrot.Normalize();
3564 List<SceneObjectGroup> new_groups = World.RezObject(m_host, item, pos, wrot, vel, param, atRoot);
3563 3565
3564 // If either of these are null, then there was an unknown error. 3566 // If either of these are null, then there was an unknown error.
3565 if (new_groups == null) 3567 if (new_groups == null)
@@ -3596,9 +3598,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3596 } 3598 }
3597 } 3599 }
3598 } 3600 }
3599 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) 3601 }
3600 }
3601
3602 }, null, "LSL_Api.doObjectRez"); 3602 }, null, "LSL_Api.doObjectRez");
3603 3603
3604 //ScriptSleep((int)((groupmass * velmag) / 10)); 3604 //ScriptSleep((int)((groupmass * velmag) / 10));
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index e51a078..79367fb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -264,6 +264,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
264 // for safe funtions always active 264 // for safe funtions always active
265 public void CheckThreatLevel() 265 public void CheckThreatLevel()
266 { 266 {
267 m_host.AddScriptLPS(1);
267 if (!m_OSFunctionsEnabled) 268 if (!m_OSFunctionsEnabled)
268 OSSLError(String.Format("{0} permission denied. All OS functions are disabled.")); // throws 269 OSSLError(String.Format("{0} permission denied. All OS functions are disabled.")); // throws
269 } 270 }
@@ -271,6 +272,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
271 // Returns if the function is allowed. Throws a script exception if not allowed. 272 // Returns if the function is allowed. Throws a script exception if not allowed.
272 public void CheckThreatLevel(ThreatLevel level, string function) 273 public void CheckThreatLevel(ThreatLevel level, string function)
273 { 274 {
275 m_host.AddScriptLPS(1);
274 if (!m_OSFunctionsEnabled) 276 if (!m_OSFunctionsEnabled)
275 OSSLError(String.Format("{0} permission denied. All OS functions are disabled.", function)); // throws 277 OSSLError(String.Format("{0} permission denied. All OS functions are disabled.", function)); // throws
276 278
@@ -452,7 +454,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
452 } 454 }
453 } 455 }
454 456
455
456 if (!m_FunctionPerms[function].AllowedCreators.Contains(m_item.CreatorID)) 457 if (!m_FunctionPerms[function].AllowedCreators.Contains(m_item.CreatorID))
457 return( 458 return(
458 String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.", 459 String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.",
@@ -499,8 +500,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
499 500
500 private LSL_Integer SetTerrainHeight(int x, int y, double val) 501 private LSL_Integer SetTerrainHeight(int x, int y, double val)
501 { 502 {
502 m_host.AddScriptLPS(1);
503
504 if (x > (World.RegionInfo.RegionSizeX - 1) || x < 0 || y > (World.RegionInfo.RegionSizeY - 1) || y < 0) 503 if (x > (World.RegionInfo.RegionSizeX - 1) || x < 0 || y > (World.RegionInfo.RegionSizeY - 1) || y < 0)
505 OSSLError("osSetTerrainHeight: Coordinate out of bounds"); 504 OSSLError("osSetTerrainHeight: Coordinate out of bounds");
506 505
@@ -517,20 +516,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
517 516
518 public LSL_Float osGetTerrainHeight(int x, int y) 517 public LSL_Float osGetTerrainHeight(int x, int y)
519 { 518 {
520 CheckThreatLevel(ThreatLevel.None, "osGetTerrainHeight"); 519 CheckThreatLevel();
521 return GetTerrainHeight(x, y); 520 return GetTerrainHeight(x, y);
522 } 521 }
523 522
524 public LSL_Float osTerrainGetHeight(int x, int y) 523 public LSL_Float osTerrainGetHeight(int x, int y)
525 { 524 {
526 CheckThreatLevel(ThreatLevel.None, "osTerrainGetHeight"); 525 CheckThreatLevel();
527 OSSLDeprecated("osTerrainGetHeight", "osGetTerrainHeight"); 526 OSSLDeprecated("osTerrainGetHeight", "osGetTerrainHeight");
528 return GetTerrainHeight(x, y); 527 return GetTerrainHeight(x, y);
529 } 528 }
530 529
531 private LSL_Float GetTerrainHeight(int x, int y) 530 private LSL_Float GetTerrainHeight(int x, int y)
532 { 531 {
533 m_host.AddScriptLPS(1);
534 if (x > (World.RegionInfo.RegionSizeX - 1) || x < 0 || y > (World.RegionInfo.RegionSizeY - 1) || y < 0) 532 if (x > (World.RegionInfo.RegionSizeX - 1) || x < 0 || y > (World.RegionInfo.RegionSizeY - 1) || y < 0)
535 OSSLError("osGetTerrainHeight: Coordinate out of bounds"); 533 OSSLError("osGetTerrainHeight: Coordinate out of bounds");
536 534
@@ -540,7 +538,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
540 public void osTerrainFlush() 538 public void osTerrainFlush()
541 { 539 {
542 CheckThreatLevel(ThreatLevel.VeryLow, "osTerrainFlush"); 540 CheckThreatLevel(ThreatLevel.VeryLow, "osTerrainFlush");
543 m_host.AddScriptLPS(1);
544 541
545 ITerrainModule terrainModule = World.RequestModuleInterface<ITerrainModule>(); 542 ITerrainModule terrainModule = World.RequestModuleInterface<ITerrainModule>();
546 if (terrainModule != null) terrainModule.TaintTerrain(); 543 if (terrainModule != null) terrainModule.TaintTerrain();
@@ -557,7 +554,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
557 CheckThreatLevel(ThreatLevel.High, "osRegionRestart"); 554 CheckThreatLevel(ThreatLevel.High, "osRegionRestart");
558 555
559 IRestartModule restartModule = World.RequestModuleInterface<IRestartModule>(); 556 IRestartModule restartModule = World.RequestModuleInterface<IRestartModule>();
560 m_host.AddScriptLPS(1);
561 if (World.Permissions.CanIssueEstateCommand(m_host.OwnerID, false) && (restartModule != null)) 557 if (World.Permissions.CanIssueEstateCommand(m_host.OwnerID, false) && (restartModule != null))
562 { 558 {
563 if (seconds < 15) 559 if (seconds < 15)
@@ -580,7 +576,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
580 CheckThreatLevel(ThreatLevel.High, "osRegionRestart"); 576 CheckThreatLevel(ThreatLevel.High, "osRegionRestart");
581 577
582 IRestartModule restartModule = World.RequestModuleInterface<IRestartModule>(); 578 IRestartModule restartModule = World.RequestModuleInterface<IRestartModule>();
583 m_host.AddScriptLPS(1);
584 if (World.Permissions.CanIssueEstateCommand(m_host.OwnerID, false) && (restartModule != null)) 579 if (World.Permissions.CanIssueEstateCommand(m_host.OwnerID, false) && (restartModule != null))
585 { 580 {
586 if (seconds < 15) 581 if (seconds < 15)
@@ -631,8 +626,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
631 // 626 //
632 CheckThreatLevel(ThreatLevel.VeryHigh, "osRegionNotice"); 627 CheckThreatLevel(ThreatLevel.VeryHigh, "osRegionNotice");
633 628
634 m_host.AddScriptLPS(1);
635
636 IDialogModule dm = World.RequestModuleInterface<IDialogModule>(); 629 IDialogModule dm = World.RequestModuleInterface<IDialogModule>();
637 630
638 if (dm != null) 631 if (dm != null)
@@ -646,7 +639,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
646 // 639 //
647 CheckThreatLevel(ThreatLevel.VeryHigh, "osSetRot"); 640 CheckThreatLevel(ThreatLevel.VeryHigh, "osSetRot");
648 641
649 m_host.AddScriptLPS(1);
650 if (World.Entities.ContainsKey(target)) 642 if (World.Entities.ContainsKey(target))
651 { 643 {
652 EntityBase entity; 644 EntityBase entity;
@@ -672,13 +664,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
672 // 664 //
673 CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureURL"); 665 CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureURL");
674 666
675 m_host.AddScriptLPS(1);
676 if (dynamicID == String.Empty) 667 if (dynamicID == String.Empty)
677 { 668 {
678 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); 669 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
679 UUID createdTexture = 670 UUID createdTexture =
680 textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url, 671 textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url,
681 extraParams, timer); 672 extraParams);
682 return createdTexture.ToString(); 673 return createdTexture.ToString();
683 } 674 }
684 else 675 else
@@ -694,13 +685,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
694 { 685 {
695 CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureURLBlend"); 686 CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureURLBlend");
696 687
697 m_host.AddScriptLPS(1);
698 if (dynamicID == String.Empty) 688 if (dynamicID == String.Empty)
699 { 689 {
700 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); 690 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
701 UUID createdTexture = 691 UUID createdTexture =
702 textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url, 692 textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url,
703 extraParams, timer, true, (byte) alpha); 693 extraParams, true, (byte) alpha);
704 return createdTexture.ToString(); 694 return createdTexture.ToString();
705 } 695 }
706 else 696 else
@@ -716,13 +706,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
716 { 706 {
717 CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureURLBlendFace"); 707 CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureURLBlendFace");
718 708
719 m_host.AddScriptLPS(1);
720 if (dynamicID == String.Empty) 709 if (dynamicID == String.Empty)
721 { 710 {
722 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); 711 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
723 UUID createdTexture = 712 UUID createdTexture =
724 textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url, 713 textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url,
725 extraParams, timer, blend, disp, (byte) alpha, face); 714 extraParams, blend, disp, (byte) alpha, face);
726 return createdTexture.ToString(); 715 return createdTexture.ToString();
727 } 716 }
728 else 717 else
@@ -736,9 +725,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
736 public string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, 725 public string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams,
737 int timer) 726 int timer)
738 { 727 {
728 return osSetDynamicTextureDataFace(dynamicID, contentType, data, extraParams, timer, -1);
729 }
730
731 public string osSetDynamicTextureDataFace(string dynamicID, string contentType, string data, string extraParams,
732 int timer, int face)
733 {
739 CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureData"); 734 CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureData");
740 735
741 m_host.AddScriptLPS(1);
742 if (dynamicID == String.Empty) 736 if (dynamicID == String.Empty)
743 { 737 {
744 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); 738 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
@@ -750,7 +744,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
750 } 744 }
751 UUID createdTexture = 745 UUID createdTexture =
752 textureManager.AddDynamicTextureData(World.RegionInfo.RegionID, m_host.UUID, contentType, data, 746 textureManager.AddDynamicTextureData(World.RegionInfo.RegionID, m_host.UUID, contentType, data,
753 extraParams, timer); 747 extraParams, false, 3, 255, face);
748
754 return createdTexture.ToString(); 749 return createdTexture.ToString();
755 } 750 }
756 } 751 }
@@ -767,7 +762,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
767 { 762 {
768 CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureDataBlend"); 763 CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureDataBlend");
769 764
770 m_host.AddScriptLPS(1);
771 if (dynamicID == String.Empty) 765 if (dynamicID == String.Empty)
772 { 766 {
773 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); 767 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
@@ -779,7 +773,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
779 } 773 }
780 UUID createdTexture = 774 UUID createdTexture =
781 textureManager.AddDynamicTextureData(World.RegionInfo.RegionID, m_host.UUID, contentType, data, 775 textureManager.AddDynamicTextureData(World.RegionInfo.RegionID, m_host.UUID, contentType, data,
782 extraParams, timer, true, (byte) alpha); 776 extraParams, true, (byte) alpha);
783 return createdTexture.ToString(); 777 return createdTexture.ToString();
784 } 778 }
785 } 779 }
@@ -794,9 +788,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
794 public string osSetDynamicTextureDataBlendFace(string dynamicID, string contentType, string data, string extraParams, 788 public string osSetDynamicTextureDataBlendFace(string dynamicID, string contentType, string data, string extraParams,
795 bool blend, int disp, int timer, int alpha, int face) 789 bool blend, int disp, int timer, int alpha, int face)
796 { 790 {
797 CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureDataBlendFace"); 791 CheckThreatLevel(ThreatLevel.VeryLow , "osSetDynamicTextureDataBlendFace");
798 792
799 m_host.AddScriptLPS(1);
800 if (dynamicID == String.Empty) 793 if (dynamicID == String.Empty)
801 { 794 {
802 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); 795 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
@@ -808,7 +801,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
808 } 801 }
809 UUID createdTexture = 802 UUID createdTexture =
810 textureManager.AddDynamicTextureData(World.RegionInfo.RegionID, m_host.UUID, contentType, data, 803 textureManager.AddDynamicTextureData(World.RegionInfo.RegionID, m_host.UUID, contentType, data,
811 extraParams, timer, blend, disp, (byte) alpha, face); 804 extraParams, blend, disp, (byte) alpha, face);
812 return createdTexture.ToString(); 805 return createdTexture.ToString();
813 } 806 }
814 } 807 }
@@ -824,8 +817,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
824 { 817 {
825 CheckThreatLevel(ThreatLevel.Severe, "osConsoleCommand"); 818 CheckThreatLevel(ThreatLevel.Severe, "osConsoleCommand");
826 819
827 m_host.AddScriptLPS(1);
828
829 // For safety, we add another permission check here, and don't rely only on the standard OSSL permissions 820 // For safety, we add another permission check here, and don't rely only on the standard OSSL permissions
830 if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) 821 if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID))
831 { 822 {
@@ -840,11 +831,50 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
840 { 831 {
841 CheckThreatLevel(ThreatLevel.VeryLow, "osSetPrimFloatOnWater"); 832 CheckThreatLevel(ThreatLevel.VeryLow, "osSetPrimFloatOnWater");
842 833
843 m_host.AddScriptLPS(1);
844
845 m_host.ParentGroup.RootPart.SetFloatOnWater(floatYN); 834 m_host.ParentGroup.RootPart.SetFloatOnWater(floatYN);
846 } 835 }
847 836
837 private bool checkAllowAgentTPbyLandOwner(UUID agentId, Vector3 pos)
838 {
839 UUID hostOwner = m_host.OwnerID;
840
841 if(hostOwner == agentId)
842 return true;
843
844 if (m_item.PermsGranter == agentId)
845 {
846 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) != 0)
847 return true;
848 }
849
850 ILandObject land = World.LandChannel.GetLandObject(pos);
851 if(land == null)
852 return true;
853
854 LandData landdata = land.LandData;
855 if(landdata == null)
856 return true;
857
858 if(landdata.OwnerID == hostOwner)
859 return true;
860
861 EstateSettings es = World.RegionInfo.EstateSettings;
862 if(es != null && es.IsEstateManagerOrOwner(hostOwner))
863 return true;
864
865 if(!landdata.IsGroupOwned)
866 return false;
867
868 UUID landGroup = landdata.GroupID;
869 if(landGroup == UUID.Zero)
870 return false;
871
872 if(landGroup == m_host.GroupID)
873 return true;
874
875 return false;
876 }
877
848 // Teleport functions 878 // Teleport functions
849 public void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) 879 public void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
850 { 880 {
@@ -852,41 +882,46 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
852 // 882 //
853 CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent"); 883 CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent");
854 884
855 TeleportAgent(agent, regionName, position, lookat, false); 885 TeleportAgent(agent, regionName, position, lookat);
856 } 886 }
857 887
858 private void TeleportAgent(string agent, string regionName, 888 private void TeleportAgent(string agent, string regionName,
859 LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions) 889 LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
860 { 890 {
861 m_host.AddScriptLPS(1); 891 if(String.IsNullOrEmpty(regionName))
862 UUID agentId = new UUID(); 892 regionName = World.RegionInfo.RegionName;
893
894 UUID agentId;
863 if (UUID.TryParse(agent, out agentId)) 895 if (UUID.TryParse(agent, out agentId))
864 { 896 {
865 ScenePresence presence = World.GetScenePresence(agentId); 897 ScenePresence presence = World.GetScenePresence(agentId);
866 if (presence != null) 898 if (presence == null || presence.IsDeleted || presence.IsInTransit)
867 { 899 return;
868 // For osTeleportAgent, agent must be over owners land to avoid abuse
869 // For osTeleportOwner, this restriction isn't necessary
870
871 // commented out because its redundant and uneeded please remove eventually.
872 // if (relaxRestrictions ||
873 // m_host.OwnerID
874 // == World.LandChannel.GetLandObject(
875 // presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
876 // {
877
878 // We will launch the teleport on a new thread so that when the script threads are terminated
879 // before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting.
880 Util.FireAndForget(
881 o => World.RequestTeleportLocation(
882 presence.ControllingClient, regionName, position,
883 lookat, (uint)TPFlags.ViaLocation),
884 null, "OSSL_Api.TeleportAgentByRegionCoords");
885
886 ScriptSleep(5000);
887 900
888 // } 901 Vector3 pos = presence.AbsolutePosition;
902 if(!checkAllowAgentTPbyLandOwner(agentId, pos))
903 {
904 ScriptSleep(500);
905 return;
906 }
889 907
908 if(regionName == World.RegionInfo.RegionName)
909 {
910 // should be faster than going to threadpool
911 World.RequestTeleportLocation(presence.ControllingClient, regionName, position,
912 lookat, (uint)TPFlags.ViaLocation);
913 ScriptSleep(500);
914 }
915 else
916 {
917 // We will launch the teleport on a new thread so that when the script threads are terminated
918 // before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting.
919 Util.FireAndForget(
920 o => World.RequestTeleportLocation(
921 presence.ControllingClient, regionName, position,
922 lookat, (uint)TPFlags.ViaLocation),
923 null, "OSSL_Api.TeleportAgentByRegionCoords");
924 ScriptSleep(5000);
890 } 925 }
891 } 926 }
892 } 927 }
@@ -897,50 +932,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
897 // 932 //
898 CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent"); 933 CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent");
899 934
900 TeleportAgent(agent, regionGridX, regionGridY, position, lookat, false); 935 TeleportAgent(agent, regionGridX, regionGridY, position, lookat);
901 } 936 }
902 937
903 private void TeleportAgent(string agent, int regionGridX, int regionGridY, 938 private void TeleportAgent(string agent, int regionGridX, int regionGridY,
904 LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions) 939 LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
905 { 940 {
906 ulong regionHandle = Util.RegionGridLocToHandle((uint)regionGridX, (uint)regionGridY); 941 ulong regionHandle = Util.RegionGridLocToHandle((uint)regionGridX, (uint)regionGridY);
907 942
908 m_host.AddScriptLPS(1); 943 UUID agentId;
909 UUID agentId = new UUID();
910 if (UUID.TryParse(agent, out agentId)) 944 if (UUID.TryParse(agent, out agentId))
911 { 945 {
912 ScenePresence presence = World.GetScenePresence(agentId); 946 ScenePresence presence = World.GetScenePresence(agentId);
913 if (presence != null) 947 if (presence == null || presence.IsDeleted || presence.IsInTransit)
914 { 948 return;
915 // For osTeleportAgent, agent must be over owners land to avoid abuse
916 // For osTeleportOwner, this restriction isn't necessary
917
918 // commented out because its redundant and uneeded please remove eventually.
919 // if (relaxRestrictions ||
920 // m_host.OwnerID
921 // == World.LandChannel.GetLandObject(
922 // presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
923 // {
924
925 // We will launch the teleport on a new thread so that when the script threads are terminated
926 // before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting.
927 Util.FireAndForget(
928 o => World.RequestTeleportLocation(
929 presence.ControllingClient, regionHandle,
930 position, lookat, (uint)TPFlags.ViaLocation),
931 null, "OSSL_Api.TeleportAgentByRegionName");
932 949
933 ScriptSleep(5000); 950 Vector3 pos = presence.AbsolutePosition;
951 if(!checkAllowAgentTPbyLandOwner(agentId, pos))
952 {
953 ScriptSleep(500);
954 return;
955 }
934 956
935 // } 957 Util.FireAndForget(
958 o => World.RequestTeleportLocation(
959 presence.ControllingClient, regionHandle,
960 position, lookat, (uint)TPFlags.ViaLocation),
961 null, "OSSL_Api.TeleportAgentByRegionName");
936 962
937 } 963 ScriptSleep(5000);
938 } 964 }
939 } 965 }
940 966
941 public void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) 967 public void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
942 { 968 {
943 osTeleportAgent(agent, World.RegionInfo.RegionName, position, lookat); 969 UUID agentId;
970 if (UUID.TryParse(agent, out agentId))
971 {
972 ScenePresence presence = World.GetScenePresence(agentId);
973 if (presence == null || presence.IsDeleted || presence.IsInTransit)
974 return;
975
976 Vector3 pos = presence.AbsolutePosition;
977 if(!checkAllowAgentTPbyLandOwner(agentId, pos))
978 {
979 ScriptSleep(500);
980 return;
981 }
982
983 World.RequestTeleportLocation(presence.ControllingClient, World.RegionInfo.RegionName, position,
984 lookat, (uint)TPFlags.ViaLocation);
985 ScriptSleep(500);
986 }
944 } 987 }
945 988
946 public void osTeleportOwner(string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) 989 public void osTeleportOwner(string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
@@ -948,19 +991,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
948 // Threat level None because this is what can already be done with the World Map in the viewer 991 // Threat level None because this is what can already be done with the World Map in the viewer
949 CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); 992 CheckThreatLevel(ThreatLevel.None, "osTeleportOwner");
950 993
951 TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat, true); 994 TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat);
952 } 995 }
953 996
954 public void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) 997 public void osTeleportOwner(int regionGridX, int regionGridY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
955 { 998 {
956 osTeleportOwner(World.RegionInfo.RegionName, position, lookat); 999 CheckThreatLevel(ThreatLevel.None, "osTeleportOwner");
1000
1001 TeleportAgent(m_host.OwnerID.ToString(), regionGridX, regionGridY, position, lookat);
957 } 1002 }
958 1003
959 public void osTeleportOwner(int regionGridX, int regionGridY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) 1004 public void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
960 { 1005 {
961 CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); 1006 CheckThreatLevel(ThreatLevel.None, "osTeleportOwner");
962 1007
963 TeleportAgent(m_host.OwnerID.ToString(), regionGridX, regionGridY, position, lookat, true); 1008 osTeleportAgent(m_host.OwnerID.ToString(), position, lookat);
964 } 1009 }
965 1010
966 ///<summary> 1011 ///<summary>
@@ -974,8 +1019,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
974 { 1019 {
975 CheckThreatLevel(ThreatLevel.VeryHigh, "osForceOtherSit"); 1020 CheckThreatLevel(ThreatLevel.VeryHigh, "osForceOtherSit");
976 1021
977 m_host.AddScriptLPS(1);
978
979 ForceSit(avatar, m_host.UUID); 1022 ForceSit(avatar, m_host.UUID);
980 } 1023 }
981 1024
@@ -989,8 +1032,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
989 { 1032 {
990 CheckThreatLevel(ThreatLevel.VeryHigh, "osForceOtherSit"); 1033 CheckThreatLevel(ThreatLevel.VeryHigh, "osForceOtherSit");
991 1034
992 m_host.AddScriptLPS(1);
993
994 UUID targetID = new UUID(target); 1035 UUID targetID = new UUID(target);
995 1036
996 ForceSit(avatar, targetID); 1037 ForceSit(avatar, targetID);
@@ -1015,21 +1056,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1015 targetID, 1056 targetID,
1016 part.SitTargetPosition); 1057 part.SitTargetPosition);
1017 } 1058 }
1059
1060 // Get a list of all the avatars/agents in the region
1061 public LSL_List osGetAgents()
1062 {
1063 // threat level is None as we could get this information with an
1064 // in-world script as well, just not as efficient
1065 CheckThreatLevel(ThreatLevel.None, "osGetAgents");
1066
1067 LSL_List result = new LSL_List();
1068 World.ForEachRootScenePresence(delegate(ScenePresence sp)
1069 {
1070 result.Add(new LSL_String(sp.Name));
1071 });
1072 return result;
1073 }
1018 1074
1019 // Functions that get information from the agent itself.
1020 //
1021 // osGetAgentIP - this is used to determine the IP address of
1022 //the client. This is needed to help configure other in world
1023 //resources based on the IP address of the clients connected.
1024 //I think High is a good risk level for this, as it is an
1025 //information leak.
1026 public string osGetAgentIP(string agent) 1075 public string osGetAgentIP(string agent)
1027 { 1076 {
1028 CheckThreatLevel(ThreatLevel.High, "osGetAgentIP"); 1077 CheckThreatLevel(ThreatLevel.Severe, "osGetAgentIP");
1078 if(!(World.Permissions.IsGod(m_host.OwnerID))) // user god always needed
1079 return "";
1029 1080
1030 UUID avatarID = (UUID)agent; 1081 UUID avatarID = (UUID)agent;
1031 1082
1032 m_host.AddScriptLPS(1);
1033 if (World.Entities.ContainsKey((UUID)agent) && World.Entities[avatarID] is ScenePresence) 1083 if (World.Entities.ContainsKey((UUID)agent) && World.Entities[avatarID] is ScenePresence)
1034 { 1084 {
1035 ScenePresence target = (ScenePresence)World.Entities[avatarID]; 1085 ScenePresence target = (ScenePresence)World.Entities[avatarID];
@@ -1040,22 +1090,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1040 return ""; 1090 return "";
1041 } 1091 }
1042 1092
1043 // Get a list of all the avatars/agents in the region
1044 public LSL_List osGetAgents()
1045 {
1046 // threat level is None as we could get this information with an
1047 // in-world script as well, just not as efficient
1048 CheckThreatLevel(ThreatLevel.None, "osGetAgents");
1049 m_host.AddScriptLPS(1);
1050
1051 LSL_List result = new LSL_List();
1052 World.ForEachRootScenePresence(delegate(ScenePresence sp)
1053 {
1054 result.Add(new LSL_String(sp.Name));
1055 });
1056 return result;
1057 }
1058
1059 // Adam's super super custom animation functions 1093 // Adam's super super custom animation functions
1060 public void osAvatarPlayAnimation(string avatar, string animation) 1094 public void osAvatarPlayAnimation(string avatar, string animation)
1061 { 1095 {
@@ -1066,19 +1100,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1066 1100
1067 private void AvatarPlayAnimation(string avatar, string animation) 1101 private void AvatarPlayAnimation(string avatar, string animation)
1068 { 1102 {
1069 m_host.AddScriptLPS(1);
1070
1071 UUID avatarID; 1103 UUID avatarID;
1072 if(!UUID.TryParse(avatar, out avatarID)) 1104 if(!UUID.TryParse(avatar, out avatarID))
1073 return; 1105 return;
1074 1106
1075 if(!World.Entities.ContainsKey(avatarID)) 1107 ScenePresence target = World.GetScenePresence(avatarID);
1076 return;
1077
1078 ScenePresence target = null;
1079 if ((World.Entities[avatarID] is ScenePresence))
1080 target = (ScenePresence)World.Entities[avatarID];
1081
1082 if (target == null) 1108 if (target == null)
1083 return; 1109 return;
1084 1110
@@ -1114,8 +1140,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1114 { 1140 {
1115 UUID avatarID = (UUID)avatar; 1141 UUID avatarID = (UUID)avatar;
1116 1142
1117 m_host.AddScriptLPS(1);
1118
1119 // FIXME: What we really want to do here is factor out the similar code in llStopAnimation() to a common 1143 // FIXME: What we really want to do here is factor out the similar code in llStopAnimation() to a common
1120 // method (though see that doesn't do the is animation check, which is probably a bug) and have both 1144 // method (though see that doesn't do the is animation check, which is probably a bug) and have both
1121 // these functions call that common code. However, this does mean navigating the brain-dead requirement 1145 // these functions call that common code. However, this does mean navigating the brain-dead requirement
@@ -1146,29 +1170,59 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1146 } 1170 }
1147 1171
1148 //Texture draw functions 1172 //Texture draw functions
1173
1174 public string osDrawResetTransform(string drawList)
1175 {
1176 CheckThreatLevel();
1177
1178 drawList += "ResetTransf;";
1179 return drawList;
1180 }
1181
1182 public string osDrawRotationTransform(string drawList, LSL_Float x)
1183 {
1184 CheckThreatLevel();
1185
1186 drawList += "RotTransf " + x + ";";
1187 return drawList;
1188 }
1189
1190 public string osDrawScaleTransform(string drawList, LSL_Float x, LSL_Float y)
1191 {
1192 CheckThreatLevel();
1193
1194 drawList += "ScaleTransf " + x + "," + y + ";";
1195 return drawList;
1196 }
1197
1198 public string osDrawTranslationTransform(string drawList, LSL_Float x, LSL_Float y)
1199 {
1200 CheckThreatLevel();
1201
1202 drawList += "TransTransf " + x + "," + y + ";";
1203 return drawList;
1204 }
1205
1149 public string osMovePen(string drawList, int x, int y) 1206 public string osMovePen(string drawList, int x, int y)
1150 { 1207 {
1151 CheckThreatLevel(ThreatLevel.None, "osMovePen"); 1208 CheckThreatLevel();
1152 1209
1153 m_host.AddScriptLPS(1);
1154 drawList += "MoveTo " + x + "," + y + ";"; 1210 drawList += "MoveTo " + x + "," + y + ";";
1155 return drawList; 1211 return drawList;
1156 } 1212 }
1157 1213
1158 public string osDrawLine(string drawList, int startX, int startY, int endX, int endY) 1214 public string osDrawLine(string drawList, int startX, int startY, int endX, int endY)
1159 { 1215 {
1160 CheckThreatLevel(ThreatLevel.None, "osDrawLine"); 1216 CheckThreatLevel();
1161 1217
1162 m_host.AddScriptLPS(1);
1163 drawList += "MoveTo "+ startX+","+ startY +"; LineTo "+endX +","+endY +"; "; 1218 drawList += "MoveTo "+ startX+","+ startY +"; LineTo "+endX +","+endY +"; ";
1164 return drawList; 1219 return drawList;
1165 } 1220 }
1166 1221
1167 public string osDrawLine(string drawList, int endX, int endY) 1222 public string osDrawLine(string drawList, int endX, int endY)
1168 { 1223 {
1169 CheckThreatLevel(ThreatLevel.None, "osDrawLine"); 1224 CheckThreatLevel();
1170 1225
1171 m_host.AddScriptLPS(1);
1172 drawList += "LineTo " + endX + "," + endY + "; "; 1226 drawList += "LineTo " + endX + "," + endY + "; ";
1173 return drawList; 1227 return drawList;
1174 } 1228 }
@@ -1177,43 +1231,45 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1177 { 1231 {
1178 CheckThreatLevel(ThreatLevel.None, "osDrawText"); 1232 CheckThreatLevel(ThreatLevel.None, "osDrawText");
1179 1233
1180 m_host.AddScriptLPS(1);
1181 drawList += "Text " + text + "; "; 1234 drawList += "Text " + text + "; ";
1182 return drawList; 1235 return drawList;
1183 } 1236 }
1184 1237
1185 public string osDrawEllipse(string drawList, int width, int height) 1238 public string osDrawEllipse(string drawList, int width, int height)
1186 { 1239 {
1187 CheckThreatLevel(ThreatLevel.None, "osDrawEllipse"); 1240 CheckThreatLevel();
1188 1241
1189 m_host.AddScriptLPS(1);
1190 drawList += "Ellipse " + width + "," + height + "; "; 1242 drawList += "Ellipse " + width + "," + height + "; ";
1191 return drawList; 1243 return drawList;
1192 } 1244 }
1193 1245
1246 public string osDrawFilledEllipse(string drawList, int width, int height)
1247 {
1248 CheckThreatLevel();
1249
1250 drawList += "FillEllipse " + width + "," + height + "; ";
1251 return drawList;
1252 }
1253
1194 public string osDrawRectangle(string drawList, int width, int height) 1254 public string osDrawRectangle(string drawList, int width, int height)
1195 { 1255 {
1196 CheckThreatLevel(ThreatLevel.None, "osDrawRectangle"); 1256 CheckThreatLevel();
1197 1257
1198 m_host.AddScriptLPS(1);
1199 drawList += "Rectangle " + width + "," + height + "; "; 1258 drawList += "Rectangle " + width + "," + height + "; ";
1200 return drawList; 1259 return drawList;
1201 } 1260 }
1202 1261
1203 public string osDrawFilledRectangle(string drawList, int width, int height) 1262 public string osDrawFilledRectangle(string drawList, int width, int height)
1204 { 1263 {
1205 CheckThreatLevel(ThreatLevel.None, "osDrawFilledRectangle"); 1264 CheckThreatLevel();
1206 1265
1207 m_host.AddScriptLPS(1);
1208 drawList += "FillRectangle " + width + "," + height + "; "; 1266 drawList += "FillRectangle " + width + "," + height + "; ";
1209 return drawList; 1267 return drawList;
1210 } 1268 }
1211 1269
1212 public string osDrawFilledPolygon(string drawList, LSL_List x, LSL_List y) 1270 public string osDrawFilledPolygon(string drawList, LSL_List x, LSL_List y)
1213 { 1271 {
1214 CheckThreatLevel(ThreatLevel.None, "osDrawFilledPolygon"); 1272 CheckThreatLevel();
1215
1216 m_host.AddScriptLPS(1);
1217 1273
1218 if (x.Length != y.Length || x.Length < 3) 1274 if (x.Length != y.Length || x.Length < 3)
1219 { 1275 {
@@ -1230,9 +1286,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1230 1286
1231 public string osDrawPolygon(string drawList, LSL_List x, LSL_List y) 1287 public string osDrawPolygon(string drawList, LSL_List x, LSL_List y)
1232 { 1288 {
1233 CheckThreatLevel(ThreatLevel.None, "osDrawPolygon"); 1289 CheckThreatLevel();
1234
1235 m_host.AddScriptLPS(1);
1236 1290
1237 if (x.Length != y.Length || x.Length < 3) 1291 if (x.Length != y.Length || x.Length < 3)
1238 { 1292 {
@@ -1249,36 +1303,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1249 1303
1250 public string osSetFontSize(string drawList, int fontSize) 1304 public string osSetFontSize(string drawList, int fontSize)
1251 { 1305 {
1252 CheckThreatLevel(ThreatLevel.None, "osSetFontSize"); 1306 CheckThreatLevel();
1253 1307
1254 m_host.AddScriptLPS(1);
1255 drawList += "FontSize "+ fontSize +"; "; 1308 drawList += "FontSize "+ fontSize +"; ";
1256 return drawList; 1309 return drawList;
1257 } 1310 }
1258 1311
1259 public string osSetFontName(string drawList, string fontName) 1312 public string osSetFontName(string drawList, string fontName)
1260 { 1313 {
1261 CheckThreatLevel(ThreatLevel.None, "osSetFontName"); 1314 CheckThreatLevel();
1262 1315
1263 m_host.AddScriptLPS(1);
1264 drawList += "FontName "+ fontName +"; "; 1316 drawList += "FontName "+ fontName +"; ";
1265 return drawList; 1317 return drawList;
1266 } 1318 }
1267 1319
1268 public string osSetPenSize(string drawList, int penSize) 1320 public string osSetPenSize(string drawList, int penSize)
1269 { 1321 {
1270 CheckThreatLevel(ThreatLevel.None, "osSetPenSize"); 1322 CheckThreatLevel();
1271 1323
1272 m_host.AddScriptLPS(1);
1273 drawList += "PenSize " + penSize + "; "; 1324 drawList += "PenSize " + penSize + "; ";
1274 return drawList; 1325 return drawList;
1275 } 1326 }
1276 1327
1277 public string osSetPenColor(string drawList, string color) 1328 public string osSetPenColor(string drawList, string color)
1278 { 1329 {
1279 CheckThreatLevel(ThreatLevel.None, "osSetPenColor"); 1330 CheckThreatLevel();
1280 1331
1281 m_host.AddScriptLPS(1);
1282 drawList += "PenColor " + color + "; "; 1332 drawList += "PenColor " + color + "; ";
1283 return drawList; 1333 return drawList;
1284 } 1334 }
@@ -1286,36 +1336,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1286 // Deprecated 1336 // Deprecated
1287 public string osSetPenColour(string drawList, string colour) 1337 public string osSetPenColour(string drawList, string colour)
1288 { 1338 {
1289 CheckThreatLevel(ThreatLevel.None, "osSetPenColour"); 1339 CheckThreatLevel();
1290 OSSLDeprecated("osSetPenColour", "osSetPenColor"); 1340 OSSLDeprecated("osSetPenColour", "osSetPenColor");
1291 1341
1292 m_host.AddScriptLPS(1);
1293 drawList += "PenColour " + colour + "; "; 1342 drawList += "PenColour " + colour + "; ";
1294 return drawList; 1343 return drawList;
1295 } 1344 }
1296 1345
1297 public string osSetPenCap(string drawList, string direction, string type) 1346 public string osSetPenCap(string drawList, string direction, string type)
1298 { 1347 {
1299 CheckThreatLevel(ThreatLevel.None, "osSetPenCap"); 1348 CheckThreatLevel();
1300 1349
1301 m_host.AddScriptLPS(1);
1302 drawList += "PenCap " + direction + "," + type + "; "; 1350 drawList += "PenCap " + direction + "," + type + "; ";
1303 return drawList; 1351 return drawList;
1304 } 1352 }
1305 1353
1306 public string osDrawImage(string drawList, int width, int height, string imageUrl) 1354 public string osDrawImage(string drawList, int width, int height, string imageUrl)
1307 { 1355 {
1308 CheckThreatLevel(ThreatLevel.None, "osDrawImage"); 1356 CheckThreatLevel();
1309 1357
1310 m_host.AddScriptLPS(1);
1311 drawList +="Image " +width + "," + height+ ","+ imageUrl +"; " ; 1358 drawList +="Image " +width + "," + height+ ","+ imageUrl +"; " ;
1312 return drawList; 1359 return drawList;
1313 } 1360 }
1314 1361
1315 public LSL_Vector osGetDrawStringSize(string contentType, string text, string fontName, int fontSize) 1362 public LSL_Vector osGetDrawStringSize(string contentType, string text, string fontName, int fontSize)
1316 { 1363 {
1317 CheckThreatLevel(ThreatLevel.VeryLow, "osGetDrawStringSize"); 1364 CheckThreatLevel();
1318 m_host.AddScriptLPS(1);
1319 1365
1320 LSL_Vector vec = new LSL_Vector(0,0,0); 1366 LSL_Vector vec = new LSL_Vector(0,0,0);
1321 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); 1367 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
@@ -1338,7 +1384,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1338 // should be removed 1384 // should be removed
1339 // 1385 //
1340 CheckThreatLevel(ThreatLevel.High, "osSetStateEvents"); 1386 CheckThreatLevel(ThreatLevel.High, "osSetStateEvents");
1341 m_host.AddScriptLPS(1);
1342 1387
1343 m_host.SetScriptEvents(m_item.ItemID, events); 1388 m_host.SetScriptEvents(m_item.ItemID, events);
1344 } 1389 }
@@ -1347,8 +1392,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1347 { 1392 {
1348 CheckThreatLevel(ThreatLevel.High, "osSetRegionWaterHeight"); 1393 CheckThreatLevel(ThreatLevel.High, "osSetRegionWaterHeight");
1349 1394
1350 m_host.AddScriptLPS(1);
1351
1352 World.EventManager.TriggerRequestChangeWaterHeight((float)height); 1395 World.EventManager.TriggerRequestChangeWaterHeight((float)height);
1353 } 1396 }
1354 1397
@@ -1362,8 +1405,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1362 { 1405 {
1363 CheckThreatLevel(ThreatLevel.High, "osSetRegionSunSettings"); 1406 CheckThreatLevel(ThreatLevel.High, "osSetRegionSunSettings");
1364 1407
1365 m_host.AddScriptLPS(1);
1366
1367 while (sunHour > 24.0) 1408 while (sunHour > 24.0)
1368 sunHour -= 24.0; 1409 sunHour -= 24.0;
1369 1410
@@ -1387,8 +1428,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1387 { 1428 {
1388 CheckThreatLevel(ThreatLevel.High, "osSetEstateSunSettings"); 1429 CheckThreatLevel(ThreatLevel.High, "osSetEstateSunSettings");
1389 1430
1390 m_host.AddScriptLPS(1);
1391
1392 while (sunHour > 24.0) 1431 while (sunHour > 24.0)
1393 sunHour -= 24.0; 1432 sunHour -= 24.0;
1394 1433
@@ -1409,9 +1448,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1409 /// <returns></returns> 1448 /// <returns></returns>
1410 public double osGetCurrentSunHour() 1449 public double osGetCurrentSunHour()
1411 { 1450 {
1412 CheckThreatLevel(ThreatLevel.None, "osGetCurrentSunHour"); 1451 CheckThreatLevel();
1413
1414 m_host.AddScriptLPS(1);
1415 1452
1416 // Must adjust for the fact that Region Sun Settings are still LL offset 1453 // Must adjust for the fact that Region Sun Settings are still LL offset
1417 double sunHour = World.RegionInfo.RegionSettings.SunPosition - 6; 1454 double sunHour = World.RegionInfo.RegionSettings.SunPosition - 6;
@@ -1435,14 +1472,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1435 1472
1436 public double osGetSunParam(string param) 1473 public double osGetSunParam(string param)
1437 { 1474 {
1438 CheckThreatLevel(ThreatLevel.None, "osGetSunParam"); 1475 CheckThreatLevel();
1439 return GetSunParam(param); 1476 return GetSunParam(param);
1440 } 1477 }
1441 1478
1442 private double GetSunParam(string param) 1479 private double GetSunParam(string param)
1443 { 1480 {
1444 m_host.AddScriptLPS(1);
1445
1446 double value = 0.0; 1481 double value = 0.0;
1447 1482
1448 ISunModule module = World.RequestModuleInterface<ISunModule>(); 1483 ISunModule module = World.RequestModuleInterface<ISunModule>();
@@ -1469,8 +1504,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1469 1504
1470 private void SetSunParam(string param, double value) 1505 private void SetSunParam(string param, double value)
1471 { 1506 {
1472 m_host.AddScriptLPS(1);
1473
1474 ISunModule module = World.RequestModuleInterface<ISunModule>(); 1507 ISunModule module = World.RequestModuleInterface<ISunModule>();
1475 if (module != null) 1508 if (module != null)
1476 { 1509 {
@@ -1481,7 +1514,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1481 public string osWindActiveModelPluginName() 1514 public string osWindActiveModelPluginName()
1482 { 1515 {
1483 CheckThreatLevel(ThreatLevel.None, "osWindActiveModelPluginName"); 1516 CheckThreatLevel(ThreatLevel.None, "osWindActiveModelPluginName");
1484 m_host.AddScriptLPS(1);
1485 1517
1486 IWindModule module = World.RequestModuleInterface<IWindModule>(); 1518 IWindModule module = World.RequestModuleInterface<IWindModule>();
1487 if (module != null) 1519 if (module != null)
@@ -1495,7 +1527,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1495 public void osSetWindParam(string plugin, string param, LSL_Float value) 1527 public void osSetWindParam(string plugin, string param, LSL_Float value)
1496 { 1528 {
1497 CheckThreatLevel(ThreatLevel.VeryLow, "osSetWindParam"); 1529 CheckThreatLevel(ThreatLevel.VeryLow, "osSetWindParam");
1498 m_host.AddScriptLPS(1);
1499 1530
1500 IWindModule module = World.RequestModuleInterface<IWindModule>(); 1531 IWindModule module = World.RequestModuleInterface<IWindModule>();
1501 if (module != null) 1532 if (module != null)
@@ -1511,7 +1542,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1511 public LSL_Float osGetWindParam(string plugin, string param) 1542 public LSL_Float osGetWindParam(string plugin, string param)
1512 { 1543 {
1513 CheckThreatLevel(ThreatLevel.VeryLow, "osGetWindParam"); 1544 CheckThreatLevel(ThreatLevel.VeryLow, "osGetWindParam");
1514 m_host.AddScriptLPS(1);
1515 1545
1516 IWindModule module = World.RequestModuleInterface<IWindModule>(); 1546 IWindModule module = World.RequestModuleInterface<IWindModule>();
1517 if (module != null) 1547 if (module != null)
@@ -1526,7 +1556,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1526 public void osParcelJoin(LSL_Vector pos1, LSL_Vector pos2) 1556 public void osParcelJoin(LSL_Vector pos1, LSL_Vector pos2)
1527 { 1557 {
1528 CheckThreatLevel(ThreatLevel.High, "osParcelJoin"); 1558 CheckThreatLevel(ThreatLevel.High, "osParcelJoin");
1529 m_host.AddScriptLPS(1);
1530 1559
1531 int startx = (int)(pos1.x < pos2.x ? pos1.x : pos2.x); 1560 int startx = (int)(pos1.x < pos2.x ? pos1.x : pos2.x);
1532 int starty = (int)(pos1.y < pos2.y ? pos1.y : pos2.y); 1561 int starty = (int)(pos1.y < pos2.y ? pos1.y : pos2.y);
@@ -1539,7 +1568,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1539 public void osParcelSubdivide(LSL_Vector pos1, LSL_Vector pos2) 1568 public void osParcelSubdivide(LSL_Vector pos1, LSL_Vector pos2)
1540 { 1569 {
1541 CheckThreatLevel(ThreatLevel.High, "osParcelSubdivide"); 1570 CheckThreatLevel(ThreatLevel.High, "osParcelSubdivide");
1542 m_host.AddScriptLPS(1);
1543 1571
1544 int startx = (int)(pos1.x < pos2.x ? pos1.x : pos2.x); 1572 int startx = (int)(pos1.x < pos2.x ? pos1.x : pos2.x);
1545 int starty = (int)(pos1.y < pos2.y ? pos1.y : pos2.y); 1573 int starty = (int)(pos1.y < pos2.y ? pos1.y : pos2.y);
@@ -1566,8 +1594,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1566 1594
1567 private void SetParcelDetails(LSL_Vector pos, LSL_List rules, string functionName) 1595 private void SetParcelDetails(LSL_Vector pos, LSL_List rules, string functionName)
1568 { 1596 {
1569 m_host.AddScriptLPS(1);
1570
1571 // Get a reference to the land data and make sure the owner of the script 1597 // Get a reference to the land data and make sure the owner of the script
1572 // can modify it 1598 // can modify it
1573 1599
@@ -1580,13 +1606,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1580 1606
1581 if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, startLandObject, GroupPowers.LandOptions, false)) 1607 if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, startLandObject, GroupPowers.LandOptions, false))
1582 { 1608 {
1583 OSSLShoutError("You do not have permission to modify the parcel"); 1609 OSSLShoutError("script owner does not have permission to modify the parcel");
1584 return; 1610 return;
1585 } 1611 }
1586 1612
1587 // Create a new land data object we can modify 1613 // Create a new land data object we can modify
1588 LandData newLand = startLandObject.LandData.Copy(); 1614 LandData newLand = startLandObject.LandData.Copy();
1589 UUID uuid; 1615 UUID uuid;
1616 EstateSettings es = World.RegionInfo.EstateSettings;
1617
1618 bool changed = false;
1619 bool changedSeeAvs = false;
1620 bool changedoverlay = false;
1621 bool changedneedupdate = false;
1590 1622
1591 // Process the rules, not sure what the impact would be of changing owner or group 1623 // Process the rules, not sure what the impact would be of changing owner or group
1592 for (int idx = 0; idx < rules.Length;) 1624 for (int idx = 0; idx < rules.Length;)
@@ -1596,35 +1628,151 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1596 switch (code) 1628 switch (code)
1597 { 1629 {
1598 case ScriptBaseClass.PARCEL_DETAILS_NAME: 1630 case ScriptBaseClass.PARCEL_DETAILS_NAME:
1599 newLand.Name = arg; 1631 if(newLand.Name != arg)
1632 {
1633 newLand.Name = arg;
1634 changed = true;
1635 }
1600 break; 1636 break;
1601 1637
1602 case ScriptBaseClass.PARCEL_DETAILS_DESC: 1638 case ScriptBaseClass.PARCEL_DETAILS_DESC:
1603 newLand.Description = arg; 1639 if(newLand.Description != arg)
1640 {
1641 newLand.Description = arg;
1642 changed = true;
1643 }
1604 break; 1644 break;
1605 1645
1606 case ScriptBaseClass.PARCEL_DETAILS_OWNER: 1646 case ScriptBaseClass.PARCEL_DETAILS_OWNER:
1607 CheckThreatLevel(ThreatLevel.VeryHigh, functionName); 1647 if(es != null && !es.IsEstateManagerOrOwner(m_host.OwnerID))
1608 if (UUID.TryParse(arg, out uuid)) 1648 {
1609 newLand.OwnerID = uuid; 1649 OSSLError("script owner does not have permission to modify the parcel owner");
1650 }
1651 else
1652 {
1653 if (UUID.TryParse(arg, out uuid))
1654 {
1655 if(newLand.OwnerID != uuid)
1656 {
1657 changed = true;
1658 newLand.OwnerID = uuid;
1659 newLand.GroupID = UUID.Zero;
1660 }
1661 }
1662 }
1610 break; 1663 break;
1611 1664
1612 case ScriptBaseClass.PARCEL_DETAILS_GROUP: 1665 case ScriptBaseClass.PARCEL_DETAILS_GROUP:
1613 CheckThreatLevel(ThreatLevel.VeryHigh, functionName); 1666 if(m_host.OwnerID == newLand.OwnerID || es == null || es.IsEstateManagerOrOwner(m_host.OwnerID))
1614 if (UUID.TryParse(arg, out uuid)) 1667 {
1615 newLand.GroupID = uuid; 1668 if (UUID.TryParse(arg, out uuid))
1669 {
1670 if(newLand.GroupID != uuid)
1671 {
1672 if(uuid == UUID.Zero)
1673 {
1674 changed = true;
1675 newLand.GroupID = uuid;
1676 }
1677 else
1678 {
1679 IGroupsModule groupsModule = m_ScriptEngine.World.RequestModuleInterface<IGroupsModule>();
1680 GroupMembershipData member = null;
1681 if (groupsModule != null)
1682 member = groupsModule.GetMembershipData(uuid, newLand.OwnerID);
1683 if (member == null)
1684 OSSLError(string.Format("land owner is not member of the new group for parcel"));
1685 else
1686 {
1687 changed = true;
1688 newLand.GroupID = uuid;
1689 }
1690 }
1691 }
1692 }
1693 }
1694 else
1695 {
1696 OSSLError("script owner does not have permission to modify the parcel group");
1697 }
1616 break; 1698 break;
1617 1699
1618 case ScriptBaseClass.PARCEL_DETAILS_CLAIMDATE: 1700 case ScriptBaseClass.PARCEL_DETAILS_CLAIMDATE:
1619 CheckThreatLevel(ThreatLevel.VeryHigh, functionName); 1701 if(es != null && !es.IsEstateManagerOrOwner(m_host.OwnerID))
1620 newLand.ClaimDate = Convert.ToInt32(arg); 1702 {
1621 if (newLand.ClaimDate == 0) 1703 OSSLError("script owner does not have permission to modify the parcel CLAIM DATE");
1622 newLand.ClaimDate = Util.UnixTimeSinceEpoch(); 1704 }
1705 else
1706 {
1707 int date = Convert.ToInt32(arg);
1708 if (date == 0)
1709 date = Util.UnixTimeSinceEpoch();
1710 if(newLand.ClaimDate != date)
1711 {
1712 changed = true;
1713 newLand.ClaimDate = date;
1714 }
1715 }
1716 break;
1717
1718 case ScriptBaseClass.PARCEL_DETAILS_SEE_AVATARS:
1719 bool newavs = (Convert.ToInt32(arg) != 0);
1720 if(newLand.SeeAVs != newavs)
1721 {
1722 changed = true;
1723 changedSeeAvs = true;
1724 changedoverlay = true;
1725 changedneedupdate = true;
1726 newLand.SeeAVs = newavs;
1727 }
1728 break;
1729
1730 case ScriptBaseClass.PARCEL_DETAILS_ANY_AVATAR_SOUNDS:
1731 bool newavsounds = (Convert.ToInt32(arg) != 0);
1732 if(newLand.AnyAVSounds != newavsounds)
1733 {
1734 changed = true;
1735 newLand.AnyAVSounds = newavsounds;
1736 }
1623 break; 1737 break;
1624 }
1625 }
1626 1738
1627 World.LandChannel.UpdateLandObject(newLand.LocalID,newLand); 1739 case ScriptBaseClass.PARCEL_DETAILS_GROUP_SOUNDS:
1740 bool newgrpsounds = (Convert.ToInt32(arg) != 0);
1741 if(newLand.GroupAVSounds != newgrpsounds)
1742 {
1743 changed = true;
1744 newLand.GroupAVSounds = newgrpsounds;
1745 }
1746 break;
1747 }
1748 }
1749 if(changed)
1750 {
1751 World.LandChannel.UpdateLandObject(newLand.LocalID, newLand);
1752
1753 if(changedneedupdate)
1754 {
1755 UUID parcelID= newLand.GlobalID;
1756 World.ForEachRootScenePresence(delegate (ScenePresence avatar)
1757 {
1758 if (avatar == null || avatar.IsDeleted || avatar.IsInTransit)
1759 return;
1760
1761 if(changedSeeAvs && avatar.currentParcelUUID == parcelID )
1762 avatar.currentParcelUUID = parcelID; // force parcel flags review
1763
1764 if(avatar.ControllingClient == null)
1765 return;
1766
1767 // this will be needed for some things like damage etc
1768// if(avatar.currentParcelUUID == parcelID)
1769// startLandObject.SendLandUpdateToClient(avatar.ControllingClient);
1770
1771 if(changedoverlay && !avatar.IsNPC)
1772 World.LandChannel.SendParcelsOverlay(avatar.ControllingClient);
1773 });
1774 }
1775 }
1628 } 1776 }
1629 1777
1630 public double osList2Double(LSL_Types.list src, int index) 1778 public double osList2Double(LSL_Types.list src, int index)
@@ -1634,9 +1782,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1634 // is not allowed to contain any. 1782 // is not allowed to contain any.
1635 // This really should be removed. 1783 // This really should be removed.
1636 // 1784 //
1637 CheckThreatLevel(ThreatLevel.None, "osList2Double"); 1785 CheckThreatLevel();
1638 1786
1639 m_host.AddScriptLPS(1);
1640 if (index < 0) 1787 if (index < 0)
1641 { 1788 {
1642 index = src.Length + index; 1789 index = src.Length + index;
@@ -1654,8 +1801,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1654 // 1801 //
1655 CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelMediaURL"); 1802 CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelMediaURL");
1656 1803
1657 m_host.AddScriptLPS(1);
1658
1659 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); 1804 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
1660 1805
1661 if (land.LandData.OwnerID != m_host.OwnerID) 1806 if (land.LandData.OwnerID != m_host.OwnerID)
@@ -1670,8 +1815,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1670 // 1815 //
1671 CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelSIPAddress"); 1816 CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelSIPAddress");
1672 1817
1673 m_host.AddScriptLPS(1);
1674
1675 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); 1818 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
1676 1819
1677 if (land.LandData.OwnerID != m_host.OwnerID) 1820 if (land.LandData.OwnerID != m_host.OwnerID)
@@ -1698,8 +1841,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1698 // 1841 //
1699 CheckThreatLevel(ThreatLevel.High, "osGetScriptEngineName"); 1842 CheckThreatLevel(ThreatLevel.High, "osGetScriptEngineName");
1700 1843
1701 m_host.AddScriptLPS(1);
1702
1703 int scriptEngineNameIndex = 0; 1844 int scriptEngineNameIndex = 0;
1704 1845
1705 if (!String.IsNullOrEmpty(m_ScriptEngine.ScriptEngineName)) 1846 if (!String.IsNullOrEmpty(m_ScriptEngine.ScriptEngineName))
@@ -1725,7 +1866,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1725 public LSL_Integer osCheckODE() 1866 public LSL_Integer osCheckODE()
1726 { 1867 {
1727 CheckThreatLevel(); 1868 CheckThreatLevel();
1728 m_host.AddScriptLPS(1);
1729 1869
1730 LSL_Integer ret = 0; // false 1870 LSL_Integer ret = 0; // false
1731 if (m_ScriptEngine.World.PhysicsScene != null) 1871 if (m_ScriptEngine.World.PhysicsScene != null)
@@ -1749,6 +1889,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1749 // about the physics engine, this function returns an empty string if 1889 // about the physics engine, this function returns an empty string if
1750 // the user does not have permission to see it. This as opposed to 1890 // the user does not have permission to see it. This as opposed to
1751 // throwing an exception. 1891 // throwing an exception.
1892
1752 m_host.AddScriptLPS(1); 1893 m_host.AddScriptLPS(1);
1753 string ret = String.Empty; 1894 string ret = String.Empty;
1754 if (String.IsNullOrEmpty(CheckThreatLevelTest(ThreatLevel.High, "osGetPhysicsEngineType"))) 1895 if (String.IsNullOrEmpty(CheckThreatLevelTest(ThreatLevel.High, "osGetPhysicsEngineType")))
@@ -1768,7 +1909,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1768 public string osGetPhysicsEngineName() 1909 public string osGetPhysicsEngineName()
1769 { 1910 {
1770 CheckThreatLevel(); 1911 CheckThreatLevel();
1771 m_host.AddScriptLPS(1);
1772 1912
1773 string ret = "NoEngine"; 1913 string ret = "NoEngine";
1774 if (m_ScriptEngine.World.PhysicsScene != null) 1914 if (m_ScriptEngine.World.PhysicsScene != null)
@@ -1789,7 +1929,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1789 // kiddie) 1929 // kiddie)
1790 // 1930 //
1791 CheckThreatLevel(ThreatLevel.High,"osGetSimulatorVersion"); 1931 CheckThreatLevel(ThreatLevel.High,"osGetSimulatorVersion");
1792 m_host.AddScriptLPS(1);
1793 1932
1794 return m_ScriptEngine.World.GetSimulatorVersion(); 1933 return m_ScriptEngine.World.GetSimulatorVersion();
1795 } 1934 }
@@ -1835,8 +1974,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1835 { 1974 {
1836 CheckThreatLevel(ThreatLevel.None, "osParseJSONNew"); 1975 CheckThreatLevel(ThreatLevel.None, "osParseJSONNew");
1837 1976
1838 m_host.AddScriptLPS(1);
1839
1840 try 1977 try
1841 { 1978 {
1842 OSD decoded = OSDParser.DeserializeJson(JSON); 1979 OSD decoded = OSDParser.DeserializeJson(JSON);
@@ -1853,8 +1990,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1853 { 1990 {
1854 CheckThreatLevel(ThreatLevel.None, "osParseJSON"); 1991 CheckThreatLevel(ThreatLevel.None, "osParseJSON");
1855 1992
1856 m_host.AddScriptLPS(1);
1857
1858 Object decoded = osParseJSONNew(JSON); 1993 Object decoded = osParseJSONNew(JSON);
1859 1994
1860 if ( decoded is Hashtable ) { 1995 if ( decoded is Hashtable ) {
@@ -1885,7 +2020,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1885 public void osMessageObject(LSL_Key objectUUID, string message) 2020 public void osMessageObject(LSL_Key objectUUID, string message)
1886 { 2021 {
1887 CheckThreatLevel(ThreatLevel.Low, "osMessageObject"); 2022 CheckThreatLevel(ThreatLevel.Low, "osMessageObject");
1888 m_host.AddScriptLPS(1);
1889 2023
1890 UUID objUUID; 2024 UUID objUUID;
1891 if (!UUID.TryParse(objectUUID, out objUUID)) // prior to patching, a thrown exception regarding invalid GUID format would be shouted instead. 2025 if (!UUID.TryParse(objectUUID, out objUUID)) // prior to patching, a thrown exception regarding invalid GUID format would be shouted instead.
@@ -1926,7 +2060,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1926 // if this is restricted to objects rezzed by this host level can be reduced 2060 // if this is restricted to objects rezzed by this host level can be reduced
1927 2061
1928 CheckThreatLevel(ThreatLevel.Low, "osDie"); 2062 CheckThreatLevel(ThreatLevel.Low, "osDie");
1929 m_host.AddScriptLPS(1);
1930 2063
1931 UUID objUUID; 2064 UUID objUUID;
1932 if (!UUID.TryParse(objectUUID, out objUUID)) 2065 if (!UUID.TryParse(objectUUID, out objUUID))
@@ -1976,7 +2109,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1976 public void osMakeNotecard(string notecardName, LSL_Types.list contents) 2109 public void osMakeNotecard(string notecardName, LSL_Types.list contents)
1977 { 2110 {
1978 CheckThreatLevel(ThreatLevel.High, "osMakeNotecard"); 2111 CheckThreatLevel(ThreatLevel.High, "osMakeNotecard");
1979 m_host.AddScriptLPS(1);
1980 2112
1981 StringBuilder notecardData = new StringBuilder(); 2113 StringBuilder notecardData = new StringBuilder();
1982 2114
@@ -2162,7 +2294,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2162 public string osGetNotecardLine(string name, int line) 2294 public string osGetNotecardLine(string name, int line)
2163 { 2295 {
2164 CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNotecardLine"); 2296 CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNotecardLine");
2165 m_host.AddScriptLPS(1);
2166 2297
2167 UUID assetID = CacheNotecard(name); 2298 UUID assetID = CacheNotecard(name);
2168 2299
@@ -2190,7 +2321,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2190 public string osGetNotecard(string name) 2321 public string osGetNotecard(string name)
2191 { 2322 {
2192 CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNotecard"); 2323 CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNotecard");
2193 m_host.AddScriptLPS(1);
2194 2324
2195 string text = LoadNotecard(name); 2325 string text = LoadNotecard(name);
2196 2326
@@ -2220,7 +2350,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2220 public int osGetNumberOfNotecardLines(string name) 2350 public int osGetNumberOfNotecardLines(string name)
2221 { 2351 {
2222 CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNumberOfNotecardLines"); 2352 CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNumberOfNotecardLines");
2223 m_host.AddScriptLPS(1);
2224 2353
2225 UUID assetID = CacheNotecard(name); 2354 UUID assetID = CacheNotecard(name);
2226 2355
@@ -2236,7 +2365,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2236 public string osAvatarName2Key(string firstname, string lastname) 2365 public string osAvatarName2Key(string firstname, string lastname)
2237 { 2366 {
2238 CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key"); 2367 CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key");
2239 m_host.AddScriptLPS(1);
2240 2368
2241 IUserManagement userManager = World.RequestModuleInterface<IUserManagement>(); 2369 IUserManagement userManager = World.RequestModuleInterface<IUserManagement>();
2242 if (userManager == null) 2370 if (userManager == null)
@@ -2288,7 +2416,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2288 public string osKey2Name(string id) 2416 public string osKey2Name(string id)
2289 { 2417 {
2290 CheckThreatLevel(ThreatLevel.Low, "osKey2Name"); 2418 CheckThreatLevel(ThreatLevel.Low, "osKey2Name");
2291 m_host.AddScriptLPS(1);
2292 2419
2293 UUID key = new UUID(); 2420 UUID key = new UUID();
2294 2421
@@ -2398,7 +2525,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2398 public string osGetGridNick() 2525 public string osGetGridNick()
2399 { 2526 {
2400 CheckThreatLevel(ThreatLevel.Moderate, "osGetGridNick"); 2527 CheckThreatLevel(ThreatLevel.Moderate, "osGetGridNick");
2401 m_host.AddScriptLPS(1);
2402 2528
2403 string nick = String.Empty; 2529 string nick = String.Empty;
2404 IConfigSource config = m_ScriptEngine.ConfigSource; 2530 IConfigSource config = m_ScriptEngine.ConfigSource;
@@ -2415,7 +2541,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2415 public string osGetGridName() 2541 public string osGetGridName()
2416 { 2542 {
2417 CheckThreatLevel(ThreatLevel.Moderate, "osGetGridName"); 2543 CheckThreatLevel(ThreatLevel.Moderate, "osGetGridName");
2418 m_host.AddScriptLPS(1);
2419 2544
2420 string name = String.Empty; 2545 string name = String.Empty;
2421 IConfigSource config = m_ScriptEngine.ConfigSource; 2546 IConfigSource config = m_ScriptEngine.ConfigSource;
@@ -2432,7 +2557,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2432 public string osGetGridLoginURI() 2557 public string osGetGridLoginURI()
2433 { 2558 {
2434 CheckThreatLevel(ThreatLevel.Moderate, "osGetGridLoginURI"); 2559 CheckThreatLevel(ThreatLevel.Moderate, "osGetGridLoginURI");
2435 m_host.AddScriptLPS(1);
2436 2560
2437 string loginURI = String.Empty; 2561 string loginURI = String.Empty;
2438 IConfigSource config = m_ScriptEngine.ConfigSource; 2562 IConfigSource config = m_ScriptEngine.ConfigSource;
@@ -2449,7 +2573,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2449 public string osGetGridHomeURI() 2573 public string osGetGridHomeURI()
2450 { 2574 {
2451 CheckThreatLevel(ThreatLevel.Moderate, "osGetGridHomeURI"); 2575 CheckThreatLevel(ThreatLevel.Moderate, "osGetGridHomeURI");
2452 m_host.AddScriptLPS(1);
2453 2576
2454 IConfigSource config = m_ScriptEngine.ConfigSource; 2577 IConfigSource config = m_ScriptEngine.ConfigSource;
2455 string HomeURI = Util.GetConfigVarFromSections<string>(config, "HomeURI", 2578 string HomeURI = Util.GetConfigVarFromSections<string>(config, "HomeURI",
@@ -2471,7 +2594,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2471 public string osGetGridGatekeeperURI() 2594 public string osGetGridGatekeeperURI()
2472 { 2595 {
2473 CheckThreatLevel(ThreatLevel.Moderate, "osGetGridGatekeeperURI"); 2596 CheckThreatLevel(ThreatLevel.Moderate, "osGetGridGatekeeperURI");
2474 m_host.AddScriptLPS(1);
2475 2597
2476 IConfigSource config = m_ScriptEngine.ConfigSource; 2598 IConfigSource config = m_ScriptEngine.ConfigSource;
2477 string gatekeeperURI = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", 2599 string gatekeeperURI = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI",
@@ -2490,7 +2612,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2490 public string osGetGridCustom(string key) 2612 public string osGetGridCustom(string key)
2491 { 2613 {
2492 CheckThreatLevel(ThreatLevel.Moderate, "osGetGridCustom"); 2614 CheckThreatLevel(ThreatLevel.Moderate, "osGetGridCustom");
2493 m_host.AddScriptLPS(1);
2494 2615
2495 string retval = String.Empty; 2616 string retval = String.Empty;
2496 IConfigSource config = m_ScriptEngine.ConfigSource; 2617 IConfigSource config = m_ScriptEngine.ConfigSource;
@@ -2507,7 +2628,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2507 public string osGetAvatarHomeURI(string uuid) 2628 public string osGetAvatarHomeURI(string uuid)
2508 { 2629 {
2509 CheckThreatLevel(ThreatLevel.Low, "osGetAvatarHomeURI"); 2630 CheckThreatLevel(ThreatLevel.Low, "osGetAvatarHomeURI");
2510 m_host.AddScriptLPS(1);
2511 2631
2512 IUserManagement userManager = m_ScriptEngine.World.RequestModuleInterface<IUserManagement>(); 2632 IUserManagement userManager = m_ScriptEngine.World.RequestModuleInterface<IUserManagement>();
2513 string returnValue = ""; 2633 string returnValue = "";
@@ -2540,7 +2660,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2540 public LSL_String osFormatString(string str, LSL_List strings) 2660 public LSL_String osFormatString(string str, LSL_List strings)
2541 { 2661 {
2542 CheckThreatLevel(ThreatLevel.VeryLow, "osFormatString"); 2662 CheckThreatLevel(ThreatLevel.VeryLow, "osFormatString");
2543 m_host.AddScriptLPS(1);
2544 2663
2545 return String.Format(str, strings.Data); 2664 return String.Format(str, strings.Data);
2546 } 2665 }
@@ -2548,7 +2667,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2548 public LSL_List osMatchString(string src, string pattern, int start) 2667 public LSL_List osMatchString(string src, string pattern, int start)
2549 { 2668 {
2550 CheckThreatLevel(ThreatLevel.VeryLow, "osMatchString"); 2669 CheckThreatLevel(ThreatLevel.VeryLow, "osMatchString");
2551 m_host.AddScriptLPS(1);
2552 2670
2553 LSL_List result = new LSL_List(); 2671 LSL_List result = new LSL_List();
2554 2672
@@ -2590,7 +2708,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2590 public LSL_String osReplaceString(string src, string pattern, string replace, int count, int start) 2708 public LSL_String osReplaceString(string src, string pattern, string replace, int count, int start)
2591 { 2709 {
2592 CheckThreatLevel(ThreatLevel.VeryLow, "osReplaceString"); 2710 CheckThreatLevel(ThreatLevel.VeryLow, "osReplaceString");
2593 m_host.AddScriptLPS(1);
2594 2711
2595 // Normalize indices (if negative). 2712 // Normalize indices (if negative).
2596 // After normlaization they may still be 2713 // After normlaization they may still be
@@ -2615,7 +2732,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2615 public string osLoadedCreationDate() 2732 public string osLoadedCreationDate()
2616 { 2733 {
2617 CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationDate"); 2734 CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationDate");
2618 m_host.AddScriptLPS(1);
2619 2735
2620 return World.RegionInfo.RegionSettings.LoadedCreationDate; 2736 return World.RegionInfo.RegionSettings.LoadedCreationDate;
2621 } 2737 }
@@ -2623,7 +2739,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2623 public string osLoadedCreationTime() 2739 public string osLoadedCreationTime()
2624 { 2740 {
2625 CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationTime"); 2741 CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationTime");
2626 m_host.AddScriptLPS(1);
2627 2742
2628 return World.RegionInfo.RegionSettings.LoadedCreationTime; 2743 return World.RegionInfo.RegionSettings.LoadedCreationTime;
2629 } 2744 }
@@ -2631,7 +2746,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2631 public string osLoadedCreationID() 2746 public string osLoadedCreationID()
2632 { 2747 {
2633 CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationID"); 2748 CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationID");
2634 m_host.AddScriptLPS(1);
2635 2749
2636 return World.RegionInfo.RegionSettings.LoadedCreationID; 2750 return World.RegionInfo.RegionSettings.LoadedCreationID;
2637 } 2751 }
@@ -2652,7 +2766,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2652 public LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules) 2766 public LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules)
2653 { 2767 {
2654 CheckThreatLevel(ThreatLevel.High, "osGetLinkPrimitiveParams"); 2768 CheckThreatLevel(ThreatLevel.High, "osGetLinkPrimitiveParams");
2655 m_host.AddScriptLPS(1); 2769
2656 InitLSL(); 2770 InitLSL();
2657 // One needs to cast m_LSL_Api because we're using functions not 2771 // One needs to cast m_LSL_Api because we're using functions not
2658 // on the ILSL_Api interface. 2772 // on the ILSL_Api interface.
@@ -2681,8 +2795,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2681 { 2795 {
2682 CheckThreatLevel(ThreatLevel.VeryLow, "osForceCreateLink"); 2796 CheckThreatLevel(ThreatLevel.VeryLow, "osForceCreateLink");
2683 2797
2684 m_host.AddScriptLPS(1);
2685
2686 InitLSL(); 2798 InitLSL();
2687 ((LSL_Api)m_LSL_Api).CreateLink(target, parent); 2799 ((LSL_Api)m_LSL_Api).CreateLink(target, parent);
2688 } 2800 }
@@ -2691,8 +2803,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2691 { 2803 {
2692 CheckThreatLevel(ThreatLevel.VeryLow, "osForceBreakLink"); 2804 CheckThreatLevel(ThreatLevel.VeryLow, "osForceBreakLink");
2693 2805
2694 m_host.AddScriptLPS(1);
2695
2696 InitLSL(); 2806 InitLSL();
2697 ((LSL_Api)m_LSL_Api).BreakLink(linknum); 2807 ((LSL_Api)m_LSL_Api).BreakLink(linknum);
2698 } 2808 }
@@ -2701,16 +2811,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2701 { 2811 {
2702 CheckThreatLevel(ThreatLevel.VeryLow, "osForceBreakAllLinks"); 2812 CheckThreatLevel(ThreatLevel.VeryLow, "osForceBreakAllLinks");
2703 2813
2704 m_host.AddScriptLPS(1);
2705
2706 InitLSL(); 2814 InitLSL();
2707 ((LSL_Api)m_LSL_Api).BreakAllLinks(); 2815 ((LSL_Api)m_LSL_Api).BreakAllLinks();
2708 } 2816 }
2709 2817
2710 public LSL_Integer osIsNpc(LSL_Key npc) 2818 public LSL_Integer osIsNpc(LSL_Key npc)
2711 { 2819 {
2712 CheckThreatLevel(ThreatLevel.None, "osIsNpc"); 2820 CheckThreatLevel();
2713 m_host.AddScriptLPS(1);
2714 2821
2715 INPCModule module = World.RequestModuleInterface<INPCModule>(); 2822 INPCModule module = World.RequestModuleInterface<INPCModule>();
2716 if (module != null) 2823 if (module != null)
@@ -2727,7 +2834,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2727 public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard) 2834 public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard)
2728 { 2835 {
2729 CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); 2836 CheckThreatLevel(ThreatLevel.High, "osNpcCreate");
2730 m_host.AddScriptLPS(1);
2731 2837
2732 // have to get the npc module also here to set the default Not Owned 2838 // have to get the npc module also here to set the default Not Owned
2733 INPCModule module = World.RequestModuleInterface<INPCModule>(); 2839 INPCModule module = World.RequestModuleInterface<INPCModule>();
@@ -2742,7 +2848,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2742 public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, int options) 2848 public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, int options)
2743 { 2849 {
2744 CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); 2850 CheckThreatLevel(ThreatLevel.High, "osNpcCreate");
2745 m_host.AddScriptLPS(1);
2746 2851
2747 return NpcCreate( 2852 return NpcCreate(
2748 firstname, lastname, position, notecard, 2853 firstname, lastname, position, notecard,
@@ -2885,7 +2990,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2885 public LSL_Key osNpcSaveAppearance(LSL_Key npc, string notecard) 2990 public LSL_Key osNpcSaveAppearance(LSL_Key npc, string notecard)
2886 { 2991 {
2887 CheckThreatLevel(ThreatLevel.High, "osNpcSaveAppearance"); 2992 CheckThreatLevel(ThreatLevel.High, "osNpcSaveAppearance");
2888 m_host.AddScriptLPS(1);
2889 2993
2890 INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); 2994 INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
2891 2995
@@ -2907,7 +3011,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2907 public void osNpcLoadAppearance(LSL_Key npc, string notecard) 3011 public void osNpcLoadAppearance(LSL_Key npc, string notecard)
2908 { 3012 {
2909 CheckThreatLevel(ThreatLevel.High, "osNpcLoadAppearance"); 3013 CheckThreatLevel(ThreatLevel.High, "osNpcLoadAppearance");
2910 m_host.AddScriptLPS(1);
2911 3014
2912 INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); 3015 INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
2913 3016
@@ -2939,7 +3042,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2939 public LSL_Key osNpcGetOwner(LSL_Key npc) 3042 public LSL_Key osNpcGetOwner(LSL_Key npc)
2940 { 3043 {
2941 CheckThreatLevel(ThreatLevel.None, "osNpcGetOwner"); 3044 CheckThreatLevel(ThreatLevel.None, "osNpcGetOwner");
2942 m_host.AddScriptLPS(1);
2943 3045
2944 INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); 3046 INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
2945 if (npcModule != null) 3047 if (npcModule != null)
@@ -2961,7 +3063,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2961 public LSL_Vector osNpcGetPos(LSL_Key npc) 3063 public LSL_Vector osNpcGetPos(LSL_Key npc)
2962 { 3064 {
2963 CheckThreatLevel(ThreatLevel.High, "osNpcGetPos"); 3065 CheckThreatLevel(ThreatLevel.High, "osNpcGetPos");
2964 m_host.AddScriptLPS(1);
2965 3066
2966 INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); 3067 INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
2967 if (npcModule != null) 3068 if (npcModule != null)
@@ -2985,7 +3086,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2985 public void osNpcMoveTo(LSL_Key npc, LSL_Vector pos) 3086 public void osNpcMoveTo(LSL_Key npc, LSL_Vector pos)
2986 { 3087 {
2987 CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo"); 3088 CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo");
2988 m_host.AddScriptLPS(1);
2989 3089
2990 INPCModule module = World.RequestModuleInterface<INPCModule>(); 3090 INPCModule module = World.RequestModuleInterface<INPCModule>();
2991 if (module != null) 3091 if (module != null)
@@ -3004,7 +3104,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3004 public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector target, int options) 3104 public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector target, int options)
3005 { 3105 {
3006 CheckThreatLevel(ThreatLevel.High, "osNpcMoveToTarget"); 3106 CheckThreatLevel(ThreatLevel.High, "osNpcMoveToTarget");
3007 m_host.AddScriptLPS(1);
3008 3107
3009 INPCModule module = World.RequestModuleInterface<INPCModule>(); 3108 INPCModule module = World.RequestModuleInterface<INPCModule>();
3010 if (module != null) 3109 if (module != null)
@@ -3029,7 +3128,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3029 public LSL_Rotation osNpcGetRot(LSL_Key npc) 3128 public LSL_Rotation osNpcGetRot(LSL_Key npc)
3030 { 3129 {
3031 CheckThreatLevel(ThreatLevel.High, "osNpcGetRot"); 3130 CheckThreatLevel(ThreatLevel.High, "osNpcGetRot");
3032 m_host.AddScriptLPS(1);
3033 3131
3034 INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); 3132 INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
3035 if (npcModule != null) 3133 if (npcModule != null)
@@ -3053,7 +3151,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3053 public void osNpcSetRot(LSL_Key npc, LSL_Rotation rotation) 3151 public void osNpcSetRot(LSL_Key npc, LSL_Rotation rotation)
3054 { 3152 {
3055 CheckThreatLevel(ThreatLevel.High, "osNpcSetRot"); 3153 CheckThreatLevel(ThreatLevel.High, "osNpcSetRot");
3056 m_host.AddScriptLPS(1);
3057 3154
3058 INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); 3155 INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
3059 if (npcModule != null) 3156 if (npcModule != null)
@@ -3075,7 +3172,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3075 public void osNpcStopMoveToTarget(LSL_Key npc) 3172 public void osNpcStopMoveToTarget(LSL_Key npc)
3076 { 3173 {
3077 CheckThreatLevel(ThreatLevel.High, "osNpcStopMoveToTarget"); 3174 CheckThreatLevel(ThreatLevel.High, "osNpcStopMoveToTarget");
3078 m_host.AddScriptLPS(1);
3079 3175
3080 INPCModule module = World.RequestModuleInterface<INPCModule>(); 3176 INPCModule module = World.RequestModuleInterface<INPCModule>();
3081 if (module != null) 3177 if (module != null)
@@ -3092,7 +3188,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3092 public void osNpcSetProfileAbout(LSL_Key npc, string about) 3188 public void osNpcSetProfileAbout(LSL_Key npc, string about)
3093 { 3189 {
3094 CheckThreatLevel(ThreatLevel.Low, "osNpcSetProfileAbout"); 3190 CheckThreatLevel(ThreatLevel.Low, "osNpcSetProfileAbout");
3095 m_host.AddScriptLPS(1);
3096 3191
3097 INPCModule module = World.RequestModuleInterface<INPCModule>(); 3192 INPCModule module = World.RequestModuleInterface<INPCModule>();
3098 if (module != null) 3193 if (module != null)
@@ -3111,7 +3206,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3111 public void osNpcSetProfileImage(LSL_Key npc, string image) 3206 public void osNpcSetProfileImage(LSL_Key npc, string image)
3112 { 3207 {
3113 CheckThreatLevel(ThreatLevel.Low, "osNpcSetProfileImage"); 3208 CheckThreatLevel(ThreatLevel.Low, "osNpcSetProfileImage");
3114 m_host.AddScriptLPS(1);
3115 3209
3116 INPCModule module = World.RequestModuleInterface<INPCModule>(); 3210 INPCModule module = World.RequestModuleInterface<INPCModule>();
3117 if (module != null) 3211 if (module != null)
@@ -3145,7 +3239,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3145 public void osNpcSay(LSL_Key npc, int channel, string message) 3239 public void osNpcSay(LSL_Key npc, int channel, string message)
3146 { 3240 {
3147 CheckThreatLevel(ThreatLevel.High, "osNpcSay"); 3241 CheckThreatLevel(ThreatLevel.High, "osNpcSay");
3148 m_host.AddScriptLPS(1);
3149 3242
3150 INPCModule module = World.RequestModuleInterface<INPCModule>(); 3243 INPCModule module = World.RequestModuleInterface<INPCModule>();
3151 if (module != null) 3244 if (module != null)
@@ -3162,7 +3255,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3162 public void osNpcShout(LSL_Key npc, int channel, string message) 3255 public void osNpcShout(LSL_Key npc, int channel, string message)
3163 { 3256 {
3164 CheckThreatLevel(ThreatLevel.High, "osNpcShout"); 3257 CheckThreatLevel(ThreatLevel.High, "osNpcShout");
3165 m_host.AddScriptLPS(1);
3166 3258
3167 INPCModule module = World.RequestModuleInterface<INPCModule>(); 3259 INPCModule module = World.RequestModuleInterface<INPCModule>();
3168 if (module != null) 3260 if (module != null)
@@ -3179,7 +3271,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3179 public void osNpcSit(LSL_Key npc, LSL_Key target, int options) 3271 public void osNpcSit(LSL_Key npc, LSL_Key target, int options)
3180 { 3272 {
3181 CheckThreatLevel(ThreatLevel.High, "osNpcSit"); 3273 CheckThreatLevel(ThreatLevel.High, "osNpcSit");
3182 m_host.AddScriptLPS(1);
3183 3274
3184 INPCModule module = World.RequestModuleInterface<INPCModule>(); 3275 INPCModule module = World.RequestModuleInterface<INPCModule>();
3185 if (module != null) 3276 if (module != null)
@@ -3196,7 +3287,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3196 public void osNpcStand(LSL_Key npc) 3287 public void osNpcStand(LSL_Key npc)
3197 { 3288 {
3198 CheckThreatLevel(ThreatLevel.High, "osNpcStand"); 3289 CheckThreatLevel(ThreatLevel.High, "osNpcStand");
3199 m_host.AddScriptLPS(1);
3200 3290
3201 INPCModule module = World.RequestModuleInterface<INPCModule>(); 3291 INPCModule module = World.RequestModuleInterface<INPCModule>();
3202 if (module != null) 3292 if (module != null)
@@ -3213,7 +3303,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3213 public void osNpcRemove(LSL_Key npc) 3303 public void osNpcRemove(LSL_Key npc)
3214 { 3304 {
3215 CheckThreatLevel(ThreatLevel.High, "osNpcRemove"); 3305 CheckThreatLevel(ThreatLevel.High, "osNpcRemove");
3216 m_host.AddScriptLPS(1);
3217 3306
3218 try 3307 try
3219 { 3308 {
@@ -3234,7 +3323,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3234 public void osNpcPlayAnimation(LSL_Key npc, string animation) 3323 public void osNpcPlayAnimation(LSL_Key npc, string animation)
3235 { 3324 {
3236 CheckThreatLevel(ThreatLevel.High, "osNpcPlayAnimation"); 3325 CheckThreatLevel(ThreatLevel.High, "osNpcPlayAnimation");
3237 m_host.AddScriptLPS(1);
3238 3326
3239 INPCModule module = World.RequestModuleInterface<INPCModule>(); 3327 INPCModule module = World.RequestModuleInterface<INPCModule>();
3240 if (module != null) 3328 if (module != null)
@@ -3249,7 +3337,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3249 public void osNpcStopAnimation(LSL_Key npc, string animation) 3337 public void osNpcStopAnimation(LSL_Key npc, string animation)
3250 { 3338 {
3251 CheckThreatLevel(ThreatLevel.High, "osNpcStopAnimation"); 3339 CheckThreatLevel(ThreatLevel.High, "osNpcStopAnimation");
3252 m_host.AddScriptLPS(1);
3253 3340
3254 INPCModule module = World.RequestModuleInterface<INPCModule>(); 3341 INPCModule module = World.RequestModuleInterface<INPCModule>();
3255 if (module != null) 3342 if (module != null)
@@ -3264,7 +3351,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3264 public void osNpcWhisper(LSL_Key npc, int channel, string message) 3351 public void osNpcWhisper(LSL_Key npc, int channel, string message)
3265 { 3352 {
3266 CheckThreatLevel(ThreatLevel.High, "osNpcWhisper"); 3353 CheckThreatLevel(ThreatLevel.High, "osNpcWhisper");
3267 m_host.AddScriptLPS(1);
3268 3354
3269 INPCModule module = World.RequestModuleInterface<INPCModule>(); 3355 INPCModule module = World.RequestModuleInterface<INPCModule>();
3270 if (module != null) 3356 if (module != null)
@@ -3281,7 +3367,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3281 public void osNpcTouch(LSL_Key npcLSL_Key, LSL_Key object_key, LSL_Integer link_num) 3367 public void osNpcTouch(LSL_Key npcLSL_Key, LSL_Key object_key, LSL_Integer link_num)
3282 { 3368 {
3283 CheckThreatLevel(ThreatLevel.High, "osNpcTouch"); 3369 CheckThreatLevel(ThreatLevel.High, "osNpcTouch");
3284 m_host.AddScriptLPS(1);
3285 3370
3286 INPCModule module = World.RequestModuleInterface<INPCModule>(); 3371 INPCModule module = World.RequestModuleInterface<INPCModule>();
3287 int linkNum = link_num.value; 3372 int linkNum = link_num.value;
@@ -3326,7 +3411,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3326 public LSL_Key osOwnerSaveAppearance(string notecard) 3411 public LSL_Key osOwnerSaveAppearance(string notecard)
3327 { 3412 {
3328 CheckThreatLevel(ThreatLevel.High, "osOwnerSaveAppearance"); 3413 CheckThreatLevel(ThreatLevel.High, "osOwnerSaveAppearance");
3329 m_host.AddScriptLPS(1);
3330 3414
3331 return SaveAppearanceToNotecard(m_host.OwnerID, notecard); 3415 return SaveAppearanceToNotecard(m_host.OwnerID, notecard);
3332 } 3416 }
@@ -3334,7 +3418,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3334 public LSL_Key osAgentSaveAppearance(LSL_Key avatarId, string notecard) 3418 public LSL_Key osAgentSaveAppearance(LSL_Key avatarId, string notecard)
3335 { 3419 {
3336 CheckThreatLevel(ThreatLevel.VeryHigh, "osAgentSaveAppearance"); 3420 CheckThreatLevel(ThreatLevel.VeryHigh, "osAgentSaveAppearance");
3337 m_host.AddScriptLPS(1);
3338 3421
3339 return SaveAppearanceToNotecard(avatarId, notecard); 3422 return SaveAppearanceToNotecard(avatarId, notecard);
3340 } 3423 }
@@ -3387,7 +3470,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3387 public LSL_String osGetGender(LSL_Key rawAvatarId) 3470 public LSL_String osGetGender(LSL_Key rawAvatarId)
3388 { 3471 {
3389 CheckThreatLevel(ThreatLevel.None, "osGetGender"); 3472 CheckThreatLevel(ThreatLevel.None, "osGetGender");
3390 m_host.AddScriptLPS(1);
3391 3473
3392 UUID avatarId; 3474 UUID avatarId;
3393 if (!UUID.TryParse(rawAvatarId, out avatarId)) 3475 if (!UUID.TryParse(rawAvatarId, out avatarId))
@@ -3430,8 +3512,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3430 /// <returns></returns> 3512 /// <returns></returns>
3431 public LSL_Key osGetMapTexture() 3513 public LSL_Key osGetMapTexture()
3432 { 3514 {
3433 CheckThreatLevel(ThreatLevel.None, "osGetMapTexture"); 3515 CheckThreatLevel();
3434 m_host.AddScriptLPS(1);
3435 3516
3436 return m_ScriptEngine.World.RegionInfo.RegionSettings.TerrainImageID.ToString(); 3517 return m_ScriptEngine.World.RegionInfo.RegionSettings.TerrainImageID.ToString();
3437 } 3518 }
@@ -3444,7 +3525,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3444 public LSL_Key osGetRegionMapTexture(string regionName) 3525 public LSL_Key osGetRegionMapTexture(string regionName)
3445 { 3526 {
3446 CheckThreatLevel(ThreatLevel.High, "osGetRegionMapTexture"); 3527 CheckThreatLevel(ThreatLevel.High, "osGetRegionMapTexture");
3447 m_host.AddScriptLPS(1);
3448 3528
3449 Scene scene = m_ScriptEngine.World; 3529 Scene scene = m_ScriptEngine.World;
3450 UUID key = UUID.Zero; 3530 UUID key = UUID.Zero;
@@ -3475,7 +3555,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3475 public LSL_List osGetRegionStats() 3555 public LSL_List osGetRegionStats()
3476 { 3556 {
3477 CheckThreatLevel(ThreatLevel.Moderate, "osGetRegionStats"); 3557 CheckThreatLevel(ThreatLevel.Moderate, "osGetRegionStats");
3478 m_host.AddScriptLPS(1); 3558
3479 LSL_List ret = new LSL_List(); 3559 LSL_List ret = new LSL_List();
3480 float[] stats = World.StatsReporter.LastReportedSimStats; 3560 float[] stats = World.StatsReporter.LastReportedSimStats;
3481 3561
@@ -3488,8 +3568,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3488 3568
3489 public LSL_Vector osGetRegionSize() 3569 public LSL_Vector osGetRegionSize()
3490 { 3570 {
3491 CheckThreatLevel(ThreatLevel.None, "osGetRegionSize"); 3571 CheckThreatLevel();
3492 m_host.AddScriptLPS(1);
3493 3572
3494 Scene scene = m_ScriptEngine.World; 3573 Scene scene = m_ScriptEngine.World;
3495 RegionInfo reg = World.RegionInfo; 3574 RegionInfo reg = World.RegionInfo;
@@ -3501,7 +3580,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3501 public int osGetSimulatorMemory() 3580 public int osGetSimulatorMemory()
3502 { 3581 {
3503 CheckThreatLevel(ThreatLevel.Moderate, "osGetSimulatorMemory"); 3582 CheckThreatLevel(ThreatLevel.Moderate, "osGetSimulatorMemory");
3504 m_host.AddScriptLPS(1); 3583
3505 long pws = System.Diagnostics.Process.GetCurrentProcess().WorkingSet64; 3584 long pws = System.Diagnostics.Process.GetCurrentProcess().WorkingSet64;
3506 3585
3507 if (pws > Int32.MaxValue) 3586 if (pws > Int32.MaxValue)
@@ -3515,7 +3594,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3515 public void osSetSpeed(string UUID, LSL_Float SpeedModifier) 3594 public void osSetSpeed(string UUID, LSL_Float SpeedModifier)
3516 { 3595 {
3517 CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); 3596 CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed");
3518 m_host.AddScriptLPS(1); 3597
3519 ScenePresence avatar = World.GetScenePresence(new UUID(UUID)); 3598 ScenePresence avatar = World.GetScenePresence(new UUID(UUID));
3520 3599
3521 if (avatar != null) 3600 if (avatar != null)
@@ -3525,7 +3604,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3525 public void osKickAvatar(string FirstName, string SurName, string alert) 3604 public void osKickAvatar(string FirstName, string SurName, string alert)
3526 { 3605 {
3527 CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); 3606 CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar");
3528 m_host.AddScriptLPS(1);
3529 3607
3530 World.ForEachRootScenePresence(delegate(ScenePresence sp) 3608 World.ForEachRootScenePresence(delegate(ScenePresence sp)
3531 { 3609 {
@@ -3544,7 +3622,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3544 public LSL_Float osGetHealth(string avatar) 3622 public LSL_Float osGetHealth(string avatar)
3545 { 3623 {
3546 CheckThreatLevel(ThreatLevel.None, "osGetHealth"); 3624 CheckThreatLevel(ThreatLevel.None, "osGetHealth");
3547 m_host.AddScriptLPS(1);
3548 3625
3549 LSL_Float health = new LSL_Float(-1); 3626 LSL_Float health = new LSL_Float(-1);
3550 ScenePresence presence = World.GetScenePresence(new UUID(avatar)); 3627 ScenePresence presence = World.GetScenePresence(new UUID(avatar));
@@ -3556,7 +3633,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3556 public void osCauseDamage(string avatar, double damage) 3633 public void osCauseDamage(string avatar, double damage)
3557 { 3634 {
3558 CheckThreatLevel(ThreatLevel.High, "osCauseDamage"); 3635 CheckThreatLevel(ThreatLevel.High, "osCauseDamage");
3559 m_host.AddScriptLPS(1);
3560 3636
3561 UUID avatarId = new UUID(avatar); 3637 UUID avatarId = new UUID(avatar);
3562 Vector3 pos = m_host.GetWorldPosition(); 3638 Vector3 pos = m_host.GetWorldPosition();
@@ -3584,7 +3660,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3584 public void osCauseHealing(string avatar, double healing) 3660 public void osCauseHealing(string avatar, double healing)
3585 { 3661 {
3586 CheckThreatLevel(ThreatLevel.High, "osCauseHealing"); 3662 CheckThreatLevel(ThreatLevel.High, "osCauseHealing");
3587 m_host.AddScriptLPS(1);
3588 3663
3589 UUID avatarId = new UUID(avatar); 3664 UUID avatarId = new UUID(avatar);
3590 ScenePresence presence = World.GetScenePresence(avatarId); 3665 ScenePresence presence = World.GetScenePresence(avatarId);
@@ -3604,7 +3679,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3604 public void osSetHealth(string avatar, double health) 3679 public void osSetHealth(string avatar, double health)
3605 { 3680 {
3606 CheckThreatLevel(ThreatLevel.High, "osSetHealth"); 3681 CheckThreatLevel(ThreatLevel.High, "osSetHealth");
3607 m_host.AddScriptLPS(1);
3608 3682
3609 UUID avatarId = new UUID(avatar); 3683 UUID avatarId = new UUID(avatar);
3610 ScenePresence presence = World.GetScenePresence(avatarId); 3684 ScenePresence presence = World.GetScenePresence(avatarId);
@@ -3623,7 +3697,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3623 public void osSetHealRate(string avatar, double healrate) 3697 public void osSetHealRate(string avatar, double healrate)
3624 { 3698 {
3625 CheckThreatLevel(ThreatLevel.High, "osSetHealRate"); 3699 CheckThreatLevel(ThreatLevel.High, "osSetHealRate");
3626 m_host.AddScriptLPS(1);
3627 3700
3628 UUID avatarId = new UUID(avatar); 3701 UUID avatarId = new UUID(avatar);
3629 ScenePresence presence = World.GetScenePresence(avatarId); 3702 ScenePresence presence = World.GetScenePresence(avatarId);
@@ -3635,7 +3708,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3635 public LSL_Float osGetHealRate(string avatar) 3708 public LSL_Float osGetHealRate(string avatar)
3636 { 3709 {
3637 CheckThreatLevel(ThreatLevel.None, "osGetHealRate"); 3710 CheckThreatLevel(ThreatLevel.None, "osGetHealRate");
3638 m_host.AddScriptLPS(1);
3639 3711
3640 LSL_Float rate = new LSL_Float(0); 3712 LSL_Float rate = new LSL_Float(0);
3641 ScenePresence presence = World.GetScenePresence(new UUID(avatar)); 3713 ScenePresence presence = World.GetScenePresence(new UUID(avatar));
@@ -3647,18 +3719,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3647 public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules) 3719 public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules)
3648 { 3720 {
3649 CheckThreatLevel(ThreatLevel.High, "osGetPrimitiveParams"); 3721 CheckThreatLevel(ThreatLevel.High, "osGetPrimitiveParams");
3650 m_host.AddScriptLPS(1);
3651 InitLSL();
3652 3722
3723 InitLSL();
3653 return m_LSL_Api.GetPrimitiveParamsEx(prim, rules); 3724 return m_LSL_Api.GetPrimitiveParamsEx(prim, rules);
3654 } 3725 }
3655 3726
3656 public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules) 3727 public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules)
3657 { 3728 {
3658 CheckThreatLevel(ThreatLevel.High, "osSetPrimitiveParams"); 3729 CheckThreatLevel(ThreatLevel.High, "osSetPrimitiveParams");
3659 m_host.AddScriptLPS(1);
3660 InitLSL();
3661 3730
3731 InitLSL();
3662 m_LSL_Api.SetPrimitiveParamsEx(prim, rules, "osSetPrimitiveParams"); 3732 m_LSL_Api.SetPrimitiveParamsEx(prim, rules, "osSetPrimitiveParams");
3663 } 3733 }
3664 3734
@@ -3667,8 +3737,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3667 /// </summary> 3737 /// </summary>
3668 public void osSetProjectionParams(bool projection, LSL_Key texture, double fov, double focus, double amb) 3738 public void osSetProjectionParams(bool projection, LSL_Key texture, double fov, double focus, double amb)
3669 { 3739 {
3670 CheckThreatLevel(ThreatLevel.High, "osSetProjectionParams");
3671
3672 osSetProjectionParams(UUID.Zero.ToString(), projection, texture, fov, focus, amb); 3740 osSetProjectionParams(UUID.Zero.ToString(), projection, texture, fov, focus, amb);
3673 } 3741 }
3674 3742
@@ -3678,7 +3746,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3678 public void osSetProjectionParams(LSL_Key prim, bool projection, LSL_Key texture, double fov, double focus, double amb) 3746 public void osSetProjectionParams(LSL_Key prim, bool projection, LSL_Key texture, double fov, double focus, double amb)
3679 { 3747 {
3680 CheckThreatLevel(ThreatLevel.High, "osSetProjectionParams"); 3748 CheckThreatLevel(ThreatLevel.High, "osSetProjectionParams");
3681 m_host.AddScriptLPS(1);
3682 3749
3683 SceneObjectPart obj = null; 3750 SceneObjectPart obj = null;
3684 if (prim == UUID.Zero.ToString()) 3751 if (prim == UUID.Zero.ToString())
@@ -3709,12 +3776,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3709 public LSL_List osGetAvatarList() 3776 public LSL_List osGetAvatarList()
3710 { 3777 {
3711 CheckThreatLevel(ThreatLevel.None, "osGetAvatarList"); 3778 CheckThreatLevel(ThreatLevel.None, "osGetAvatarList");
3712 m_host.AddScriptLPS(1);
3713 3779
3714 LSL_List result = new LSL_List(); 3780 LSL_List result = new LSL_List();
3715 World.ForEachRootScenePresence(delegate (ScenePresence avatar) 3781 World.ForEachRootScenePresence(delegate (ScenePresence avatar)
3716 { 3782 {
3717 if (avatar != null && avatar.UUID != m_host.OwnerID) 3783 if (avatar != null && !avatar.IsDeleted && avatar.UUID != m_host.OwnerID )
3784 {
3785 result.Add(new LSL_String(avatar.UUID.ToString()));
3786 result.Add(new LSL_Vector(avatar.AbsolutePosition));
3787 result.Add(new LSL_String(avatar.Name));
3788 }
3789 });
3790
3791 return result;
3792 }
3793
3794 public LSL_List osGetNPCList()
3795 {
3796 CheckThreatLevel(ThreatLevel.None, "osGetNPCList");
3797
3798 LSL_List result = new LSL_List();
3799 World.ForEachRootScenePresence(delegate (ScenePresence avatar)
3800 {
3801 // npcs are not childagents but that is now.
3802 if (avatar != null && avatar.IsNPC && !avatar.IsDeleted && !avatar.IsChildAgent && !avatar.IsInTransit)
3718 { 3803 {
3719 result.Add(new LSL_String(avatar.UUID.ToString())); 3804 result.Add(new LSL_String(avatar.UUID.ToString()));
3720 result.Add(new LSL_Vector(avatar.AbsolutePosition)); 3805 result.Add(new LSL_Vector(avatar.AbsolutePosition));
@@ -3733,7 +3818,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3733 public LSL_String osUnixTimeToTimestamp(long time) 3818 public LSL_String osUnixTimeToTimestamp(long time)
3734 { 3819 {
3735 CheckThreatLevel(ThreatLevel.VeryLow, "osUnixTimeToTimestamp"); 3820 CheckThreatLevel(ThreatLevel.VeryLow, "osUnixTimeToTimestamp");
3736 m_host.AddScriptLPS(1);
3737 3821
3738 long baseTicks = 621355968000000000; 3822 long baseTicks = 621355968000000000;
3739 long tickResolution = 10000000; 3823 long tickResolution = 10000000;
@@ -3750,7 +3834,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3750 /// <returns>Item description</returns> 3834 /// <returns>Item description</returns>
3751 public LSL_String osGetInventoryDesc(string item) 3835 public LSL_String osGetInventoryDesc(string item)
3752 { 3836 {
3753 m_host.AddScriptLPS(1); 3837 CheckThreatLevel();
3754 3838
3755 lock (m_host.TaskInventory) 3839 lock (m_host.TaskInventory)
3756 { 3840 {
@@ -3774,7 +3858,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3774 public LSL_Integer osInviteToGroup(LSL_Key agentId) 3858 public LSL_Integer osInviteToGroup(LSL_Key agentId)
3775 { 3859 {
3776 CheckThreatLevel(ThreatLevel.VeryLow, "osInviteToGroup"); 3860 CheckThreatLevel(ThreatLevel.VeryLow, "osInviteToGroup");
3777 m_host.AddScriptLPS(1);
3778 3861
3779 UUID agent = new UUID(agentId); 3862 UUID agent = new UUID(agentId);
3780 3863
@@ -3809,7 +3892,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3809 public LSL_Integer osEjectFromGroup(LSL_Key agentId) 3892 public LSL_Integer osEjectFromGroup(LSL_Key agentId)
3810 { 3893 {
3811 CheckThreatLevel(ThreatLevel.VeryLow, "osEjectFromGroup"); 3894 CheckThreatLevel(ThreatLevel.VeryLow, "osEjectFromGroup");
3812 m_host.AddScriptLPS(1);
3813 3895
3814 UUID agent = new UUID(agentId); 3896 UUID agent = new UUID(agentId);
3815 3897
@@ -3845,7 +3927,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3845 { 3927 {
3846 CheckThreatLevel(ThreatLevel.High, "osSetTerrainTexture"); 3928 CheckThreatLevel(ThreatLevel.High, "osSetTerrainTexture");
3847 3929
3848 m_host.AddScriptLPS(1);
3849 //Check to make sure that the script's owner is the estate manager/master 3930 //Check to make sure that the script's owner is the estate manager/master
3850 //World.Permissions.GenericEstatePermission( 3931 //World.Permissions.GenericEstatePermission(
3851 if (World.Permissions.IsGod(m_host.OwnerID)) 3932 if (World.Permissions.IsGod(m_host.OwnerID))
@@ -3875,7 +3956,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3875 { 3956 {
3876 CheckThreatLevel(ThreatLevel.High, "osSetTerrainTextureHeight"); 3957 CheckThreatLevel(ThreatLevel.High, "osSetTerrainTextureHeight");
3877 3958
3878 m_host.AddScriptLPS(1);
3879 //Check to make sure that the script's owner is the estate manager/master 3959 //Check to make sure that the script's owner is the estate manager/master
3880 //World.Permissions.GenericEstatePermission( 3960 //World.Permissions.GenericEstatePermission(
3881 if (World.Permissions.IsGod(m_host.OwnerID)) 3961 if (World.Permissions.IsGod(m_host.OwnerID))
@@ -3896,8 +3976,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3896 { 3976 {
3897 CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatar"); 3977 CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatar");
3898 3978
3899 m_host.AddScriptLPS(1);
3900
3901 InitLSL(); 3979 InitLSL();
3902 ((LSL_Api)m_LSL_Api).AttachToAvatar(attachmentPoint); 3980 ((LSL_Api)m_LSL_Api).AttachToAvatar(attachmentPoint);
3903 } 3981 }
@@ -3906,8 +3984,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3906 { 3984 {
3907 CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatarFromInventory"); 3985 CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatarFromInventory");
3908 3986
3909 m_host.AddScriptLPS(1);
3910
3911 ForceAttachToAvatarFromInventory(m_host.OwnerID, itemName, attachmentPoint); 3987 ForceAttachToAvatarFromInventory(m_host.OwnerID, itemName, attachmentPoint);
3912 } 3988 }
3913 3989
@@ -3915,8 +3991,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3915 { 3991 {
3916 CheckThreatLevel(ThreatLevel.VeryHigh, "osForceAttachToOtherAvatarFromInventory"); 3992 CheckThreatLevel(ThreatLevel.VeryHigh, "osForceAttachToOtherAvatarFromInventory");
3917 3993
3918 m_host.AddScriptLPS(1);
3919
3920 UUID avatarId; 3994 UUID avatarId;
3921 3995
3922 if (!UUID.TryParse(rawAvatarId, out avatarId)) 3996 if (!UUID.TryParse(rawAvatarId, out avatarId))
@@ -3976,8 +4050,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3976 { 4050 {
3977 CheckThreatLevel(ThreatLevel.High, "osForceDetachFromAvatar"); 4051 CheckThreatLevel(ThreatLevel.High, "osForceDetachFromAvatar");
3978 4052
3979 m_host.AddScriptLPS(1);
3980
3981 InitLSL(); 4053 InitLSL();
3982 ((LSL_Api)m_LSL_Api).DetachFromAvatar(); 4054 ((LSL_Api)m_LSL_Api).DetachFromAvatar();
3983 } 4055 }
@@ -3986,8 +4058,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3986 { 4058 {
3987 CheckThreatLevel(ThreatLevel.Moderate, "osGetNumberOfAttachments"); 4059 CheckThreatLevel(ThreatLevel.Moderate, "osGetNumberOfAttachments");
3988 4060
3989 m_host.AddScriptLPS(1);
3990
3991 UUID targetUUID; 4061 UUID targetUUID;
3992 ScenePresence target; 4062 ScenePresence target;
3993 LSL_List resp = new LSL_List(); 4063 LSL_List resp = new LSL_List();
@@ -4021,7 +4091,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4021 public void osMessageAttachments(LSL_Key avatar, string message, LSL_List attachmentPoints, int options) 4091 public void osMessageAttachments(LSL_Key avatar, string message, LSL_List attachmentPoints, int options)
4022 { 4092 {
4023 CheckThreatLevel(ThreatLevel.Moderate, "osMessageAttachments"); 4093 CheckThreatLevel(ThreatLevel.Moderate, "osMessageAttachments");
4024 m_host.AddScriptLPS(1);
4025 4094
4026 UUID targetUUID; 4095 UUID targetUUID;
4027 if(!UUID.TryParse(avatar.ToString(), out targetUUID)) 4096 if(!UUID.TryParse(avatar.ToString(), out targetUUID))
@@ -4130,8 +4199,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4130 /// <returns>1 if thing is a valid UUID, 0 otherwise</returns> 4199 /// <returns>1 if thing is a valid UUID, 0 otherwise</returns>
4131 public LSL_Integer osIsUUID(string thing) 4200 public LSL_Integer osIsUUID(string thing)
4132 { 4201 {
4133 CheckThreatLevel(ThreatLevel.None, "osIsUUID"); 4202 CheckThreatLevel();
4134 m_host.AddScriptLPS(1);
4135 4203
4136 UUID test; 4204 UUID test;
4137 return UUID.TryParse(thing, out test) ? 1 : 0; 4205 return UUID.TryParse(thing, out test) ? 1 : 0;
@@ -4145,8 +4213,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4145 /// <returns></returns> 4213 /// <returns></returns>
4146 public LSL_Float osMin(double a, double b) 4214 public LSL_Float osMin(double a, double b)
4147 { 4215 {
4148 CheckThreatLevel(ThreatLevel.None, "osMin"); 4216 CheckThreatLevel();
4149 m_host.AddScriptLPS(1);
4150 4217
4151 return Math.Min(a, b); 4218 return Math.Min(a, b);
4152 } 4219 }
@@ -4159,8 +4226,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4159 /// <returns></returns> 4226 /// <returns></returns>
4160 public LSL_Float osMax(double a, double b) 4227 public LSL_Float osMax(double a, double b)
4161 { 4228 {
4162 CheckThreatLevel(ThreatLevel.None, "osMax"); 4229 CheckThreatLevel();
4163 m_host.AddScriptLPS(1);
4164 4230
4165 return Math.Max(a, b); 4231 return Math.Max(a, b);
4166 } 4232 }
@@ -4168,7 +4234,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4168 public LSL_Key osGetRezzingObject() 4234 public LSL_Key osGetRezzingObject()
4169 { 4235 {
4170 CheckThreatLevel(ThreatLevel.None, "osGetRezzingObject"); 4236 CheckThreatLevel(ThreatLevel.None, "osGetRezzingObject");
4171 m_host.AddScriptLPS(1); 4237
4172 UUID rezID = m_host.ParentGroup.RezzerID; 4238 UUID rezID = m_host.ParentGroup.RezzerID;
4173 if(rezID == UUID.Zero || m_host.ParentGroup.Scene.GetScenePresence(rezID) != null) 4239 if(rezID == UUID.Zero || m_host.ParentGroup.Scene.GetScenePresence(rezID) != null)
4174 return new LSL_Key(UUID.Zero.ToString()); 4240 return new LSL_Key(UUID.Zero.ToString());
@@ -4193,7 +4259,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4193 /// <returns>boolean indicating whether an error was shouted.</returns> 4259 /// <returns>boolean indicating whether an error was shouted.</returns>
4194 protected bool ShoutErrorOnLackingOwnerPerms(int perms, string errorPrefix) 4260 protected bool ShoutErrorOnLackingOwnerPerms(int perms, string errorPrefix)
4195 { 4261 {
4196 m_host.AddScriptLPS(1);
4197 bool fail = false; 4262 bool fail = false;
4198 if (m_item.PermsGranter != m_host.OwnerID) 4263 if (m_item.PermsGranter != m_host.OwnerID)
4199 { 4264 {
@@ -4244,7 +4309,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4244 public void osDropAttachment() 4309 public void osDropAttachment()
4245 { 4310 {
4246 CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachment"); 4311 CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachment");
4247 m_host.AddScriptLPS(1);
4248 4312
4249 DropAttachment(true); 4313 DropAttachment(true);
4250 } 4314 }
@@ -4252,7 +4316,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4252 public void osForceDropAttachment() 4316 public void osForceDropAttachment()
4253 { 4317 {
4254 CheckThreatLevel(ThreatLevel.High, "osForceDropAttachment"); 4318 CheckThreatLevel(ThreatLevel.High, "osForceDropAttachment");
4255 m_host.AddScriptLPS(1);
4256 4319
4257 DropAttachment(false); 4320 DropAttachment(false);
4258 } 4321 }
@@ -4260,7 +4323,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4260 public void osDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot) 4323 public void osDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot)
4261 { 4324 {
4262 CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachmentAt"); 4325 CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachmentAt");
4263 m_host.AddScriptLPS(1);
4264 4326
4265 DropAttachmentAt(true, pos, rot); 4327 DropAttachmentAt(true, pos, rot);
4266 } 4328 }
@@ -4268,7 +4330,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4268 public void osForceDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot) 4330 public void osForceDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot)
4269 { 4331 {
4270 CheckThreatLevel(ThreatLevel.High, "osForceDropAttachmentAt"); 4332 CheckThreatLevel(ThreatLevel.High, "osForceDropAttachmentAt");
4271 m_host.AddScriptLPS(1);
4272 4333
4273 DropAttachmentAt(false, pos, rot); 4334 DropAttachmentAt(false, pos, rot);
4274 } 4335 }
@@ -4276,7 +4337,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4276 public LSL_Integer osListenRegex(int channelID, string name, string ID, string msg, int regexBitfield) 4337 public LSL_Integer osListenRegex(int channelID, string name, string ID, string msg, int regexBitfield)
4277 { 4338 {
4278 CheckThreatLevel(ThreatLevel.Low, "osListenRegex"); 4339 CheckThreatLevel(ThreatLevel.Low, "osListenRegex");
4279 m_host.AddScriptLPS(1); 4340
4280 UUID keyID; 4341 UUID keyID;
4281 UUID.TryParse(ID, out keyID); 4342 UUID.TryParse(ID, out keyID);
4282 4343
@@ -4324,7 +4385,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4324 public LSL_Integer osRegexIsMatch(string input, string pattern) 4385 public LSL_Integer osRegexIsMatch(string input, string pattern)
4325 { 4386 {
4326 CheckThreatLevel(ThreatLevel.Low, "osRegexIsMatch"); 4387 CheckThreatLevel(ThreatLevel.Low, "osRegexIsMatch");
4327 m_host.AddScriptLPS(1); 4388
4328 try 4389 try
4329 { 4390 {
4330 return Regex.IsMatch(input, pattern) ? 1 : 0; 4391 return Regex.IsMatch(input, pattern) ? 1 : 0;
@@ -4339,7 +4400,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4339 public LSL_String osRequestURL(LSL_List options) 4400 public LSL_String osRequestURL(LSL_List options)
4340 { 4401 {
4341 CheckThreatLevel(ThreatLevel.Moderate, "osRequestSecureURL"); 4402 CheckThreatLevel(ThreatLevel.Moderate, "osRequestSecureURL");
4342 m_host.AddScriptLPS(1);
4343 4403
4344 Hashtable opts = new Hashtable(); 4404 Hashtable opts = new Hashtable();
4345 for (int i = 0 ; i < options.Length ; i++) 4405 for (int i = 0 ; i < options.Length ; i++)
@@ -4357,7 +4417,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4357 public LSL_String osRequestSecureURL(LSL_List options) 4417 public LSL_String osRequestSecureURL(LSL_List options)
4358 { 4418 {
4359 CheckThreatLevel(ThreatLevel.Moderate, "osRequestSecureURL"); 4419 CheckThreatLevel(ThreatLevel.Moderate, "osRequestSecureURL");
4360 m_host.AddScriptLPS(1);
4361 4420
4362 Hashtable opts = new Hashtable(); 4421 Hashtable opts = new Hashtable();
4363 for (int i = 0 ; i < options.Length ; i++) 4422 for (int i = 0 ; i < options.Length ; i++)
@@ -4375,7 +4434,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4375 public void osCollisionSound(string impact_sound, double impact_volume) 4434 public void osCollisionSound(string impact_sound, double impact_volume)
4376 { 4435 {
4377 CheckThreatLevel(); 4436 CheckThreatLevel();
4378 m_host.AddScriptLPS(1);
4379 4437
4380 if(impact_sound == "") 4438 if(impact_sound == "")
4381 { 4439 {
@@ -4408,7 +4466,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4408 public void osVolumeDetect(int detect) 4466 public void osVolumeDetect(int detect)
4409 { 4467 {
4410 CheckThreatLevel(); 4468 CheckThreatLevel();
4411 m_host.AddScriptLPS(1);
4412 4469
4413 if (m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted || m_host.ParentGroup.IsAttachment) 4470 if (m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted || m_host.ParentGroup.IsAttachment)
4414 return; 4471 return;
@@ -4431,7 +4488,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4431 public LSL_List osGetInertiaData() 4488 public LSL_List osGetInertiaData()
4432 { 4489 {
4433 CheckThreatLevel(); 4490 CheckThreatLevel();
4434 m_host.AddScriptLPS(1);
4435 4491
4436 LSL_List result = new LSL_List(); 4492 LSL_List result = new LSL_List();
4437 float TotalMass; 4493 float TotalMass;
@@ -4479,7 +4535,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4479 public void osSetInertia(LSL_Float mass, LSL_Vector centerOfMass, LSL_Vector principalInertiaScaled, LSL_Rotation lslrot) 4535 public void osSetInertia(LSL_Float mass, LSL_Vector centerOfMass, LSL_Vector principalInertiaScaled, LSL_Rotation lslrot)
4480 { 4536 {
4481 CheckThreatLevel(); 4537 CheckThreatLevel();
4482 m_host.AddScriptLPS(1);
4483 4538
4484 SceneObjectGroup sog = m_host.ParentGroup; 4539 SceneObjectGroup sog = m_host.ParentGroup;
4485 if(sog== null || sog.IsDeleted) 4540 if(sog== null || sog.IsDeleted)
@@ -4518,7 +4573,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4518 public void osSetInertiaAsBox(LSL_Float mass, LSL_Vector boxSize, LSL_Vector centerOfMass, LSL_Rotation lslrot) 4573 public void osSetInertiaAsBox(LSL_Float mass, LSL_Vector boxSize, LSL_Vector centerOfMass, LSL_Rotation lslrot)
4519 { 4574 {
4520 CheckThreatLevel(); 4575 CheckThreatLevel();
4521 m_host.AddScriptLPS(1);
4522 4576
4523 SceneObjectGroup sog = m_host.ParentGroup; 4577 SceneObjectGroup sog = m_host.ParentGroup;
4524 if(sog== null || sog.IsDeleted) 4578 if(sog== null || sog.IsDeleted)
@@ -4560,7 +4614,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4560 public void osSetInertiaAsSphere(LSL_Float mass, LSL_Float radius, LSL_Vector centerOfMass) 4614 public void osSetInertiaAsSphere(LSL_Float mass, LSL_Float radius, LSL_Vector centerOfMass)
4561 { 4615 {
4562 CheckThreatLevel(); 4616 CheckThreatLevel();
4563 m_host.AddScriptLPS(1);
4564 4617
4565 SceneObjectGroup sog = m_host.ParentGroup; 4618 SceneObjectGroup sog = m_host.ParentGroup;
4566 if(sog== null || sog.IsDeleted) 4619 if(sog== null || sog.IsDeleted)
@@ -4600,7 +4653,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4600 public void osSetInertiaAsCylinder(LSL_Float mass, LSL_Float radius, LSL_Float lenght, LSL_Vector centerOfMass, LSL_Rotation lslrot) 4653 public void osSetInertiaAsCylinder(LSL_Float mass, LSL_Float radius, LSL_Float lenght, LSL_Vector centerOfMass, LSL_Rotation lslrot)
4601 { 4654 {
4602 CheckThreatLevel(); 4655 CheckThreatLevel();
4603 m_host.AddScriptLPS(1);
4604 4656
4605 SceneObjectGroup sog = m_host.ParentGroup; 4657 SceneObjectGroup sog = m_host.ParentGroup;
4606 if(sog== null || sog.IsDeleted) 4658 if(sog== null || sog.IsDeleted)
@@ -4639,7 +4691,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4639 public void osClearInertia() 4691 public void osClearInertia()
4640 { 4692 {
4641 CheckThreatLevel(); 4693 CheckThreatLevel();
4642 m_host.AddScriptLPS(1);
4643 4694
4644 SceneObjectGroup sog = m_host.ParentGroup; 4695 SceneObjectGroup sog = m_host.ParentGroup;
4645 if(sog== null || sog.IsDeleted) 4696 if(sog== null || sog.IsDeleted)
@@ -4648,6 +4699,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4648 sog.SetInertiaData(-1, Vector3.Zero, Vector3.Zero, Vector4.Zero ); 4699 sog.SetInertiaData(-1, Vector3.Zero, Vector3.Zero, Vector4.Zero );
4649 } 4700 }
4650 4701
4702 private bool checkAllowObjectTPbyLandOwner(Vector3 pos)
4703 {
4704 ILandObject land = World.LandChannel.GetLandObject(pos);
4705 if(land == null)
4706 return true;
4707
4708 LandData landdata = land.LandData;
4709 if(landdata == null)
4710 return true;
4711
4712 UUID hostOwner = m_host.OwnerID;
4713 if(landdata.OwnerID == hostOwner)
4714 return true;
4715
4716 EstateSettings es = World.RegionInfo.EstateSettings;
4717 if(es != null && es.IsEstateManagerOrOwner(hostOwner))
4718 return true;
4719
4720 if(!landdata.IsGroupOwned)
4721 return false;
4722
4723 UUID landGroup = landdata.GroupID;
4724 if(landGroup == UUID.Zero)
4725 return false;
4726
4727 if(landGroup == m_host.GroupID)
4728 return true;
4729
4730 return false;
4731 }
4732
4651 /// <summary> 4733 /// <summary>
4652 /// teleports a object (full linkset) 4734 /// teleports a object (full linkset)
4653 /// </summary> 4735 /// </summary>
@@ -4667,7 +4749,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4667 public LSL_Integer osTeleportObject(LSL_Key objectUUID, LSL_Vector targetPos, LSL_Rotation rotation, LSL_Integer flags) 4749 public LSL_Integer osTeleportObject(LSL_Key objectUUID, LSL_Vector targetPos, LSL_Rotation rotation, LSL_Integer flags)
4668 { 4750 {
4669 CheckThreatLevel(ThreatLevel.Severe, "osTeleportObject"); 4751 CheckThreatLevel(ThreatLevel.Severe, "osTeleportObject");
4670 m_host.AddScriptLPS(1);
4671 4752
4672 UUID objUUID; 4753 UUID objUUID;
4673 if (!UUID.TryParse(objectUUID, out objUUID)) 4754 if (!UUID.TryParse(objectUUID, out objUUID))
@@ -4677,9 +4758,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4677 } 4758 }
4678 4759
4679 SceneObjectGroup sog = World.GetSceneObjectGroup(objUUID); 4760 SceneObjectGroup sog = World.GetSceneObjectGroup(objUUID);
4680 if(sog== null || sog.IsDeleted) 4761 if(sog== null || sog.IsDeleted || sog.inTransit)
4681 return -1; 4762 return -1;
4682 4763
4764 if(sog.OwnerID != m_host.OwnerID)
4765 {
4766 Vector3 pos = sog.AbsolutePosition;
4767 if(!checkAllowObjectTPbyLandOwner(pos))
4768 return -1;
4769 }
4770
4683 UUID myid = m_host.ParentGroup.UUID; 4771 UUID myid = m_host.ParentGroup.UUID;
4684 4772
4685 return sog.TeleportObject(myid, targetPos, rotation, flags); 4773 return sog.TeleportObject(myid, targetPos, rotation, flags);
@@ -4689,7 +4777,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4689 public LSL_Integer osGetLinkNumber(LSL_String name) 4777 public LSL_Integer osGetLinkNumber(LSL_String name)
4690 { 4778 {
4691 CheckThreatLevel(); 4779 CheckThreatLevel();
4692 m_host.AddScriptLPS(1);
4693 4780
4694 SceneObjectGroup sog = m_host.ParentGroup; 4781 SceneObjectGroup sog = m_host.ParentGroup;
4695 if(sog== null || sog.IsDeleted) 4782 if(sog== null || sog.IsDeleted)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index bd5d008..8f863af 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -123,6 +123,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
123 string osSetDynamicTextureURLBlendFace(string dynamicID, string contentType, string url, string extraParams, 123 string osSetDynamicTextureURLBlendFace(string dynamicID, string contentType, string url, string extraParams,
124 bool blend, int disp, int timer, int alpha, int face); 124 bool blend, int disp, int timer, int alpha, int face);
125 string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, int timer); 125 string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, int timer);
126 string osSetDynamicTextureDataFace(string dynamicID, string contentType, string data, string extraParams, int timer, int face);
126 string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams, 127 string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams,
127 int timer, int alpha); 128 int timer, int alpha);
128 string osSetDynamicTextureDataBlendFace(string dynamicID, string contentType, string data, string extraParams, 129 string osSetDynamicTextureDataBlendFace(string dynamicID, string contentType, string data, string extraParams,
@@ -143,8 +144,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
143 void osSetParcelSIPAddress(string SIPAddress); 144 void osSetParcelSIPAddress(string SIPAddress);
144 145
145 // Avatar Info Commands 146 // Avatar Info Commands
146 string osGetAgentIP(string agent);
147 LSL_List osGetAgents(); 147 LSL_List osGetAgents();
148 string osGetAgentIP(string agent);
148 149
149 // Teleport commands 150 // Teleport commands
150 void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); 151 void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
@@ -222,10 +223,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
222 string osDrawLine(string drawList, int endX, int endY); 223 string osDrawLine(string drawList, int endX, int endY);
223 string osDrawText(string drawList, string text); 224 string osDrawText(string drawList, string text);
224 string osDrawEllipse(string drawList, int width, int height); 225 string osDrawEllipse(string drawList, int width, int height);
226 string osDrawFilledEllipse(string drawList, int width, int height);
225 string osDrawRectangle(string drawList, int width, int height); 227 string osDrawRectangle(string drawList, int width, int height);
226 string osDrawFilledRectangle(string drawList, int width, int height); 228 string osDrawFilledRectangle(string drawList, int width, int height);
227 string osDrawPolygon(string drawList, LSL_List x, LSL_List y); 229 string osDrawPolygon(string drawList, LSL_List x, LSL_List y);
228 string osDrawFilledPolygon(string drawList, LSL_List x, LSL_List y); 230 string osDrawFilledPolygon(string drawList, LSL_List x, LSL_List y);
231 string osDrawResetTransform(string drawList);
232 string osDrawRotationTransform(string drawList, LSL_Float x);
233 string osDrawScaleTransform(string drawList, LSL_Float x, LSL_Float y);
234 string osDrawTranslationTransform(string drawList, LSL_Float x, LSL_Float y);
229 string osSetFontName(string drawList, string fontName); 235 string osSetFontName(string drawList, string fontName);
230 string osSetFontSize(string drawList, int fontSize); 236 string osSetFontSize(string drawList, int fontSize);
231 string osSetPenSize(string drawList, int penSize); 237 string osSetPenSize(string drawList, int penSize);
@@ -389,6 +395,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
389 void osSetProjectionParams(LSL_Key prim, bool projection, LSL_Key texture, double fov, double focus, double amb); 395 void osSetProjectionParams(LSL_Key prim, bool projection, LSL_Key texture, double fov, double focus, double amb);
390 396
391 LSL_List osGetAvatarList(); 397 LSL_List osGetAvatarList();
398 LSL_List osGetNPCList();
392 399
393 LSL_String osUnixTimeToTimestamp(long time); 400 LSL_String osUnixTimeToTimestamp(long time);
394 401
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index a277f6c..e4c1ca0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -697,7 +697,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
697 public const int PARCEL_DETAILS_GROUP = 3; 697 public const int PARCEL_DETAILS_GROUP = 3;
698 public const int PARCEL_DETAILS_AREA = 4; 698 public const int PARCEL_DETAILS_AREA = 4;
699 public const int PARCEL_DETAILS_ID = 5; 699 public const int PARCEL_DETAILS_ID = 5;
700 public const int PARCEL_DETAILS_SEE_AVATARS = 6; // not implemented 700 public const int PARCEL_DETAILS_SEE_AVATARS = 6;
701 public const int PARCEL_DETAILS_ANY_AVATAR_SOUNDS = 7;
702 public const int PARCEL_DETAILS_GROUP_SOUNDS = 8;
701 703
702 //osSetParcelDetails 704 //osSetParcelDetails
703 public const int PARCEL_DETAILS_CLAIMDATE = 10; 705 public const int PARCEL_DETAILS_CLAIMDATE = 10;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 9eac114..42e7bfb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -153,6 +153,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
153 return m_OSSL_Functions.osSetDynamicTextureData(dynamicID, contentType, data, extraParams, timer); 153 return m_OSSL_Functions.osSetDynamicTextureData(dynamicID, contentType, data, extraParams, timer);
154 } 154 }
155 155
156 public string osSetDynamicTextureDataFace(string dynamicID, string contentType, string data, string extraParams,
157 int timer, int face)
158 {
159 return m_OSSL_Functions.osSetDynamicTextureDataFace(dynamicID, contentType, data, extraParams, timer, face);
160 }
161
156 public string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams, 162 public string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams,
157 int timer, int alpha) 163 int timer, int alpha)
158 { 164 {
@@ -271,15 +277,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
271 m_OSSL_Functions.osTeleportOwner(position, lookat); 277 m_OSSL_Functions.osTeleportOwner(position, lookat);
272 } 278 }
273 279
274 // Avatar info functions 280 public LSL_List osGetAgents()
275 public string osGetAgentIP(string agent)
276 { 281 {
277 return m_OSSL_Functions.osGetAgentIP(agent); 282 return m_OSSL_Functions.osGetAgents();
278 } 283 }
279 284
280 public LSL_List osGetAgents() 285 public string osGetAgentIP(string agent)
281 { 286 {
282 return m_OSSL_Functions.osGetAgents(); 287 return m_OSSL_Functions.osGetAgentIP(agent);
283 } 288 }
284 289
285 // Animation Functions 290 // Animation Functions
@@ -355,6 +360,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
355 return m_OSSL_Functions.osDrawEllipse(drawList, width, height); 360 return m_OSSL_Functions.osDrawEllipse(drawList, width, height);
356 } 361 }
357 362
363 public string osDrawFilledEllipse(string drawList, int width, int height)
364 {
365 return m_OSSL_Functions.osDrawFilledEllipse(drawList, width, height);
366 }
367
358 public string osDrawRectangle(string drawList, int width, int height) 368 public string osDrawRectangle(string drawList, int width, int height)
359 { 369 {
360 return m_OSSL_Functions.osDrawRectangle(drawList, width, height); 370 return m_OSSL_Functions.osDrawRectangle(drawList, width, height);
@@ -375,6 +385,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
375 return m_OSSL_Functions.osDrawFilledPolygon(drawList, x, y); 385 return m_OSSL_Functions.osDrawFilledPolygon(drawList, x, y);
376 } 386 }
377 387
388 public string osDrawResetTransform(string drawList)
389 {
390 return m_OSSL_Functions.osDrawResetTransform(drawList);
391 }
392
393 public string osDrawRotationTransform(string drawList, LSL_Float x)
394 {
395 return m_OSSL_Functions.osDrawRotationTransform(drawList, x);
396 }
397
398 public string osDrawScaleTransform(string drawList, LSL_Float x, LSL_Float y)
399 {
400 return m_OSSL_Functions.osDrawScaleTransform(drawList, x, y);
401 }
402
403 public string osDrawTranslationTransform(string drawList, LSL_Float x, LSL_Float y)
404 {
405 return m_OSSL_Functions.osDrawTranslationTransform(drawList, x, y);
406 }
407
378 public string osSetFontSize(string drawList, int fontSize) 408 public string osSetFontSize(string drawList, int fontSize)
379 { 409 {
380 return m_OSSL_Functions.osSetFontSize(drawList, fontSize); 410 return m_OSSL_Functions.osSetFontSize(drawList, fontSize);
@@ -399,6 +429,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
399 { 429 {
400 return m_OSSL_Functions.osSetPenColor(drawList, color); 430 return m_OSSL_Functions.osSetPenColor(drawList, color);
401 } 431 }
432
402 // Deprecated 433 // Deprecated
403 public string osSetPenColour(string drawList, string colour) 434 public string osSetPenColour(string drawList, string colour)
404 { 435 {
@@ -1010,6 +1041,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
1010 return m_OSSL_Functions.osGetAvatarList(); 1041 return m_OSSL_Functions.osGetAvatarList();
1011 } 1042 }
1012 1043
1044 public LSL_List osGetNPCList()
1045 {
1046 return m_OSSL_Functions.osGetNPCList();
1047 }
1048
1013 public LSL_String osUnixTimeToTimestamp(long time) 1049 public LSL_String osUnixTimeToTimestamp(long time)
1014 { 1050 {
1015 return m_OSSL_Functions.osUnixTimeToTimestamp(time); 1051 return m_OSSL_Functions.osUnixTimeToTimestamp(time);
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 4d7a698..8780e49 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -39,7 +39,6 @@ using OMV_Quaternion = OpenMetaverse.Quaternion;
39 39
40namespace OpenSim.Region.ScriptEngine.Shared 40namespace OpenSim.Region.ScriptEngine.Shared
41{ 41{
42 [Serializable]
43 public partial class LSL_Types 42 public partial class LSL_Types
44 { 43 {
45 // Types are kept is separate .dll to avoid having to add whatever .dll it is in it to script AppDomain 44 // Types are kept is separate .dll to avoid having to add whatever .dll it is in it to script AppDomain
@@ -526,7 +525,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
526 } 525 }
527 526
528 [Serializable] 527 [Serializable]
529 public class list 528 public class list: MarshalByRefObject
530 { 529 {
531 private object[] m_data; 530 private object[] m_data;
532 531