diff options
Diffstat (limited to 'OpenSim/OpenSim.Region/Scene/SceneBase.cs')
-rw-r--r-- | OpenSim/OpenSim.Region/Scene/SceneBase.cs | 138 |
1 files changed, 138 insertions, 0 deletions
diff --git a/OpenSim/OpenSim.Region/Scene/SceneBase.cs b/OpenSim/OpenSim.Region/Scene/SceneBase.cs new file mode 100644 index 0000000..114b6a3 --- /dev/null +++ b/OpenSim/OpenSim.Region/Scene/SceneBase.cs | |||
@@ -0,0 +1,138 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using libsecondlife; | ||
30 | using libsecondlife.Packets; | ||
31 | using System.Collections.Generic; | ||
32 | using System.Text; | ||
33 | using System.Reflection; | ||
34 | using System.IO; | ||
35 | using System.Threading; | ||
36 | using OpenSim.Physics.Manager; | ||
37 | using OpenSim.Framework.Interfaces; | ||
38 | using OpenSim.Framework.Types; | ||
39 | using OpenSim.Framework.Inventory; | ||
40 | using OpenSim.Region.Scripting; | ||
41 | using OpenSim.Terrain; | ||
42 | |||
43 | namespace OpenSim.Region | ||
44 | { | ||
45 | public abstract class SceneBase : IWorld | ||
46 | { | ||
47 | public Dictionary<libsecondlife.LLUUID, Entity> Entities; | ||
48 | protected Dictionary<uint, IClientAPI> m_clientThreads; | ||
49 | protected ulong m_regionHandle; | ||
50 | protected string m_regionName; | ||
51 | protected RegionInfo m_regInfo; | ||
52 | |||
53 | public TerrainEngine Terrain; //TODO: Replace TerrainManager with this. | ||
54 | protected libsecondlife.TerrainManager TerrainManager; // To be referenced via TerrainEngine | ||
55 | protected object m_syncRoot = new object(); | ||
56 | private uint m_nextLocalId = 8880000; | ||
57 | |||
58 | #region Update Methods | ||
59 | /// <summary> | ||
60 | /// Normally called once every frame/tick to let the world preform anything required (like running the physics simulation) | ||
61 | /// </summary> | ||
62 | public abstract void Update(); | ||
63 | |||
64 | #endregion | ||
65 | |||
66 | #region Terrain Methods | ||
67 | |||
68 | /// <summary> | ||
69 | /// Loads the World heightmap | ||
70 | /// </summary> | ||
71 | public abstract void LoadWorldMap(); | ||
72 | |||
73 | /// <summary> | ||
74 | /// Send the region heightmap to the client | ||
75 | /// </summary> | ||
76 | /// <param name="RemoteClient">Client to send to</param> | ||
77 | public virtual void SendLayerData(IClientAPI RemoteClient) | ||
78 | { | ||
79 | RemoteClient.SendLayerData(Terrain.getHeights1D()); | ||
80 | } | ||
81 | |||
82 | /// <summary> | ||
83 | /// Sends a specified patch to a client | ||
84 | /// </summary> | ||
85 | /// <param name="px">Patch coordinate (x) 0..16</param> | ||
86 | /// <param name="py">Patch coordinate (y) 0..16</param> | ||
87 | /// <param name="RemoteClient">The client to send to</param> | ||
88 | public abstract void SendLayerData(int px, int py, IClientAPI RemoteClient); | ||
89 | |||
90 | #endregion | ||
91 | |||
92 | #region Add/Remove Agent/Avatar | ||
93 | /// <summary> | ||
94 | /// | ||
95 | /// </summary> | ||
96 | /// <param name="remoteClient"></param> | ||
97 | /// <param name="agentID"></param> | ||
98 | /// <param name="child"></param> | ||
99 | public abstract void AddNewAvatar(IClientAPI remoteClient, LLUUID agentID, bool child); | ||
100 | |||
101 | /// <summary> | ||
102 | /// | ||
103 | /// </summary> | ||
104 | /// <param name="agentID"></param> | ||
105 | public abstract void RemoveAvatar(LLUUID agentID); | ||
106 | |||
107 | #endregion | ||
108 | |||
109 | /// <summary> | ||
110 | /// | ||
111 | /// </summary> | ||
112 | /// <returns></returns> | ||
113 | public virtual RegionInfo RegionInfo | ||
114 | { | ||
115 | get { return null; } | ||
116 | } | ||
117 | |||
118 | public object SyncRoot | ||
119 | { | ||
120 | get { return m_syncRoot; } | ||
121 | } | ||
122 | |||
123 | public uint NextLocalId | ||
124 | { | ||
125 | get { return m_nextLocalId++; } | ||
126 | } | ||
127 | |||
128 | #region Shutdown | ||
129 | /// <summary> | ||
130 | /// Tidy before shutdown | ||
131 | /// </summary> | ||
132 | public abstract void Close(); | ||
133 | |||
134 | #endregion | ||
135 | |||
136 | |||
137 | } | ||
138 | } | ||