aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.RegionServer/world/WorldBase.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/OpenSim.RegionServer/world/WorldBase.cs204
1 files changed, 0 insertions, 204 deletions
diff --git a/OpenSim/OpenSim.RegionServer/world/WorldBase.cs b/OpenSim/OpenSim.RegionServer/world/WorldBase.cs
deleted file mode 100644
index 4050c09..0000000
--- a/OpenSim/OpenSim.RegionServer/world/WorldBase.cs
+++ /dev/null
@@ -1,204 +0,0 @@
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*/
28using System;
29using libsecondlife;
30using libsecondlife.Packets;
31using System.Collections.Generic;
32using System.Text;
33using System.Reflection;
34using System.IO;
35using System.Threading;
36using OpenSim.Physics.Manager;
37using OpenSim.Framework.Interfaces;
38using OpenSim.Framework.Types;
39using OpenSim.Framework.Terrain;
40using OpenSim.Framework.Inventory;
41using OpenSim.Assets;
42using OpenSim.RegionServer.world.scripting;
43using OpenSim.Terrain;
44using OpenSim.Framework.Console;
45
46namespace OpenSim.world
47{
48 public class WorldBase
49 {
50 public Dictionary<libsecondlife.LLUUID, Entity> Entities;
51 protected Dictionary<uint, ClientView> m_clientThreads;
52 protected ulong m_regionHandle;
53 protected string m_regionName;
54 protected InventoryCache _inventoryCache;
55 protected AssetCache _assetCache;
56 public RegionInfo m_regInfo;
57
58 public TerrainEngine Terrain; //TODO: Replace TerrainManager with this.
59 protected libsecondlife.TerrainManager TerrainManager; // To be referenced via TerrainEngine
60
61 #region Properties
62 public InventoryCache InventoryCache
63 {
64 set
65 {
66 this._inventoryCache = value;
67 }
68 }
69
70 public AssetCache AssetCache
71 {
72 set
73 {
74 this._assetCache = value;
75 }
76 }
77 #endregion
78
79 #region Constructors
80 public WorldBase()
81 {
82
83 }
84 #endregion
85
86 #region Setup Methods
87 /// <summary>
88 /// Register Packet handler Methods with the packet server (which will register them with the SimClient)
89 /// </summary>
90 /// <param name="packetServer"></param>
91 public virtual void RegisterPacketHandlers(PacketServer packetServer)
92 {
93
94 }
95 #endregion
96
97 #region Update Methods
98 /// <summary>
99 /// Normally called once every frame/tick to let the world preform anything required (like running the physics simulation)
100 /// </summary>
101 public virtual void Update()
102 {
103
104 }
105 #endregion
106
107 #region Terrain Methods
108
109 /// <summary>
110 /// Loads the World heightmap
111 /// </summary>
112 public virtual void LoadWorldMap()
113 {
114
115 }
116
117 /// <summary>
118 /// Send the region heightmap to the client
119 /// </summary>
120 /// <param name="RemoteClient">Client to send to</param>
121 public virtual void SendLayerData(ClientView RemoteClient)
122 {
123 try
124 {
125 int[] patches = new int[4];
126
127 for (int y = 0; y < 16; y++)
128 {
129 for (int x = 0; x < 16; x = x + 4)
130 {
131 patches[0] = x + 0 + y * 16;
132 patches[1] = x + 1 + y * 16;
133 patches[2] = x + 2 + y * 16;
134 patches[3] = x + 3 + y * 16;
135
136 Packet layerpack = TerrainManager.CreateLandPacket(Terrain.getHeights1D(), patches);
137 RemoteClient.OutPacket(layerpack);
138 }
139 }
140 }
141 catch (Exception e)
142 {
143 MainConsole.Instance.Warn("World.cs: SendLayerData() - Failed with exception " + e.ToString());
144 }
145 }
146
147 /// <summary>
148 /// Sends a specified patch to a client
149 /// </summary>
150 /// <param name="px">Patch coordinate (x) 0..16</param>
151 /// <param name="py">Patch coordinate (y) 0..16</param>
152 /// <param name="RemoteClient">The client to send to</param>
153 public void SendLayerData(int px, int py, ClientView RemoteClient)
154 {
155 try
156 {
157 int[] patches = new int[1];
158 int patchx, patchy;
159 patchx = px / 16;
160 patchy = py / 16;
161
162 patches[0] = patchx + 0 + patchy * 16;
163
164 Packet layerpack = TerrainManager.CreateLandPacket(Terrain.getHeights1D(), patches);
165 RemoteClient.OutPacket(layerpack);
166 }
167 catch (Exception e)
168 {
169 MainConsole.Instance.Warn("World.cs: SendLayerData() - Failed with exception " + e.ToString());
170 }
171 }
172 #endregion
173
174 #region Add/Remove Agent/Avatar
175 /// <summary>
176 /// Add a new Agent's avatar
177 /// </summary>
178 /// <param name="agentClient"></param>
179 public virtual Avatar AddViewerAgent(ClientView agentClient)
180 {
181 return null;
182 }
183
184 /// <summary>
185 /// Remove a Agent's avatar
186 /// </summary>
187 /// <param name="agentClient"></param>
188 public virtual void RemoveViewerAgent(ClientView agentClient)
189 {
190
191 }
192 #endregion
193
194 #region Shutdown
195 /// <summary>
196 /// Tidy before shutdown
197 /// </summary>
198 public virtual void Close()
199 {
200
201 }
202 #endregion
203 }
204}