diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 203 |
1 files changed, 145 insertions, 58 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 5bfc640..faa07d4 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1341,6 +1341,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1341 | RemoveFromPhysicalScene(); | 1341 | RemoveFromPhysicalScene(); |
1342 | ParentID = 0; // Child agents can't be sitting | 1342 | ParentID = 0; // Child agents can't be sitting |
1343 | 1343 | ||
1344 | // we dont have land information for child | ||
1345 | m_previusParcelHide = false; | ||
1346 | m_previusParcelUUID = UUID.Zero; | ||
1347 | m_currentParcelHide = false; | ||
1348 | m_currentParcelUUID = UUID.Zero; | ||
1344 | // FIXME: Set RegionHandle to the region handle of the scene this agent is moving into | 1349 | // FIXME: Set RegionHandle to the region handle of the scene this agent is moving into |
1345 | 1350 | ||
1346 | m_scene.EventManager.TriggerOnMakeChildAgent(this); | 1351 | m_scene.EventManager.TriggerOnMakeChildAgent(this); |
@@ -1753,13 +1758,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1753 | // Tell the client that we're totally ready | 1758 | // Tell the client that we're totally ready |
1754 | ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); | 1759 | ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); |
1755 | 1760 | ||
1756 | // Remember in HandleUseCircuitCode, we delayed this to here | ||
1757 | // this prims etc, moved down | ||
1758 | // if (m_teleportFlags > 0) | ||
1759 | // SendInitialDataToMe(); | ||
1760 | |||
1761 | // m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); | ||
1762 | |||
1763 | m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 1761 | m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
1764 | 1762 | ||
1765 | if (!string.IsNullOrEmpty(m_callbackURI)) | 1763 | if (!string.IsNullOrEmpty(m_callbackURI)) |
@@ -1805,19 +1803,82 @@ namespace OpenSim.Region.Framework.Scenes | |||
1805 | if (!IsChildAgent) | 1803 | if (!IsChildAgent) |
1806 | { | 1804 | { |
1807 | 1805 | ||
1808 | ValidateAndSendAppearanceAndAgentData(); | 1806 | // ValidateAndSendAppearanceAndAgentData(); |
1807 | |||
1808 | // do it here in line | ||
1809 | // so sequence is clear | ||
1810 | |||
1811 | // verify baked textures and cache | ||
1812 | |||
1813 | bool cachedbaked = false; | ||
1814 | |||
1815 | if (m_scene.AvatarFactory != null) | ||
1816 | cachedbaked = m_scene.AvatarFactory.ValidateBakedTextureCache(this); | ||
1817 | |||
1818 | // not sure we need this | ||
1819 | if (!cachedbaked) | ||
1820 | { | ||
1821 | if (m_scene.AvatarFactory != null) | ||
1822 | m_scene.AvatarFactory.QueueAppearanceSave(UUID); | ||
1823 | } | ||
1824 | |||
1825 | List<ScenePresence> allpresences = m_scene.GetScenePresences(); | ||
1826 | |||
1827 | // send avatar object to all presences including us, so they cross it into region | ||
1828 | // then hide if necessary | ||
1829 | SendInitialAvatarDataToAllAgents(allpresences); | ||
1830 | |||
1831 | // send this look | ||
1832 | SendAppearanceToAgent(this); | ||
1833 | |||
1834 | // send this animations | ||
1835 | UUID[] animIDs = null; | ||
1836 | int[] animseqs = null; | ||
1837 | UUID[] animsobjs = null; | ||
1838 | |||
1839 | if (Animator != null) | ||
1840 | Animator.GetArrays(out animIDs, out animseqs, out animsobjs); | ||
1841 | |||
1842 | bool haveAnims = (animIDs != null && animseqs != null && animsobjs != null); | ||
1843 | |||
1844 | if(haveAnims) | ||
1845 | SendAnimPackToAgent(this, animIDs, animseqs, animsobjs); | ||
1846 | |||
1847 | // we should be able to receive updates, etc | ||
1848 | // so release them | ||
1849 | m_inTransit = false; | ||
1850 | |||
1851 | // send look and animations to others | ||
1852 | // if not cached we send greys | ||
1853 | // uncomented if will wait till avatar does baking | ||
1854 | //if (cachedbaked) | ||
1855 | { | ||
1856 | foreach (ScenePresence p in allpresences) | ||
1857 | { | ||
1858 | if (p == this) | ||
1859 | continue; | ||
1860 | |||
1861 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) | ||
1862 | continue; | ||
1863 | |||
1864 | SendAppearanceToAgentNF(p); | ||
1865 | if (haveAnims) | ||
1866 | SendAnimPackToAgentNF(p, animIDs, animseqs, animsobjs); | ||
1867 | } | ||
1868 | } // greys if | ||
1809 | 1869 | ||
1810 | m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 1870 | m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
1811 | 1871 | ||
1812 | // attachments | 1872 | // attachments |
1873 | |||
1813 | if (isNPC || (TeleportFlags & TeleportFlags.ViaLogin) != 0) | 1874 | if (isNPC || (TeleportFlags & TeleportFlags.ViaLogin) != 0) |
1814 | { | 1875 | { |
1815 | if (Scene.AttachmentsModule != null) | 1876 | if (Scene.AttachmentsModule != null) |
1816 | // Util.FireAndForget( | 1877 | // Util.FireAndForget( |
1817 | // o => | 1878 | // o => |
1818 | // { | 1879 | // { |
1819 | Scene.AttachmentsModule.RezAttachments(this); | 1880 | Scene.AttachmentsModule.RezAttachments(this); |
1820 | // }); | 1881 | // }); |
1821 | } | 1882 | } |
1822 | else | 1883 | else |
1823 | { | 1884 | { |
@@ -1829,23 +1890,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
1829 | // Resume scripts this possible should also be moved down after sending the avatar to viewer ? | 1890 | // Resume scripts this possible should also be moved down after sending the avatar to viewer ? |
1830 | foreach (SceneObjectGroup sog in m_attachments) | 1891 | foreach (SceneObjectGroup sog in m_attachments) |
1831 | { | 1892 | { |
1832 | sog.SendFullUpdateToClient(ControllingClient); | ||
1833 | SendFullUpdateToClient(ControllingClient); | 1893 | SendFullUpdateToClient(ControllingClient); |
1894 | sog.SendFullUpdateToClient(ControllingClient); | ||
1834 | 1895 | ||
1835 | if (!sog.HasPrivateAttachmentPoint) | 1896 | if (!sog.HasPrivateAttachmentPoint) |
1836 | { | 1897 | { |
1837 | // sog.ScheduleGroupForFullUpdate(); | 1898 | // sog.ScheduleGroupForFullUpdate(); |
1838 | m_scene.ForEachScenePresence(delegate(ScenePresence p) | 1899 | foreach(ScenePresence p in allpresences) |
1839 | { | 1900 | { |
1840 | if (p == this) | 1901 | if (p == this) |
1841 | return; | 1902 | continue; |
1842 | 1903 | ||
1843 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) | 1904 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) |
1844 | return; | 1905 | continue; |
1845 | 1906 | ||
1846 | sog.SendFullUpdateToClient(p.ControllingClient); | ||
1847 | SendFullUpdateToClient(p.ControllingClient); // resend our data by updates path | 1907 | SendFullUpdateToClient(p.ControllingClient); // resend our data by updates path |
1848 | }); | 1908 | sog.SendFullUpdateToClient(p.ControllingClient); |
1909 | }; | ||
1849 | } | 1910 | } |
1850 | sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); | 1911 | sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); |
1851 | sog.ResumeScripts(); | 1912 | sog.ResumeScripts(); |
@@ -1872,25 +1933,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1872 | 1933 | ||
1873 | m_log.DebugFormat("[CompleteMovement] SendInitialDataToMe: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 1934 | m_log.DebugFormat("[CompleteMovement] SendInitialDataToMe: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
1874 | 1935 | ||
1875 | if (!IsChildAgent) | 1936 | if (!IsChildAgent && openChildAgents) |
1876 | { | 1937 | { |
1877 | // moved from makeroot missing in sendInitialDataToMe | ||
1878 | // its already there | ||
1879 | /* | ||
1880 | m_scene.ForEachRootScenePresence(delegate(ScenePresence presence) | ||
1881 | { | ||
1882 | if (presence != this) | ||
1883 | presence.Animator.SendAnimPackToClient(ControllingClient); | ||
1884 | }); | ||
1885 | */ | ||
1886 | if (openChildAgents) | ||
1887 | { | ||
1888 | IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); | 1938 | IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); |
1889 | if (friendsModule != null) | 1939 | if (friendsModule != null) |
1890 | friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); | 1940 | friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); |
1891 | 1941 | ||
1892 | m_log.DebugFormat("[CompleteMovement] friendsModule: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 1942 | m_log.DebugFormat("[CompleteMovement] friendsModule: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
1893 | } | 1943 | |
1894 | } | 1944 | } |
1895 | } | 1945 | } |
1896 | finally | 1946 | finally |
@@ -3481,6 +3531,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3481 | /// Do everything required once a client completes its movement into a region and becomes | 3531 | /// Do everything required once a client completes its movement into a region and becomes |
3482 | /// a root agent. | 3532 | /// a root agent. |
3483 | /// </summary> | 3533 | /// </summary> |
3534 | /// | ||
3535 | /* only called from on place, do done inline there | ||
3484 | private void ValidateAndSendAppearanceAndAgentData() | 3536 | private void ValidateAndSendAppearanceAndAgentData() |
3485 | { | 3537 | { |
3486 | //m_log.DebugFormat("[SCENE PRESENCE] SendInitialData: {0} ({1})", Name, UUID); | 3538 | //m_log.DebugFormat("[SCENE PRESENCE] SendInitialData: {0} ({1})", Name, UUID); |
@@ -3502,11 +3554,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3502 | m_scene.AvatarFactory.QueueAppearanceSave(UUID); | 3554 | m_scene.AvatarFactory.QueueAppearanceSave(UUID); |
3503 | } | 3555 | } |
3504 | 3556 | ||
3557 | // send avatar object to all viewers so they cross it into region | ||
3505 | bool newhide = m_currentParcelHide; | 3558 | bool newhide = m_currentParcelHide; |
3506 | m_currentParcelHide = false; | 3559 | m_currentParcelHide = false; |
3507 | 3560 | ||
3508 | SendAvatarDataToAllAgents(); | 3561 | SendAvatarDataToAllAgents(); |
3509 | 3562 | ||
3563 | // now hide | ||
3510 | if (newhide) | 3564 | if (newhide) |
3511 | { | 3565 | { |
3512 | ParcelLoginCheck(m_currentParcelUUID); | 3566 | ParcelLoginCheck(m_currentParcelUUID); |
@@ -3522,7 +3576,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3522 | if(Animator!= null) | 3576 | if(Animator!= null) |
3523 | Animator.SendAnimPack(); | 3577 | Animator.SendAnimPack(); |
3524 | } | 3578 | } |
3525 | 3579 | */ | |
3526 | /// <summary> | 3580 | /// <summary> |
3527 | /// Send avatar full data appearance and animations for all other root agents to this agent, this agent | 3581 | /// Send avatar full data appearance and animations for all other root agents to this agent, this agent |
3528 | /// can be either a child or root | 3582 | /// can be either a child or root |
@@ -3530,15 +3584,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3530 | public void SendOtherAgentsAvatarFullToMe() | 3584 | public void SendOtherAgentsAvatarFullToMe() |
3531 | { | 3585 | { |
3532 | int count = 0; | 3586 | int count = 0; |
3533 | m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) | 3587 | m_scene.ForEachRootScenePresence(delegate(ScenePresence p) |
3534 | { | 3588 | { |
3535 | // only send information about other root agents | 3589 | // only send information about other root agents |
3536 | if (scenePresence.UUID == UUID) | 3590 | if (p.UUID == UUID) |
3537 | return; | 3591 | return; |
3538 | 3592 | ||
3539 | scenePresence.SendAvatarDataToAgent(this); | 3593 | if (p.ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && GodLevel < 200) |
3540 | scenePresence.SendAppearanceToAgent(this); | 3594 | return; |
3541 | scenePresence.SendAnimPackToAgent(this); | 3595 | |
3596 | p.SendAvatarDataToAgentNF(this); | ||
3597 | p.SendAppearanceToAgentNF(this); | ||
3598 | p.SendAnimPackToAgentNF(this); | ||
3542 | // for now attachments are sent with all SOG | 3599 | // for now attachments are sent with all SOG |
3543 | count++; | 3600 | count++; |
3544 | }); | 3601 | }); |
@@ -3559,7 +3616,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3559 | m_log.WarnFormat( | 3616 | m_log.WarnFormat( |
3560 | "[SCENE PRESENCE]: Attempt to send avatar data from a child agent for {0} in {1}", | 3617 | "[SCENE PRESENCE]: Attempt to send avatar data from a child agent for {0} in {1}", |
3561 | Name, Scene.RegionInfo.RegionName); | 3618 | Name, Scene.RegionInfo.RegionName); |
3562 | |||
3563 | return; | 3619 | return; |
3564 | } | 3620 | } |
3565 | 3621 | ||
@@ -3575,6 +3631,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
3575 | m_scene.StatsReporter.AddAgentUpdates(count); | 3631 | m_scene.StatsReporter.AddAgentUpdates(count); |
3576 | } | 3632 | } |
3577 | 3633 | ||
3634 | // sends avatar object to all clients so they cross it into region | ||
3635 | // then sends kills to hide | ||
3636 | public void SendInitialAvatarDataToAllAgents(List<ScenePresence> presences) | ||
3637 | { | ||
3638 | m_lastSize = Appearance.AvatarSize; | ||
3639 | int count = 0; | ||
3640 | |||
3641 | foreach (ScenePresence p in presences) | ||
3642 | { | ||
3643 | p.ControllingClient.SendAvatarDataImmediate(this); | ||
3644 | if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) | ||
3645 | // either just kill the object | ||
3646 | // p.ControllingClient.SendKillObject(new List<uint> {LocalId}); | ||
3647 | // or also attachments viewer may still know about | ||
3648 | SendKillTo(p); | ||
3649 | count++; | ||
3650 | } | ||
3651 | m_scene.StatsReporter.AddAgentUpdates(count); | ||
3652 | } | ||
3653 | |||
3578 | /// <summary> | 3654 | /// <summary> |
3579 | /// Send avatar data to an agent. | 3655 | /// Send avatar data to an agent. |
3580 | /// </summary> | 3656 | /// </summary> |
@@ -3589,9 +3665,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3589 | 3665 | ||
3590 | public void SendAvatarDataToAgentNF(ScenePresence avatar) | 3666 | public void SendAvatarDataToAgentNF(ScenePresence avatar) |
3591 | { | 3667 | { |
3592 | avatar.ControllingClient.SendAvatarDataImmediate(this); | 3668 | avatar.ControllingClient.SendAvatarDataImmediate(this); |
3593 | } | 3669 | } |
3594 | 3670 | ||
3595 | /// <summary> | 3671 | /// <summary> |
3596 | /// Send this agent's appearance to all other root and child agents in the scene | 3672 | /// Send this agent's appearance to all other root and child agents in the scene |
3597 | /// This agent must be root. | 3673 | /// This agent must be root. |
@@ -3637,6 +3713,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3637 | UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); | 3713 | UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); |
3638 | } | 3714 | } |
3639 | 3715 | ||
3716 | public void SendAppearanceToAgentNF(ScenePresence avatar) | ||
3717 | { | ||
3718 | avatar.ControllingClient.SendAppearance( | ||
3719 | UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); | ||
3720 | } | ||
3721 | |||
3640 | public void SendAnimPackToAgent(ScenePresence p) | 3722 | public void SendAnimPackToAgent(ScenePresence p) |
3641 | { | 3723 | { |
3642 | if (IsChildAgent || Animator == null) | 3724 | if (IsChildAgent || Animator == null) |
@@ -3648,6 +3730,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
3648 | Animator.SendAnimPackToClient(p.ControllingClient); | 3730 | Animator.SendAnimPackToClient(p.ControllingClient); |
3649 | } | 3731 | } |
3650 | 3732 | ||
3733 | public void SendAnimPackToAgent(ScenePresence p, UUID[] animations, int[] seqs, UUID[] objectIDs) | ||
3734 | { | ||
3735 | if (IsChildAgent) | ||
3736 | return; | ||
3737 | |||
3738 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) | ||
3739 | return; | ||
3740 | |||
3741 | p.ControllingClient.SendAnimations(animations, seqs, ControllingClient.AgentId, objectIDs); | ||
3742 | } | ||
3743 | |||
3744 | public void SendAnimPackToAgentNF(ScenePresence p) | ||
3745 | { | ||
3746 | if (IsChildAgent || Animator == null) | ||
3747 | return; | ||
3748 | Animator.SendAnimPackToClient(p.ControllingClient); | ||
3749 | } | ||
3750 | |||
3751 | public void SendAnimPackToAgentNF(ScenePresence p, UUID[] animations, int[] seqs, UUID[] objectIDs) | ||
3752 | { | ||
3753 | p.ControllingClient.SendAnimations(animations, seqs, ControllingClient.AgentId, objectIDs); | ||
3754 | } | ||
3755 | |||
3651 | public void SendAnimPack(UUID[] animations, int[] seqs, UUID[] objectIDs) | 3756 | public void SendAnimPack(UUID[] animations, int[] seqs, UUID[] objectIDs) |
3652 | { | 3757 | { |
3653 | if (IsChildAgent) | 3758 | if (IsChildAgent) |
@@ -5634,22 +5739,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
5634 | } | 5739 | } |
5635 | } | 5740 | } |
5636 | 5741 | ||
5637 | private void ParcelLoginCheck(UUID currentParcelID) | ||
5638 | { | ||
5639 | List<ScenePresence> allpresences = m_scene.GetScenePresences(); | ||
5640 | |||
5641 | foreach (ScenePresence p in allpresences) | ||
5642 | { | ||
5643 | if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) | ||
5644 | continue; | ||
5645 | |||
5646 | if (currentParcelID != p.currentParcelUUID && p.GodLevel < 200) | ||
5647 | { | ||
5648 | SendKillTo(p); | ||
5649 | } | ||
5650 | } | ||
5651 | } | ||
5652 | |||
5653 | public void parcelRegionCross() | 5742 | public void parcelRegionCross() |
5654 | { | 5743 | { |
5655 | if (!ParcelHideThisAvatar || GodLevel >= 200) | 5744 | if (!ParcelHideThisAvatar || GodLevel >= 200) |
@@ -5817,8 +5906,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
5817 | 5906 | ||
5818 | if (killsToSendme.Count > 0) | 5907 | if (killsToSendme.Count > 0) |
5819 | { | 5908 | { |
5820 | m_log.Debug("[AVATAR]: killtoMe: " + Lastname + " " + killsToSendme.Count.ToString()); | ||
5821 | |||
5822 | foreach (ScenePresence p in killsToSendme) | 5909 | foreach (ScenePresence p in killsToSendme) |
5823 | { | 5910 | { |
5824 | m_log.Debug("[AVATAR]: killToMe: " + Lastname + " " + p.Lastname); | 5911 | m_log.Debug("[AVATAR]: killToMe: " + Lastname + " " + p.Lastname); |