aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs72
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs5
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 6af3c1e..713f832 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4564,10 +4564,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4564 ScriptSleep(5000); 4564 ScriptSleep(5000);
4565 } 4565 }
4566 4566
4567 public void llTeleportAgent(string agent, string simname, LSL_Vector pos, LSL_Vector lookAt) 4567 public void llTeleportAgent(string agent, string destination, LSL_Vector pos, LSL_Vector lookAt)
4568 { 4568 {
4569 m_host.AddScriptLPS(1); 4569 m_host.AddScriptLPS(1);
4570 UUID agentId = new UUID(); 4570 UUID agentId = new UUID();
4571
4572 Vector3 targetPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
4573 Vector3 targetLookAt = new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z);
4574
4571 if (UUID.TryParse(agent, out agentId)) 4575 if (UUID.TryParse(agent, out agentId))
4572 { 4576 {
4573 ScenePresence presence = World.GetScenePresence(agentId); 4577 ScenePresence presence = World.GetScenePresence(agentId);
@@ -4576,26 +4580,84 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4576 // agent must not be a god 4580 // agent must not be a god
4577 if (presence.GodLevel >= 200) return; 4581 if (presence.GodLevel >= 200) return;
4578 4582
4579 if (simname == String.Empty) 4583 if (destination == String.Empty)
4580 simname = World.RegionInfo.RegionName; 4584 destination = World.RegionInfo.RegionName;
4585
4586 // agent must be over the owners land
4587 if (m_host.OwnerID == World.LandChannel.GetLandObject(
4588 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
4589 {
4590 DoLLTeleport(presence, destination, targetPos, targetLookAt);
4591 }
4592 else // or must be wearing the prim
4593 {
4594 if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID)
4595 {
4596 DoLLTeleport(presence, destination, targetPos, targetLookAt);
4597 }
4598 }
4599 }
4600 }
4601 }
4602
4603 public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global_coords, LSL_Vector pos, LSL_Vector lookAt)
4604 {
4605 m_host.AddScriptLPS(1);
4606 UUID agentId = new UUID();
4607
4608 ulong regionHandle = Utils.UIntsToLong((uint)global_coords.x, (uint)global_coords.y);
4609
4610 Vector3 targetPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
4611 Vector3 targetLookAt = new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z);
4612 if (UUID.TryParse(agent, out agentId))
4613 {
4614 ScenePresence presence = World.GetScenePresence(agentId);
4615 if (presence != null && presence.PresenceType != PresenceType.Npc)
4616 {
4617 // agent must not be a god
4618 if (presence.GodLevel >= 200) return;
4581 4619
4582 // agent must be over the owners land 4620 // agent must be over the owners land
4583 if (m_host.OwnerID == World.LandChannel.GetLandObject( 4621 if (m_host.OwnerID == World.LandChannel.GetLandObject(
4584 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) 4622 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
4585 { 4623 {
4586 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); 4624 World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
4587 } 4625 }
4588 else // or must be wearing the prim 4626 else // or must be wearing the prim
4589 { 4627 {
4590 if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID) 4628 if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID)
4591 { 4629 {
4592 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); 4630 World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
4593 } 4631 }
4594 } 4632 }
4595 } 4633 }
4596 } 4634 }
4597 } 4635 }
4598 4636
4637 private void DoLLTeleport(ScenePresence sp, string destination, Vector3 targetPos, Vector3 targetLookAt)
4638 {
4639 UUID assetID = KeyOrName(destination);
4640
4641 // The destinaion is not an asset ID and also doesn't name a landmark.
4642 // Use it as a sim name
4643 if (assetID == UUID.Zero)
4644 {
4645 World.RequestTeleportLocation(sp.ControllingClient, destination, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
4646 return;
4647 }
4648
4649 AssetBase lma = World.AssetService.Get(assetID.ToString());
4650 if (lma == null)
4651 return;
4652
4653 if (lma.Type != (sbyte)AssetType.Landmark)
4654 return;
4655
4656 AssetLandmark lm = new AssetLandmark(lma);
4657
4658 World.RequestTeleportLocation(sp.ControllingClient, lm.RegionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
4659 }
4660
4599 public void llTextBox(string agent, string message, int chatChannel) 4661 public void llTextBox(string agent, string message, int chatChannel)
4600 { 4662 {
4601 IDialogModule dm = World.RequestModuleInterface<IDialogModule>(); 4663 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 048124d..749fc97 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -407,6 +407,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
407 void llTargetRemove(int number); 407 void llTargetRemove(int number);
408 void llTeleportAgentHome(string agent); 408 void llTeleportAgentHome(string agent);
409 void llTeleportAgent(string agent, string simname, LSL_Vector pos, LSL_Vector lookAt); 409 void llTeleportAgent(string agent, string simname, LSL_Vector pos, LSL_Vector lookAt);
410 void llTeleportAgentGlobalCoords(string agent, LSL_Vector global, LSL_Vector pos, LSL_Vector lookAt);
410 void llTextBox(string avatar, string message, int chat_channel); 411 void llTextBox(string avatar, string message, int chat_channel);
411 LSL_String llToLower(string source); 412 LSL_String llToLower(string source);
412 LSL_String llToUpper(string source); 413 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 2d23d30..976969a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -1860,6 +1860,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
1860 m_LSL_Functions.llTeleportAgent(agent, simname, pos, lookAt); 1860 m_LSL_Functions.llTeleportAgent(agent, simname, pos, lookAt);
1861 } 1861 }
1862 1862
1863 public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global, LSL_Vector pos, LSL_Vector lookAt)
1864 {
1865 m_LSL_Functions.llTeleportAgentGlobalCoords(agent, global, pos, lookAt);
1866 }
1867
1863 public void llTeleportAgentHome(string agent) 1868 public void llTeleportAgentHome(string agent)
1864 { 1869 {
1865 m_LSL_Functions.llTeleportAgentHome(agent); 1870 m_LSL_Functions.llTeleportAgentHome(agent);