aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs56
1 files changed, 52 insertions, 4 deletions
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