* Adds World.Avatars[] to MRM Scripting. Contains an enumerable array containing IAvatar instances for each avatar in the region.

* Adds Test/TestModule.cs which demonstrates a very quick and simple MRM Test.
0.6.5-rc1
Adam Frisby 2009-04-01 06:55:39 +00:00
parent 0266c344fb
commit 7eccad05c9
5 changed files with 73 additions and 1 deletions

View File

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

View File

@ -34,6 +34,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
public interface IWorld
{
IObject[] Objects { get; }
IAvatar[] Avatars { get; }
IHeightmap Terrain { get; }
}
}

View File

@ -0,0 +1,37 @@
using OpenMetaverse;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
class SPAvatar : IAvatar
{
private readonly Scene m_rootScene;
private readonly UUID m_ID;
public SPAvatar(Scene scene, UUID ID)
{
m_rootScene = scene;
m_ID = ID;
}
private ScenePresence GetSP()
{
return m_rootScene.GetScenePresence(m_ID);
}
public string Name
{
get { return GetSP().Name; }
}
public UUID GlobalID
{
get { return m_ID; }
}
public Vector3 Position
{
get { return GetSP().AbsolutePosition; }
}
}
}

View File

@ -0,0 +1,17 @@
using OpenSim.Region.OptionalModules.Scripting.Minimodule;
namespace OpenSim
{
class MiniModule : MRMBase
{
public override void Start()
{
Host.Console.Info("Hello World!");
}
public override void Stop()
{
}
}
}

View File

@ -58,6 +58,23 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
}
}
public IAvatar[] Avatars
{
get
{
List<EntityBase> ents = m_internalScene.Entities.GetAllByType<ScenePresence>();
IAvatar[] rets = new IAvatar[ents.Count];
for (int i = 0; i < ents.Count; i++)
{
EntityBase ent = ents[i];
rets[i] = new SPAvatar(m_internalScene, ent.UUID);
}
return rets;
}
}
public IHeightmap Terrain
{
get { return m_heights; }