From 9e51c2db95fd43aa18e66d359c15349bdc9ad8f0 Mon Sep 17 00:00:00 2001
From: Adam Frisby
Date: Mon, 6 Apr 2009 07:17:23 +0000
Subject: * Implements World.Parcels[] array for MRM scripting.
---
.../Region/CoreModules/World/Land/LandChannel.cs | 9 +++++
.../Region/Framework/Interfaces/ILandChannel.cs | 4 +-
.../Scripting/Minimodule/IParcel.cs | 4 +-
.../Scripting/Minimodule/ISocialEntity.cs | 2 +-
.../OptionalModules/Scripting/Minimodule/IWorld.cs | 1 +
.../Scripting/Minimodule/LOParcel.cs | 45 ++++++++++++++++++++++
.../OptionalModules/Scripting/Minimodule/World.cs | 18 +++++++++
7 files changed, 79 insertions(+), 4 deletions(-)
create mode 100644 OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
index 9822af7..f0ab955 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 0249025..eb9eb65 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 7c3fe86..2a973a9 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 fe4826a..0833ffd 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 f06f57a..b35b57d 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 0000000..aceeacc
--- /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 c798cc8..05a6a84 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
--
cgit v1.1