From 915b0f2448e6785c4031f664b98ea67ef1a90380 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Wed, 4 Mar 2009 02:29:51 +0000 Subject: * More work on MiniRegionModule module. --- .../Scripting/Minimodule/Heightmap.cs | 34 +++++ .../Scripting/Minimodule/IHeightmap.cs | 2 +- .../Scripting/Minimodule/IObject.cs | 2 +- .../OptionalModules/Scripting/Minimodule/IWorld.cs | 3 +- .../Scripting/Minimodule/SOPObject.cs | 166 +++++++++++++++++++++ .../OptionalModules/Scripting/Minimodule/World.cs | 39 +++++ 6 files changed, 243 insertions(+), 3 deletions(-) create mode 100644 OpenSim/Region/OptionalModules/Scripting/Minimodule/Heightmap.cs create mode 100644 OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs create mode 100644 OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs (limited to 'OpenSim/Region/OptionalModules/Scripting') diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Heightmap.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Heightmap.cs new file mode 100644 index 0000000..c75c6e7 --- /dev/null +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Heightmap.cs @@ -0,0 +1,34 @@ +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Region.OptionalModules.Scripting.Minimodule +{ + public class Heightmap : IHeightmap + { + private Scene m_scene; + + public Heightmap(Scene scene) + { + m_scene = scene; + } + + public int Height + { + get { return m_scene.Heightmap.Height; } + } + + public int Width + { + get { return m_scene.Heightmap.Width; } + } + + public double Get(int x, int y) + { + return m_scene.Heightmap[x, y]; + } + + public void Set(int x, int y, double val) + { + m_scene.Heightmap[x, y] = val; + } + } +} diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IHeightmap.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IHeightmap.cs index fd1cc3d..b4502a4 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IHeightmap.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IHeightmap.cs @@ -4,7 +4,7 @@ using System.Text; namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { - interface IHeightmap + public interface IHeightmap { int Height { get; } int Width { get; } diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IObject.cs index 04d36a5..30b08b0 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IObject.cs @@ -4,7 +4,7 @@ using OpenMetaverse; namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { - interface IObject + public interface IObject { bool Exists { get; } uint LocalID { get; } diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs index 3ce7020..087f94f 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs @@ -6,6 +6,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { interface IWorld { - + IObject[] Objects { get; } + IHeightmap Terrain { get; } } } diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs new file mode 100644 index 0000000..55b9767 --- /dev/null +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs @@ -0,0 +1,166 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenMetaverse; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Region.OptionalModules.Scripting.Minimodule +{ + class SOPObject : IObject + { + private readonly Scene m_rootScene; + private readonly uint m_localID; + + public SOPObject(Scene rootScene, uint localID) + { + m_rootScene = rootScene; + m_localID = localID; + } + + private SceneObjectPart GetSOP() + { + if (m_rootScene.Entities.ContainsKey(m_localID)) + return ((SceneObjectGroup) m_rootScene.Entities[m_localID]).RootPart; + + return null; + } + + public bool Exists + { + get { return GetSOP() != null; } + } + + public uint LocalID + { + get { return m_localID; } + } + + public UUID GlobalID + { + get { return GetSOP().UUID; } + } + + public IObject[] Children + { + get { throw new System.NotImplementedException(); } + } + + public IObject Root + { + get { return new SOPObject(m_rootScene, GetSOP().ParentGroup.RootPart.LocalId); } + } + + public IObjectFace[] Faces + { + get { throw new System.NotImplementedException(); } + } + + public Vector3 Scale + { + get { throw new System.NotImplementedException(); } + set { throw new System.NotImplementedException(); } + } + + public Quaternion Rotation + { + get { throw new System.NotImplementedException(); } + set { throw new System.NotImplementedException(); } + } + + public Vector3 SitTarget + { + get { throw new System.NotImplementedException(); } + set { throw new System.NotImplementedException(); } + } + + public string SitTargetText + { + get { throw new System.NotImplementedException(); } + set { throw new System.NotImplementedException(); } + } + + public string TouchText + { + get { throw new System.NotImplementedException(); } + set { throw new System.NotImplementedException(); } + } + + public string Text + { + get { throw new System.NotImplementedException(); } + set { throw new System.NotImplementedException(); } + } + + public bool IsPhysical + { + get { throw new System.NotImplementedException(); } + set { throw new System.NotImplementedException(); } + } + + public bool IsPhantom + { + get { throw new System.NotImplementedException(); } + set { throw new System.NotImplementedException(); } + } + + public bool IsRotationLockedX + { + get { throw new System.NotImplementedException(); } + set { throw new System.NotImplementedException(); } + } + + public bool IsRotationLockedY + { + get { throw new System.NotImplementedException(); } + set { throw new System.NotImplementedException(); } + } + + public bool IsRotationLockedZ + { + get { throw new System.NotImplementedException(); } + set { throw new System.NotImplementedException(); } + } + + public bool IsSandboxed + { + get { throw new System.NotImplementedException(); } + set { throw new System.NotImplementedException(); } + } + + public bool IsImmotile + { + get { throw new System.NotImplementedException(); } + set { throw new System.NotImplementedException(); } + } + + public bool IsAlwaysReturned + { + get { throw new System.NotImplementedException(); } + set { throw new System.NotImplementedException(); } + } + + public bool IsTemporary + { + get { throw new System.NotImplementedException(); } + set { throw new System.NotImplementedException(); } + } + + public bool IsFlexible + { + get { throw new System.NotImplementedException(); } + set { throw new System.NotImplementedException(); } + } + + public PrimType PrimShape + { + get { throw new System.NotImplementedException(); } + set { throw new System.NotImplementedException(); } + } + + public Material Material + { + get { throw new System.NotImplementedException(); } + set { throw new System.NotImplementedException(); } + } + } +} diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs new file mode 100644 index 0000000..6c7f854 --- /dev/null +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Region.OptionalModules.Scripting.Minimodule +{ + public class World : IWorld + { + private readonly Scene m_internalScene; + private readonly Heightmap m_heights; + + public World(Scene internalScene) + { + m_internalScene = internalScene; + m_heights = new Heightmap(m_internalScene); + } + + public IObject[] Objects + { + get + { + List ents = m_internalScene.Entities.GetAllByType(); + IObject[] rets = new IObject[ents.Count]; + + for (int i = 0; i < ents.Count; i++) + { + EntityBase ent = ents[i]; + rets[i] = new SOPObject(m_internalScene, ent.LocalId); + } + + return rets; + } + } + + public IHeightmap Terrain + { + get { return m_heights; } + } + } +} -- cgit v1.1