aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
blob: b1a4394928111f809a63a672f7b37392a28e085d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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<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;
            }
        }

        public IHeightmap Terrain
        {
            get { return m_heights; }
        }
    }
}