* MRM Adjustments

* Changes World.Objects from Array IObject[] to IObjectAccessor.
* Syntactically identical in most behaviour, however the indexer is now ranges not from 0..Count, but any valid internal LocalID. Additional indexers have been added for UUID.
* Example: for(int i=0;i<World.Objects.Count;i++) will not work any more, however foreach(World.Objects) will remain functional.
* This prevents us needing to create a list for each access to World.Objects which should [in theory] present a dramatic speed improvement to MRM scripts frequently accessing World.Objects.
This commit is contained in:
Adam Frisby
2009-04-01 09:31:40 +00:00
parent 7eccad05c9
commit 5cd70a8c0e
4 changed files with 150 additions and 15 deletions

View File

@@ -35,27 +35,18 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
private readonly Scene m_internalScene;
private readonly Heightmap m_heights;
private ObjectAccessor m_objs;
public World(Scene internalScene)
{
m_internalScene = internalScene;
m_heights = new Heightmap(m_internalScene);
m_objs = new ObjectAccessor(m_internalScene);
}
public IObject[] Objects
public IObjectAccessor Objects
{
get
{
List<EntityBase> ents = m_internalScene.Entities.GetAllByType<SceneObjectGroup>();
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;
}
get { return m_objs; }
}
public IAvatar[] Avatars