* Implements World.Parcels[] array for MRM scripting.

0.6.5-rc1
Adam Frisby 2009-04-06 07:17:23 +00:00
parent 918c466881
commit 9e51c2db95
8 changed files with 81 additions and 5 deletions

View File

@ -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)

View File

@ -44,6 +44,8 @@ namespace OpenSim.Region.Framework.Interfaces
/// <returns>Land object at the point supplied</returns>
ILandObject GetLandObject(int x, int y);
ILandObject GetLandObject(int localID);
/// <summary>
/// Get the land object at the specified point
/// </summary>

View File

@ -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; }
}
}

View File

@ -5,7 +5,7 @@ using OpenMetaverse;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
interface ISocialEntity
public interface ISocialEntity
{
UUID GlobalID { get; }
string Name { get; }

View File

@ -31,6 +31,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
IObjectAccessor Objects { get; }
IAvatar[] Avatars { get; }
IParcel[] Parcels { get; }
IHeightmap Terrain { get; }
}
}

View File

@ -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; }
}
}
}

View File

@ -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<ILandObject> m_los = m_internalScene.LandChannel.AllParcels();
List<IParcel> m_parcels = new List<IParcel>(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

View File

@ -40,6 +40,7 @@ namespace OpenSim.Tests.Common.Mock
public List<ILandObject> ParcelsNearPoint(Vector3 position) { return null; }
public List<ILandObject> AllParcels() { 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; }