From b1c1de2fbeeaba34f2daa96a34a14cc9cb4effa8 Mon Sep 17 00:00:00 2001 From: Homer Horwitz Date: Wed, 1 Oct 2008 21:30:48 +0000 Subject: [PATCH] - Added SendScriptTeleportRequest to IClientView and classes implementing it. - Implemented llMapDestination. --- OpenSim/Framework/IClientAPI.cs | 1 + .../Region/ClientStack/LindenUDP/LLClientView.cs | 12 ++++++++++++ .../Environment/Modules/World/NPC/NPCAvatar.cs | 4 ++++ .../Region/Examples/SimpleModule/MyNpcCharacter.cs | 4 ++++ .../Shared/Api/Implementation/LSL_Api.cs | 13 +++++++++++-- 5 files changed, 32 insertions(+), 2 deletions(-) diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index ddd1cd3d64..ad4e22b6cf 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -759,6 +759,7 @@ namespace OpenSim.Framework void SendRegionHandle(UUID regoinID, ulong handle); void SendParcelInfo(RegionInfo info, LandData land, UUID parcelID, uint x, uint y); + void SendScriptTeleportRequest(string objName, string simName, Vector3 pos, Vector3 lookAt); void KillEndDone(); } } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 1aff886304..692de46ba4 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -6631,6 +6631,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(reply, ThrottleOutPacketType.Land); } + public void SendScriptTeleportRequest(string objName, string simName, Vector3 pos, Vector3 lookAt) + { + ScriptTeleportRequestPacket packet = (ScriptTeleportRequestPacket)PacketPool.Instance.GetPacket(PacketType.ScriptTeleportRequest); + + packet.Data.ObjectName = Utils.StringToBytes(objName); + packet.Data.SimName = Utils.StringToBytes(simName); + packet.Data.SimPosition = pos; + packet.Data.LookAt = lookAt; + + OutPacket(packet, ThrottleOutPacketType.Task); + } + public void SetClientOption(string option, string value) { switch (option) diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index 9476571677..9300b92ea9 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs @@ -883,6 +883,10 @@ namespace OpenSim.Region.Environment.Modules.World.NPC return string.Empty; } + public void SendScriptTeleportRequest (string objName, string simName, Vector3 pos, Vector3 lookAt) + { + } + public void KillEndDone() { } diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 19673181ba..2b8bcb10d0 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -880,6 +880,10 @@ namespace OpenSim.Region.Examples.SimpleModule return string.Empty; } + public void SendScriptTeleportRequest(string objName, string simName, Vector3 pos, Vector3 lookAt) + { + } + public void KillEndDone() { } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c2b16cf29c..39e24b48bc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7624,10 +7624,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public void llMapDestination(string simname, LSL_Vector pos, LSL_Vector look_at) + public void llMapDestination(string simname, LSL_Vector pos, LSL_Vector lookAt) { m_host.AddScriptLPS(1); - NotImplemented("llMapDestination"); + DetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, 0); + if (d == null) return; // only works on the first detected avatar + + ScenePresence avatar = World.GetScenePresence(d.Key); + if (avatar != null) + { + avatar.ControllingClient.SendScriptTeleportRequest(m_host.Name, simname, + new Vector3((float)pos.x, (float)pos.y, (float)pos.z), + new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z)); + } // ScriptSleep(1000); }