diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/InnerScene.cs | 198 |
1 files changed, 107 insertions, 91 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 3889741..da286ad 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -46,33 +46,36 @@ namespace OpenSim.Region.Environment.Scenes | |||
46 | 46 | ||
47 | #region Events | 47 | #region Events |
48 | 48 | ||
49 | private PhysicsCrash handlerPhysicsCrash; | ||
50 | public event PhysicsCrash UnRecoverableError; | 49 | public event PhysicsCrash UnRecoverableError; |
50 | private PhysicsCrash handlerPhysicsCrash = null; | ||
51 | 51 | ||
52 | #endregion | 52 | #endregion |
53 | 53 | ||
54 | #region Fields | 54 | #region Fields |
55 | 55 | ||
56 | public Dictionary<LLUUID, ScenePresence> ScenePresences; | ||
56 | // SceneObjects is not currently populated or used. | 57 | // SceneObjects is not currently populated or used. |
57 | //public Dictionary<LLUUID, SceneObjectGroup> SceneObjects; | 58 | //public Dictionary<LLUUID, SceneObjectGroup> SceneObjects; |
58 | public PhysicsScene _PhyScene; | ||
59 | public Dictionary<LLUUID, EntityBase> Entities; | 59 | public Dictionary<LLUUID, EntityBase> Entities; |
60 | protected int m_activeScripts; | 60 | public Dictionary<LLUUID, ScenePresence> RestorePresences; |
61 | protected int m_numChildAgents; | 61 | |
62 | protected int m_numPrim; | 62 | public BasicQuadTreeNode QuadTree; |
63 | protected int m_numRootAgents; | 63 | |
64 | protected Scene m_parentScene; | ||
65 | protected int m_physicalPrim; | ||
66 | protected RegionInfo m_regInfo; | 64 | protected RegionInfo m_regInfo; |
65 | protected Scene m_parentScene; | ||
66 | protected PermissionManager PermissionsMngr; | ||
67 | protected List<EntityBase> m_updateList = new List<EntityBase>(); | ||
68 | protected int m_numRootAgents = 0; | ||
69 | protected int m_numPrim = 0; | ||
70 | protected int m_numChildAgents = 0; | ||
71 | protected int m_physicalPrim = 0; | ||
67 | 72 | ||
68 | protected int m_scriptLPS; | 73 | protected int m_activeScripts = 0; |
74 | protected int m_scriptLPS = 0; | ||
69 | 75 | ||
70 | internal object m_syncRoot = new object(); | 76 | internal object m_syncRoot = new object(); |
71 | protected List<EntityBase> m_updateList = new List<EntityBase>(); | 77 | |
72 | protected PermissionManager PermissionsMngr; | 78 | public PhysicsScene _PhyScene; |
73 | public BasicQuadTreeNode QuadTree; | ||
74 | public Dictionary<LLUUID, ScenePresence> RestorePresences; | ||
75 | public Dictionary<LLUUID, ScenePresence> ScenePresences; | ||
76 | 79 | ||
77 | #endregion | 80 | #endregion |
78 | 81 | ||
@@ -81,7 +84,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
81 | m_parentScene = parent; | 84 | m_parentScene = parent; |
82 | m_regInfo = regInfo; | 85 | m_regInfo = regInfo; |
83 | PermissionsMngr = permissionsMngr; | 86 | PermissionsMngr = permissionsMngr; |
84 | QuadTree = new BasicQuadTreeNode(null, "/0/", 0, 0, (short) Constants.RegionSize, (short) Constants.RegionSize); | 87 | QuadTree = new BasicQuadTreeNode(null, "/0/", 0, 0, (short)Constants.RegionSize, (short)Constants.RegionSize); |
85 | QuadTree.Subdivide(); | 88 | QuadTree.Subdivide(); |
86 | QuadTree.Subdivide(); | 89 | QuadTree.Subdivide(); |
87 | } | 90 | } |
@@ -159,7 +162,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
159 | { | 162 | { |
160 | lock (m_syncRoot) | 163 | lock (m_syncRoot) |
161 | { | 164 | { |
162 | return _PhyScene.Simulate((float) elapsed); | 165 | return _PhyScene.Simulate((float)elapsed); |
163 | } | 166 | } |
164 | } | 167 | } |
165 | 168 | ||
@@ -184,6 +187,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
184 | foreach (SceneObjectPart part in sceneObject.Children.Values) | 187 | foreach (SceneObjectPart part in sceneObject.Children.Values) |
185 | { | 188 | { |
186 | part.LocalId = m_parentScene.PrimIDAllocate(); | 189 | part.LocalId = m_parentScene.PrimIDAllocate(); |
190 | |||
187 | } | 191 | } |
188 | sceneObject.UpdateParentIDs(); | 192 | sceneObject.UpdateParentIDs(); |
189 | AddEntity(sceneObject); | 193 | AddEntity(sceneObject); |
@@ -229,7 +233,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
229 | for (int i = 0; i < m_updateList.Count; i++) | 233 | for (int i = 0; i < m_updateList.Count; i++) |
230 | { | 234 | { |
231 | EntityBase entity = m_updateList[i]; | 235 | EntityBase entity = m_updateList[i]; |
232 | 236 | ||
233 | // Don't abort the whole update if one entity happens to give us an exception. | 237 | // Don't abort the whole update if one entity happens to give us an exception. |
234 | try | 238 | try |
235 | { | 239 | { |
@@ -245,7 +249,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
245 | } | 249 | } |
246 | catch (Exception e) | 250 | catch (Exception e) |
247 | { | 251 | { |
248 | m_log.ErrorFormat("[INNER SCENE]: Failed to update {0}, - {1}", entity.Name, e); //entity.m_uuid | 252 | m_log.ErrorFormat("[INNER SCENE]: Failed to update {0}, - {1}", entity.Name, e);//entity.m_uuid |
249 | } | 253 | } |
250 | } | 254 | } |
251 | m_updateList.Clear(); | 255 | m_updateList.Clear(); |
@@ -280,16 +284,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
280 | { | 284 | { |
281 | if (obj is SceneObjectGroup) | 285 | if (obj is SceneObjectGroup) |
282 | { | 286 | { |
283 | if ((obj).LocalId == localID) | 287 | if (((SceneObjectGroup)obj).LocalId == localID) |
284 | { | 288 | { |
285 | m_parentScene.RemoveEntity((SceneObjectGroup) obj); | 289 | m_parentScene.RemoveEntity((SceneObjectGroup)obj); |
286 | m_numPrim--; | 290 | m_numPrim--; |
287 | return; | 291 | return; |
288 | } | 292 | } |
289 | } | 293 | } |
290 | } | 294 | } |
291 | } | 295 | } |
292 | |||
293 | public void DetachObject(uint objectLocalID, IClientAPI remoteClient) | 296 | public void DetachObject(uint objectLocalID, IClientAPI remoteClient) |
294 | { | 297 | { |
295 | List<EntityBase> EntityList = GetEntities(); | 298 | List<EntityBase> EntityList = GetEntities(); |
@@ -298,25 +301,29 @@ namespace OpenSim.Region.Environment.Scenes | |||
298 | { | 301 | { |
299 | if (obj is SceneObjectGroup) | 302 | if (obj is SceneObjectGroup) |
300 | { | 303 | { |
301 | if ((obj).LocalId == objectLocalID) | 304 | if (((SceneObjectGroup)obj).LocalId == objectLocalID) |
302 | { | 305 | { |
303 | SceneObjectGroup group = (SceneObjectGroup) obj; | 306 | SceneObjectGroup group = (SceneObjectGroup)obj; |
304 | 307 | ||
305 | //group.DetachToGround(); | 308 | //group.DetachToGround(); |
306 | DetachSingleAttachmentToInv(group.GetFromAssetID(), remoteClient); | 309 | DetachSingleAttachmentToInv(group.GetFromAssetID(),remoteClient); |
307 | } | 310 | } |
308 | } | 311 | } |
309 | } | 312 | } |
313 | |||
310 | } | 314 | } |
311 | 315 | ||
312 | public void HandleUndo(IClientAPI remoteClient, LLUUID primId) | 316 | public void HandleUndo(IClientAPI remoteClient, LLUUID primId) |
313 | { | 317 | { |
314 | if (primId != LLUUID.Zero) | 318 | if (primId != LLUUID.Zero) |
315 | { | 319 | { |
316 | SceneObjectPart part = m_parentScene.GetSceneObjectPart(primId); | 320 | SceneObjectPart part = m_parentScene.GetSceneObjectPart(primId); |
317 | if (part != null) | 321 | if (part != null) |
318 | part.Undo(); | 322 | part.Undo(); |
323 | |||
319 | } | 324 | } |
325 | |||
326 | |||
320 | } | 327 | } |
321 | 328 | ||
322 | /// <summary> | 329 | /// <summary> |
@@ -331,29 +338,27 @@ namespace OpenSim.Region.Environment.Scenes | |||
331 | // Calls attach with a Zero position | 338 | // Calls attach with a Zero position |
332 | AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, LLVector3.Zero); | 339 | AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, LLVector3.Zero); |
333 | } | 340 | } |
334 | 341 | public void RezSingleAttachment(IClientAPI remoteClient, LLUUID itemID, uint AttachmentPt,uint ItemFlags, uint NextOwnerMask) | |
335 | public void RezSingleAttachment(IClientAPI remoteClient, LLUUID itemID, uint AttachmentPt, uint ItemFlags, uint NextOwnerMask) | ||
336 | { | 342 | { |
337 | SceneObjectGroup objatt = m_parentScene.RezObject(remoteClient, itemID, LLVector3.Zero, LLVector3.Zero, LLUUID.Zero, 1, true, | 343 | SceneObjectGroup objatt = m_parentScene.RezObject(remoteClient, itemID, LLVector3.Zero, LLVector3.Zero, LLUUID.Zero, (byte)1, true, |
338 | (uint) | 344 | (uint)(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer), |
339 | (PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer), | 345 | (uint)(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer), |
340 | (uint) | 346 | (uint)(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer), |
341 | (PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer), | 347 | ItemFlags, false, false, remoteClient.AgentId, true); |
342 | (uint) | ||
343 | (PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer), | ||
344 | ItemFlags, false, false, remoteClient.AgentId, true); | ||
345 | 348 | ||
346 | if (objatt != null) | 349 | if (objatt != null) |
347 | { | 350 | { |
348 | AttachObject(remoteClient, objatt.LocalId, AttachmentPt, new LLQuaternion(0, 0, 0, 1), objatt.AbsolutePosition); | 351 | AttachObject(remoteClient,objatt.LocalId,AttachmentPt,new LLQuaternion(0,0,0,1),objatt.AbsolutePosition); |
349 | objatt.ScheduleGroupForFullUpdate(); | 352 | objatt.ScheduleGroupForFullUpdate(); |
350 | } | 353 | } |
354 | |||
351 | } | 355 | } |
352 | 356 | ||
353 | // What makes this method odd and unique is it tries to detach using an LLUUID.... Yay for standards. | 357 | // What makes this method odd and unique is it tries to detach using an LLUUID.... Yay for standards. |
354 | // To LocalId or LLUUID, *THAT* is the question. How now Brown LLUUID?? | 358 | // To LocalId or LLUUID, *THAT* is the question. How now Brown LLUUID?? |
355 | public void DetachSingleAttachmentToInv(LLUUID itemID, IClientAPI remoteClient) | 359 | public void DetachSingleAttachmentToInv(LLUUID itemID, IClientAPI remoteClient) |
356 | { | 360 | { |
361 | |||
357 | if (itemID == LLUUID.Zero) // If this happened, someone made a mistake.... | 362 | if (itemID == LLUUID.Zero) // If this happened, someone made a mistake.... |
358 | return; | 363 | return; |
359 | 364 | ||
@@ -363,16 +368,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
363 | { | 368 | { |
364 | if (obj is SceneObjectGroup) | 369 | if (obj is SceneObjectGroup) |
365 | { | 370 | { |
366 | if (((SceneObjectGroup) obj).GetFromAssetID() == itemID) | 371 | if (((SceneObjectGroup)obj).GetFromAssetID() == itemID) |
367 | { | 372 | { |
368 | SceneObjectGroup group = (SceneObjectGroup) obj; | 373 | SceneObjectGroup group = (SceneObjectGroup)obj; |
369 | group.DetachToInventoryPrep(); | 374 | group.DetachToInventoryPrep(); |
370 | m_log.Debug("[DETACH]: Saving attachpoint: " + ((uint) group.GetAttachmentPoint())); | 375 | m_log.Debug("[DETACH]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); |
371 | m_parentScene.updateKnownAsset(remoteClient, group, group.GetFromAssetID(), group.OwnerID); | 376 | m_parentScene.updateKnownAsset(remoteClient, group, group.GetFromAssetID(),group.OwnerID); |
372 | m_parentScene.DeleteSceneObjectGroup(group); | 377 | m_parentScene.DeleteSceneObjectGroup(group); |
373 | } | 378 | } |
374 | } | 379 | } |
375 | } | 380 | } |
381 | |||
376 | } | 382 | } |
377 | 383 | ||
378 | public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot, LLVector3 attachPos) | 384 | public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot, LLVector3 attachPos) |
@@ -382,34 +388,39 @@ namespace OpenSim.Region.Environment.Scenes | |||
382 | { | 388 | { |
383 | if (obj is SceneObjectGroup) | 389 | if (obj is SceneObjectGroup) |
384 | { | 390 | { |
385 | if ((obj).LocalId == objectLocalID) | 391 | if (((SceneObjectGroup)obj).LocalId == objectLocalID) |
386 | { | 392 | { |
387 | SceneObjectGroup group = (SceneObjectGroup) obj; | 393 | SceneObjectGroup group = (SceneObjectGroup)obj; |
388 | 394 | ||
389 | // If the attachment point isn't the same as the one previously used | 395 | // If the attachment point isn't the same as the one previously used |
390 | // set it's offset position = 0 so that it appears on the attachment point | 396 | // set it's offset position = 0 so that it appears on the attachment point |
391 | // and not in a weird location somewhere unknown. | 397 | // and not in a weird location somewhere unknown. |
392 | if (AttachmentPt != 0 && AttachmentPt != group.GetAttachmentPoint()) | 398 | if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint()) |
393 | { | 399 | { |
400 | |||
394 | attachPos = LLVector3.Zero; | 401 | attachPos = LLVector3.Zero; |
395 | } | 402 | } |
396 | 403 | ||
397 | // AttachmentPt 0 means the client chose to 'wear' the attachment. | 404 | // AttachmentPt 0 means the client chose to 'wear' the attachment. |
398 | if (AttachmentPt == 0) | 405 | if (AttachmentPt == 0) |
399 | { | 406 | { |
407 | |||
400 | // Check object for stored attachment point | 408 | // Check object for stored attachment point |
401 | AttachmentPt = group.GetAttachmentPoint(); | 409 | AttachmentPt = (uint)group.GetAttachmentPoint(); |
410 | |||
411 | |||
402 | } | 412 | } |
403 | 413 | ||
404 | // if we still didn't find a suitable attachment point....... | 414 | // if we still didn't find a suitable attachment point....... |
405 | if (AttachmentPt == 0) | 415 | if (AttachmentPt == 0) |
406 | { | 416 | { |
407 | // Stick it on left hand with Zero Offset from the attachment point. | 417 | // Stick it on left hand with Zero Offset from the attachment point. |
408 | AttachmentPt = (uint) AttachmentPoint.LeftHand; | 418 | AttachmentPt = (uint)AttachmentPoint.LeftHand; |
409 | attachPos = LLVector3.Zero; | 419 | attachPos = LLVector3.Zero; |
410 | } | 420 | } |
411 | m_log.Debug("[ATTACH]: Using attachpoint: " + AttachmentPt); | 421 | m_log.Debug("[ATTACH]: Using attachpoint: " + AttachmentPt.ToString()); |
412 | 422 | ||
423 | |||
413 | 424 | ||
414 | // Saves and gets assetID | 425 | // Saves and gets assetID |
415 | if (group.GetFromAssetID() == LLUUID.Zero) | 426 | if (group.GetFromAssetID() == LLUUID.Zero) |
@@ -420,14 +431,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
420 | group.SetFromAssetID(newAssetID); | 431 | group.SetFromAssetID(newAssetID); |
421 | } | 432 | } |
422 | group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos); | 433 | group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos); |
434 | |||
423 | } | 435 | } |
436 | |||
424 | } | 437 | } |
425 | } | 438 | } |
426 | } | ||
427 | 439 | ||
440 | } | ||
428 | // Use the above method. | 441 | // Use the above method. |
429 | public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot, | 442 | public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot, |
430 | bool deadMethod) | 443 | bool deadMethod) |
431 | { | 444 | { |
432 | Console.WriteLine("Attaching object " + objectLocalID + " to " + AttachmentPt); | 445 | Console.WriteLine("Attaching object " + objectLocalID + " to " + AttachmentPt); |
433 | SceneObjectPart p = GetSceneObjectPart(objectLocalID); | 446 | SceneObjectPart p = GetSceneObjectPart(objectLocalID); |
@@ -476,14 +489,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
476 | objupdate.ObjectData[0].ParentID = 0; | 489 | objupdate.ObjectData[0].ParentID = 0; |
477 | objupdate.ObjectData[0].OwnerID = LLUUID.Zero; | 490 | objupdate.ObjectData[0].OwnerID = LLUUID.Zero; |
478 | objupdate.ObjectData[0].Scale = new LLVector3(1, 1, 1); | 491 | objupdate.ObjectData[0].Scale = new LLVector3(1, 1, 1); |
479 | objupdate.ObjectData[0].PCode = (byte) PCode.Avatar; | 492 | objupdate.ObjectData[0].PCode = (byte)PCode.Avatar; |
480 | objupdate.ObjectData[0].TextureEntry = ScenePresence.DefaultTexture; | 493 | objupdate.ObjectData[0].TextureEntry = ScenePresence.DefaultTexture; |
481 | 494 | ||
482 | objupdate.ObjectData[0].ID = av.LocalId; | 495 | objupdate.ObjectData[0].ID = av.LocalId; |
483 | objupdate.ObjectData[0].FullID = remoteClient.AgentId; | 496 | objupdate.ObjectData[0].FullID = remoteClient.AgentId; |
484 | objupdate.ObjectData[0].ParentID = 0; | 497 | objupdate.ObjectData[0].ParentID = 0; |
485 | objupdate.ObjectData[0].NameValue = | 498 | objupdate.ObjectData[0].NameValue = |
486 | Helpers.StringToField("FirstName STRING RW SV " + av.Firstname + "\nLastName STRING RW SV " + av.Lastname); | 499 | Helpers.StringToField("FirstName STRING RW SV " + av.Firstname + "\nLastName STRING RW SV " + av.Lastname); |
487 | LLVector3 pos2 = av.AbsolutePosition; | 500 | LLVector3 pos2 = av.AbsolutePosition; |
488 | // new LLVector3((float) Pos.X, (float) Pos.Y, (float) Pos.Z); | 501 | // new LLVector3((float) Pos.X, (float) Pos.Y, (float) Pos.Z); |
489 | byte[] pb = pos2.GetBytes(); | 502 | byte[] pb = pos2.GetBytes(); |
@@ -516,7 +529,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
516 | 529 | ||
517 | objupdate.ObjectData[1].TextureEntry = primData.TextureEntry; | 530 | objupdate.ObjectData[1].TextureEntry = primData.TextureEntry; |
518 | objupdate.ObjectData[1].PCode = primData.PCode; | 531 | objupdate.ObjectData[1].PCode = primData.PCode; |
519 | objupdate.ObjectData[1].State = (byte) (((byte) AttachmentPt) << 4); | 532 | objupdate.ObjectData[1].State = (byte)(((byte)AttachmentPt) << 4); |
520 | objupdate.ObjectData[1].PathBegin = primData.PathBegin; | 533 | objupdate.ObjectData[1].PathBegin = primData.PathBegin; |
521 | objupdate.ObjectData[1].PathEnd = primData.PathEnd; | 534 | objupdate.ObjectData[1].PathEnd = primData.PathEnd; |
522 | objupdate.ObjectData[1].PathScaleX = primData.PathScaleX; | 535 | objupdate.ObjectData[1].PathScaleX = primData.PathScaleX; |
@@ -553,8 +566,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
553 | //objupdate.ObjectData[1].ClickAction = clickAction; | 566 | //objupdate.ObjectData[1].ClickAction = clickAction; |
554 | objupdate.ObjectData[1].Radius = 20; | 567 | objupdate.ObjectData[1].Radius = 20; |
555 | objupdate.ObjectData[1].NameValue = | 568 | objupdate.ObjectData[1].NameValue = |
556 | Helpers.StringToField("AttachItemID STRING RW SV " + p.UUID); | 569 | Helpers.StringToField("AttachItemID STRING RW SV " + p.UUID); |
557 | LLVector3 pos = new LLVector3((float) 0.0, (float) 0.0, (float) 0.0); | 570 | LLVector3 pos = new LLVector3((float)0.0, (float)0.0, (float)0.0); |
558 | 571 | ||
559 | pb = pos.GetBytes(); | 572 | pb = pos.GetBytes(); |
560 | Array.Copy(pb, 0, objupdate.ObjectData[1].ObjectData, 0, pb.Length); | 573 | Array.Copy(pb, 0, objupdate.ObjectData[1].ObjectData, 0, pb.Length); |
@@ -725,7 +738,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
725 | m_scriptLPS = 0; | 738 | m_scriptLPS = 0; |
726 | return returnval; | 739 | return returnval; |
727 | } | 740 | } |
728 | |||
729 | #endregion | 741 | #endregion |
730 | 742 | ||
731 | #region Get Methods | 743 | #region Get Methods |
@@ -753,7 +765,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
753 | 765 | ||
754 | return result; | 766 | return result; |
755 | } | 767 | } |
756 | 768 | ||
757 | /// <summary> | 769 | /// <summary> |
758 | /// Get the controlling client for the given avatar, if there is one. | 770 | /// Get the controlling client for the given avatar, if there is one. |
759 | /// | 771 | /// |
@@ -767,12 +779,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
767 | public IClientAPI GetControllingClient(LLUUID agentId) | 779 | public IClientAPI GetControllingClient(LLUUID agentId) |
768 | { | 780 | { |
769 | ScenePresence presence = GetScenePresence(agentId); | 781 | ScenePresence presence = GetScenePresence(agentId); |
770 | 782 | ||
771 | if (presence != null) | 783 | if (presence != null) |
772 | { | 784 | { |
773 | return presence.ControllingClient; | 785 | return presence.ControllingClient; |
774 | } | 786 | } |
775 | 787 | ||
776 | return null; | 788 | return null; |
777 | } | 789 | } |
778 | 790 | ||
@@ -807,7 +819,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
807 | { | 819 | { |
808 | return ScenePresences[agentID]; | 820 | return ScenePresences[agentID]; |
809 | } | 821 | } |
810 | 822 | ||
811 | return null; | 823 | return null; |
812 | } | 824 | } |
813 | 825 | ||
@@ -819,8 +831,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
819 | { | 831 | { |
820 | if (ent is SceneObjectGroup) | 832 | if (ent is SceneObjectGroup) |
821 | { | 833 | { |
822 | if (((SceneObjectGroup) ent).HasChildPrim(localID)) | 834 | if (((SceneObjectGroup)ent).HasChildPrim(localID)) |
823 | return (SceneObjectGroup) ent; | 835 | return (SceneObjectGroup)ent; |
824 | } | 836 | } |
825 | } | 837 | } |
826 | return null; | 838 | return null; |
@@ -834,8 +846,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
834 | { | 846 | { |
835 | if (ent is SceneObjectGroup) | 847 | if (ent is SceneObjectGroup) |
836 | { | 848 | { |
837 | if (((SceneObjectGroup) ent).HasChildPrim(fullID)) | 849 | if (((SceneObjectGroup)ent).HasChildPrim(fullID)) |
838 | return (SceneObjectGroup) ent; | 850 | return (SceneObjectGroup)ent; |
839 | } | 851 | } |
840 | } | 852 | } |
841 | return null; | 853 | return null; |
@@ -850,7 +862,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
850 | { | 862 | { |
851 | if (ent is SceneObjectGroup) | 863 | if (ent is SceneObjectGroup) |
852 | { | 864 | { |
853 | SceneObjectGroup reportingG = (SceneObjectGroup) ent; | 865 | SceneObjectGroup reportingG = (SceneObjectGroup)ent; |
854 | EntityIntersection result = reportingG.TestIntersection(hray, frontFacesOnly, faceCenters); | 866 | EntityIntersection result = reportingG.TestIntersection(hray, frontFacesOnly, faceCenters); |
855 | if (result.HitTF) | 867 | if (result.HitTF) |
856 | { | 868 | { |
@@ -890,13 +902,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
890 | { | 902 | { |
891 | if (!presence.IsChildAgent) | 903 | if (!presence.IsChildAgent) |
892 | { | 904 | { |
893 | avatar = presence; | 905 | avatar = presence; |
894 | return true; | 906 | return true; |
895 | } | 907 | } |
896 | else | 908 | else |
897 | { | 909 | { |
898 | m_log.WarnFormat( | 910 | m_log.WarnFormat( |
899 | "[INNER SCENE]: Requested avatar {0} could not be found in scene {1} since it is only registered as a child agent!", | 911 | "[INNER SCENE]: Requested avatar {0} could not be found in scene {1} since it is only registered as a child agent!", |
900 | avatarId, m_parentScene.RegionInfo.RegionName); | 912 | avatarId, m_parentScene.RegionInfo.RegionName); |
901 | } | 913 | } |
902 | } | 914 | } |
@@ -975,8 +987,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
975 | 987 | ||
976 | if (presence.IsChildAgent && m_parentScene.m_seeIntoRegionFromNeighbor) | 988 | if (presence.IsChildAgent && m_parentScene.m_seeIntoRegionFromNeighbor) |
977 | { | 989 | { |
978 | LLVector3 oLoc = (ent).AbsolutePosition; | 990 | LLVector3 oLoc = ((SceneObjectGroup)ent).AbsolutePosition; |
979 | float distResult = (float) Util.GetDistanceTo(presence.AbsolutePosition, oLoc); | 991 | float distResult = (float)Util.GetDistanceTo(presence.AbsolutePosition, oLoc); |
980 | 992 | ||
981 | //m_log.Info("[DISTANCE]: " + distResult.ToString()); | 993 | //m_log.Info("[DISTANCE]: " + distResult.ToString()); |
982 | 994 | ||
@@ -984,13 +996,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
984 | { | 996 | { |
985 | // Send Only if we don't already know about it. | 997 | // Send Only if we don't already know about it. |
986 | // KnownPrim also makes the prim known when called. | 998 | // KnownPrim also makes the prim known when called. |
987 | if (!presence.KnownPrim((ent).UUID)) | 999 | if (!presence.KnownPrim(((SceneObjectGroup)ent).UUID)) |
988 | ((SceneObjectGroup) ent).ScheduleFullUpdateToAvatar(presence); | 1000 | ((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence); |
989 | } | 1001 | } |
990 | } | 1002 | } |
991 | else | 1003 | else |
992 | { | 1004 | { |
993 | ((SceneObjectGroup) ent).ScheduleFullUpdateToAvatar(presence); | 1005 | ((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence); |
994 | } | 1006 | } |
995 | } | 1007 | } |
996 | } | 1008 | } |
@@ -1025,7 +1037,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
1025 | } | 1037 | } |
1026 | } | 1038 | } |
1027 | } | 1039 | } |
1028 | |||
1029 | public void UpdatePrimGroupScale(uint localID, LLVector3 scale, IClientAPI remoteClient) | 1040 | public void UpdatePrimGroupScale(uint localID, LLVector3 scale, IClientAPI remoteClient) |
1030 | { | 1041 | { |
1031 | SceneObjectGroup group = GetGroupByPrim(localID); | 1042 | SceneObjectGroup group = GetGroupByPrim(localID); |
@@ -1140,12 +1151,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1140 | SceneObjectGroup group = GetGroupByPrim(localID); | 1151 | SceneObjectGroup group = GetGroupByPrim(localID); |
1141 | if (group != null) | 1152 | if (group != null) |
1142 | { | 1153 | { |
1154 | |||
1143 | LLVector3 oldPos = group.AbsolutePosition; | 1155 | LLVector3 oldPos = group.AbsolutePosition; |
1144 | if (group.RootPart.m_IsAttachment) | 1156 | if (group.RootPart.m_IsAttachment) |
1145 | { | 1157 | { |
1146 | group.UpdateGroupPosition(pos); | 1158 | group.UpdateGroupPosition(pos); |
1147 | } | 1159 | } |
1148 | else | 1160 | else |
1149 | { | 1161 | { |
1150 | if (!PermissionsMngr.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment) | 1162 | if (!PermissionsMngr.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment) |
1151 | { | 1163 | { |
@@ -1191,7 +1203,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1191 | { | 1203 | { |
1192 | if (PermissionsMngr.CanEditObject(remoteClient.AgentId, group.UUID)) | 1204 | if (PermissionsMngr.CanEditObject(remoteClient.AgentId, group.UUID)) |
1193 | { | 1205 | { |
1194 | group.UpdatePrimFlags(localID, (ushort) packet.Type, true, packet.ToBytes()); | 1206 | group.UpdatePrimFlags(localID, (ushort)packet.Type, true, packet.ToBytes()); |
1195 | } | 1207 | } |
1196 | } | 1208 | } |
1197 | } | 1209 | } |
@@ -1201,7 +1213,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1201 | SceneObjectGroup group = GetGroupByPrim(objectID); | 1213 | SceneObjectGroup group = GetGroupByPrim(objectID); |
1202 | if (group != null) | 1214 | if (group != null) |
1203 | { | 1215 | { |
1204 | if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) // && PermissionsMngr.) | 1216 | if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID))// && PermissionsMngr.) |
1205 | { | 1217 | { |
1206 | group.GrabMovement(offset, pos, remoteClient); | 1218 | group.GrabMovement(offset, pos, remoteClient); |
1207 | } | 1219 | } |
@@ -1292,9 +1304,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1292 | { | 1304 | { |
1293 | if (ent is SceneObjectGroup) | 1305 | if (ent is SceneObjectGroup) |
1294 | { | 1306 | { |
1295 | if ((ent).LocalId == parentPrim) | 1307 | if (((SceneObjectGroup)ent).LocalId == parentPrim) |
1296 | { | 1308 | { |
1297 | parenPrim = (SceneObjectGroup) ent; | 1309 | parenPrim = (SceneObjectGroup)ent; |
1298 | break; | 1310 | break; |
1299 | } | 1311 | } |
1300 | } | 1312 | } |
@@ -1309,9 +1321,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1309 | { | 1321 | { |
1310 | if (ent is SceneObjectGroup) | 1322 | if (ent is SceneObjectGroup) |
1311 | { | 1323 | { |
1312 | if ((ent).LocalId == childPrims[i]) | 1324 | if (((SceneObjectGroup)ent).LocalId == childPrims[i]) |
1313 | { | 1325 | { |
1314 | children.Add((SceneObjectGroup) ent); | 1326 | children.Add((SceneObjectGroup)ent); |
1315 | } | 1327 | } |
1316 | } | 1328 | } |
1317 | } | 1329 | } |
@@ -1322,7 +1334,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1322 | { | 1334 | { |
1323 | parenPrim.LinkToGroup(sceneObj); | 1335 | parenPrim.LinkToGroup(sceneObj); |
1324 | } | 1336 | } |
1325 | 1337 | ||
1326 | // We need to explicitly resend the newly link prim's object properties since no other actions | 1338 | // We need to explicitly resend the newly link prim's object properties since no other actions |
1327 | // occur on link to invoke this elsewhere (such as object selection) | 1339 | // occur on link to invoke this elsewhere (such as object selection) |
1328 | parenPrim.GetProperties(client); | 1340 | parenPrim.GetProperties(client); |
@@ -1348,16 +1360,19 @@ namespace OpenSim.Region.Environment.Scenes | |||
1348 | { | 1360 | { |
1349 | if (ent is SceneObjectGroup) | 1361 | if (ent is SceneObjectGroup) |
1350 | { | 1362 | { |
1351 | SceneObjectGroup obj = (SceneObjectGroup) ent; | 1363 | SceneObjectGroup obj = (SceneObjectGroup)ent; |
1352 | sceneObjects.Add(obj.LocalId, obj); | 1364 | sceneObjects.Add(obj.LocalId, obj); |
1365 | |||
1353 | } | 1366 | } |
1354 | } | 1367 | } |
1355 | 1368 | ||
1356 | // Find the root prim among the prim ids we've been given | 1369 | // Find the root prim among the prim ids we've been given |
1357 | for (int i = 0; i < primIds.Count; i++) | 1370 | for (int i = 0; i < primIds.Count; i++) |
1358 | { | 1371 | { |
1372 | |||
1359 | if (sceneObjects.ContainsKey(primIds[i])) | 1373 | if (sceneObjects.ContainsKey(primIds[i])) |
1360 | { | 1374 | { |
1375 | |||
1361 | parenPrim = sceneObjects[primIds[i]]; | 1376 | parenPrim = sceneObjects[primIds[i]]; |
1362 | primIds.RemoveAt(i); | 1377 | primIds.RemoveAt(i); |
1363 | break; | 1378 | break; |
@@ -1387,13 +1402,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
1387 | grp.DelinkFromGroup(primIds[i]); | 1402 | grp.DelinkFromGroup(primIds[i]); |
1388 | delinkedSomething = true; | 1403 | delinkedSomething = true; |
1389 | } | 1404 | } |
1405 | |||
1390 | } | 1406 | } |
1391 | } | 1407 | } |
1392 | if (!delinkedSomething) | 1408 | if (!delinkedSomething) |
1393 | { | 1409 | { |
1394 | m_log.InfoFormat("[SCENE]: " + | 1410 | m_log.InfoFormat("[SCENE]: " + |
1395 | "DelinkObjects(): Could not find a root prim out of {0} as given to a delink request!", | 1411 | "DelinkObjects(): Could not find a root prim out of {0} as given to a delink request!", |
1396 | primIds); | 1412 | primIds); |
1397 | } | 1413 | } |
1398 | } | 1414 | } |
1399 | } | 1415 | } |
@@ -1409,7 +1425,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1409 | { | 1425 | { |
1410 | if (ent is SceneObjectGroup) | 1426 | if (ent is SceneObjectGroup) |
1411 | { | 1427 | { |
1412 | foreach (KeyValuePair<LLUUID, SceneObjectPart> subent in ((SceneObjectGroup) ent).Children) | 1428 | foreach (KeyValuePair<LLUUID, SceneObjectPart> subent in ((SceneObjectGroup)ent).Children) |
1413 | { | 1429 | { |
1414 | if (subent.Value.LocalId == localID) | 1430 | if (subent.Value.LocalId == localID) |
1415 | { | 1431 | { |
@@ -1419,7 +1435,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1419 | } | 1435 | } |
1420 | } | 1436 | } |
1421 | } | 1437 | } |
1422 | 1438 | ||
1423 | //Protip: In my day, we didn't call them searchable objects, we called them limited point-to-point joints | 1439 | //Protip: In my day, we didn't call them searchable objects, we called them limited point-to-point joints |
1424 | //aka ObjectFlags.JointWheel = IncludeInSearch | 1440 | //aka ObjectFlags.JointWheel = IncludeInSearch |
1425 | 1441 | ||
@@ -1451,7 +1467,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1451 | public void DuplicateObject(uint originalPrim, LLVector3 offset, uint flags, LLUUID AgentID, LLUUID GroupID) | 1467 | public void DuplicateObject(uint originalPrim, LLVector3 offset, uint flags, LLUUID AgentID, LLUUID GroupID) |
1452 | { | 1468 | { |
1453 | m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID); | 1469 | m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID); |
1454 | 1470 | ||
1455 | List<EntityBase> EntityList = GetEntities(); | 1471 | List<EntityBase> EntityList = GetEntities(); |
1456 | 1472 | ||
1457 | SceneObjectGroup originPrim = null; | 1473 | SceneObjectGroup originPrim = null; |
@@ -1459,9 +1475,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1459 | { | 1475 | { |
1460 | if (ent is SceneObjectGroup) | 1476 | if (ent is SceneObjectGroup) |
1461 | { | 1477 | { |
1462 | if ((ent).LocalId == originalPrim) | 1478 | if (((SceneObjectGroup)ent).LocalId == originalPrim) |
1463 | { | 1479 | { |
1464 | originPrim = (SceneObjectGroup) ent; | 1480 | originPrim = (SceneObjectGroup)ent; |
1465 | break; | 1481 | break; |
1466 | } | 1482 | } |
1467 | } | 1483 | } |
@@ -1510,4 +1526,4 @@ namespace OpenSim.Region.Environment.Scenes | |||
1510 | 1526 | ||
1511 | #endregion | 1527 | #endregion |
1512 | } | 1528 | } |
1513 | } \ No newline at end of file | 1529 | } |