diff options
Diffstat (limited to 'OpenSim/Region')
3 files changed, 73 insertions, 5 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 667aa93..065d3df 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -4732,10 +4732,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4732 | ScriptSleep(5000); | 4732 | ScriptSleep(5000); |
4733 | } | 4733 | } |
4734 | 4734 | ||
4735 | public void llTeleportAgent(string agent, string simname, LSL_Vector pos, LSL_Vector lookAt) | 4735 | public void llTeleportAgent(string agent, string destination, LSL_Vector pos, LSL_Vector lookAt) |
4736 | { | 4736 | { |
4737 | m_host.AddScriptLPS(1); | 4737 | m_host.AddScriptLPS(1); |
4738 | UUID agentId = new UUID(); | 4738 | UUID agentId = new UUID(); |
4739 | |||
4740 | Vector3 targetPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z); | ||
4741 | Vector3 targetLookAt = new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z); | ||
4742 | |||
4739 | if (UUID.TryParse(agent, out agentId)) | 4743 | if (UUID.TryParse(agent, out agentId)) |
4740 | { | 4744 | { |
4741 | ScenePresence presence = World.GetScenePresence(agentId); | 4745 | ScenePresence presence = World.GetScenePresence(agentId); |
@@ -4744,26 +4748,84 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4744 | // agent must not be a god | 4748 | // agent must not be a god |
4745 | if (presence.GodLevel >= 200) return; | 4749 | if (presence.GodLevel >= 200) return; |
4746 | 4750 | ||
4747 | if (simname == String.Empty) | 4751 | if (destination == String.Empty) |
4748 | simname = World.RegionInfo.RegionName; | 4752 | destination = World.RegionInfo.RegionName; |
4753 | |||
4754 | // agent must be over the owners land | ||
4755 | if (m_host.OwnerID == World.LandChannel.GetLandObject( | ||
4756 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | ||
4757 | { | ||
4758 | DoLLTeleport(presence, destination, targetPos, targetLookAt); | ||
4759 | } | ||
4760 | else // or must be wearing the prim | ||
4761 | { | ||
4762 | if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID) | ||
4763 | { | ||
4764 | DoLLTeleport(presence, destination, targetPos, targetLookAt); | ||
4765 | } | ||
4766 | } | ||
4767 | } | ||
4768 | } | ||
4769 | } | ||
4770 | |||
4771 | public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global_coords, LSL_Vector pos, LSL_Vector lookAt) | ||
4772 | { | ||
4773 | m_host.AddScriptLPS(1); | ||
4774 | UUID agentId = new UUID(); | ||
4775 | |||
4776 | ulong regionHandle = Utils.UIntsToLong((uint)global_coords.x, (uint)global_coords.y); | ||
4777 | |||
4778 | Vector3 targetPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z); | ||
4779 | Vector3 targetLookAt = new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z); | ||
4780 | if (UUID.TryParse(agent, out agentId)) | ||
4781 | { | ||
4782 | ScenePresence presence = World.GetScenePresence(agentId); | ||
4783 | if (presence != null && presence.PresenceType != PresenceType.Npc) | ||
4784 | { | ||
4785 | // agent must not be a god | ||
4786 | if (presence.GodLevel >= 200) return; | ||
4749 | 4787 | ||
4750 | // agent must be over the owners land | 4788 | // agent must be over the owners land |
4751 | if (m_host.OwnerID == World.LandChannel.GetLandObject( | 4789 | if (m_host.OwnerID == World.LandChannel.GetLandObject( |
4752 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | 4790 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) |
4753 | { | 4791 | { |
4754 | World.RequestTeleportLocation(presence.ControllingClient, simname, new Vector3((float)pos.x, (float)pos.y, (float)pos.z), new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z), (uint)TeleportFlags.ViaLocation); | 4792 | World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); |
4755 | } | 4793 | } |
4756 | else // or must be wearing the prim | 4794 | else // or must be wearing the prim |
4757 | { | 4795 | { |
4758 | if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID) | 4796 | if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID) |
4759 | { | 4797 | { |
4760 | World.RequestTeleportLocation(presence.ControllingClient, simname, new Vector3((float)pos.x, (float)pos.y, (float)pos.z), new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z), (uint)TeleportFlags.ViaLocation); | 4798 | World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); |
4761 | } | 4799 | } |
4762 | } | 4800 | } |
4763 | } | 4801 | } |
4764 | } | 4802 | } |
4765 | } | 4803 | } |
4766 | 4804 | ||
4805 | private void DoLLTeleport(ScenePresence sp, string destination, Vector3 targetPos, Vector3 targetLookAt) | ||
4806 | { | ||
4807 | UUID assetID = KeyOrName(destination); | ||
4808 | |||
4809 | // The destinaion is not an asset ID and also doesn't name a landmark. | ||
4810 | // Use it as a sim name | ||
4811 | if (assetID == UUID.Zero) | ||
4812 | { | ||
4813 | World.RequestTeleportLocation(sp.ControllingClient, destination, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); | ||
4814 | return; | ||
4815 | } | ||
4816 | |||
4817 | AssetBase lma = World.AssetService.Get(assetID.ToString()); | ||
4818 | if (lma == null) | ||
4819 | return; | ||
4820 | |||
4821 | if (lma.Type != (sbyte)AssetType.Landmark) | ||
4822 | return; | ||
4823 | |||
4824 | AssetLandmark lm = new AssetLandmark(lma); | ||
4825 | |||
4826 | World.RequestTeleportLocation(sp.ControllingClient, lm.RegionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); | ||
4827 | } | ||
4828 | |||
4767 | public void llTextBox(string agent, string message, int chatChannel) | 4829 | public void llTextBox(string agent, string message, int chatChannel) |
4768 | { | 4830 | { |
4769 | IDialogModule dm = World.RequestModuleInterface<IDialogModule>(); | 4831 | IDialogModule dm = World.RequestModuleInterface<IDialogModule>(); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index be5740e..50f520a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | |||
@@ -402,6 +402,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
402 | void llTargetRemove(int number); | 402 | void llTargetRemove(int number); |
403 | void llTeleportAgentHome(string agent); | 403 | void llTeleportAgentHome(string agent); |
404 | void llTeleportAgent(string agent, string simname, LSL_Vector pos, LSL_Vector lookAt); | 404 | void llTeleportAgent(string agent, string simname, LSL_Vector pos, LSL_Vector lookAt); |
405 | void llTeleportAgentGlobalCoords(string agent, LSL_Vector global, LSL_Vector pos, LSL_Vector lookAt); | ||
405 | void llTextBox(string avatar, string message, int chat_channel); | 406 | void llTextBox(string avatar, string message, int chat_channel); |
406 | LSL_String llToLower(string source); | 407 | LSL_String llToLower(string source); |
407 | LSL_String llToUpper(string source); | 408 | LSL_String llToUpper(string source); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 9ba9561..116f639 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | |||
@@ -1835,6 +1835,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1835 | m_LSL_Functions.llTeleportAgent(agent, simname, pos, lookAt); | 1835 | m_LSL_Functions.llTeleportAgent(agent, simname, pos, lookAt); |
1836 | } | 1836 | } |
1837 | 1837 | ||
1838 | public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global, LSL_Vector pos, LSL_Vector lookAt) | ||
1839 | { | ||
1840 | m_LSL_Functions.llTeleportAgentGlobalCoords(agent, global, pos, lookAt); | ||
1841 | } | ||
1842 | |||
1838 | public void llTeleportAgentHome(string agent) | 1843 | public void llTeleportAgentHome(string agent) |
1839 | { | 1844 | { |
1840 | m_LSL_Functions.llTeleportAgentHome(agent); | 1845 | m_LSL_Functions.llTeleportAgentHome(agent); |