diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneBase.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneBase.cs | 390 |
1 files changed, 195 insertions, 195 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index 161a5cf..cbf69ac 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs | |||
@@ -1,195 +1,195 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | using OpenSim.Framework.Console; | 32 | using OpenSim.Framework.Console; |
33 | using OpenSim.Framework.Interfaces; | 33 | using OpenSim.Framework.Interfaces; |
34 | using OpenSim.Framework.Types; | 34 | using OpenSim.Framework.Types; |
35 | using OpenSim.Region.Caches; | 35 | using OpenSim.Region.Caches; |
36 | using OpenSim.Region.Terrain; | 36 | using OpenSim.Region.Terrain; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | 38 | ||
39 | namespace OpenSim.Region.Environment.Scenes | 39 | namespace OpenSim.Region.Environment.Scenes |
40 | { | 40 | { |
41 | public abstract class SceneBase : IWorld | 41 | public abstract class SceneBase : IWorld |
42 | { | 42 | { |
43 | public Dictionary<LLUUID, EntityBase> Entities; | 43 | public Dictionary<LLUUID, EntityBase> Entities; |
44 | protected ulong m_regionHandle; | 44 | protected ulong m_regionHandle; |
45 | protected string m_regionName; | 45 | protected string m_regionName; |
46 | protected RegionInfo m_regInfo; | 46 | protected RegionInfo m_regInfo; |
47 | 47 | ||
48 | public TerrainEngine Terrain; | 48 | public TerrainEngine Terrain; |
49 | 49 | ||
50 | public string m_datastore; | 50 | public string m_datastore; |
51 | public ILocalStorage localStorage; | 51 | public ILocalStorage localStorage; |
52 | 52 | ||
53 | protected object m_syncRoot = new object(); | 53 | protected object m_syncRoot = new object(); |
54 | private uint m_nextLocalId = 8880000; | 54 | private uint m_nextLocalId = 8880000; |
55 | protected AssetCache assetCache; | 55 | protected AssetCache assetCache; |
56 | 56 | ||
57 | #region Update Methods | 57 | #region Update Methods |
58 | /// <summary> | 58 | /// <summary> |
59 | /// Normally called once every frame/tick to let the world preform anything required (like running the physics simulation) | 59 | /// Normally called once every frame/tick to let the world preform anything required (like running the physics simulation) |
60 | /// </summary> | 60 | /// </summary> |
61 | public abstract void Update(); | 61 | public abstract void Update(); |
62 | 62 | ||
63 | #endregion | 63 | #endregion |
64 | 64 | ||
65 | #region Terrain Methods | 65 | #region Terrain Methods |
66 | 66 | ||
67 | /// <summary> | 67 | /// <summary> |
68 | /// Loads the World heightmap | 68 | /// Loads the World heightmap |
69 | /// </summary> | 69 | /// </summary> |
70 | public abstract void LoadWorldMap(); | 70 | public abstract void LoadWorldMap(); |
71 | 71 | ||
72 | /// <summary> | 72 | /// <summary> |
73 | /// Loads a new storage subsystem from a named library | 73 | /// Loads a new storage subsystem from a named library |
74 | /// </summary> | 74 | /// </summary> |
75 | /// <param name="dllName">Storage Library</param> | 75 | /// <param name="dllName">Storage Library</param> |
76 | /// <returns>Successful or not</returns> | 76 | /// <returns>Successful or not</returns> |
77 | public bool LoadStorageDLL(string dllName) | 77 | public bool LoadStorageDLL(string dllName) |
78 | { | 78 | { |
79 | try | 79 | try |
80 | { | 80 | { |
81 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | 81 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); |
82 | ILocalStorage store = null; | 82 | ILocalStorage store = null; |
83 | 83 | ||
84 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 84 | foreach (Type pluginType in pluginAssembly.GetTypes()) |
85 | { | 85 | { |
86 | if (pluginType.IsPublic) | 86 | if (pluginType.IsPublic) |
87 | { | 87 | { |
88 | if (!pluginType.IsAbstract) | 88 | if (!pluginType.IsAbstract) |
89 | { | 89 | { |
90 | Type typeInterface = pluginType.GetInterface("ILocalStorage", true); | 90 | Type typeInterface = pluginType.GetInterface("ILocalStorage", true); |
91 | 91 | ||
92 | if (typeInterface != null) | 92 | if (typeInterface != null) |
93 | { | 93 | { |
94 | ILocalStorage plug = (ILocalStorage)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 94 | ILocalStorage plug = (ILocalStorage)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); |
95 | store = plug; | 95 | store = plug; |
96 | 96 | ||
97 | store.Initialise(this.m_datastore); | 97 | store.Initialise(this.m_datastore); |
98 | break; | 98 | break; |
99 | } | 99 | } |
100 | 100 | ||
101 | typeInterface = null; | 101 | typeInterface = null; |
102 | } | 102 | } |
103 | } | 103 | } |
104 | } | 104 | } |
105 | pluginAssembly = null; | 105 | pluginAssembly = null; |
106 | this.localStorage = store; | 106 | this.localStorage = store; |
107 | return (store == null); | 107 | return (store == null); |
108 | } | 108 | } |
109 | catch (Exception e) | 109 | catch (Exception e) |
110 | { | 110 | { |
111 | MainLog.Instance.Warn("World.cs: LoadStorageDLL() - Failed with exception " + e.ToString()); | 111 | MainLog.Instance.Warn("World.cs: LoadStorageDLL() - Failed with exception " + e.ToString()); |
112 | return false; | 112 | return false; |
113 | } | 113 | } |
114 | } | 114 | } |
115 | 115 | ||
116 | 116 | ||
117 | /// <summary> | 117 | /// <summary> |
118 | /// Send the region heightmap to the client | 118 | /// Send the region heightmap to the client |
119 | /// </summary> | 119 | /// </summary> |
120 | /// <param name="RemoteClient">Client to send to</param> | 120 | /// <param name="RemoteClient">Client to send to</param> |
121 | public virtual void SendLayerData(IClientAPI RemoteClient) | 121 | public virtual void SendLayerData(IClientAPI RemoteClient) |
122 | { | 122 | { |
123 | RemoteClient.SendLayerData(Terrain.getHeights1D()); | 123 | RemoteClient.SendLayerData(Terrain.getHeights1D()); |
124 | } | 124 | } |
125 | 125 | ||
126 | /// <summary> | 126 | /// <summary> |
127 | /// Sends a specified patch to a client | 127 | /// Sends a specified patch to a client |
128 | /// </summary> | 128 | /// </summary> |
129 | /// <param name="px">Patch coordinate (x) 0..16</param> | 129 | /// <param name="px">Patch coordinate (x) 0..16</param> |
130 | /// <param name="py">Patch coordinate (y) 0..16</param> | 130 | /// <param name="py">Patch coordinate (y) 0..16</param> |
131 | /// <param name="RemoteClient">The client to send to</param> | 131 | /// <param name="RemoteClient">The client to send to</param> |
132 | public virtual void SendLayerData(int px, int py, IClientAPI RemoteClient) | 132 | public virtual void SendLayerData(int px, int py, IClientAPI RemoteClient) |
133 | { | 133 | { |
134 | RemoteClient.SendLayerData(px, py, Terrain.getHeights1D()); | 134 | RemoteClient.SendLayerData(px, py, Terrain.getHeights1D()); |
135 | } | 135 | } |
136 | 136 | ||
137 | #endregion | 137 | #endregion |
138 | 138 | ||
139 | #region Add/Remove Agent/Avatar | 139 | #region Add/Remove Agent/Avatar |
140 | /// <summary> | 140 | /// <summary> |
141 | /// | 141 | /// |
142 | /// </summary> | 142 | /// </summary> |
143 | /// <param name="remoteClient"></param> | 143 | /// <param name="remoteClient"></param> |
144 | /// <param name="agentID"></param> | 144 | /// <param name="agentID"></param> |
145 | /// <param name="child"></param> | 145 | /// <param name="child"></param> |
146 | public abstract void AddNewClient(IClientAPI client, bool child); | 146 | public abstract void AddNewClient(IClientAPI client, bool child); |
147 | 147 | ||
148 | /// <summary> | 148 | /// <summary> |
149 | /// | 149 | /// |
150 | /// </summary> | 150 | /// </summary> |
151 | /// <param name="agentID"></param> | 151 | /// <param name="agentID"></param> |
152 | public abstract void RemoveClient(LLUUID agentID); | 152 | public abstract void RemoveClient(LLUUID agentID); |
153 | 153 | ||
154 | #endregion | 154 | #endregion |
155 | 155 | ||
156 | /// <summary> | 156 | /// <summary> |
157 | /// | 157 | /// |
158 | /// </summary> | 158 | /// </summary> |
159 | /// <returns></returns> | 159 | /// <returns></returns> |
160 | public virtual RegionInfo RegionInfo | 160 | public virtual RegionInfo RegionInfo |
161 | { | 161 | { |
162 | get { return this.m_regInfo; } | 162 | get { return this.m_regInfo; } |
163 | } | 163 | } |
164 | 164 | ||
165 | public object SyncRoot | 165 | public object SyncRoot |
166 | { | 166 | { |
167 | get { return m_syncRoot; } | 167 | get { return m_syncRoot; } |
168 | } | 168 | } |
169 | 169 | ||
170 | public uint NextLocalId | 170 | public uint NextLocalId |
171 | { | 171 | { |
172 | get { return m_nextLocalId++; } | 172 | get { return m_nextLocalId++; } |
173 | } | 173 | } |
174 | 174 | ||
175 | #region Shutdown | 175 | #region Shutdown |
176 | /// <summary> | 176 | /// <summary> |
177 | /// Tidy before shutdown | 177 | /// Tidy before shutdown |
178 | /// </summary> | 178 | /// </summary> |
179 | public virtual void Close() | 179 | public virtual void Close() |
180 | { | 180 | { |
181 | try | 181 | try |
182 | { | 182 | { |
183 | this.localStorage.ShutDown(); | 183 | this.localStorage.ShutDown(); |
184 | } | 184 | } |
185 | catch (Exception e) | 185 | catch (Exception e) |
186 | { | 186 | { |
187 | MainLog.Instance.WriteLine(LogPriority.HIGH, "World.cs: Close() - Failed with exception " + e.ToString()); | 187 | MainLog.Instance.WriteLine(LogPriority.HIGH, "World.cs: Close() - Failed with exception " + e.ToString()); |
188 | } | 188 | } |
189 | } | 189 | } |
190 | 190 | ||
191 | #endregion | 191 | #endregion |
192 | 192 | ||
193 | 193 | ||
194 | } | 194 | } |
195 | } | 195 | } |