aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs32
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs56
2 files changed, 72 insertions, 16 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index c251a49..d06b134 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2983,17 +2983,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2983 2983
2984 if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) 2984 if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0)
2985 { 2985 {
2986 SceneObjectGroup grp = m_host.ParentGroup;
2987 UUID itemID = grp.GetFromItemID();
2988
2989 ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
2990
2991 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; 2986 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
2992 if (attachmentsModule != null) 2987 if (attachmentsModule != null)
2993 attachmentsModule.ShowDetachInUserInventory(itemID, presence.ControllingClient); 2988 Util.FireAndForget(DetachWrapper, m_host);
2994 } 2989 }
2995 } 2990 }
2996 2991
2992 private void DetachWrapper(object o)
2993 {
2994 SceneObjectPart host = (SceneObjectPart)o;
2995
2996 SceneObjectGroup grp = host.ParentGroup;
2997 UUID itemID = grp.GetFromItemID();
2998 ScenePresence presence = World.GetScenePresence(host.OwnerID);
2999
3000 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
3001 if (attachmentsModule != null)
3002 attachmentsModule.ShowDetachInUserInventory(itemID, presence.ControllingClient);
3003 }
3004
2997 public void llTakeCamera(string avatar) 3005 public void llTakeCamera(string avatar)
2998 { 3006 {
2999 m_host.AddScriptLPS(1); 3007 m_host.AddScriptLPS(1);
@@ -8742,24 +8750,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8742 8750
8743 switch (data) 8751 switch (data)
8744 { 8752 {
8745 case 5: // DATA_SIM_POS 8753 case ScriptBaseClass.DATA_SIM_POS:
8746 if (info == null) 8754 if (info == null)
8747 { 8755 {
8748 ScriptSleep(1000); 8756 ScriptSleep(1000);
8749 return UUID.Zero.ToString(); 8757 return UUID.Zero.ToString();
8750 } 8758 }
8751 reply = new LSL_Vector( 8759 reply = new LSL_Vector(
8752 info.RegionLocX * Constants.RegionSize, 8760 info.RegionLocX,
8753 info.RegionLocY * Constants.RegionSize, 8761 info.RegionLocY,
8754 0).ToString(); 8762 0).ToString();
8755 break; 8763 break;
8756 case 6: // DATA_SIM_STATUS 8764 case ScriptBaseClass.DATA_SIM_STATUS:
8757 if (info != null) 8765 if (info != null)
8758 reply = "up"; // Duh! 8766 reply = "up"; // Duh!
8759 else 8767 else
8760 reply = "unknown"; 8768 reply = "unknown";
8761 break; 8769 break;
8762 case 7: // DATA_SIM_RATING 8770 case ScriptBaseClass.DATA_SIM_RATING:
8763 if (info == null) 8771 if (info == null)
8764 { 8772 {
8765 ScriptSleep(1000); 8773 ScriptSleep(1000);
@@ -8775,7 +8783,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8775 else 8783 else
8776 reply = "UNKNOWN"; 8784 reply = "UNKNOWN";
8777 break; 8785 break;
8778 case 128: 8786 case ScriptBaseClass.DATA_SIM_RELEASE:
8779 if (ossl != null) 8787 if (ossl != null)
8780 ossl.CheckThreatLevel(ThreatLevel.High, "llRequestSimulatorData"); 8788 ossl.CheckThreatLevel(ThreatLevel.High, "llRequestSimulatorData");
8781 reply = "OpenSim"; 8789 reply = "OpenSim";
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 8a98be7..fc92f23 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -639,6 +639,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
639 // 639 //
640 CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); 640 CheckThreatLevel(ThreatLevel.High, "osTeleportAgent");
641 641
642 TeleportAgent(agent, regionName, position, lookat);
643 }
644
645 private void TeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
646 {
642 m_host.AddScriptLPS(1); 647 m_host.AddScriptLPS(1);
643 UUID agentId = new UUID(); 648 UUID agentId = new UUID();
644 if (UUID.TryParse(agent, out agentId)) 649 if (UUID.TryParse(agent, out agentId))
@@ -651,7 +656,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
651 == World.LandChannel.GetLandObject( 656 == World.LandChannel.GetLandObject(
652 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) 657 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
653 { 658 {
654
655 // Check for hostname , attempt to make a hglink 659 // Check for hostname , attempt to make a hglink
656 // and convert the regionName to the target region 660 // and convert the regionName to the target region
657 if (regionName.Contains(".") && regionName.Contains(":")) 661 if (regionName.Contains(".") && regionName.Contains(":"))
@@ -661,7 +665,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
661 if (regions != null && regions.Count > 0) 665 if (regions != null && regions.Count > 0)
662 { 666 {
663 GridRegion regInfo = regions[0]; 667 GridRegion regInfo = regions[0];
664 regionName = regInfo.RegionName; 668 string[] parts = regInfo.RegionName.Split(new char[] { ':' });
669 if (parts.Length > 2)
670 regionName = parts[2];
671 else
672 regionName = parts[0];
665 } 673 }
666 } 674 }
667 World.RequestTeleportLocation(presence.ControllingClient, regionName, 675 World.RequestTeleportLocation(presence.ControllingClient, regionName,
@@ -674,13 +682,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
674 } 682 }
675 } 683 }
676 684
677 // Teleport functions
678 public void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) 685 public void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
679 { 686 {
680 // High because there is no security check. High griefer potential 687 // High because there is no security check. High griefer potential
681 // 688 //
682 CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); 689 CheckThreatLevel(ThreatLevel.High, "osTeleportAgent");
683 690
691 TeleportAgent(agent, regionX, regionY, position, lookat);
692 }
693
694 private void TeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
695 {
684 ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize)); 696 ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize));
685 697
686 m_host.AddScriptLPS(1); 698 m_host.AddScriptLPS(1);
@@ -709,6 +721,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
709 osTeleportAgent(agent, World.RegionInfo.RegionName, position, lookat); 721 osTeleportAgent(agent, World.RegionInfo.RegionName, position, lookat);
710 } 722 }
711 723
724 public void osTeleportOwner(string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
725 {
726 // Threat level None because this is what can already be done with the World Map in the viewer
727 CheckThreatLevel(ThreatLevel.None, "osTeleportOwner");
728
729 TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat);
730 }
731
732 public void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
733 {
734 osTeleportOwner(World.RegionInfo.RegionName, position, lookat);
735 }
736
737 public void osTeleportOwner(int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
738 {
739 CheckThreatLevel(ThreatLevel.None, "osTeleportOwner");
740
741 TeleportAgent(m_host.OwnerID.ToString(), regionX, regionY, position, lookat);
742 }
743
712 // Functions that get information from the agent itself. 744 // Functions that get information from the agent itself.
713 // 745 //
714 // osGetAgentIP - this is used to determine the IP address of 746 // osGetAgentIP - this is used to determine the IP address of
@@ -2266,5 +2298,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2266 }); 2298 });
2267 return result; 2299 return result;
2268 } 2300 }
2301
2302 /// <summary>
2303 /// Convert a unix time to a llGetTimestamp() like string
2304 /// </summary>
2305 /// <param name="unixTime"></param>
2306 /// <returns></returns>
2307 public LSL_String osUnixTimeToTimestamp(long time)
2308 {
2309 CheckThreatLevel(ThreatLevel.VeryLow, "osUnixTimeToTimestamp");
2310 long baseTicks = 621355968000000000;
2311 long tickResolution = 10000000;
2312 long epochTicks = (time * tickResolution) + baseTicks;
2313 DateTime date = new DateTime(epochTicks);
2314
2315 return date.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ");
2316 }
2269 } 2317 }
2270} 2318} \ No newline at end of file