diff options
Diffstat (limited to 'OpenSim/Region')
9 files changed, 409 insertions, 199 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 4c77c18..dc8d267 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -4087,10 +4087,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4087 | */ | 4087 | */ |
4088 | if (entity is SceneObjectPart) | 4088 | if (entity is SceneObjectPart) |
4089 | { | 4089 | { |
4090 | SceneObjectPart e = (SceneObjectPart)entity; | 4090 | SceneObjectPart p = (SceneObjectPart)entity; |
4091 | SceneObjectGroup g = e.ParentGroup; | 4091 | SceneObjectGroup g = p.ParentGroup; |
4092 | if (g.HasPrivateAttachmentPoint && g.OwnerID != AgentId) | 4092 | if (g.HasPrivateAttachmentPoint && g.OwnerID != AgentId) |
4093 | return; // Don't send updates for other people's HUDs | 4093 | return; // Don't send updates for other people's HUDs |
4094 | |||
4095 | if((updateFlags ^ PrimUpdateFlags.SendInTransit) == 0) | ||
4096 | { | ||
4097 | List<uint> partIDs = (new List<uint> {p.LocalId}); | ||
4098 | lock (m_entityProps.SyncRoot) | ||
4099 | m_entityProps.Remove(partIDs); | ||
4100 | lock (m_entityUpdates.SyncRoot) | ||
4101 | m_entityUpdates.Remove(partIDs); | ||
4102 | return; | ||
4103 | } | ||
4094 | } | 4104 | } |
4095 | 4105 | ||
4096 | //double priority = m_prioritizer.GetUpdatePriority(this, entity); | 4106 | //double priority = m_prioritizer.GetUpdatePriority(this, entity); |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 92485a1..87b76dc 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -1703,11 +1703,81 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1703 | return agent; | 1703 | return agent; |
1704 | } | 1704 | } |
1705 | 1705 | ||
1706 | public bool CrossAgentCreateFarChild(ScenePresence agent, GridRegion neighbourRegion, Vector3 pos, EntityTransferContext ctx) | ||
1707 | { | ||
1708 | ulong regionhandler = neighbourRegion.RegionHandle; | ||
1709 | |||
1710 | if(agent.knowsNeighbourRegion(regionhandler)) | ||
1711 | return true; | ||
1712 | |||
1713 | string reason; | ||
1714 | ulong currentRegionHandler = agent.Scene.RegionInfo.RegionHandle; | ||
1715 | GridRegion source = new GridRegion(agent.Scene.RegionInfo); | ||
1716 | |||
1717 | AgentCircuitData currentAgentCircuit = | ||
1718 | agent.Scene.AuthenticateHandler.GetAgentCircuitData(agent.ControllingClient.CircuitCode); | ||
1719 | AgentCircuitData agentCircuit = agent.ControllingClient.RequestClientInfo(); | ||
1720 | agentCircuit.startpos = pos; | ||
1721 | agentCircuit.child = true; | ||
1722 | |||
1723 | agentCircuit.Appearance = new AvatarAppearance(); | ||
1724 | agentCircuit.Appearance.AvatarHeight = agent.Appearance.AvatarHeight; | ||
1725 | |||
1726 | if (currentAgentCircuit != null) | ||
1727 | { | ||
1728 | agentCircuit.ServiceURLs = currentAgentCircuit.ServiceURLs; | ||
1729 | agentCircuit.IPAddress = currentAgentCircuit.IPAddress; | ||
1730 | agentCircuit.Viewer = currentAgentCircuit.Viewer; | ||
1731 | agentCircuit.Channel = currentAgentCircuit.Channel; | ||
1732 | agentCircuit.Mac = currentAgentCircuit.Mac; | ||
1733 | agentCircuit.Id0 = currentAgentCircuit.Id0; | ||
1734 | } | ||
1735 | |||
1736 | agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | ||
1737 | agent.AddNeighbourRegion(neighbourRegion, agentCircuit.CapsPath); | ||
1738 | |||
1739 | IPEndPoint endPoint = neighbourRegion.ExternalEndPoint; | ||
1740 | if (Scene.SimulationService.CreateAgent(source, neighbourRegion, agentCircuit, (int)TeleportFlags.Default, ctx, out reason)) | ||
1741 | { | ||
1742 | string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | ||
1743 | int newSizeX = neighbourRegion.RegionSizeX; | ||
1744 | int newSizeY = neighbourRegion.RegionSizeY; | ||
1745 | |||
1746 | if (m_eqModule != null) | ||
1747 | { | ||
1748 | #region IP Translation for NAT | ||
1749 | IClientIPEndpoint ipepClient; | ||
1750 | if (agent.ClientView.TryGet(out ipepClient)) | ||
1751 | endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); | ||
1752 | |||
1753 | m_log.DebugFormat("{0} {1} is sending {2} EnableSimulator for neighbour region {3}(loc=<{4},{5}>,siz=<{6},{7}>) " + | ||
1754 | "and EstablishAgentCommunication with seed cap {8}", LogHeader, | ||
1755 | source.RegionName, agent.Name, | ||
1756 | neighbourRegion.RegionName, neighbourRegion.RegionLocX, neighbourRegion.RegionLocY, newSizeX, newSizeY , capsPath); | ||
1757 | |||
1758 | m_eqModule.EnableSimulator(regionhandler, | ||
1759 | endPoint, agent.UUID, newSizeX, newSizeY); | ||
1760 | m_eqModule.EstablishAgentCommunication(agent.UUID, endPoint, capsPath, | ||
1761 | regionhandler, newSizeX, newSizeY); | ||
1762 | } | ||
1763 | else | ||
1764 | { | ||
1765 | agent.ControllingClient.InformClientOfNeighbour(regionhandler, endPoint); | ||
1766 | } | ||
1767 | return true; | ||
1768 | } | ||
1769 | agent.RemoveNeighbourRegion(regionhandler); | ||
1770 | return false; | ||
1771 | } | ||
1772 | |||
1706 | public bool CrossAgentIntoNewRegionMain(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, EntityTransferContext ctx) | 1773 | public bool CrossAgentIntoNewRegionMain(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, EntityTransferContext ctx) |
1707 | { | 1774 | { |
1708 | int ts = Util.EnvironmentTickCount(); | 1775 | int ts = Util.EnvironmentTickCount(); |
1776 | bool sucess = true; | ||
1777 | string reason = String.Empty; | ||
1709 | try | 1778 | try |
1710 | { | 1779 | { |
1780 | |||
1711 | AgentData cAgent = new AgentData(); | 1781 | AgentData cAgent = new AgentData(); |
1712 | agent.CopyTo(cAgent,true); | 1782 | agent.CopyTo(cAgent,true); |
1713 | 1783 | ||
@@ -1725,18 +1795,26 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1725 | // Beyond this point, extra cleanup is needed beyond removing transit state | 1795 | // Beyond this point, extra cleanup is needed beyond removing transit state |
1726 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.Transferring); | 1796 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.Transferring); |
1727 | 1797 | ||
1728 | if (!agent.Scene.SimulationService.UpdateAgent(neighbourRegion, cAgent, ctx)) | 1798 | if (sucess && !agent.Scene.SimulationService.UpdateAgent(neighbourRegion, cAgent, ctx)) |
1799 | { | ||
1800 | sucess = false; | ||
1801 | reason = "agent update failed"; | ||
1802 | } | ||
1803 | |||
1804 | if(!sucess) | ||
1729 | { | 1805 | { |
1730 | // region doesn't take it | 1806 | // region doesn't take it |
1731 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); | 1807 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); |
1732 | 1808 | ||
1733 | m_log.WarnFormat( | 1809 | m_log.WarnFormat( |
1734 | "[ENTITY TRANSFER MODULE]: Region {0} would not accept update for agent {1} on cross attempt. Returning to original region.", | 1810 | "[ENTITY TRANSFER MODULE]: agent {0} crossing to {1} failed: {2}", |
1735 | neighbourRegion.RegionName, agent.Name); | 1811 | agent.Name, neighbourRegion.RegionName, reason); |
1736 | 1812 | ||
1737 | ReInstantiateScripts(agent); | 1813 | ReInstantiateScripts(agent); |
1738 | if(agent.ParentID == 0 && agent.ParentUUID == UUID.Zero) | 1814 | if(agent.ParentID == 0 && agent.ParentUUID == UUID.Zero) |
1815 | { | ||
1739 | agent.AddToPhysicalScene(isFlying); | 1816 | agent.AddToPhysicalScene(isFlying); |
1817 | } | ||
1740 | 1818 | ||
1741 | return false; | 1819 | return false; |
1742 | } | 1820 | } |
@@ -1777,7 +1855,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1777 | 1855 | ||
1778 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); | 1856 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); |
1779 | 1857 | ||
1780 | Vector3 vel2 = new Vector3(agent.Velocity.X, agent.Velocity.Y, 0); | 1858 | Vector3 vel2 = Vector3.Zero; |
1859 | if((agent.crossingFlags & 2) != 0) | ||
1860 | vel2 = new Vector3(agent.Velocity.X, agent.Velocity.Y, 0); | ||
1781 | 1861 | ||
1782 | if (m_eqModule != null) | 1862 | if (m_eqModule != null) |
1783 | { | 1863 | { |
@@ -1804,7 +1884,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1804 | 1884 | ||
1805 | // this may need the attachments | 1885 | // this may need the attachments |
1806 | 1886 | ||
1807 | agent.HasMovedAway(true); | 1887 | agent.HasMovedAway((agent.crossingFlags & 8) == 0); |
1808 | 1888 | ||
1809 | agent.MakeChildAgent(neighbourRegion.RegionHandle); | 1889 | agent.MakeChildAgent(neighbourRegion.RegionHandle); |
1810 | 1890 | ||
@@ -2135,7 +2215,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2135 | sp.Scene.RegionInfo.WorldLocY - neighbour.RegionLocY, | 2215 | sp.Scene.RegionInfo.WorldLocY - neighbour.RegionLocY, |
2136 | 0f); | 2216 | 0f); |
2137 | } | 2217 | } |
2138 | 2218 | #endregion | |
2139 | 2219 | ||
2140 | #region NotFoundLocationCache class | 2220 | #region NotFoundLocationCache class |
2141 | // A collection of not found locations to make future lookups 'not found' lookups quick. | 2221 | // A collection of not found locations to make future lookups 'not found' lookups quick. |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index af70848..0e7ac58 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -538,7 +538,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
538 | 538 | ||
539 | 539 | ||
540 | public bool inTransit = false; | 540 | public bool inTransit = false; |
541 | public delegate SceneObjectGroup SOGCrossDelegate(SceneObjectGroup sog,Vector3 pos); | 541 | private delegate SceneObjectGroup SOGCrossDelegate(SceneObjectGroup sog,Vector3 pos, TeleportObjectData tpData); |
542 | 542 | ||
543 | /// <summary> | 543 | /// <summary> |
544 | /// The absolute position of this scene object in the scene | 544 | /// The absolute position of this scene object in the scene |
@@ -560,7 +560,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
560 | { | 560 | { |
561 | inTransit = true; | 561 | inTransit = true; |
562 | SOGCrossDelegate d = CrossAsync; | 562 | SOGCrossDelegate d = CrossAsync; |
563 | d.BeginInvoke(this, val, CrossAsyncCompleted, d); | 563 | d.BeginInvoke(this, val, null, CrossAsyncCompleted, d); |
564 | } | 564 | } |
565 | return; | 565 | return; |
566 | } | 566 | } |
@@ -601,7 +601,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
601 | av.sitSOGmoved(); | 601 | av.sitSOGmoved(); |
602 | } | 602 | } |
603 | 603 | ||
604 | |||
605 | // now that position is changed tell it to scripts | 604 | // now that position is changed tell it to scripts |
606 | if (triggerScriptEvent) | 605 | if (triggerScriptEvent) |
607 | { | 606 | { |
@@ -617,64 +616,75 @@ namespace OpenSim.Region.Framework.Scenes | |||
617 | } | 616 | } |
618 | } | 617 | } |
619 | 618 | ||
620 | public SceneObjectGroup CrossAsync(SceneObjectGroup sog, Vector3 val) | 619 | private SceneObjectGroup CrossAsync(SceneObjectGroup sog, Vector3 val, TeleportObjectData tpdata) |
621 | { | 620 | { |
622 | Scene sogScene = sog.m_scene; | 621 | Scene sogScene = sog.m_scene; |
623 | IEntityTransferModule entityTransfer = sogScene.RequestModuleInterface<IEntityTransferModule>(); | 622 | SceneObjectPart root = sog.RootPart; |
624 | 623 | ||
625 | Vector3 newpos = Vector3.Zero; | 624 | bool isTeleport = tpdata != null; |
626 | OpenSim.Services.Interfaces.GridRegion destination = null; | ||
627 | 625 | ||
628 | if (sog.RootPart.DIE_AT_EDGE) | 626 | if(!isTeleport) |
629 | { | 627 | { |
630 | try | 628 | if (root.DIE_AT_EDGE) |
631 | { | ||
632 | sogScene.DeleteSceneObject(sog, false); | ||
633 | } | ||
634 | catch (Exception) | ||
635 | { | 629 | { |
636 | m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border."); | 630 | try |
631 | { | ||
632 | sogScene.DeleteSceneObject(sog, false); | ||
633 | } | ||
634 | catch (Exception) | ||
635 | { | ||
636 | m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border."); | ||
637 | } | ||
638 | return sog; | ||
637 | } | 639 | } |
638 | return sog; | ||
639 | } | ||
640 | 640 | ||
641 | if (sog.RootPart.RETURN_AT_EDGE) | 641 | if (root.RETURN_AT_EDGE) |
642 | { | ||
643 | // We remove the object here | ||
644 | try | ||
645 | { | 642 | { |
646 | List<uint> localIDs = new List<uint>(); | 643 | // We remove the object here |
647 | localIDs.Add(sog.RootPart.LocalId); | 644 | try |
648 | sogScene.AddReturn(sog.OwnerID, sog.Name, sog.AbsolutePosition, | 645 | { |
649 | "Returned at region cross"); | 646 | List<uint> localIDs = new List<uint>(); |
650 | sogScene.DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return, UUID.Zero, false); | 647 | localIDs.Add(root.LocalId); |
651 | } | 648 | sogScene.AddReturn(sog.OwnerID, sog.Name, sog.AbsolutePosition, |
652 | catch (Exception) | 649 | "Returned at region cross"); |
653 | { | 650 | sogScene.DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return, UUID.Zero, false); |
654 | m_log.Warn("[SCENE]: exception when trying to return the prim that crossed the border."); | 651 | } |
652 | catch (Exception) | ||
653 | { | ||
654 | m_log.Warn("[SCENE]: exception when trying to return the prim that crossed the border."); | ||
655 | } | ||
656 | return sog; | ||
655 | } | 657 | } |
656 | return sog; | ||
657 | } | 658 | } |
658 | 659 | ||
659 | if (sog.m_rootPart.KeyframeMotion != null) | 660 | if (root.KeyframeMotion != null) |
660 | sog.m_rootPart.KeyframeMotion.StartCrossingCheck(); | 661 | root.KeyframeMotion.StartCrossingCheck(); |
662 | |||
663 | if(root.PhysActor != null) | ||
664 | root.PhysActor.CrossingStart(); | ||
665 | |||
666 | IEntityTransferModule entityTransfer = sogScene.RequestModuleInterface<IEntityTransferModule>(); | ||
661 | 667 | ||
662 | if (entityTransfer == null) | 668 | if (entityTransfer == null) |
663 | return sog; | 669 | return sog; |
664 | 670 | ||
671 | Vector3 newpos = Vector3.Zero; | ||
672 | OpenSim.Services.Interfaces.GridRegion destination = null; | ||
673 | |||
665 | destination = entityTransfer.GetObjectDestination(sog, val, out newpos); | 674 | destination = entityTransfer.GetObjectDestination(sog, val, out newpos); |
666 | if (destination == null) | 675 | if (destination == null) |
667 | return sog; | 676 | return sog; |
668 | 677 | ||
669 | if (sog.m_sittingAvatars.Count == 0) | 678 | if (sog.m_sittingAvatars.Count == 0) |
670 | { | 679 | { |
671 | entityTransfer.CrossPrimGroupIntoNewRegion(destination, newpos, sog, true, true); | 680 | entityTransfer.CrossPrimGroupIntoNewRegion(destination, newpos, sog, !isTeleport, true); |
672 | return sog; | 681 | return sog; |
673 | } | 682 | } |
674 | 683 | ||
675 | string reason = String.Empty; | 684 | string reason = String.Empty; |
676 | EntityTransferContext ctx = new EntityTransferContext(); | 685 | EntityTransferContext ctx = new EntityTransferContext(); |
677 | 686 | ||
687 | Vector3 curPos = root.GroupPosition; | ||
678 | foreach (ScenePresence av in sog.m_sittingAvatars) | 688 | foreach (ScenePresence av in sog.m_sittingAvatars) |
679 | { | 689 | { |
680 | // We need to cross these agents. First, let's find | 690 | // We need to cross these agents. First, let's find |
@@ -685,10 +695,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
685 | 695 | ||
686 | // We set the avatar position as being the object | 696 | // We set the avatar position as being the object |
687 | // position to get the region to send to | 697 | // position to get the region to send to |
698 | if(av.IsNPC) | ||
699 | continue; | ||
700 | |||
701 | if(av.IsInTransit) | ||
702 | return sog; | ||
703 | |||
688 | if(!entityTransfer.checkAgentAccessToRegion(av, destination, newpos, ctx, out reason)) | 704 | if(!entityTransfer.checkAgentAccessToRegion(av, destination, newpos, ctx, out reason)) |
689 | { | ||
690 | return sog; | 705 | return sog; |
691 | } | 706 | |
692 | m_log.DebugFormat("[SCENE OBJECT]: Avatar {0} needs to be crossed to {1}", av.Name, destination.RegionName); | 707 | m_log.DebugFormat("[SCENE OBJECT]: Avatar {0} needs to be crossed to {1}", av.Name, destination.RegionName); |
693 | } | 708 | } |
694 | 709 | ||
@@ -696,8 +711,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
696 | // be made to stand up | 711 | // be made to stand up |
697 | 712 | ||
698 | List<avtocrossInfo> avsToCross = new List<avtocrossInfo>(); | 713 | List<avtocrossInfo> avsToCross = new List<avtocrossInfo>(); |
699 | 714 | List<ScenePresence> avsToCrossFar = new List<ScenePresence>(); | |
700 | foreach (ScenePresence av in sog.m_sittingAvatars) | 715 | ulong destHandle = destination.RegionHandle; |
716 | List<ScenePresence> sittingAvatars = GetSittingAvatars(); | ||
717 | foreach (ScenePresence av in sittingAvatars) | ||
701 | { | 718 | { |
702 | byte cflags = 1; | 719 | byte cflags = 1; |
703 | 720 | ||
@@ -711,68 +728,175 @@ namespace OpenSim.Region.Framework.Scenes | |||
711 | else | 728 | else |
712 | cflags = 3; | 729 | cflags = 3; |
713 | } | 730 | } |
731 | if(!av.knowsNeighbourRegion(destHandle)) | ||
732 | cflags |= 8; | ||
714 | 733 | ||
715 | // 1 is crossing | 734 | // 1 is crossing |
716 | // 2 is sitting | 735 | // 2 is sitting |
717 | // 4 is sitting at sittarget | 736 | // 4 is sitting at sittarget |
718 | av.crossingFlags = cflags; | 737 | // 8 far crossing |
719 | 738 | ||
720 | avinfo.av = av; | 739 | avinfo.av = av; |
721 | avinfo.ParentID = av.ParentID; | 740 | avinfo.ParentID = av.ParentID; |
722 | avsToCross.Add(avinfo); | 741 | avsToCross.Add(avinfo); |
723 | 742 | ||
743 | if(!av.knowsNeighbourRegion(destHandle)) | ||
744 | { | ||
745 | cflags |= 8; | ||
746 | avsToCrossFar.Add(av); | ||
747 | } | ||
748 | |||
749 | if(av.IsNPC) | ||
750 | av.crossingFlags = 0; | ||
751 | else | ||
752 | av.crossingFlags = cflags; | ||
753 | |||
724 | av.PrevSitOffset = av.OffsetPosition; | 754 | av.PrevSitOffset = av.OffsetPosition; |
725 | av.ParentID = 0; | 755 | av.ParentID = 0; |
726 | } | 756 | } |
727 | 757 | ||
758 | Vector3 vel = root.Velocity; | ||
759 | Vector3 avel = root.AngularVelocity; | ||
760 | Vector3 acc = root.Acceleration; | ||
761 | Quaternion ori = root.RotationOffset; | ||
762 | |||
763 | if(isTeleport) | ||
764 | { | ||
765 | root.Stop(); | ||
766 | sogScene.ForEachScenePresence(delegate(ScenePresence av) | ||
767 | { | ||
768 | av.ControllingClient.SendEntityUpdate(root,PrimUpdateFlags.SendInTransit); | ||
769 | av.ControllingClient.SendEntityTerseUpdateImmediate(root); | ||
770 | }); | ||
771 | |||
772 | root.Velocity = tpdata.vel; | ||
773 | root.AngularVelocity = tpdata.avel; | ||
774 | root.Acceleration = tpdata.acc; | ||
775 | root.RotationOffset = tpdata.ori; | ||
776 | } | ||
777 | |||
728 | if (entityTransfer.CrossPrimGroupIntoNewRegion(destination, newpos, sog, true, false)) | 778 | if (entityTransfer.CrossPrimGroupIntoNewRegion(destination, newpos, sog, true, false)) |
729 | { | 779 | { |
780 | if(isTeleport) | ||
781 | { | ||
782 | sogScene.ForEachScenePresence(delegate(ScenePresence oav) | ||
783 | { | ||
784 | if(sittingAvatars.Contains(oav)) | ||
785 | return; | ||
786 | if(oav.knowsNeighbourRegion(destHandle)) | ||
787 | return; | ||
788 | oav.ControllingClient.SendEntityUpdate(root, PrimUpdateFlags.Kill); | ||
789 | foreach (ScenePresence sav in sittingAvatars) | ||
790 | { | ||
791 | sav.SendKillTo(oav); | ||
792 | } | ||
793 | }); | ||
794 | } | ||
795 | bool crossedfar = false; | ||
796 | foreach (ScenePresence av in avsToCrossFar) | ||
797 | { | ||
798 | if(entityTransfer.CrossAgentCreateFarChild(av,destination, newpos, ctx)) | ||
799 | crossedfar = true; | ||
800 | else | ||
801 | av.crossingFlags = 0; | ||
802 | } | ||
803 | |||
804 | if(crossedfar) | ||
805 | Thread.Sleep(1000); | ||
806 | |||
730 | foreach (avtocrossInfo avinfo in avsToCross) | 807 | foreach (avtocrossInfo avinfo in avsToCross) |
731 | { | 808 | { |
732 | ScenePresence av = avinfo.av; | 809 | ScenePresence av = avinfo.av; |
733 | if (!av.IsInTransit) // just in case... | 810 | av.IsInTransit = true; |
734 | { | 811 | m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val); |
735 | m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val); | ||
736 | 812 | ||
737 | av.IsInTransit = true; | 813 | if(av.crossingFlags > 0) |
814 | entityTransfer.CrossAgentToNewRegionAsync(av, newpos, destination, false, ctx); | ||
738 | 815 | ||
739 | // CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync; | 816 | if (av.IsChildAgent) |
740 | // d.BeginInvoke(av, val, destination, av.Flying, version, CrossAgentToNewRegionCompleted, d); | 817 | { |
741 | entityTransfer.CrossAgentToNewRegionAsync(av, newpos, destination, av.Flying, ctx); | 818 | // avatar crossed do some extra cleanup |
742 | if (av.IsChildAgent) | 819 | if (av.ParentUUID != UUID.Zero) |
743 | { | ||
744 | // avatar crossed do some extra cleanup | ||
745 | if (av.ParentUUID != UUID.Zero) | ||
746 | { | ||
747 | av.ClearControls(); | ||
748 | av.ParentPart = null; | ||
749 | } | ||
750 | } | ||
751 | else | ||
752 | { | 820 | { |
753 | // avatar cross failed we need do dedicated standUp | 821 | av.ClearControls(); |
754 | // part of it was done at CrossAgentToNewRegionAsync | 822 | av.ParentPart = null; |
755 | // so for now just remove the sog controls | ||
756 | // this may need extra care | ||
757 | av.UnRegisterSeatControls(sog.UUID); | ||
758 | } | 823 | } |
759 | |||
760 | av.ParentUUID = UUID.Zero; | 824 | av.ParentUUID = UUID.Zero; |
825 | av.ParentPart = null; | ||
761 | // In any case | 826 | // In any case |
762 | av.IsInTransit = false; | 827 | av.IsInTransit = false; |
763 | av.crossingFlags = 0; | 828 | av.crossingFlags = 0; |
764 | m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", av.Firstname, av.Lastname); | 829 | m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", av.Firstname, av.Lastname); |
765 | } | 830 | } |
766 | else | 831 | else |
767 | m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar already in transit {0} to {1}", av.Name, val); | 832 | { |
833 | // avatar cross failed we need do dedicated standUp | ||
834 | // part of it was done at CrossAgentToNewRegionAsync | ||
835 | // so for now just remove the sog controls | ||
836 | // this may need extra care | ||
837 | av.UnRegisterSeatControls(sog.UUID); | ||
838 | av.ParentUUID = UUID.Zero; | ||
839 | av.ParentPart = null; | ||
840 | Vector3 oldp = curPos; | ||
841 | oldp.X = Util.Clamp<float>(oldp.X, 0.5f, sog.m_scene.RegionInfo.RegionSizeX - 0.5f); | ||
842 | oldp.Y = Util.Clamp<float>(oldp.Y, 0.5f, sog.m_scene.RegionInfo.RegionSizeY - 0.5f); | ||
843 | av.AbsolutePosition = oldp; | ||
844 | av.crossingFlags = 0; | ||
845 | av.sitAnimation = "SIT"; | ||
846 | av.IsInTransit = false; | ||
847 | if(av.Animator!= null) | ||
848 | av.Animator.SetMovementAnimations("STAND"); | ||
849 | av.AddToPhysicalScene(false); | ||
850 | sogScene.ForEachScenePresence(delegate(ScenePresence oav) | ||
851 | { | ||
852 | if(sittingAvatars.Contains(oav)) | ||
853 | return; | ||
854 | if(oav.knowsNeighbourRegion(destHandle)) | ||
855 | av.SendAvatarDataToAgent(oav); | ||
856 | else | ||
857 | { | ||
858 | av.SendAvatarDataToAgent(oav); | ||
859 | av.SendAppearanceToAgent(oav); | ||
860 | if (av.Animator != null) | ||
861 | av.Animator.SendAnimPackToClient(oav.ControllingClient); | ||
862 | av.SendAttachmentsToAgentNF(oav); // not ok | ||
863 | } | ||
864 | }); | ||
865 | m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} failed.", av.Firstname, av.Lastname); | ||
866 | } | ||
768 | } | 867 | } |
868 | |||
869 | if(crossedfar) | ||
870 | { | ||
871 | Thread.Sleep(10000); | ||
872 | foreach (ScenePresence av in avsToCrossFar) | ||
873 | { | ||
874 | if(av.IsChildAgent) | ||
875 | { | ||
876 | av.Scene.CloseAgent(av.UUID, false); | ||
877 | } | ||
878 | else | ||
879 | av.RemoveNeighbourRegion(destHandle); | ||
880 | } | ||
881 | } | ||
882 | avsToCrossFar.Clear(); | ||
769 | avsToCross.Clear(); | 883 | avsToCross.Clear(); |
770 | sog.RemoveScriptInstances(true); | 884 | sog.RemoveScriptInstances(true); |
771 | sog.Clear(); | 885 | sog.Clear(); |
772 | return sog; | 886 | return sog; |
773 | } | 887 | } |
774 | else // cross failed, put avas back ?? | 888 | else |
775 | { | 889 | { |
890 | if(isTeleport) | ||
891 | { | ||
892 | if((tpdata.flags & OSTPOBJ_STOPONFAIL) == 0) | ||
893 | { | ||
894 | root.Velocity = vel; | ||
895 | root.AngularVelocity = avel; | ||
896 | root.Acceleration = acc; | ||
897 | } | ||
898 | root.RotationOffset = ori; | ||
899 | } | ||
776 | foreach (avtocrossInfo avinfo in avsToCross) | 900 | foreach (avtocrossInfo avinfo in avsToCross) |
777 | { | 901 | { |
778 | ScenePresence av = avinfo.av; | 902 | ScenePresence av = avinfo.av; |
@@ -782,7 +906,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
782 | } | 906 | } |
783 | } | 907 | } |
784 | avsToCross.Clear(); | 908 | avsToCross.Clear(); |
785 | |||
786 | return sog; | 909 | return sog; |
787 | } | 910 | } |
788 | 911 | ||
@@ -794,11 +917,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
794 | if (!sog.IsDeleted) | 917 | if (!sog.IsDeleted) |
795 | { | 918 | { |
796 | SceneObjectPart rootp = sog.m_rootPart; | 919 | SceneObjectPart rootp = sog.m_rootPart; |
920 | |||
797 | Vector3 oldp = rootp.GroupPosition; | 921 | Vector3 oldp = rootp.GroupPosition; |
798 | oldp.X = Util.Clamp<float>(oldp.X, 0.5f, sog.m_scene.RegionInfo.RegionSizeX - 0.5f); | 922 | oldp.X = Util.Clamp<float>(oldp.X, 0.5f, sog.m_scene.RegionInfo.RegionSizeX - 0.5f); |
799 | oldp.Y = Util.Clamp<float>(oldp.Y, 0.5f, sog.m_scene.RegionInfo.RegionSizeY - 0.5f); | 923 | oldp.Y = Util.Clamp<float>(oldp.Y, 0.5f, sog.m_scene.RegionInfo.RegionSizeY - 0.5f); |
800 | rootp.GroupPosition = oldp; | 924 | rootp.GroupPosition = oldp; |
801 | 925 | ||
926 | rootp.Stop(); | ||
927 | |||
802 | SceneObjectPart[] parts = sog.m_parts.GetArray(); | 928 | SceneObjectPart[] parts = sog.m_parts.GetArray(); |
803 | 929 | ||
804 | foreach (SceneObjectPart part in parts) | 930 | foreach (SceneObjectPart part in parts) |
@@ -812,57 +938,37 @@ namespace OpenSim.Region.Framework.Scenes | |||
812 | av.sitSOGmoved(); | 938 | av.sitSOGmoved(); |
813 | } | 939 | } |
814 | 940 | ||
815 | sog.Velocity = Vector3.Zero; | ||
816 | |||
817 | if (sog.m_rootPart.KeyframeMotion != null) | 941 | if (sog.m_rootPart.KeyframeMotion != null) |
818 | sog.m_rootPart.KeyframeMotion.CrossingFailure(); | 942 | sog.m_rootPart.KeyframeMotion.CrossingFailure(); |
819 | 943 | ||
820 | if (sog.RootPart.PhysActor != null) | 944 | if (sog.RootPart.PhysActor != null) |
821 | { | ||
822 | sog.RootPart.PhysActor.CrossingFailure(); | 945 | sog.RootPart.PhysActor.CrossingFailure(); |
823 | } | ||
824 | 946 | ||
825 | sog.inTransit = false; | 947 | sog.inTransit = false; |
948 | AttachToBackup(); | ||
826 | sog.ScheduleGroupForFullUpdate(); | 949 | sog.ScheduleGroupForFullUpdate(); |
827 | } | 950 | } |
828 | } | 951 | } |
829 | 952 | ||
830 | /* outdated | 953 | private class TeleportObjectData |
831 | private void CrossAgentToNewRegionCompleted(ScenePresence agent) | ||
832 | { | 954 | { |
833 | //// If the cross was successful, this agent is a child agent | 955 | public int flags; |
834 | if (agent.IsChildAgent) | 956 | public Vector3 vel; |
835 | { | 957 | public Vector3 avel; |
836 | if (agent.ParentUUID != UUID.Zero) | 958 | public Vector3 acc; |
837 | { | 959 | public Quaternion ori; |
838 | agent.HandleForceReleaseControls(agent.ControllingClient,agent.UUID); | 960 | public UUID sourceID; |
839 | agent.ParentPart = null; | ||
840 | // agent.ParentPosition = Vector3.Zero; | ||
841 | // agent.ParentUUID = UUID.Zero; | ||
842 | } | ||
843 | } | ||
844 | |||
845 | agent.ParentUUID = UUID.Zero; | ||
846 | // agent.Reset(); | ||
847 | // else // Not successful | ||
848 | // agent.RestoreInCurrentScene(); | ||
849 | |||
850 | // In any case | ||
851 | agent.IsInTransit = false; | ||
852 | |||
853 | m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname); | ||
854 | } | 961 | } |
855 | */ | ||
856 | 962 | ||
857 | // copy from LSL_constants.cs | 963 | // copy from LSL_constants.cs |
858 | const int OSTPOBJ_STOPATTARRGET = 0x1; // stops at destination | 964 | const int OSTPOBJ_STOPATTARGET = 0x1; // stops at destination |
859 | const int OSTPOBJ_STOPONFAIL = 0x2; // stops at start if tp fails | 965 | const int OSTPOBJ_STOPONFAIL = 0x2; // stops at start if tp fails |
860 | const int OSTPOBJ_SETROT = 0x4; // the rotation is the final rotation, otherwise is a added rotation | 966 | const int OSTPOBJ_SETROT = 0x4; // the rotation is the final rotation, otherwise is a added rotation |
861 | 967 | ||
862 | public void TeleportObject(UUID sourceID, Vector3 targetPosition, Quaternion rotation, int flags) | 968 | public int TeleportObject(UUID sourceID, Vector3 targetPosition, Quaternion rotation, int flags) |
863 | { | 969 | { |
864 | if(inTransit || IsDeleted || IsAttachmentCheckFull() || IsSelected || Scene == null) | 970 | if(inTransit || IsDeleted || IsAttachmentCheckFull() || IsSelected || Scene == null) |
865 | return; | 971 | return -1; |
866 | 972 | ||
867 | inTransit = true; | 973 | inTransit = true; |
868 | 974 | ||
@@ -870,7 +976,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
870 | if(pa == null || RootPart.KeyframeMotion != null /*|| m_sittingAvatars.Count == 0*/) | 976 | if(pa == null || RootPart.KeyframeMotion != null /*|| m_sittingAvatars.Count == 0*/) |
871 | { | 977 | { |
872 | inTransit = false; | 978 | inTransit = false; |
873 | return; | 979 | return -1; |
980 | } | ||
981 | |||
982 | bool stop = (flags & OSTPOBJ_STOPATTARGET) != 0; | ||
983 | bool setrot = (flags & OSTPOBJ_SETROT) != 0; | ||
984 | |||
985 | rotation.Normalize(); | ||
986 | |||
987 | Quaternion currentRot = RootPart.RotationOffset; | ||
988 | if(setrot) | ||
989 | rotation = Quaternion.Conjugate(currentRot) * rotation; | ||
990 | |||
991 | bool dorot = setrot | (Math.Abs(rotation.W) < 0.99999); | ||
992 | |||
993 | Vector3 vel = Vector3.Zero; | ||
994 | Vector3 avel = Vector3.Zero; | ||
995 | Vector3 acc = Vector3.Zero; | ||
996 | |||
997 | if(!stop) | ||
998 | { | ||
999 | vel = RootPart.Velocity; | ||
1000 | avel = RootPart.AngularVelocity; | ||
1001 | acc = RootPart.Acceleration; | ||
1002 | } | ||
1003 | Quaternion ori = RootPart.RotationOffset; | ||
1004 | |||
1005 | if(dorot) | ||
1006 | { | ||
1007 | if(!stop) | ||
1008 | { | ||
1009 | vel *= rotation; | ||
1010 | avel *= rotation; | ||
1011 | acc *= rotation; | ||
1012 | } | ||
1013 | ori *= rotation; | ||
874 | } | 1014 | } |
875 | 1015 | ||
876 | if(Scene.PositionIsInCurrentRegion(targetPosition)) | 1016 | if(Scene.PositionIsInCurrentRegion(targetPosition)) |
@@ -878,7 +1018,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
878 | if(Scene.InTeleportTargetsCoolDown(UUID, sourceID, 1.0)) | 1018 | if(Scene.InTeleportTargetsCoolDown(UUID, sourceID, 1.0)) |
879 | { | 1019 | { |
880 | inTransit = false; | 1020 | inTransit = false; |
881 | return; | 1021 | return -2; |
882 | } | 1022 | } |
883 | 1023 | ||
884 | Vector3 curPos = AbsolutePosition; | 1024 | Vector3 curPos = AbsolutePosition; |
@@ -891,7 +1031,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
891 | if(!Scene.Permissions.CanObjectEnterWithScripts(this, land)) | 1031 | if(!Scene.Permissions.CanObjectEnterWithScripts(this, land)) |
892 | { | 1032 | { |
893 | inTransit = false; | 1033 | inTransit = false; |
894 | return; | 1034 | return -3; |
895 | } | 1035 | } |
896 | 1036 | ||
897 | UUID agentID; | 1037 | UUID agentID; |
@@ -901,49 +1041,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
901 | if(land.IsRestrictedFromLand(agentID) || land.IsBannedFromLand(agentID)) | 1041 | if(land.IsRestrictedFromLand(agentID) || land.IsBannedFromLand(agentID)) |
902 | { | 1042 | { |
903 | inTransit = false; | 1043 | inTransit = false; |
904 | return; | 1044 | return -4; |
905 | } | 1045 | } |
906 | } | 1046 | } |
907 | } | 1047 | } |
908 | 1048 | ||
909 | bool stop = (flags & OSTPOBJ_STOPATTARRGET) != 0; | 1049 | RootPart.Velocity = vel; |
910 | bool setrot = (flags & OSTPOBJ_SETROT) != 0; | 1050 | RootPart.AngularVelocity = avel; |
911 | 1051 | RootPart.Acceleration = acc; | |
912 | rotation.Normalize(); | 1052 | RootPart.RotationOffset = ori; |
913 | Quaternion currentRot = RootPart.RotationOffset; | ||
914 | |||
915 | if(setrot) | ||
916 | rotation = Quaternion.Conjugate(currentRot) * rotation; | ||
917 | |||
918 | bool dorot = setrot | (Math.Abs(rotation.W) < 0.999); | ||
919 | |||
920 | if(stop) | ||
921 | { | ||
922 | RootPart.Stop(); | ||
923 | } | ||
924 | else | ||
925 | { | ||
926 | if(dorot) | ||
927 | { | ||
928 | Vector3 vel = RootPart.Velocity; | ||
929 | Vector3 avel = RootPart.AngularVelocity; | ||
930 | Vector3 acc = RootPart.Acceleration; | ||
931 | |||
932 | vel *= rotation; | ||
933 | avel *= rotation; | ||
934 | acc *= rotation; | ||
935 | |||
936 | RootPart.Velocity = vel; | ||
937 | RootPart.AngularVelocity = avel; | ||
938 | RootPart.Acceleration = acc; | ||
939 | } | ||
940 | } | ||
941 | |||
942 | if(dorot) | ||
943 | { | ||
944 | currentRot *= rotation; | ||
945 | RootPart.RotationOffset = currentRot; | ||
946 | } | ||
947 | 1053 | ||
948 | Vector3 s = RootPart.Scale * RootPart.RotationOffset; | 1054 | Vector3 s = RootPart.Scale * RootPart.RotationOffset; |
949 | float h = Scene.GetGroundHeight(posX, posY) + 0.5f * (float)Math.Abs(s.Z) + 0.01f; | 1055 | float h = Scene.GetGroundHeight(posX, posY) + 0.5f * (float)Math.Abs(s.Z) + 0.01f; |
@@ -953,10 +1059,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
953 | inTransit = false; | 1059 | inTransit = false; |
954 | AbsolutePosition = targetPosition; | 1060 | AbsolutePosition = targetPosition; |
955 | RootPart.ScheduleTerseUpdate(); | 1061 | RootPart.ScheduleTerseUpdate(); |
956 | return; | 1062 | return 1; |
957 | } | 1063 | } |
958 | 1064 | ||
959 | inTransit = false; | 1065 | if(Scene.InTeleportTargetsCoolDown(UUID, sourceID, 20.0)) |
1066 | { | ||
1067 | inTransit = false; | ||
1068 | return -1; | ||
1069 | } | ||
1070 | |||
1071 | TeleportObjectData tdata = new TeleportObjectData(); | ||
1072 | tdata.flags = flags; | ||
1073 | tdata.vel = vel; | ||
1074 | tdata.avel = avel; | ||
1075 | tdata.acc = acc; | ||
1076 | tdata.ori = ori; | ||
1077 | tdata.sourceID = sourceID; | ||
1078 | |||
1079 | |||
1080 | SOGCrossDelegate d = CrossAsync; | ||
1081 | d.BeginInvoke(this, targetPosition, tdata, CrossAsyncCompleted, d); | ||
1082 | return 0; | ||
960 | } | 1083 | } |
961 | 1084 | ||
962 | public override Vector3 Velocity | 1085 | public override Vector3 Velocity |
@@ -5398,9 +5521,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
5398 | { | 5521 | { |
5399 | if (avs[i].Name == name) | 5522 | if (avs[i].Name == name) |
5400 | { | 5523 | { |
5401 | GetLinkNumber_lastname = name; | 5524 | GetLinkNumber_lastname = name; |
5402 | GetLinkNumber_lastnumber = j; | 5525 | GetLinkNumber_lastnumber = j; |
5403 | return j; | 5526 | return j; |
5404 | } | 5527 | } |
5405 | } | 5528 | } |
5406 | } | 5529 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 8d04c9f..affd4de 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -1066,7 +1066,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1066 | m_angularVelocity = value; | 1066 | m_angularVelocity = value; |
1067 | 1067 | ||
1068 | PhysicsActor actor = PhysActor; | 1068 | PhysicsActor actor = PhysActor; |
1069 | if ((actor != null) && actor.IsPhysical && ParentGroup.RootPart == this && VehicleType == (int)Vehicle.TYPE_NONE) | 1069 | if ((actor != null) && actor.IsPhysical && ParentGroup.RootPart == this) |
1070 | { | 1070 | { |
1071 | actor.RotationalVelocity = m_angularVelocity; | 1071 | actor.RotationalVelocity = m_angularVelocity; |
1072 | } | 1072 | } |
@@ -1092,6 +1092,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1092 | m_acceleration = Vector3.Zero; | 1092 | m_acceleration = Vector3.Zero; |
1093 | else | 1093 | else |
1094 | m_acceleration = value; | 1094 | m_acceleration = value; |
1095 | |||
1096 | PhysicsActor actor = PhysActor; | ||
1097 | if ((actor != null) && actor.IsPhysical && ParentGroup.RootPart == this) | ||
1098 | { | ||
1099 | actor.Acceleration = m_acceleration; | ||
1100 | } | ||
1095 | } | 1101 | } |
1096 | } | 1102 | } |
1097 | 1103 | ||
@@ -2016,7 +2022,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2016 | // SetVelocity for LSL llSetVelocity.. may need revision if having other uses in future | 2022 | // SetVelocity for LSL llSetVelocity.. may need revision if having other uses in future |
2017 | public void SetVelocity(Vector3 pVel, bool localGlobalTF) | 2023 | public void SetVelocity(Vector3 pVel, bool localGlobalTF) |
2018 | { | 2024 | { |
2019 | if (ParentGroup == null || ParentGroup.IsDeleted) | 2025 | if (ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.inTransit) |
2020 | return; | 2026 | return; |
2021 | 2027 | ||
2022 | if (ParentGroup.IsAttachment) | 2028 | if (ParentGroup.IsAttachment) |
@@ -2043,7 +2049,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2043 | // SetAngularVelocity for LSL llSetAngularVelocity.. may need revision if having other uses in future | 2049 | // SetAngularVelocity for LSL llSetAngularVelocity.. may need revision if having other uses in future |
2044 | public void SetAngularVelocity(Vector3 pAngVel, bool localGlobalTF) | 2050 | public void SetAngularVelocity(Vector3 pAngVel, bool localGlobalTF) |
2045 | { | 2051 | { |
2046 | if (ParentGroup == null || ParentGroup.IsDeleted) | 2052 | if (ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.inTransit) |
2047 | return; | 2053 | return; |
2048 | 2054 | ||
2049 | if (ParentGroup.IsAttachment) | 2055 | if (ParentGroup.IsAttachment) |
@@ -2077,6 +2083,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2077 | /// <param name="localGlobalTF">true for the local frame, false for the global frame</param> | 2083 | /// <param name="localGlobalTF">true for the local frame, false for the global frame</param> |
2078 | public void ApplyAngularImpulse(Vector3 impulsei, bool localGlobalTF) | 2084 | public void ApplyAngularImpulse(Vector3 impulsei, bool localGlobalTF) |
2079 | { | 2085 | { |
2086 | if (ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.inTransit) | ||
2087 | return; | ||
2088 | |||
2080 | Vector3 impulse = impulsei; | 2089 | Vector3 impulse = impulsei; |
2081 | 2090 | ||
2082 | if (localGlobalTF) | 2091 | if (localGlobalTF) |
@@ -3376,25 +3385,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
3376 | /// <param name="remoteClient"></param> | 3385 | /// <param name="remoteClient"></param> |
3377 | public void SendFullUpdateToClient(IClientAPI remoteClient) | 3386 | public void SendFullUpdateToClient(IClientAPI remoteClient) |
3378 | { | 3387 | { |
3379 | SendFullUpdateToClient(remoteClient, OffsetPosition); | 3388 | if (ParentGroup == null || ParentGroup.IsDeleted) |
3380 | } | ||
3381 | |||
3382 | /// <summary> | ||
3383 | /// Sends a full update to the client | ||
3384 | /// </summary> | ||
3385 | /// <param name="remoteClient"></param> | ||
3386 | /// <param name="lPos"></param> | ||
3387 | public void SendFullUpdateToClient(IClientAPI remoteClient, Vector3 lPos) | ||
3388 | { | ||
3389 | if (ParentGroup == null) | ||
3390 | return; | ||
3391 | |||
3392 | // Suppress full updates during attachment editing | ||
3393 | // sl Does send them | ||
3394 | // if (ParentGroup.IsSelected && ParentGroup.IsAttachment) | ||
3395 | // return; | ||
3396 | |||
3397 | if (ParentGroup.IsDeleted) | ||
3398 | return; | 3389 | return; |
3399 | 3390 | ||
3400 | if (ParentGroup.IsAttachment | 3391 | if (ParentGroup.IsAttachment |
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs index 0d8eeec..bf0400b 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | |||
@@ -85,7 +85,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
85 | private Vector3 m_lastposition; | 85 | private Vector3 m_lastposition; |
86 | private Vector3 m_rotationalVelocity; | 86 | private Vector3 m_rotationalVelocity; |
87 | private Vector3 _size; | 87 | private Vector3 _size; |
88 | private Vector3 _acceleration; | 88 | private Vector3 m_acceleration; |
89 | private IntPtr Amotor; | 89 | private IntPtr Amotor; |
90 | 90 | ||
91 | internal Vector3 m_force; | 91 | internal Vector3 m_force; |
@@ -746,8 +746,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
746 | 746 | ||
747 | public override Vector3 Acceleration | 747 | public override Vector3 Acceleration |
748 | { | 748 | { |
749 | get { return _acceleration; } | 749 | get { return m_acceleration; } |
750 | set { } | 750 | set |
751 | { | ||
752 | if(m_outbounds) | ||
753 | m_acceleration = value; | ||
754 | } | ||
751 | } | 755 | } |
752 | 756 | ||
753 | public override Vector3 RotationalVelocity | 757 | public override Vector3 RotationalVelocity |
@@ -767,7 +771,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
767 | { | 771 | { |
768 | if (value.IsFinite()) | 772 | if (value.IsFinite()) |
769 | { | 773 | { |
770 | AddChange(changes.AngVelocity, value); | 774 | if(m_outbounds) |
775 | m_rotationalVelocity = value; | ||
776 | else | ||
777 | AddChange(changes.AngVelocity, value); | ||
771 | } | 778 | } |
772 | else | 779 | else |
773 | { | 780 | { |
@@ -941,7 +948,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
941 | } | 948 | } |
942 | public void SetAcceleration(Vector3 accel) | 949 | public void SetAcceleration(Vector3 accel) |
943 | { | 950 | { |
944 | _acceleration = accel; | 951 | m_acceleration = accel; |
945 | } | 952 | } |
946 | 953 | ||
947 | public override void AddForce(Vector3 force, bool pushforce) | 954 | public override void AddForce(Vector3 force, bool pushforce) |
@@ -2748,7 +2755,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
2748 | m_angularForceacc = Vector3.Zero; | 2755 | m_angularForceacc = Vector3.Zero; |
2749 | // m_torque = Vector3.Zero; | 2756 | // m_torque = Vector3.Zero; |
2750 | _velocity = Vector3.Zero; | 2757 | _velocity = Vector3.Zero; |
2751 | _acceleration = Vector3.Zero; | 2758 | m_acceleration = Vector3.Zero; |
2752 | m_rotationalVelocity = Vector3.Zero; | 2759 | m_rotationalVelocity = Vector3.Zero; |
2753 | _target_velocity = Vector3.Zero; | 2760 | _target_velocity = Vector3.Zero; |
2754 | if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) | 2761 | if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) |
@@ -3784,9 +3791,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3784 | m_outbounds = true; | 3791 | m_outbounds = true; |
3785 | 3792 | ||
3786 | lpos.Z = Util.Clip(lpos.Z, -100f, 100000f); | 3793 | lpos.Z = Util.Clip(lpos.Z, -100f, 100000f); |
3787 | _acceleration.X = 0; | 3794 | m_acceleration.X = 0; |
3788 | _acceleration.Y = 0; | 3795 | m_acceleration.Y = 0; |
3789 | _acceleration.Z = 0; | 3796 | m_acceleration.Z = 0; |
3790 | 3797 | ||
3791 | _velocity.X = 0; | 3798 | _velocity.X = 0; |
3792 | _velocity.Y = 0; | 3799 | _velocity.Y = 0; |
@@ -3915,12 +3922,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3915 | _orientation.W = ori.W; | 3922 | _orientation.W = ori.W; |
3916 | } | 3923 | } |
3917 | 3924 | ||
3918 | // update velocities and aceleration | 3925 | // update velocities and acceleration |
3919 | if (_zeroFlag || lastZeroFlag) | 3926 | if (_zeroFlag || lastZeroFlag) |
3920 | { | 3927 | { |
3921 | // disable interpolators | 3928 | // disable interpolators |
3922 | _velocity = Vector3.Zero; | 3929 | _velocity = Vector3.Zero; |
3923 | _acceleration = Vector3.Zero; | 3930 | m_acceleration = Vector3.Zero; |
3924 | m_rotationalVelocity = Vector3.Zero; | 3931 | m_rotationalVelocity = Vector3.Zero; |
3925 | } | 3932 | } |
3926 | else | 3933 | else |
@@ -3929,7 +3936,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3929 | { | 3936 | { |
3930 | d.Vector3 vel = d.BodyGetLinearVel(Body); | 3937 | d.Vector3 vel = d.BodyGetLinearVel(Body); |
3931 | 3938 | ||
3932 | _acceleration = _velocity; | 3939 | m_acceleration = _velocity; |
3933 | 3940 | ||
3934 | if ((Math.Abs(vel.X) < 0.005f) && | 3941 | if ((Math.Abs(vel.X) < 0.005f) && |
3935 | (Math.Abs(vel.Y) < 0.005f) && | 3942 | (Math.Abs(vel.Y) < 0.005f) && |
@@ -3937,21 +3944,21 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3937 | { | 3944 | { |
3938 | _velocity = Vector3.Zero; | 3945 | _velocity = Vector3.Zero; |
3939 | float t = -m_invTimeStep; | 3946 | float t = -m_invTimeStep; |
3940 | _acceleration = _acceleration * t; | 3947 | m_acceleration = m_acceleration * t; |
3941 | } | 3948 | } |
3942 | else | 3949 | else |
3943 | { | 3950 | { |
3944 | _velocity.X = vel.X; | 3951 | _velocity.X = vel.X; |
3945 | _velocity.Y = vel.Y; | 3952 | _velocity.Y = vel.Y; |
3946 | _velocity.Z = vel.Z; | 3953 | _velocity.Z = vel.Z; |
3947 | _acceleration = (_velocity - _acceleration) * m_invTimeStep; | 3954 | m_acceleration = (_velocity - m_acceleration) * m_invTimeStep; |
3948 | } | 3955 | } |
3949 | 3956 | ||
3950 | if ((Math.Abs(_acceleration.X) < 0.01f) && | 3957 | if ((Math.Abs(m_acceleration.X) < 0.01f) && |
3951 | (Math.Abs(_acceleration.Y) < 0.01f) && | 3958 | (Math.Abs(m_acceleration.Y) < 0.01f) && |
3952 | (Math.Abs(_acceleration.Z) < 0.01f)) | 3959 | (Math.Abs(m_acceleration.Z) < 0.01f)) |
3953 | { | 3960 | { |
3954 | _acceleration = Vector3.Zero; | 3961 | m_acceleration = Vector3.Zero; |
3955 | } | 3962 | } |
3956 | 3963 | ||
3957 | vel = d.BodyGetAngularVel(Body); | 3964 | vel = d.BodyGetAngularVel(Body); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index b3bd8c4..e12cedf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -4664,7 +4664,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4664 | /// has a cool down time. retries before expire reset it | 4664 | /// has a cool down time. retries before expire reset it |
4665 | /// fail conditions are silent ignored | 4665 | /// fail conditions are silent ignored |
4666 | /// </remarks> | 4666 | /// </remarks> |
4667 | public void osTeleportObject(LSL_Key objectUUID, LSL_Vector targetPos, LSL_Rotation rotation, LSL_Integer flags) | 4667 | public LSL_Integer osTeleportObject(LSL_Key objectUUID, LSL_Vector targetPos, LSL_Rotation rotation, LSL_Integer flags) |
4668 | { | 4668 | { |
4669 | CheckThreatLevel(ThreatLevel.Severe, "osTeleportObject"); | 4669 | CheckThreatLevel(ThreatLevel.Severe, "osTeleportObject"); |
4670 | m_host.AddScriptLPS(1); | 4670 | m_host.AddScriptLPS(1); |
@@ -4673,16 +4673,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4673 | if (!UUID.TryParse(objectUUID, out objUUID)) | 4673 | if (!UUID.TryParse(objectUUID, out objUUID)) |
4674 | { | 4674 | { |
4675 | OSSLShoutError("osTeleportObject() invalid object Key"); | 4675 | OSSLShoutError("osTeleportObject() invalid object Key"); |
4676 | return; | 4676 | return -1; |
4677 | } | 4677 | } |
4678 | 4678 | ||
4679 | SceneObjectGroup sog = World.GetSceneObjectGroup(objUUID); | 4679 | SceneObjectGroup sog = World.GetSceneObjectGroup(objUUID); |
4680 | if(sog== null || sog.IsDeleted) | 4680 | if(sog== null || sog.IsDeleted) |
4681 | return; | 4681 | return -1; |
4682 | 4682 | ||
4683 | UUID myid = m_host.ParentGroup.UUID; | 4683 | UUID myid = m_host.ParentGroup.UUID; |
4684 | 4684 | ||
4685 | sog.TeleportObject(myid, targetPos, rotation, flags); | 4685 | return sog.TeleportObject(myid, targetPos, rotation, flags); |
4686 | // a delay here may break vehicles | 4686 | // a delay here may break vehicles |
4687 | } | 4687 | } |
4688 | 4688 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 08b144a..bd5d008 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -51,7 +51,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
51 | /// </summary> | 51 | /// </summary> |
52 | public enum ThreatLevel | 52 | public enum ThreatLevel |
53 | { | 53 | { |
54 | // Not documented, presumably means permanently disabled ? | ||
55 | NoAccess = -1, | 54 | NoAccess = -1, |
56 | 55 | ||
57 | /// <summary> | 56 | /// <summary> |
@@ -496,7 +495,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
496 | void osSetInertiaAsSphere(LSL_Float mass, LSL_Float radius, vector centerOfMass); | 495 | void osSetInertiaAsSphere(LSL_Float mass, LSL_Float radius, vector centerOfMass); |
497 | void osSetInertiaAsCylinder(LSL_Float mass, LSL_Float radius, LSL_Float lenght, vector centerOfMass,rotation lslrot); | 496 | void osSetInertiaAsCylinder(LSL_Float mass, LSL_Float radius, LSL_Float lenght, vector centerOfMass,rotation lslrot); |
498 | 497 | ||
499 | void osTeleportObject(LSL_Key objectUUID, vector targetPos, rotation targetrotation, LSL_Integer flags); | 498 | LSL_Integer osTeleportObject(LSL_Key objectUUID, vector targetPos, rotation targetrotation, LSL_Integer flags); |
500 | LSL_Integer osGetLinkNumber(LSL_String name); | 499 | LSL_Integer osGetLinkNumber(LSL_String name); |
501 | } | 500 | } |
502 | } | 501 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 59493a3..ce0fa48 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | |||
@@ -856,7 +856,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
856 | 856 | ||
857 | // for osTeleportObject | 857 | // for osTeleportObject |
858 | public const int OSTPOBJ_NONE = 0x0; | 858 | public const int OSTPOBJ_NONE = 0x0; |
859 | public const int OSTPOBJ_STOPATTARRGET = 0x1; // stops at destination | 859 | public const int OSTPOBJ_STOPATTARGET = 0x1; // stops at destination |
860 | public const int OSTPOBJ_STOPONFAIL = 0x2; // stops at jump point if tp fails | 860 | public const int OSTPOBJ_STOPONFAIL = 0x2; // stops at jump point if tp fails |
861 | public const int OSTPOBJ_SETROT = 0x4; // the rotation is the final rotation, otherwise is a added rotation | 861 | public const int OSTPOBJ_SETROT = 0x4; // the rotation is the final rotation, otherwise is a added rotation |
862 | 862 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 7c08628..9eac114 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -1140,9 +1140,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1140 | m_OSSL_Functions.osClearInertia(); | 1140 | m_OSSL_Functions.osClearInertia(); |
1141 | } | 1141 | } |
1142 | 1142 | ||
1143 | public void osTeleportObject(LSL_Key objectUUID, vector targetPos, rotation targetrotation, LSL_Integer flags) | 1143 | public LSL_Integer osTeleportObject(LSL_Key objectUUID, vector targetPos, rotation targetrotation, LSL_Integer flags) |
1144 | { | 1144 | { |
1145 | m_OSSL_Functions.osTeleportObject(objectUUID, targetPos, targetrotation, flags); | 1145 | return m_OSSL_Functions.osTeleportObject(objectUUID, targetPos, targetrotation, flags); |
1146 | } | 1146 | } |
1147 | 1147 | ||
1148 | public LSL_Integer osGetLinkNumber(LSL_String name) | 1148 | public LSL_Integer osGetLinkNumber(LSL_String name) |