diff options
author | Jonathan Freedman | 2010-11-21 20:01:48 -0800 |
---|---|---|
committer | Jonathan Freedman | 2010-11-21 20:01:48 -0800 |
commit | b7f5e8284360f92e0e102b9546076573c57d9397 (patch) | |
tree | 132663da8c1882e524241b55a739ef2758ef8958 /OpenSim/Region/ScriptEngine | |
parent | Merge https://github.com/opensim/opensim into mantis5110 (diff) | |
parent | Merge branch 'master' of /var/git/opensim/ (diff) | |
download | opensim-SC_OLD-b7f5e8284360f92e0e102b9546076573c57d9397.zip opensim-SC_OLD-b7f5e8284360f92e0e102b9546076573c57d9397.tar.gz opensim-SC_OLD-b7f5e8284360f92e0e102b9546076573c57d9397.tar.bz2 opensim-SC_OLD-b7f5e8284360f92e0e102b9546076573c57d9397.tar.xz |
Merge branch 'master-core' into mantis5110
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
4 files changed, 103 insertions, 17 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 |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 630821b..10d61ca 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -86,6 +86,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
86 | void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); | 86 | void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); |
87 | void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); | 87 | void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); |
88 | void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); | 88 | void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); |
89 | void osTeleportOwner(string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); | ||
90 | void osTeleportOwner(int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); | ||
91 | void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); | ||
89 | 92 | ||
90 | // Animation commands | 93 | // Animation commands |
91 | void osAvatarPlayAnimation(string avatar, string animation); | 94 | void osAvatarPlayAnimation(string avatar, string animation); |
@@ -181,5 +184,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
181 | 184 | ||
182 | LSL_List osGetAvatarList(); | 185 | LSL_List osGetAvatarList(); |
183 | 186 | ||
187 | LSL_String osUnixTimeToTimestamp(long time); | ||
184 | } | 188 | } |
185 | } | 189 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index e289554..f3142e6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -227,6 +227,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
227 | m_OSSL_Functions.osTeleportAgent(agent, position, lookat); | 227 | m_OSSL_Functions.osTeleportAgent(agent, position, lookat); |
228 | } | 228 | } |
229 | 229 | ||
230 | public void osTeleportOwner(string regionName, vector position, vector lookat) | ||
231 | { | ||
232 | m_OSSL_Functions.osTeleportOwner(regionName, position, lookat); | ||
233 | } | ||
234 | |||
235 | public void osTeleportOwner(int regionX, int regionY, vector position, vector lookat) | ||
236 | { | ||
237 | m_OSSL_Functions.osTeleportOwner(regionX, regionY, position, lookat); | ||
238 | } | ||
239 | |||
240 | public void osTeleportOwner(vector position, vector lookat) | ||
241 | { | ||
242 | m_OSSL_Functions.osTeleportOwner(position, lookat); | ||
243 | } | ||
244 | |||
230 | // Avatar info functions | 245 | // Avatar info functions |
231 | public string osGetAgentIP(string agent) | 246 | public string osGetAgentIP(string agent) |
232 | { | 247 | { |
@@ -663,26 +678,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
663 | { | 678 | { |
664 | return m_OSSL_Functions.osGetSimulatorMemory(); | 679 | return m_OSSL_Functions.osGetSimulatorMemory(); |
665 | } | 680 | } |
681 | |||
666 | public void osKickAvatar(string FirstName,string SurName,string alert) | 682 | public void osKickAvatar(string FirstName,string SurName,string alert) |
667 | { | 683 | { |
668 | m_OSSL_Functions.osKickAvatar(FirstName, SurName, alert); | 684 | m_OSSL_Functions.osKickAvatar(FirstName, SurName, alert); |
669 | } | 685 | } |
686 | |||
670 | public void osSetSpeed(string UUID, float SpeedModifier) | 687 | public void osSetSpeed(string UUID, float SpeedModifier) |
671 | { | 688 | { |
672 | m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier); | 689 | m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier); |
673 | } | 690 | } |
691 | |||
674 | public void osCauseDamage(string avatar, double damage) | 692 | public void osCauseDamage(string avatar, double damage) |
675 | { | 693 | { |
676 | m_OSSL_Functions.osCauseDamage(avatar, damage); | 694 | m_OSSL_Functions.osCauseDamage(avatar, damage); |
677 | } | 695 | } |
696 | |||
678 | public void osCauseHealing(string avatar, double healing) | 697 | public void osCauseHealing(string avatar, double healing) |
679 | { | 698 | { |
680 | m_OSSL_Functions.osCauseHealing(avatar, healing); | 699 | m_OSSL_Functions.osCauseHealing(avatar, healing); |
681 | } | 700 | } |
701 | |||
682 | public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules) | 702 | public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules) |
683 | { | 703 | { |
684 | return m_OSSL_Functions.osGetPrimitiveParams(prim, rules); | 704 | return m_OSSL_Functions.osGetPrimitiveParams(prim, rules); |
685 | } | 705 | } |
706 | |||
686 | public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules) | 707 | public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules) |
687 | { | 708 | { |
688 | m_OSSL_Functions.osSetPrimitiveParams(prim, rules); | 709 | m_OSSL_Functions.osSetPrimitiveParams(prim, rules); |
@@ -702,5 +723,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
702 | { | 723 | { |
703 | return m_OSSL_Functions.osGetAvatarList(); | 724 | return m_OSSL_Functions.osGetAvatarList(); |
704 | } | 725 | } |
726 | |||
727 | public LSL_String osUnixTimeToTimestamp(long time) | ||
728 | { | ||
729 | return m_OSSL_Functions.osUnixTimeToTimestamp(time); | ||
730 | } | ||
705 | } | 731 | } |
706 | } | 732 | } \ No newline at end of file |