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