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