aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
diff options
context:
space:
mode:
authorMW2007-11-03 19:14:22 +0000
committerMW2007-11-03 19:14:22 +0000
commitdabbdec2cdf2c1056e4ebb8aec38302a1fa9eba4 (patch)
treeee886c072810521bd56b7124d53e093a8bc9cbf8 /OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
parenttiny commit to prepare for the first proper part of Scene.cs refactoring. (diff)
downloadopensim-SC_OLD-dabbdec2cdf2c1056e4ebb8aec38302a1fa9eba4.zip
opensim-SC_OLD-dabbdec2cdf2c1056e4ebb8aec38302a1fa9eba4.tar.gz
opensim-SC_OLD-dabbdec2cdf2c1056e4ebb8aec38302a1fa9eba4.tar.bz2
opensim-SC_OLD-dabbdec2cdf2c1056e4ebb8aec38302a1fa9eba4.tar.xz
First part of Scene refactoring:
Started the move of some of the methods from scene into a inner class (currently called InnerScene.cs), the idea being that the code related to the 3d scene (primitive/entities/Avatars etc) will be in this inner class, then what is now Scene.cs will be left as a kind of wrapper class around it. And once the spilt is complete can be renamed to something like RegionInstance (or any name that sounds good and ids it as the Region layer class that "has" a scene). Added SceneCommunicationService which at the moment is a kind of high level wrapper around commsManager. The idea being that it has a higher level API for the Region/Scene to send messages to the other regions on the grid. a Example of the API is that instead of having sendXmessage methods, it has more functional level method like PassAvatarToNeighbour. Hopefully this will allow more freedom to do changes in communications that doesn't break other things.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs367
1 files changed, 0 insertions, 367 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 73d317a..a9f6991 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -92,129 +92,6 @@ namespace OpenSim.Region.Environment.Scenes
92 /// <summary> 92 /// <summary>
93 /// 93 ///
94 /// </summary> 94 /// </summary>
95 /// <param name="originalPrim"></param>
96 /// <param name="offset"></param>
97 /// <param name="flags"></param>
98 public void DuplicateObject(uint originalPrim, LLVector3 offset, uint flags)
99 {
100 SceneObjectGroup originPrim = null;
101 foreach (EntityBase ent in Entities.Values)
102 {
103 if (ent is SceneObjectGroup)
104 {
105 if (((SceneObjectGroup) ent).LocalId == originalPrim)
106 {
107 originPrim = (SceneObjectGroup) ent;
108 break;
109 }
110 }
111 }
112
113 if (originPrim != null)
114 {
115 SceneObjectGroup copy = originPrim.Copy();
116 copy.AbsolutePosition = copy.AbsolutePosition + offset;
117 Entities.Add(copy.UUID, copy);
118
119 copy.ScheduleGroupForFullUpdate();
120 /* List<ScenePresence> avatars = this.GetScenePresences();
121 for (int i = 0; i < avatars.Count; i++)
122 {
123 // copy.SendAllChildPrimsToClient(avatars[i].ControllingClient);
124 }*/
125 }
126 else
127 {
128 MainLog.Instance.Warn("client", "Attempted to duplicate nonexistant prim");
129 }
130 }
131
132 /// <summary>
133 ///
134 /// </summary>
135 /// <param name="parentPrim"></param>
136 /// <param name="childPrims"></param>
137 public void LinkObjects(uint parentPrim, List<uint> childPrims)
138 {
139 SceneObjectGroup parenPrim = null;
140 foreach (EntityBase ent in Entities.Values)
141 {
142 if (ent is SceneObjectGroup)
143 {
144 if (((SceneObjectGroup) ent).LocalId == parentPrim)
145 {
146 parenPrim = (SceneObjectGroup) ent;
147 break;
148 }
149 }
150 }
151
152 List<SceneObjectGroup> children = new List<SceneObjectGroup>();
153 if (parenPrim != null)
154 {
155 for (int i = 0; i < childPrims.Count; i++)
156 {
157 foreach (EntityBase ent in Entities.Values)
158 {
159 if (ent is SceneObjectGroup)
160 {
161 if (((SceneObjectGroup) ent).LocalId == childPrims[i])
162 {
163 children.Add((SceneObjectGroup) ent);
164 }
165 }
166 }
167 }
168 }
169
170 foreach (SceneObjectGroup sceneObj in children)
171 {
172 parenPrim.LinkToGroup(sceneObj);
173 }
174 }
175
176 /// <summary>
177 ///
178 /// </summary>
179 /// <param name="primLocalID"></param>
180 /// <param name="shapeBlock"></param>
181 public void UpdatePrimShape(uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock)
182 {
183 bool hasPrim = false;
184 foreach (EntityBase ent in Entities.Values)
185 {
186 if (ent is SceneObjectGroup)
187 {
188 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
189 if (hasPrim != false)
190 {
191 ((SceneObjectGroup) ent).UpdateShape(shapeBlock, primLocalID);
192 break;
193 }
194 }
195 }
196 }
197
198 public void UpdateExtraParam(uint primLocalID, ushort type, bool inUse, byte[] data)
199 {
200 bool hasPrim = false;
201 foreach (EntityBase ent in Entities.Values)
202 {
203 if (ent is SceneObjectGroup)
204 {
205 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
206 if (hasPrim != false)
207 {
208 ((SceneObjectGroup) ent).UpdateExtraParam(primLocalID, type, inUse, data);
209 break;
210 }
211 }
212 }
213 }
214
215 /// <summary>
216 ///
217 /// </summary>
218 /// <param name="primLocalID"></param> 95 /// <param name="primLocalID"></param>
219 /// <param name="remoteClient"></param> 96 /// <param name="remoteClient"></param>
220 public void SelectPrim(uint primLocalID, IClientAPI remoteClient) 97 public void SelectPrim(uint primLocalID, IClientAPI remoteClient)
@@ -255,250 +132,6 @@ namespace OpenSim.Region.Environment.Scenes
255 } 132 }
256 } 133 }
257 134
258 /// <summary>
259 ///
260 /// </summary>
261 /// <param name="primLocalID"></param>
262 /// <param name="description"></param>
263 public void PrimDescription(uint primLocalID, string description)
264 {
265 bool hasPrim = false;
266 foreach (EntityBase ent in Entities.Values)
267 {
268 if (ent is SceneObjectGroup)
269 {
270 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
271 if (hasPrim != false)
272 {
273 ((SceneObjectGroup) ent).SetPartDescription(description, primLocalID);
274 break;
275 }
276 }
277 }
278 }
279
280 /// <summary>
281 ///
282 /// </summary>
283 /// <param name="primLocalID"></param>
284 /// <param name="description"></param>
285 public void PrimName(uint primLocalID, string name)
286 {
287 bool hasPrim = false;
288 foreach (EntityBase ent in Entities.Values)
289 {
290 if (ent is SceneObjectGroup)
291 {
292 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
293 if (hasPrim != false)
294 {
295 ((SceneObjectGroup) ent).SetPartName(name, primLocalID);
296 break;
297 }
298 }
299 }
300 }
301
302 public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
303 {
304 if (PermissionsMngr.CanEditObject(remoteClient.AgentId, objectID))
305 {
306 bool hasPrim = false;
307 foreach (EntityBase ent in Entities.Values)
308 {
309 if (ent is SceneObjectGroup)
310 {
311 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(objectID);
312 if (hasPrim != false)
313 {
314 ((SceneObjectGroup) ent).GrabMovement(offset, pos, remoteClient);
315 break;
316 }
317 }
318 }
319 }
320 }
321
322 /// <summary>
323 ///
324 /// </summary>
325 /// <param name="localID"></param>
326 /// <param name="packet"></param>
327 /// <param name="remoteClient"></param>
328 public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient)
329 {
330 bool hasprim = false;
331 foreach (EntityBase ent in Entities.Values)
332 {
333 if (ent is SceneObjectGroup)
334 {
335 hasprim = ((SceneObjectGroup) ent).HasChildPrim(localID);
336 if (hasprim != false)
337 {
338 ((SceneObjectGroup) ent).UpdatePrimFlags(localID, (ushort) packet.Type, true, packet.ToBytes());
339 }
340 }
341 }
342
343 //System.Console.WriteLine("Got primupdate packet: " + packet.UsePhysics.ToString());
344 }
345
346 /// <summary>
347 ///
348 /// </summary>
349 /// <param name="localID"></param>
350 /// <param name="texture"></param>
351 /// <param name="remoteClient"></param>
352 public void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient)
353 {
354 bool hasPrim = false;
355 foreach (EntityBase ent in Entities.Values)
356 {
357 if (ent is SceneObjectGroup)
358 {
359 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
360 if (hasPrim != false)
361 {
362 ((SceneObjectGroup) ent).UpdateTextureEntry(localID, texture);
363 break;
364 }
365 }
366 }
367 }
368
369 /// <summary>
370 ///
371 /// </summary>
372 /// <param name="localID"></param>
373 /// <param name="pos"></param>
374 /// <param name="remoteClient"></param>
375 public void UpdatePrimPosition(uint localID, LLVector3 pos, IClientAPI remoteClient)
376 {
377 bool hasPrim = false;
378 foreach (EntityBase ent in Entities.Values)
379 {
380 if (ent is SceneObjectGroup)
381 {
382 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
383 if (hasPrim != false)
384 {
385 ((SceneObjectGroup) ent).UpdateGroupPosition(pos);
386 break;
387 }
388 }
389 }
390 }
391
392 public void UpdatePrimSinglePosition(uint localID, LLVector3 pos, IClientAPI remoteClient)
393 {
394 bool hasPrim = false;
395 foreach (EntityBase ent in Entities.Values)
396 {
397 if (ent is SceneObjectGroup)
398 {
399 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
400 if (hasPrim != false)
401 {
402 ((SceneObjectGroup) ent).UpdateSinglePosition(pos, localID);
403 break;
404 }
405 }
406 }
407 }
408
409 /// <summary>
410 ///
411 /// </summary>
412 /// <param name="localID"></param>
413 /// <param name="pos"></param>
414 /// <param name="rot"></param>
415 /// <param name="remoteClient"></param>
416 public void UpdatePrimRotation(uint localID, LLVector3 pos, LLQuaternion rot, IClientAPI remoteClient)
417 {
418 bool hasPrim = false;
419 foreach (EntityBase ent in Entities.Values)
420 {
421 if (ent is SceneObjectGroup)
422 {
423 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
424 if (hasPrim != false)
425 {
426 ((SceneObjectGroup) ent).UpdateGroupRotation(pos, rot);
427 break;
428 }
429 }
430 }
431 }
432
433 /// <summary>
434 ///
435 /// </summary>
436 /// <param name="localID"></param>
437 /// <param name="rot"></param>
438 /// <param name="remoteClient"></param>
439 public void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient)
440 {
441 bool hasPrim = false;
442 foreach (EntityBase ent in Entities.Values)
443 {
444 if (ent is SceneObjectGroup)
445 {
446 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
447 if (hasPrim != false)
448 {
449 ((SceneObjectGroup) ent).UpdateGroupRotation(rot);
450 break;
451 }
452 }
453 }
454 }
455
456 /// <summary>
457 ///
458 /// </summary>
459 /// <param name="localID"></param>
460 /// <param name="rot"></param>
461 /// <param name="remoteClient"></param>
462 public void UpdatePrimSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient)
463 {
464 bool hasPrim = false;
465 foreach (EntityBase ent in Entities.Values)
466 {
467 if (ent is SceneObjectGroup)
468 {
469 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
470 if (hasPrim != false)
471 {
472 ((SceneObjectGroup) ent).UpdateSingleRotation(rot, localID);
473 break;
474 }
475 }
476 }
477 }
478
479 /// <summary>
480 ///
481 /// </summary>
482 /// <param name="localID"></param>
483 /// <param name="scale"></param>
484 /// <param name="remoteClient"></param>
485 public void UpdatePrimScale(uint localID, LLVector3 scale, IClientAPI remoteClient)
486 {
487 bool hasPrim = false;
488 foreach (EntityBase ent in Entities.Values)
489 {
490 if (ent is SceneObjectGroup)
491 {
492 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
493 if (hasPrim != false)
494 {
495 ((SceneObjectGroup) ent).Resize(scale, localID);
496 break;
497 }
498 }
499 }
500 }
501
502 public void StartAnimation(LLUUID animID, int seq, LLUUID agentId) 135 public void StartAnimation(LLUUID animID, int seq, LLUUID agentId)
503 { 136 {
504 Broadcast(delegate(IClientAPI client) { client.SendAnimation(animID, seq, agentId); }); 137 Broadcast(delegate(IClientAPI client) { client.SendAnimation(animID, seq, agentId); });