mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 20:05:33 +08:00
* 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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user