diff options
author | MW | 2007-03-30 16:50:19 +0000 |
---|---|---|
committer | MW | 2007-03-30 16:50:19 +0000 |
commit | bcae0bce8573ba7a567c4d63ffd8c9cbfe269684 (patch) | |
tree | f5914caa64651e1591443c631b74e2610953159e /OpenSim.RegionServer/world | |
parent | (no commit message) (diff) | |
download | opensim-SC_OLD-bcae0bce8573ba7a567c4d63ffd8c9cbfe269684.zip opensim-SC_OLD-bcae0bce8573ba7a567c4d63ffd8c9cbfe269684.tar.gz opensim-SC_OLD-bcae0bce8573ba7a567c4d63ffd8c9cbfe269684.tar.bz2 opensim-SC_OLD-bcae0bce8573ba7a567c4d63ffd8c9cbfe269684.tar.xz |
Some very basic terraforming, can raise and lower the terrain, but currently only a very basic brush algorithm (and can't change the brushes size)
Diffstat (limited to '')
-rw-r--r-- | OpenSim.RegionServer/world/Avatar.cs | 2 | ||||
-rw-r--r-- | OpenSim.RegionServer/world/Primitive.cs | 6 | ||||
-rw-r--r-- | OpenSim.RegionServer/world/World.cs | 461 |
3 files changed, 255 insertions, 214 deletions
diff --git a/OpenSim.RegionServer/world/Avatar.cs b/OpenSim.RegionServer/world/Avatar.cs index 7b79378..e1e314a 100644 --- a/OpenSim.RegionServer/world/Avatar.cs +++ b/OpenSim.RegionServer/world/Avatar.cs | |||
@@ -506,7 +506,7 @@ namespace OpenSim.world | |||
506 | handshake.RegionInfo.TerrainStartHeight11 = 10; | 506 | handshake.RegionInfo.TerrainStartHeight11 = 10; |
507 | handshake.RegionInfo.SimAccess = 13; | 507 | handshake.RegionInfo.SimAccess = 13; |
508 | handshake.RegionInfo.WaterHeight = 20; | 508 | handshake.RegionInfo.WaterHeight = 20; |
509 | handshake.RegionInfo.RegionFlags = 72458694; | 509 | handshake.RegionInfo.RegionFlags = 72458694 -32; |
510 | handshake.RegionInfo.SimName = _enc.GetBytes(m_regionName + "\0"); | 510 | handshake.RegionInfo.SimName = _enc.GetBytes(m_regionName + "\0"); |
511 | handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000"); | 511 | handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000"); |
512 | handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); | 512 | handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); |
diff --git a/OpenSim.RegionServer/world/Primitive.cs b/OpenSim.RegionServer/world/Primitive.cs index ca764a7..2f97053 100644 --- a/OpenSim.RegionServer/world/Primitive.cs +++ b/OpenSim.RegionServer/world/Primitive.cs | |||
@@ -295,13 +295,15 @@ namespace OpenSim.world | |||
295 | objupdate.ObjectData[0].PSBlock = new byte[0]; | 295 | objupdate.ObjectData[0].PSBlock = new byte[0]; |
296 | objupdate.ObjectData[0].ExtraParams = new byte[1]; | 296 | objupdate.ObjectData[0].ExtraParams = new byte[1]; |
297 | objupdate.ObjectData[0].MediaURL = new byte[0]; | 297 | objupdate.ObjectData[0].MediaURL = new byte[0]; |
298 | objupdate.ObjectData[0].NameValue = new byte[0]; | 298 | objupdate.ObjectData[0].NameValue = new byte[2]; |
299 | objupdate.ObjectData[0].NameValue[0] = (byte)'t'; | ||
300 | objupdate.ObjectData[0].NameValue[1] = (byte)'o'; | ||
299 | objupdate.ObjectData[0].Text = new byte[0]; | 301 | objupdate.ObjectData[0].Text = new byte[0]; |
300 | objupdate.ObjectData[0].TextColor = new byte[4]; | 302 | objupdate.ObjectData[0].TextColor = new byte[4]; |
301 | objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0, 0, 0); | 303 | objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0, 0, 0); |
302 | objupdate.ObjectData[0].JointPivot = new LLVector3(0, 0, 0); | 304 | objupdate.ObjectData[0].JointPivot = new LLVector3(0, 0, 0); |
303 | objupdate.ObjectData[0].Material = 3; | 305 | objupdate.ObjectData[0].Material = 3; |
304 | objupdate.ObjectData[0].UpdateFlags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456; | 306 | objupdate.ObjectData[0].UpdateFlags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456; |
305 | objupdate.ObjectData[0].TextureAnim = new byte[0]; | 307 | objupdate.ObjectData[0].TextureAnim = new byte[0]; |
306 | objupdate.ObjectData[0].Sound = LLUUID.Zero; | 308 | objupdate.ObjectData[0].Sound = LLUUID.Zero; |
307 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); | 309 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); |
diff --git a/OpenSim.RegionServer/world/World.cs b/OpenSim.RegionServer/world/World.cs index 3c131b2..446d37c 100644 --- a/OpenSim.RegionServer/world/World.cs +++ b/OpenSim.RegionServer/world/World.cs | |||
@@ -12,20 +12,20 @@ using OpenSim.Framework.Terrain; | |||
12 | 12 | ||
13 | namespace OpenSim.world | 13 | namespace OpenSim.world |
14 | { | 14 | { |
15 | public class World : ILocalStorageReceiver | 15 | public class World : ILocalStorageReceiver |
16 | { | 16 | { |
17 | public object LockPhysicsEngine = new object(); | 17 | public object LockPhysicsEngine = new object(); |
18 | public Dictionary<libsecondlife.LLUUID, Entity> Entities; | 18 | public Dictionary<libsecondlife.LLUUID, Entity> Entities; |
19 | public float[] LandMap; | 19 | public float[] LandMap; |
20 | public ScriptEngine Scripts; | 20 | public ScriptEngine Scripts; |
21 | public uint _localNumber=0; | 21 | public uint _localNumber = 0; |
22 | private PhysicsScene phyScene; | 22 | private PhysicsScene phyScene; |
23 | private float timeStep= 0.1f; | 23 | private float timeStep = 0.1f; |
24 | private libsecondlife.TerrainManager TerrainManager; | 24 | private libsecondlife.TerrainManager TerrainManager; |
25 | public ILocalStorage localStorage; | 25 | public ILocalStorage localStorage; |
26 | private Random Rand = new Random(); | 26 | private Random Rand = new Random(); |
27 | private uint _primCount = 702000; | 27 | private uint _primCount = 702000; |
28 | private int storageCount; | 28 | private int storageCount; |
29 | private Dictionary<uint, SimClient> m_clientThreads; | 29 | private Dictionary<uint, SimClient> m_clientThreads; |
30 | private ulong m_regionHandle; | 30 | private ulong m_regionHandle; |
31 | private string m_regionName; | 31 | private string m_regionName; |
@@ -38,90 +38,90 @@ namespace OpenSim.world | |||
38 | m_regionName = regionName; | 38 | m_regionName = regionName; |
39 | m_cfg = cfg; | 39 | m_cfg = cfg; |
40 | 40 | ||
41 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating new entitities instance"); | 41 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating new entitities instance"); |
42 | Entities = new Dictionary<libsecondlife.LLUUID, Entity>(); | 42 | Entities = new Dictionary<libsecondlife.LLUUID, Entity>(); |
43 | 43 | ||
44 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating LandMap"); | 44 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating LandMap"); |
45 | TerrainManager = new TerrainManager(new SecondLife()); | 45 | TerrainManager = new TerrainManager(new SecondLife()); |
46 | Avatar.SetupTemplate("avatar-template.dat"); | 46 | Avatar.SetupTemplate("avatar-template.dat"); |
47 | // MainConsole.Instance.WriteLine("World.cs - Creating script engine instance"); | 47 | // MainConsole.Instance.WriteLine("World.cs - Creating script engine instance"); |
48 | // Initialise this only after the world has loaded | 48 | // Initialise this only after the world has loaded |
49 | // Scripts = new ScriptEngine(this); | 49 | // Scripts = new ScriptEngine(this); |
50 | Avatar.LoadAnims(); | 50 | Avatar.LoadAnims(); |
51 | } | 51 | } |
52 | 52 | ||
53 | public PhysicsScene PhysScene | 53 | public PhysicsScene PhysScene |
54 | { | 54 | { |
55 | set | 55 | set |
56 | { | 56 | { |
57 | this.phyScene = value; | 57 | this.phyScene = value; |
58 | } | 58 | } |
59 | get | 59 | get |
60 | { | 60 | { |
61 | return(this.phyScene); | 61 | return (this.phyScene); |
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
65 | public void Update() | 65 | public void Update() |
66 | { | 66 | { |
67 | if(this.phyScene.IsThreaded) | 67 | if (this.phyScene.IsThreaded) |
68 | { | 68 | { |
69 | this.phyScene.GetResults(); | 69 | this.phyScene.GetResults(); |
70 | 70 | ||
71 | } | 71 | } |
72 | 72 | ||
73 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) | 73 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) |
74 | { | 74 | { |
75 | Entities[UUID].addForces(); | 75 | Entities[UUID].addForces(); |
76 | } | 76 | } |
77 | 77 | ||
78 | lock (this.LockPhysicsEngine) | 78 | lock (this.LockPhysicsEngine) |
79 | { | 79 | { |
80 | this.phyScene.Simulate(timeStep); | 80 | this.phyScene.Simulate(timeStep); |
81 | } | 81 | } |
82 | 82 | ||
83 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) | 83 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) |
84 | { | 84 | { |
85 | Entities[UUID].update(); | 85 | Entities[UUID].update(); |
86 | } | 86 | } |
87 | 87 | ||
88 | //backup world data | 88 | //backup world data |
89 | this.storageCount++; | 89 | this.storageCount++; |
90 | if(storageCount> 1200) //set to how often you want to backup | 90 | if (storageCount > 1200) //set to how often you want to backup |
91 | { | 91 | { |
92 | this.Backup(); | 92 | this.Backup(); |
93 | storageCount =0; | 93 | storageCount = 0; |
94 | } | 94 | } |
95 | } | 95 | } |
96 | 96 | ||
97 | public bool LoadStorageDLL(string dllName) | 97 | public bool LoadStorageDLL(string dllName) |
98 | { | 98 | { |
99 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | 99 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); |
100 | ILocalStorage store = null; | 100 | ILocalStorage store = null; |
101 | 101 | ||
102 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 102 | foreach (Type pluginType in pluginAssembly.GetTypes()) |
103 | { | 103 | { |
104 | if (pluginType.IsPublic) | 104 | if (pluginType.IsPublic) |
105 | { | 105 | { |
106 | if (!pluginType.IsAbstract) | 106 | if (!pluginType.IsAbstract) |
107 | { | 107 | { |
108 | Type typeInterface = pluginType.GetInterface("ILocalStorage", true); | 108 | Type typeInterface = pluginType.GetInterface("ILocalStorage", true); |
109 | 109 | ||
110 | if (typeInterface != null) | 110 | if (typeInterface != null) |
111 | { | 111 | { |
112 | ILocalStorage plug = (ILocalStorage)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 112 | ILocalStorage plug = (ILocalStorage)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); |
113 | store = plug; | 113 | store = plug; |
114 | break; | 114 | break; |
115 | } | 115 | } |
116 | 116 | ||
117 | typeInterface = null; | 117 | typeInterface = null; |
118 | } | 118 | } |
119 | } | 119 | } |
120 | } | 120 | } |
121 | pluginAssembly = null; | 121 | pluginAssembly = null; |
122 | this.localStorage = store; | 122 | this.localStorage = store; |
123 | return(store == null); | 123 | return (store == null); |
124 | } | 124 | } |
125 | 125 | ||
126 | public void RegenerateTerrain() | 126 | public void RegenerateTerrain() |
127 | { | 127 | { |
@@ -164,144 +164,183 @@ namespace OpenSim.world | |||
164 | Entities[UUID].LandRenegerated(); | 164 | Entities[UUID].LandRenegerated(); |
165 | } | 165 | } |
166 | } | 166 | } |
167 | 167 | ||
168 | public void LoadPrimsFromStorage() | 168 | public void RegenerateTerrain(bool changes, int pointx, int pointy) |
169 | { | 169 | { |
170 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: LoadPrimsFromStorage() - Loading primitives"); | 170 | if (changes) |
171 | this.localStorage.LoadPrimitives(this); | 171 | { |
172 | } | 172 | lock (this.LockPhysicsEngine) |
173 | 173 | { | |
174 | public void PrimFromStorage(PrimData prim) | 174 | this.phyScene.SetTerrain(this.LandMap); |
175 | { | 175 | } |
176 | if(prim.LocalID >= this._primCount) | 176 | m_cfg.SaveMap(this.LandMap); |
177 | { | 177 | |
178 | _primCount = prim.LocalID + 1; | 178 | foreach (SimClient client in m_clientThreads.Values) |
179 | } | 179 | { |
180 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: PrimFromStorage() - Reloading prim (localId "+ prim.LocalID+ " ) from storage"); | 180 | this.SendLayerData(pointx , pointy , client); |
181 | } | ||
182 | } | ||
183 | } | ||
184 | |||
185 | public void LoadPrimsFromStorage() | ||
186 | { | ||
187 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: LoadPrimsFromStorage() - Loading primitives"); | ||
188 | this.localStorage.LoadPrimitives(this); | ||
189 | } | ||
190 | |||
191 | public void PrimFromStorage(PrimData prim) | ||
192 | { | ||
193 | if (prim.LocalID >= this._primCount) | ||
194 | { | ||
195 | _primCount = prim.LocalID + 1; | ||
196 | } | ||
197 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: PrimFromStorage() - Reloading prim (localId " + prim.LocalID + " ) from storage"); | ||
181 | Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this); | 198 | Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this); |
182 | nPrim.CreateFromStorage(prim); | 199 | nPrim.CreateFromStorage(prim); |
183 | this.Entities.Add(nPrim.uuid, nPrim); | 200 | this.Entities.Add(nPrim.uuid, nPrim); |
184 | } | 201 | } |
185 | 202 | ||
186 | public void Close() | 203 | public void Close() |
187 | { | 204 | { |
188 | this.localStorage.ShutDown(); | 205 | this.localStorage.ShutDown(); |
189 | } | 206 | } |
190 | 207 | ||
191 | public void SendLayerData(SimClient RemoteClient) { | 208 | public void SendLayerData(SimClient RemoteClient) |
192 | int[] patches = new int[4]; | 209 | { |
193 | 210 | int[] patches = new int[4]; | |
194 | for (int y = 0; y < 16; y++) | 211 | |
195 | { | 212 | for (int y = 0; y < 16; y++) |
196 | for (int x = 0; x < 16; x = x + 4) | 213 | { |
197 | { | 214 | for (int x = 0; x < 16; x = x + 4) |
198 | patches[0] = x + 0 + y * 16; | 215 | { |
199 | patches[1] = x + 1 + y * 16; | 216 | patches[0] = x + 0 + y * 16; |
200 | patches[2] = x + 2 + y * 16; | 217 | patches[1] = x + 1 + y * 16; |
201 | patches[3] = x + 3 + y * 16; | 218 | patches[2] = x + 2 + y * 16; |
202 | 219 | patches[3] = x + 3 + y * 16; | |
203 | Packet layerpack = TerrainManager.CreateLandPacket(LandMap, patches); | 220 | |
204 | RemoteClient.OutPacket(layerpack); | 221 | Packet layerpack = TerrainManager.CreateLandPacket(LandMap, patches); |
205 | } | 222 | RemoteClient.OutPacket(layerpack); |
206 | } | 223 | } |
207 | } | 224 | } |
208 | 225 | } | |
209 | public void GetInitialPrims(SimClient RemoteClient) | 226 | |
210 | { | 227 | public void SendLayerData(int px, int py, SimClient RemoteClient) |
211 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) | 228 | { |
212 | { | 229 | int[] patches = new int[1]; |
213 | if(Entities[UUID].ToString()== "OpenSim.world.Primitive") | 230 | int patchx, patchy; |
214 | { | 231 | patchx = px / 16; |
215 | ((OpenSim.world.Primitive)Entities[UUID]).UpdateClient(RemoteClient); | 232 | /* if (patchx > 12) |
216 | } | 233 | { |
217 | } | 234 | patchx = 12; |
218 | } | 235 | }*/ |
219 | 236 | patchy = py / 16; | |
220 | public void AddViewerAgent(SimClient AgentClient) | 237 | |
238 | patches[0] = patchx + 0 + patchy * 16; | ||
239 | //patches[1] = patchx + 1 + patchy * 16; | ||
240 | //patches[2] = patchx + 2 + patchy * 16; | ||
241 | //patches[3] = patchx + 3 + patchy * 16; | ||
242 | |||
243 | Packet layerpack = TerrainManager.CreateLandPacket(LandMap, patches); | ||
244 | RemoteClient.OutPacket(layerpack); | ||
245 | |||
246 | } | ||
247 | public void GetInitialPrims(SimClient RemoteClient) | ||
248 | { | ||
249 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) | ||
250 | { | ||
251 | if (Entities[UUID].ToString() == "OpenSim.world.Primitive") | ||
252 | { | ||
253 | ((OpenSim.world.Primitive)Entities[UUID]).UpdateClient(RemoteClient); | ||
254 | } | ||
255 | } | ||
256 | } | ||
257 | |||
258 | public void AddViewerAgent(SimClient AgentClient) | ||
221 | { | 259 | { |
222 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); | 260 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); |
223 | Avatar NewAvatar = new Avatar(AgentClient, this, m_regionName, m_clientThreads, m_regionHandle); | 261 | Avatar NewAvatar = new Avatar(AgentClient, this, m_regionName, m_clientThreads, m_regionHandle); |
224 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world"); | 262 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world"); |
225 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake "); | 263 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake "); |
226 | NewAvatar.SendRegionHandshake(this); | 264 | NewAvatar.SendRegionHandshake(this); |
227 | PhysicsVector pVec = new PhysicsVector(NewAvatar.position.X, NewAvatar.position.Y, NewAvatar.position.Z); | 265 | PhysicsVector pVec = new PhysicsVector(NewAvatar.position.X, NewAvatar.position.Y, NewAvatar.position.Z); |
228 | lock (this.LockPhysicsEngine) | 266 | lock (this.LockPhysicsEngine) |
229 | { | 267 | { |
230 | NewAvatar.PhysActor = this.phyScene.AddAvatar(pVec); | 268 | NewAvatar.PhysActor = this.phyScene.AddAvatar(pVec); |
231 | } | 269 | } |
232 | this.Entities.Add(AgentClient.AgentID, NewAvatar); | 270 | this.Entities.Add(AgentClient.AgentID, NewAvatar); |
233 | } | 271 | } |
234 | 272 | ||
235 | public void AddNewPrim(ObjectAddPacket addPacket, SimClient AgentClient) | 273 | public void AddNewPrim(ObjectAddPacket addPacket, SimClient AgentClient) |
236 | { | 274 | { |
237 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim"); | 275 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim"); |
238 | Primitive prim = new Primitive(m_clientThreads, m_regionHandle, this); | 276 | Primitive prim = new Primitive(m_clientThreads, m_regionHandle, this); |
239 | prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount); | 277 | prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount); |
240 | PhysicsVector pVec = new PhysicsVector(prim.position.X, prim.position.Y, prim.position.Z); | 278 | PhysicsVector pVec = new PhysicsVector(prim.position.X, prim.position.Y, prim.position.Z); |
241 | PhysicsVector pSize = new PhysicsVector( 0.255f, 0.255f, 0.255f); | 279 | PhysicsVector pSize = new PhysicsVector(0.255f, 0.255f, 0.255f); |
242 | if(OpenSim.world.Avatar.PhysicsEngineFlying) | 280 | if (OpenSim.world.Avatar.PhysicsEngineFlying) |
243 | { | 281 | { |
244 | lock (this.LockPhysicsEngine) | 282 | lock (this.LockPhysicsEngine) |
245 | { | 283 | { |
246 | prim.PhysActor = this.phyScene.AddPrim(pVec, pSize); | 284 | prim.PhysActor = this.phyScene.AddPrim(pVec, pSize); |
247 | } | 285 | } |
248 | } | 286 | } |
249 | //prim.PhysicsEnabled = true; | 287 | //prim.PhysicsEnabled = true; |
250 | this.Entities.Add(prim.uuid, prim); | 288 | this.Entities.Add(prim.uuid, prim); |
251 | this._primCount++; | 289 | this._primCount++; |
252 | } | 290 | } |
253 | 291 | ||
254 | public void DeRezObject(DeRezObjectPacket DeRezPacket, SimClient AgentClient) | 292 | public void DeRezObject(DeRezObjectPacket DeRezPacket, SimClient AgentClient) |
255 | { | 293 | { |
256 | //Needs to delete object from physics at a later date | 294 | //Needs to delete object from physics at a later date |
257 | 295 | ||
258 | libsecondlife.LLUUID [] DeRezEnts; | 296 | libsecondlife.LLUUID[] DeRezEnts; |
259 | DeRezEnts = new libsecondlife.LLUUID[ DeRezPacket.ObjectData.Length ]; | 297 | DeRezEnts = new libsecondlife.LLUUID[DeRezPacket.ObjectData.Length]; |
260 | int i = 0; | 298 | int i = 0; |
261 | foreach( DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData ) | 299 | foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) |
262 | { | 300 | { |
263 | //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); | 301 | //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); |
264 | foreach (Entity ent in this.Entities.Values) | 302 | foreach (Entity ent in this.Entities.Values) |
265 | { | 303 | { |
266 | if (ent.localid == Data.ObjectLocalID) | 304 | if (ent.localid == Data.ObjectLocalID) |
267 | { | 305 | { |
268 | DeRezEnts[i++] = ent.uuid; | 306 | DeRezEnts[i++] = ent.uuid; |
269 | this.localStorage.RemovePrim(ent.uuid); | 307 | this.localStorage.RemovePrim(ent.uuid); |
270 | KillObjectPacket kill = new KillObjectPacket(); | 308 | KillObjectPacket kill = new KillObjectPacket(); |
271 | kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; | 309 | kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; |
272 | kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); | 310 | kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); |
273 | kill.ObjectData[0].ID = ent.localid; | 311 | kill.ObjectData[0].ID = ent.localid; |
274 | foreach (SimClient client in m_clientThreads.Values) | 312 | foreach (SimClient client in m_clientThreads.Values) |
275 | { | 313 | { |
276 | client.OutPacket(kill); | 314 | client.OutPacket(kill); |
277 | } | 315 | } |
278 | //Uncommenting this means an old UUID will be re-used, thus crashing the asset server | 316 | //Uncommenting this means an old UUID will be re-used, thus crashing the asset server |
279 | //Uncomment when prim/object UUIDs are random or such | 317 | //Uncomment when prim/object UUIDs are random or such |
280 | //2007-03-22 - Randomskk | 318 | //2007-03-22 - Randomskk |
281 | //this._primCount--; | 319 | //this._primCount--; |
282 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Deleted UUID " + ent.uuid); | 320 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Deleted UUID " + ent.uuid); |
283 | } | 321 | } |
284 | } | 322 | } |
285 | } | 323 | } |
286 | foreach( libsecondlife.LLUUID uuid in DeRezEnts ) | 324 | foreach (libsecondlife.LLUUID uuid in DeRezEnts) |
287 | { | 325 | { |
288 | lock (Entities) | 326 | lock (Entities) |
289 | { | 327 | { |
290 | Entities.Remove(uuid); | 328 | Entities.Remove(uuid); |
291 | } | 329 | } |
292 | } | 330 | } |
293 | 331 | ||
332 | } | ||
333 | |||
334 | public bool Backup() | ||
335 | { | ||
336 | |||
337 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: Backup() - Backing up Primitives"); | ||
338 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) | ||
339 | { | ||
340 | Entities[UUID].BackUp(); | ||
341 | } | ||
342 | return true; | ||
294 | } | 343 | } |
295 | 344 | ||
296 | public bool Backup() { | ||
297 | |||
298 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: Backup() - Backing up Primitives"); | ||
299 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) | ||
300 | { | ||
301 | Entities[UUID].BackUp(); | ||
302 | } | ||
303 | return true; | ||
304 | } | ||
305 | |||
306 | } | 345 | } |
307 | } | 346 | } |