aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs177
1 files changed, 86 insertions, 91 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index d4051c0..4ac6743 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -557,121 +557,116 @@ namespace OpenSim.Region.Framework.Scenes
557 // actually assume this sog was removed from simulation 557 // actually assume this sog was removed from simulation
558 return; 558 return;
559 } 559 }
560 else 560
561 if (m_rootPart.KeyframeMotion != null)
562 m_rootPart.KeyframeMotion.StartCrossingCheck();
563
564 bool canCross = true;
565
566 foreach (ScenePresence av in m_linkedAvatars)
561 { 567 {
562 if (m_rootPart.KeyframeMotion != null) 568 // We need to cross these agents. First, let's find
563 m_rootPart.KeyframeMotion.StartCrossingCheck(); 569 // out if any of them can't cross for some reason.
570 // We have to deny the crossing entirely if any
571 // of them are banned. Alternatively, we could
572 // unsit banned agents....
564 573
565 bool canCross = true;
566 574
567 foreach (ScenePresence av in m_linkedAvatars) 575 // We set the avatar position as being the object
576 // position to get the region to send to
577 if ((destination = entityTransfer.GetDestination(m_scene, av.UUID, val, out x, out y, out version, out newpos)) == null)
568 { 578 {
569 // We need to cross these agents. First, let's find 579 canCross = false;
570 // out if any of them can't cross for some reason. 580 break;
571 // We have to deny the crossing entirely if any 581 }
572 // of them are banned. Alternatively, we could
573 // unsit banned agents....
574 582
583 m_log.DebugFormat("[SCENE OBJECT]: Avatar {0} needs to be crossed to {1}", av.Name, destination.RegionName);
584 }
575 585
576 // We set the avatar position as being the object 586 if (canCross)
577 // position to get the region to send to 587 {
578 if ((destination = entityTransfer.GetDestination(m_scene, av.UUID, val, out x, out y, out version, out newpos)) == null) 588 // We unparent the SP quietly so that it won't
579 { 589 // be made to stand up
580 canCross = false;
581 break;
582 }
583 590
584 m_log.DebugFormat("[SCENE OBJECT]: Avatar {0} needs to be crossed to {1}", av.Name, destination.RegionName); 591 List<avtocrossInfo> avsToCross = new List<avtocrossInfo>();
585 }
586 592
587 if (canCross) 593 foreach (ScenePresence av in m_linkedAvatars)
588 { 594 {
589 // We unparent the SP quietly so that it won't 595 avtocrossInfo avinfo = new avtocrossInfo();
590 // be made to stand up 596 SceneObjectPart parentPart = m_scene.GetSceneObjectPart(av.ParentID);
597 if (parentPart != null)
598 av.ParentUUID = parentPart.UUID;
591 599
592 List<avtocrossInfo> avsToCross = new List<avtocrossInfo>(); 600 avinfo.av = av;
601 avinfo.ParentID = av.ParentID;
602 avsToCross.Add(avinfo);
593 603
594 foreach (ScenePresence av in m_linkedAvatars) 604 av.PrevSitOffset = av.OffsetPosition;
595 { 605 av.ParentID = 0;
596 avtocrossInfo avinfo = new avtocrossInfo(); 606 }
597 SceneObjectPart parentPart = m_scene.GetSceneObjectPart(av.ParentID);
598 if (parentPart != null)
599 av.ParentUUID = parentPart.UUID;
600
601 avinfo.av = av;
602 avinfo.ParentID = av.ParentID;
603 avsToCross.Add(avinfo);
604 607
605 av.PrevSitOffset = av.OffsetPosition; 608 // m_linkedAvatars.Clear();
606 av.ParentID = 0; 609 m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
607 }
608 610
609 // m_linkedAvatars.Clear(); 611 // Normalize
610 m_scene.CrossPrimGroupIntoNewRegion(val, this, true); 612 if (val.X >= Constants.RegionSize)
611 613 val.X -= Constants.RegionSize;
612 // Normalize 614 if (val.Y >= Constants.RegionSize)
613 if (val.X >= Constants.RegionSize) 615 val.Y -= Constants.RegionSize;
614 val.X -= Constants.RegionSize; 616 if (val.X < 0)
615 if (val.Y >= Constants.RegionSize) 617 val.X += Constants.RegionSize;
616 val.Y -= Constants.RegionSize; 618 if (val.Y < 0)
617 if (val.X < 0) 619 val.Y += Constants.RegionSize;
618 val.X += Constants.RegionSize; 620
619 if (val.Y < 0) 621 // If it's deleted, crossing was successful
620 val.Y += Constants.RegionSize; 622 if (IsDeleted)
621 623 {
622 // If it's deleted, crossing was successful 624 // foreach (ScenePresence av in m_linkedAvatars)
623 if (IsDeleted) 625 foreach (avtocrossInfo avinfo in avsToCross)
624 {
625 // foreach (ScenePresence av in m_linkedAvatars)
626 foreach (avtocrossInfo avinfo in avsToCross)
627 {
628 ScenePresence av = avinfo.av;
629 if (!av.IsInTransit) // just in case...
630 {
631 m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val);
632
633 av.IsInTransit = true;
634
635 CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync;
636 d.BeginInvoke(av, val, destination, av.Flying, version, CrossAgentToNewRegionCompleted, d);
637 }
638 else
639 m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar alreasy in transit {0} to {1}", av.Name, val);
640 }
641 avsToCross.Clear();
642 return;
643 }
644 else // cross failed, put avas back ??
645 { 626 {
646 foreach (avtocrossInfo avinfo in avsToCross) 627 ScenePresence av = avinfo.av;
628 if (!av.IsInTransit) // just in case...
647 { 629 {
648 ScenePresence av = avinfo.av; 630 m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val);
649 av.ParentUUID = UUID.Zero; 631
650 av.ParentID = avinfo.ParentID; 632 av.IsInTransit = true;
651 // m_linkedAvatars.Add(av); 633
634 CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync;
635 d.BeginInvoke(av, val, destination, av.Flying, version, CrossAgentToNewRegionCompleted, d);
652 } 636 }
637 else
638 m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar alreasy in transit {0} to {1}", av.Name, val);
653 } 639 }
654 avsToCross.Clear(); 640 avsToCross.Clear();
655 641 return;
656 } 642 }
657 // else 643 else // cross failed, put avas back ??
658 // we need to do this on all fails
659
660 { 644 {
661 if (m_rootPart.KeyframeMotion != null) 645 foreach (avtocrossInfo avinfo in avsToCross)
662 m_rootPart.KeyframeMotion.CrossingFailure();
663
664 if (RootPart.PhysActor != null)
665 { 646 {
666 RootPart.PhysActor.CrossingFailure(); 647 ScenePresence av = avinfo.av;
648 av.ParentUUID = UUID.Zero;
649 av.ParentID = avinfo.ParentID;
650 // m_linkedAvatars.Add(av);
667 } 651 }
668 } 652 }
669 Vector3 oldp = AbsolutePosition; 653 avsToCross.Clear();
670 val.X = Util.Clamp<float>(oldp.X, 0.5f, (float)Constants.RegionSize - 0.5f); 654 }
671 val.Y = Util.Clamp<float>(oldp.Y, 0.5f, (float)Constants.RegionSize - 0.5f); 655 else
672 // dont crash land StarShips 656 {
673 // val.Z = Util.Clamp<float>(oldp.Z, 0.5f, 4096.0f); 657 if (m_rootPart.KeyframeMotion != null)
658 m_rootPart.KeyframeMotion.CrossingFailure();
659
660 if (RootPart.PhysActor != null)
661 {
662 RootPart.PhysActor.CrossingFailure();
663 }
674 } 664 }
665 Vector3 oldp = AbsolutePosition;
666 val.X = Util.Clamp<float>(oldp.X, 0.5f, (float)Constants.RegionSize - 0.5f);
667 val.Y = Util.Clamp<float>(oldp.Y, 0.5f, (float)Constants.RegionSize - 0.5f);
668 // dont crash land StarShips
669 // val.Z = Util.Clamp<float>(oldp.Z, 0.5f, 4096.0f);
675 } 670 }
676 } 671 }
677 672