From 0ed4f24b3432d282f2f1517d403341cde069af29 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 5 Mar 2012 02:14:27 +0100 Subject: [PATCH 1/5] A stab at making llEjectFromLand work in all cases --- OpenSim/Region/Framework/Scenes/Scene.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 11a41aa98b..5d27d867aa 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4938,9 +4938,16 @@ Environment.Exit(1); return nearestPoint.Value; } - //Ultimate backup if we have no idea where they are - Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); - return avatar.lastKnownAllowedPosition; + ILandObject dest = LandChannel.GetLandObject(avatar.lastKnownAllowedPosition.X, avatar.lastKnownAllowedPosition.Y); + if (dest != excludeParcel) + { + // Ultimate backup if we have no idea where they are and + // the last allowed position was in another parcel + Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); + return avatar.lastKnownAllowedPosition; + } + + // else fall through to region edge } //Go to the edge, this happens in teleporting to a region with no available parcels From c2a73a26b550c523ed0f87c45caa7382bfc16667 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 5 Mar 2012 02:37:51 +0100 Subject: [PATCH 2/5] SL compatibility - return only points on segemtn, not ray in llCastRay --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5c02d98556..fc6bec1824 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -11574,6 +11574,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Vector3 rayEnd = new Vector3((float)end.x, (float)end.y, (float)end.z); Vector3 dir = rayEnd - rayStart; + float dist = Vector3.Mag(dir); + int count = 1; bool detectPhantom = false; int dataFlags = 0; @@ -11630,6 +11632,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api int values = 0; foreach (ContactResult result in results) { + if (result.Depth > dist) + continue; + UUID itemID = UUID.Zero; int linkNum = 0; From 97f0cff3885e00e7e56a6c7a5c59086d241c1f2e Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 5 Mar 2012 11:54:06 +0100 Subject: [PATCH 3/5] llListSort SL compatibility: When sorting strided list and the list length is not a multiple of the stride, return the original list. Also, enforce that sort is ascending only when the ascending parameter is 1, and not when it is != 0 --- OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 9e6752c10f..8adf4c5bc8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs @@ -858,7 +858,7 @@ namespace OpenSim.Region.ScriptEngine.Shared ret = Math.Sign(Quaternion.Mag(l) - Quaternion.Mag(r)); } - if (ascending == 0) + if (ascending != 1) { ret = 0 - ret; } @@ -891,6 +891,9 @@ namespace OpenSim.Region.ScriptEngine.Shared stride = 1; } + if ((Data.Length % stride) != 0) + return new list(ret); + // we can optimize here in the case where stride == 1 and the list // consists of homogeneous types @@ -910,7 +913,7 @@ namespace OpenSim.Region.ScriptEngine.Shared if (homogeneous) { Array.Sort(ret, new HomogeneousComparer()); - if (ascending == 0) + if (ascending != 1) { Array.Reverse(ret); } From f2653b9b8e956e1372fccfe6aadd798d89a27ec2 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 5 Mar 2012 21:52:24 +0100 Subject: [PATCH 4/5] Teleport users to the cornfield when they are teleported with llTeleportAgentHome(). Don't try to teleport NPCs. --- .../Shared/Api/Implementation/LSL_Api.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index fc6bec1824..0cc88297f9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4641,7 +4641,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (UUID.TryParse(agent, out agentId)) { ScenePresence presence = World.GetScenePresence(agentId); - if (presence != null) + if (presence != null && presence.PresenceType != PresenceType.Npc) { // agent must not be a god if (presence.UserLevel >= 200) return; @@ -4650,7 +4650,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_host.OwnerID == World.LandChannel.GetLandObject( presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) { - World.TeleportClientHome(agentId, presence.ControllingClient); + if (!World.TeleportClientHome(agentId, presence.ControllingClient)) + { + // They can't be teleported home for some reason + GridRegion regionInfo = World.GridService.GetRegionByUUID(UUID.Zero, new UUID("2b02daac-e298-42fa-9a75-f488d37896e6")); + if (regionInfo != null) + { + World.RequestTeleportLocation( + presence.ControllingClient, regionInfo.RegionHandle, new Vector3(128, 128, 23), Vector3.Zero, + (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); + } + } } } } @@ -4664,7 +4674,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (UUID.TryParse(agent, out agentId)) { ScenePresence presence = World.GetScenePresence(agentId); - if (presence != null) + if (presence != null && presence.PresenceType != PresenceType.Npc) { // agent must not be a god if (presence.UserLevel >= 200) return; From a7b61add99bb7907ae054010232fd303f6ae739e Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 5 Mar 2012 22:22:28 +0100 Subject: [PATCH 5/5] Allow NPC to be removed by the owner of the parcel they're over. Don't allow NPC creation unless the prim owner has rez rights. --- .../Shared/Api/Implementation/OSSL_Api.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 2424130c08..a9b8e0454e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2265,6 +2265,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api string groupTitle = String.Empty; + if (!World.Permissions.CanRezObject(1, m_host.OwnerID, new Vector3((float)position.x, (float)position.y, (float)position.z))) + return new LSL_Key(UUID.Zero.ToString()); + if (firstname != String.Empty || lastname != String.Empty) { if (firstname != "Shown outfit:") @@ -2594,8 +2597,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { UUID npcId = new UUID(npc.m_string); - if (!module.CheckPermissions(npcId, m_host.OwnerID)) - return; + ILandObject l = World.LandChannel.GetLandObject(m_host.GroupPosition.X, m_host.GroupPosition.Y); + if (l == null || m_host.OwnerID != l.LandData.OwnerID) + { + if (!module.CheckPermissions(npcId, m_host.OwnerID)) + return; + } module.DeleteNPC(npcId, World); }