From 4c740e1717f8071d48e34c584728fddcf05afdb2 Mon Sep 17 00:00:00 2001 From: OpenSim Master Date: Thu, 29 Apr 2010 11:57:30 -0700 Subject: Implements three new OSSL functions for parcel management: osParcelJoin joins parcels in an area, osParcelSubdivide splits parcels in an area, osParcelSetDetails sets parcel name, description, owner and group owner. Join and Subdivide methods in LandChannel are exposed. --- .../Region/CoreModules/World/Land/LandChannel.cs | 16 +++++ .../CoreModules/World/Land/LandManagementModule.cs | 10 +++ .../Region/Framework/Interfaces/ILandChannel.cs | 3 + .../RegionCombinerLargeLandChannel.cs | 10 +++ .../Shared/Api/Implementation/OSSL_Api.cs | 82 ++++++++++++++++++++++ .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 4 ++ .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 15 ++++ 7 files changed, 140 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs index 1fbc733..1ad4db2 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs @@ -154,6 +154,22 @@ namespace OpenSim.Region.CoreModules.World.Land m_landManagementModule.UpdateLandObject(localID, data); } } + + public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) + { + if (m_landManagementModule != null) + { + m_landManagementModule.Join(start_x, start_y, end_x, end_y, attempting_user_id); + } + } + + public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) + { + if (m_landManagementModule != null) + { + m_landManagementModule.Subdivide(start_x, start_y, end_x, end_y, attempting_user_id); + } + } public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) { diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 139e6ff..4ccd0f0 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -948,6 +948,16 @@ namespace OpenSim.Region.CoreModules.World.Land masterLandObject.SendLandUpdateToAvatarsOverMe(); } + public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) + { + join(start_x, start_y, end_x, end_y, attempting_user_id); + } + + public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) + { + subdivide(start_x, start_y, end_x, end_y, attempting_user_id); + } + #endregion #region Parcel Updating diff --git a/OpenSim/Region/Framework/Interfaces/ILandChannel.cs b/OpenSim/Region/Framework/Interfaces/ILandChannel.cs index f71e31d..20b8ab6 100644 --- a/OpenSim/Region/Framework/Interfaces/ILandChannel.cs +++ b/OpenSim/Region/Framework/Interfaces/ILandChannel.cs @@ -76,5 +76,8 @@ namespace OpenSim.Region.Framework.Interfaces void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel); void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel); void SetParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime); + + void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id); + void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id); } } diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs index 9da818a..33ff707 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs @@ -140,6 +140,16 @@ public class RegionCombinerLargeLandChannel : ILandChannel RootRegionLandChannel.UpdateLandObject(localID, data); } + public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) + { + RootRegionLandChannel.Join(start_x, start_y, end_x, end_y, attempting_user_id); + } + + public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) + { + RootRegionLandChannel.Subdivide(start_x, start_y, end_x, end_y, attempting_user_id); + } + public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) { RootRegionLandChannel.ReturnObjectsInParcel(localID, returnType, agentIDs, taskIDs, remoteClient); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 7e68cc7..15469db 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1129,7 +1129,89 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return 0.0f; } + // Routines for creating and managing parcels programmatically + public void osParcelJoin(LSL_Vector pos1, LSL_Vector pos2) + { + CheckThreatLevel(ThreatLevel.High, "osParcelJoin"); + m_host.AddScriptLPS(1); + + int startx = (int)(pos1.x < pos2.x ? pos1.x : pos2.x); + int starty = (int)(pos1.y < pos2.y ? pos1.y : pos2.y); + int endx = (int)(pos1.x > pos2.x ? pos1.x : pos2.x); + int endy = (int)(pos1.y > pos2.y ? pos1.y : pos2.y); + + World.LandChannel.Join(startx,starty,endx,endy,m_host.OwnerID); + } + + public void osParcelSubdivide(LSL_Vector pos1, LSL_Vector pos2) + { + CheckThreatLevel(ThreatLevel.High, "osParcelSubdivide"); + m_host.AddScriptLPS(1); + + int startx = (int)(pos1.x < pos2.x ? pos1.x : pos2.x); + int starty = (int)(pos1.y < pos2.y ? pos1.y : pos2.y); + int endx = (int)(pos1.x > pos2.x ? pos1.x : pos2.x); + int endy = (int)(pos1.y > pos2.y ? pos1.y : pos2.y); + World.LandChannel.Subdivide(startx,starty,endx,endy,m_host.OwnerID); + } + + public void osParcelSetDetails(LSL_Vector pos, LSL_List rules) + { + CheckThreatLevel(ThreatLevel.High, "osParcelSetDetails"); + m_host.AddScriptLPS(1); + + // Get a reference to the land data and make sure the owner of the script + // can modify it + + ILandObject startLandObject = World.LandChannel.GetLandObject((int)pos.x, (int)pos.y); + if (startLandObject == null) + { + OSSLShoutError("There is no land at that location"); + return; + } + + if (! World.Permissions.CanEditParcel(m_host.OwnerID, startLandObject)) + { + OSSLShoutError("You do not have permission to modify the parcel"); + return; + } + + // Create a new land data object we can modify + LandData newLand = startLandObject.LandData.Copy(); + UUID uuid; + + // Process the rules, not sure what the impact would be of changing owner or group + for (int idx = 0; idx < rules.Length; ) + { + int code = rules.GetLSLIntegerItem(idx++); + string arg = rules.GetLSLStringItem(idx++); + switch (code) + { + case 0: + newLand.Name = arg; + break; + + case 1: + newLand.Description = arg; + break; + + case 2: + CheckThreatLevel(ThreatLevel.VeryHigh, "osParcelSetDetails"); + if (UUID.TryParse(arg , out uuid)) + newLand.OwnerID = uuid; + break; + + case 3: + CheckThreatLevel(ThreatLevel.VeryHigh, "osParcelSetDetails"); + if (UUID.TryParse(arg , out uuid)) + newLand.GroupID = uuid; + break; + } + } + + World.LandChannel.UpdateLandObject(newLand.LocalID,newLand); + } public double osList2Double(LSL_Types.list src, int index) { diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 60b8050..7a8f469 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -123,6 +123,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osWindParamSet(string plugin, string param, float value); float osWindParamGet(string plugin, string param); + // Parcel commands + void osParcelJoin(vector pos1, vector pos2); + void osParcelSubdivide(vector pos1, vector pos2); + void osParcelSetDetails(vector pos, LSL_List rules); string osGetScriptEngineName(); string osGetSimulatorVersion(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 3870af3..fd9309a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -106,6 +106,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase // return m_OSSL_Functions.osWindParamGet(plugin, param); // } + public void osParcelJoin(vector pos1, vector pos2) + { + m_OSSL_Functions.osParcelJoin(pos1,pos2); + } + + public void osParcelSubdivide(vector pos1, vector pos2) + { + m_OSSL_Functions.osParcelSubdivide(pos1, pos2); + } + + public void osParcelSetDetails(vector pos, LSL_List rules) + { + m_OSSL_Functions.osParcelSetDetails(pos,rules); + } + public double osList2Double(LSL_Types.list src, int index) { return m_OSSL_Functions.osList2Double(src, index); -- cgit v1.1