diff options
author | UbitUmarov | 2012-02-15 03:51:30 +0000 |
---|---|---|
committer | UbitUmarov | 2012-02-15 03:51:30 +0000 |
commit | 04279e36d1bc01f966940eb8cc0457064356fced (patch) | |
tree | bff74b33a2cf072877e8f1d876944905399d4be6 /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |
parent | remove drawstuff from ubitode (diff) | |
parent | Merge branch 'master' of ssh://melanie@3dhosting.de/var/git/careminster into ... (diff) | |
download | opensim-SC-04279e36d1bc01f966940eb8cc0457064356fced.zip opensim-SC-04279e36d1bc01f966940eb8cc0457064356fced.tar.gz opensim-SC-04279e36d1bc01f966940eb8cc0457064356fced.tar.bz2 opensim-SC-04279e36d1bc01f966940eb8cc0457064356fced.tar.xz |
Merge branch 'master' of ssh://3dhosting.de/var/git/careminster into ubitwork
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 89 |
1 files changed, 88 insertions, 1 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 9961438..644b78a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -465,7 +465,77 @@ namespace OpenSim.Region.Framework.Scenes | |||
465 | || Scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || Scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S)) | 465 | || Scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || Scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S)) |
466 | && !IsAttachmentCheckFull() && (!Scene.LoadingPrims)) | 466 | && !IsAttachmentCheckFull() && (!Scene.LoadingPrims)) |
467 | { | 467 | { |
468 | m_scene.CrossPrimGroupIntoNewRegion(val, this, true); | 468 | IEntityTransferModule entityTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); |
469 | uint x = 0; | ||
470 | uint y = 0; | ||
471 | string version = String.Empty; | ||
472 | Vector3 newpos = Vector3.Zero; | ||
473 | OpenSim.Services.Interfaces.GridRegion destination = null; | ||
474 | |||
475 | bool canCross = true; | ||
476 | foreach (ScenePresence av in m_linkedAvatars) | ||
477 | { | ||
478 | // We need to cross these agents. First, let's find | ||
479 | // out if any of them can't cross for some reason. | ||
480 | // We have to deny the crossing entirely if any | ||
481 | // of them are banned. Alternatively, we could | ||
482 | // unsit banned agents.... | ||
483 | |||
484 | |||
485 | // We set the avatar position as being the object | ||
486 | // position to get the region to send to | ||
487 | if ((destination = entityTransfer.GetDestination(m_scene, av.UUID, val, out x, out y, out version, out newpos)) == null) | ||
488 | { | ||
489 | canCross = false; | ||
490 | break; | ||
491 | } | ||
492 | |||
493 | m_log.DebugFormat("[SCENE OBJECT]: Avatar {0} needs to be crossed to {1}", av.Name, destination.RegionName); | ||
494 | } | ||
495 | |||
496 | if (canCross) | ||
497 | { | ||
498 | // We unparent the SP quietly so that it won't | ||
499 | // be made to stand up | ||
500 | foreach (ScenePresence av in m_linkedAvatars) | ||
501 | { | ||
502 | SceneObjectPart parentPart = m_scene.GetSceneObjectPart(av.ParentID); | ||
503 | if (parentPart != null) | ||
504 | av.ParentUUID = parentPart.UUID; | ||
505 | |||
506 | av.ParentID = 0; | ||
507 | } | ||
508 | |||
509 | m_scene.CrossPrimGroupIntoNewRegion(val, this, true); | ||
510 | |||
511 | // Normalize | ||
512 | if (val.X >= Constants.RegionSize) | ||
513 | val.X -= Constants.RegionSize; | ||
514 | if (val.Y >= Constants.RegionSize) | ||
515 | val.Y -= Constants.RegionSize; | ||
516 | if (val.X < 0) | ||
517 | val.X += Constants.RegionSize; | ||
518 | if (val.Y < 0) | ||
519 | val.Y += Constants.RegionSize; | ||
520 | |||
521 | // If it's deleted, crossing was successful | ||
522 | if (IsDeleted) | ||
523 | { | ||
524 | foreach (ScenePresence av in m_linkedAvatars) | ||
525 | { | ||
526 | m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val); | ||
527 | |||
528 | av.IsInTransit = true; | ||
529 | |||
530 | CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync; | ||
531 | d.BeginInvoke(av, val, x, y, destination, av.Flying, version, CrossAgentToNewRegionCompleted, d); | ||
532 | } | ||
533 | |||
534 | return; | ||
535 | } | ||
536 | } | ||
537 | |||
538 | val = AbsolutePosition; | ||
469 | } | 539 | } |
470 | } | 540 | } |
471 | 541 | ||
@@ -524,6 +594,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
524 | } | 594 | } |
525 | } | 595 | } |
526 | 596 | ||
597 | private void CrossAgentToNewRegionCompleted(IAsyncResult iar) | ||
598 | { | ||
599 | CrossAgentToNewRegionDelegate icon = (CrossAgentToNewRegionDelegate)iar.AsyncState; | ||
600 | ScenePresence agent = icon.EndInvoke(iar); | ||
601 | |||
602 | //// If the cross was successful, this agent is a child agent | ||
603 | //if (agent.IsChildAgent) | ||
604 | // agent.Reset(); | ||
605 | //else // Not successful | ||
606 | // agent.RestoreInCurrentScene(); | ||
607 | |||
608 | // In any case | ||
609 | agent.IsInTransit = false; | ||
610 | |||
611 | m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname); | ||
612 | } | ||
613 | |||
527 | public override uint LocalId | 614 | public override uint LocalId |
528 | { | 615 | { |
529 | get { return m_rootPart.LocalId; } | 616 | get { return m_rootPart.LocalId; } |