From f12619b78665a6f6b148c870d36b528428cf78b4 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Fri, 6 Mar 2009 20:44:31 +0000 Subject: * refactor: Remove GetLandOwner function from Scene * Simplify since the land is never null --- OpenSim/Region/Framework/Scenes/Scene.cs | 13 -------- .../Shared/Api/Implementation/LSL_Api.cs | 39 ++++++++++++---------- .../Shared/Api/Implementation/OSSL_Api.cs | 24 ++++++------- 3 files changed, 34 insertions(+), 42 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index aa0218b..5cb9724 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3019,19 +3019,6 @@ namespace OpenSim.Region.Framework.Scenes m_eventManager.TriggerOnPluginConsole(args); } - public UUID GetLandOwner(float x, float y) - { - ILandObject land = LandChannel.GetLandObject(x, y); - if (land == null) - { - return UUID.Zero; - } - else - { - return land.landData.OwnerID; - } - } - public LandData GetLandData(float x, float y) { return LandChannel.GetLandObject(x, y).landData; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index fad456f..517453e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3706,8 +3706,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScenePresence presence = World.GetScenePresence(agentId); if (presence != null) { - // agent must be over the owners land - if (m_host.OwnerID == World.GetLandOwner(presence.AbsolutePosition.X, presence.AbsolutePosition.Y)) + // agent must be over the owners land + if (m_host.OwnerID + == World.LandChannel.GetLandObject( + presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID) { presence.ControllingClient.SendTeleportLocationStart(); World.TeleportClientHome(agentId, presence.ControllingClient); @@ -5182,7 +5184,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (presence != null) { // agent must be over the owners land - if (m_host.OwnerID == World.GetLandOwner(presence.AbsolutePosition.X, presence.AbsolutePosition.Y)) + if (m_host.OwnerID + == World.LandChannel.GetLandObject( + presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID) World.TeleportClientHome(agentId, presence.ControllingClient); } } @@ -5265,29 +5269,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); UUID key = new UUID(); - if (UUID.TryParse(id,out key)) + if (UUID.TryParse(id, out key)) { - ScenePresence presence = World.GetScenePresence(key); + ScenePresence presence = World.GetScenePresence(key); if (presence != null) // object is an avatar { - if (m_host.OwnerID == World.GetLandOwner(presence.AbsolutePosition.X, presence.AbsolutePosition.Y)) + if (m_host.OwnerID + == World.LandChannel.GetLandObject( + presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID) return 1; } else // object is not an avatar { SceneObjectPart obj = World.GetSceneObjectPart(key); if (obj != null) - if (m_host.OwnerID == World.GetLandOwner(obj.AbsolutePosition.X, obj.AbsolutePosition.Y)) + if (m_host.OwnerID + == World.LandChannel.GetLandObject( + obj.AbsolutePosition.X, obj.AbsolutePosition.Y).landData.OwnerID) return 1; } } + return 0; } public LSL_String llGetLandOwnerAt(LSL_Vector pos) { m_host.AddScriptLPS(1); - return World.GetLandOwner((float)pos.x, (float)pos.y).ToString(); + return World.LandChannel.GetLandObject((float)pos.x, (float)pos.y).landData.OwnerID.ToString(); } /// @@ -6812,17 +6821,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llSetParcelMusicURL(string url) { m_host.AddScriptLPS(1); - UUID landowner = World.GetLandOwner(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); - if (landowner == UUID.Zero) - { - return; - } - if (landowner != m_host.ObjectOwner) - { + + ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); + + if (land.landData.OwnerID != m_host.ObjectOwner) return; - } - World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).SetMusicUrl(url); + land.SetMusicUrl(url); // ScriptSleep(2000); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 17732e6..e96dd26 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -503,12 +503,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (presence != null) { // agent must be over owners land to avoid abuse - if (m_host.OwnerID == World.GetLandOwner(presence.AbsolutePosition.X, presence.AbsolutePosition.Y)) + if (m_host.OwnerID + == World.LandChannel.GetLandObject( + presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID) { presence.ControllingClient.SendTeleportLocationStart(); World.RequestTeleportLocation(presence.ControllingClient, regionName, new Vector3((float)position.x, (float)position.y, (float)position.z), new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation); + ScriptSleep(5000); } } @@ -532,7 +535,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (presence != null) { // agent must be over owners land to avoid abuse - if (m_host.OwnerID == World.GetLandOwner(presence.AbsolutePosition.X, presence.AbsolutePosition.Y)) + if (m_host.OwnerID + == World.LandChannel.GetLandObject( + presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID) { presence.ControllingClient.SendTeleportLocationStart(); World.RequestTeleportLocation(presence.ControllingClient, regionHandle, @@ -777,19 +782,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelMediaURL"); m_host.AddScriptLPS(1); - UUID landowner = World.GetLandOwner(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); + + ILandObject land + = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); - if (landowner == UUID.Zero) - { - return; - } - - if (landowner != m_host.ObjectOwner) - { + if (land.landData.OwnerID != m_host.ObjectOwner) return; - } - World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).SetMediaUrl(url); + land.SetMediaUrl(url); } public string osGetScriptEngineName() -- cgit v1.1