diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs index 9822af7f3e..f0ab955c4e 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs @@ -86,6 +86,15 @@ namespace OpenSim.Region.CoreModules.World.Land return obj; } + public ILandObject GetLandObject(int localID) + { + if (m_landManagementModule != null) + { + return m_landManagementModule.GetLandObject(localID); + } + return null; + } + public ILandObject GetLandObject(int x, int y) { if (m_landManagementModule != null) diff --git a/OpenSim/Region/Framework/Interfaces/ILandChannel.cs b/OpenSim/Region/Framework/Interfaces/ILandChannel.cs index 024902568f..eb9eb650b2 100644 --- a/OpenSim/Region/Framework/Interfaces/ILandChannel.cs +++ b/OpenSim/Region/Framework/Interfaces/ILandChannel.cs @@ -43,7 +43,9 @@ namespace OpenSim.Region.Framework.Interfaces /// Value between 0 - 256 on the y axis of the point /// Land object at the point supplied ILandObject GetLandObject(int x, int y); - + + ILandObject GetLandObject(int localID); + /// /// Get the land object at the specified point /// diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IParcel.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IParcel.cs index 7c3fe8619f..2a973a9c6a 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IParcel.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IParcel.cs @@ -5,11 +5,11 @@ using OpenMetaverse; namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { - interface IParcel + public interface IParcel { string Name { get; set; } string Description { get; set; } ISocialEntity Owner { get; set; } - bool[,] Bitmap { get; set; } + bool[,] Bitmap { get; } } } diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISocialEntity.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISocialEntity.cs index fe4826a620..0833ffd17d 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISocialEntity.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISocialEntity.cs @@ -5,7 +5,7 @@ using OpenMetaverse; namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { - interface ISocialEntity + public interface ISocialEntity { UUID GlobalID { get; } string Name { get; } diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs index f06f57a4dc..b35b57d5a4 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs @@ -31,6 +31,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { IObjectAccessor Objects { get; } IAvatar[] Avatars { get; } + IParcel[] Parcels { get; } IHeightmap Terrain { get; } } } diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs new file mode 100644 index 0000000000..aceeacce15 --- /dev/null +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs @@ -0,0 +1,45 @@ +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Region.OptionalModules.Scripting.Minimodule +{ + class LOParcel : IParcel + { + private readonly Scene m_scene; + private readonly int m_parcelID; + + public LOParcel(Scene m_scene, int m_parcelID) + { + this.m_scene = m_scene; + this.m_parcelID = m_parcelID; + } + + private ILandObject GetLO() + { + return m_scene.LandChannel.GetLandObject(m_parcelID); + } + + public string Name + { + get { return GetLO().landData.Name; } + set { GetLO().landData.Name = value; } + } + + public string Description + { + get { return GetLO().landData.Description; } + set { GetLO().landData.Description = value; } + } + + public ISocialEntity Owner + { + get { throw new System.NotImplementedException(); } + set { throw new System.NotImplementedException(); } + } + + public bool[,] Bitmap + { + get { return GetLO().landBitmap; } + } + } +} diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs index c798cc8353..05a6a84e28 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs @@ -26,6 +26,7 @@ */ using System.Collections.Generic; +using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.OptionalModules.Scripting.Minimodule @@ -49,6 +50,23 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule get { return m_objs; } } + public IParcel[] Parcels + { + get + { + List m_los = m_internalScene.LandChannel.AllParcels(); + List m_parcels = new List(m_los.Count); + + foreach (ILandObject landObject in m_los) + { + m_parcels.Add(new LOParcel(m_internalScene, landObject.landData.LocalID)); + } + + return m_parcels.ToArray(); + } + } + + public IAvatar[] Avatars { get diff --git a/OpenSim/Tests/Common/Mock/TestLandChannel.cs b/OpenSim/Tests/Common/Mock/TestLandChannel.cs index 761ef44c2f..4165641217 100644 --- a/OpenSim/Tests/Common/Mock/TestLandChannel.cs +++ b/OpenSim/Tests/Common/Mock/TestLandChannel.cs @@ -39,7 +39,8 @@ namespace OpenSim.Tests.Common.Mock { public List ParcelsNearPoint(Vector3 position) { return null; } public List AllParcels() { return null; } - public ILandObject GetLandObject(int x, int y) { return null; } + public ILandObject GetLandObject(int x, int y) { return null; } + public ILandObject GetLandObject(int localID) { return null; } public ILandObject GetLandObject(float x, float y) { return null; } public bool IsLandPrimCountTainted() { return false; } public bool IsForcefulBansAllowed() { return false; }