diff options
author | Melanie | 2019-07-27 12:10:28 +0100 |
---|---|---|
committer | Melanie | 2019-07-27 12:10:28 +0100 |
commit | d6723dab37d86af22c712e2705af34fd2c82b174 (patch) | |
tree | 041be46cdcc778660fe3083794dabd2a2805283f /OpenSim/Region/Framework | |
parent | When using FSAssets, the HGAssetService would still use AssetService. (diff) | |
parent | mantis 8563: do not modify collection inside a loop on it a foreach on it (diff) | |
download | opensim-SC-d6723dab37d86af22c712e2705af34fd2c82b174.zip opensim-SC-d6723dab37d86af22c712e2705af34fd2c82b174.tar.gz opensim-SC-d6723dab37d86af22c712e2705af34fd2c82b174.tar.bz2 opensim-SC-d6723dab37d86af22c712e2705af34fd2c82b174.tar.xz |
Merge branch 'master' of brain.opensimulator.org:/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Framework')
9 files changed, 688 insertions, 449 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs index 1b690ba..9377564 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs | |||
@@ -90,6 +90,8 @@ namespace OpenSim.Region.Framework.Interfaces | |||
90 | void AgentArrivedAtDestination(UUID agent); | 90 | void AgentArrivedAtDestination(UUID agent); |
91 | 91 | ||
92 | void EnableChildAgents(ScenePresence agent); | 92 | void EnableChildAgents(ScenePresence agent); |
93 | void CheckChildAgents(ScenePresence agent); | ||
94 | void CloseOldChildAgents(ScenePresence agent); | ||
93 | 95 | ||
94 | void EnableChildAgent(ScenePresence agent, GridRegion region); | 96 | void EnableChildAgent(ScenePresence agent, GridRegion region); |
95 | 97 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 0c080d2..2995091 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -153,10 +153,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
153 | /// <param name="remoteClient"></param> | 153 | /// <param name="remoteClient"></param> |
154 | public void RequestPrim(uint primLocalID, IClientAPI remoteClient) | 154 | public void RequestPrim(uint primLocalID, IClientAPI remoteClient) |
155 | { | 155 | { |
156 | SceneObjectGroup sog = GetGroupByPrim(primLocalID); | 156 | SceneObjectPart part = GetSceneObjectPart(primLocalID); |
157 | if (part != null) | ||
158 | { | ||
159 | SceneObjectGroup sog = part.ParentGroup; | ||
160 | if(!sog.IsDeleted) | ||
161 | { | ||
162 | PrimUpdateFlags update = PrimUpdateFlags.FullUpdate; | ||
163 | if (sog.RootPart.Shape.MeshFlagEntry) | ||
164 | update = PrimUpdateFlags.FullUpdatewithAnim; | ||
165 | part.SendUpdate(remoteClient, update); | ||
166 | } | ||
167 | } | ||
168 | |||
169 | //SceneObjectGroup sog = GetGroupByPrim(primLocalID); | ||
157 | 170 | ||
158 | if (sog != null) | 171 | //if (sog != null) |
159 | sog.SendFullAnimUpdateToClient(remoteClient); | 172 | //sog.SendFullAnimUpdateToClient(remoteClient); |
160 | } | 173 | } |
161 | 174 | ||
162 | /// <summary> | 175 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 7668a87..073d11f 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -170,8 +170,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
170 | } | 170 | } |
171 | private bool m_scripts_enabled; | 171 | private bool m_scripts_enabled; |
172 | 172 | ||
173 | public SynchronizeSceneHandler SynchronizeScene; | ||
174 | |||
175 | public bool ClampNegativeZ | 173 | public bool ClampNegativeZ |
176 | { | 174 | { |
177 | get { return m_clampNegativeZ; } | 175 | get { return m_clampNegativeZ; } |
@@ -277,6 +275,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
277 | get { return m_maxRegionViewDistance; } | 275 | get { return m_maxRegionViewDistance; } |
278 | } | 276 | } |
279 | 277 | ||
278 | protected float m_minRegionViewDistance = 96f; | ||
279 | public float MinRegionViewDistance | ||
280 | { | ||
281 | get { return m_minRegionViewDistance; } | ||
282 | } | ||
283 | |||
280 | private List<string> m_AllowedViewers = new List<string>(); | 284 | private List<string> m_AllowedViewers = new List<string>(); |
281 | private List<string> m_BannedViewers = new List<string>(); | 285 | private List<string> m_BannedViewers = new List<string>(); |
282 | 286 | ||
@@ -922,6 +926,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
922 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); | 926 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); |
923 | m_maxDrawDistance = startupConfig.GetFloat("MaxDrawDistance", m_maxDrawDistance); | 927 | m_maxDrawDistance = startupConfig.GetFloat("MaxDrawDistance", m_maxDrawDistance); |
924 | m_maxRegionViewDistance = startupConfig.GetFloat("MaxRegionsViewDistance", m_maxRegionViewDistance); | 928 | m_maxRegionViewDistance = startupConfig.GetFloat("MaxRegionsViewDistance", m_maxRegionViewDistance); |
929 | m_minRegionViewDistance = startupConfig.GetFloat("MinRegionsViewDistance", m_minRegionViewDistance); | ||
925 | 930 | ||
926 | // old versions compatibility | 931 | // old versions compatibility |
927 | LegacySitOffsets = startupConfig.GetBoolean("LegacySitOffsets", LegacySitOffsets); | 932 | LegacySitOffsets = startupConfig.GetBoolean("LegacySitOffsets", LegacySitOffsets); |
@@ -932,6 +937,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
932 | if (m_maxRegionViewDistance > m_maxDrawDistance) | 937 | if (m_maxRegionViewDistance > m_maxDrawDistance) |
933 | m_maxRegionViewDistance = m_maxDrawDistance; | 938 | m_maxRegionViewDistance = m_maxDrawDistance; |
934 | 939 | ||
940 | if(m_minRegionViewDistance < 96f) | ||
941 | m_minRegionViewDistance = 96f; | ||
942 | if(m_minRegionViewDistance > m_maxRegionViewDistance) | ||
943 | m_minRegionViewDistance = m_maxRegionViewDistance; | ||
944 | |||
935 | UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); | 945 | UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); |
936 | if (!UseBackup) | 946 | if (!UseBackup) |
937 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); | 947 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); |
@@ -1006,11 +1016,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1006 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); | 1016 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); |
1007 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | 1017 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); |
1008 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | 1018 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); |
1009 | m_dontPersistBefore = | 1019 | m_dontPersistBefore = startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); |
1010 | startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); | ||
1011 | m_dontPersistBefore *= 10000000; | 1020 | m_dontPersistBefore *= 10000000; |
1012 | m_persistAfter = | 1021 | m_persistAfter = startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); |
1013 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); | ||
1014 | m_persistAfter *= 10000000; | 1022 | m_persistAfter *= 10000000; |
1015 | 1023 | ||
1016 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | 1024 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); |
@@ -1290,7 +1298,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1290 | { | 1298 | { |
1291 | if (RegionInfo.RegionHandle != otherRegion.RegionHandle) | 1299 | if (RegionInfo.RegionHandle != otherRegion.RegionHandle) |
1292 | { | 1300 | { |
1293 | |||
1294 | if (isNeighborRegion(otherRegion)) | 1301 | if (isNeighborRegion(otherRegion)) |
1295 | { | 1302 | { |
1296 | // Let the grid service module know, so this can be cached | 1303 | // Let the grid service module know, so this can be cached |
@@ -1300,9 +1307,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1300 | { | 1307 | { |
1301 | ForEachRootScenePresence(delegate(ScenePresence agent) | 1308 | ForEachRootScenePresence(delegate(ScenePresence agent) |
1302 | { | 1309 | { |
1303 | //agent.ControllingClient.new | ||
1304 | //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); | ||
1305 | |||
1306 | List<ulong> old = new List<ulong>(); | 1310 | List<ulong> old = new List<ulong>(); |
1307 | old.Add(otherRegion.RegionHandle); | 1311 | old.Add(otherRegion.RegionHandle); |
1308 | agent.DropOldNeighbours(old); | 1312 | agent.DropOldNeighbours(old); |
@@ -1328,7 +1332,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1328 | 1332 | ||
1329 | public bool isNeighborRegion(GridRegion otherRegion) | 1333 | public bool isNeighborRegion(GridRegion otherRegion) |
1330 | { | 1334 | { |
1331 | int tmp = otherRegion.RegionLocX - (int)RegionInfo.WorldLocX; ; | 1335 | int tmp = otherRegion.RegionLocX - (int)RegionInfo.WorldLocX; |
1332 | 1336 | ||
1333 | if (tmp < -otherRegion.RegionSizeX && tmp > RegionInfo.RegionSizeX) | 1337 | if (tmp < -otherRegion.RegionSizeX && tmp > RegionInfo.RegionSizeX) |
1334 | return false; | 1338 | return false; |
@@ -1695,9 +1699,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1695 | { | 1699 | { |
1696 | if (PhysicsEnabled) | 1700 | if (PhysicsEnabled) |
1697 | physicsFPS = m_sceneGraph.UpdatePhysics(FrameTime); | 1701 | physicsFPS = m_sceneGraph.UpdatePhysics(FrameTime); |
1698 | |||
1699 | if (SynchronizeScene != null) | ||
1700 | SynchronizeScene(this); | ||
1701 | } | 1702 | } |
1702 | 1703 | ||
1703 | tmpMS2 = Util.GetTimeStampMS(); | 1704 | tmpMS2 = Util.GetTimeStampMS(); |
@@ -1775,30 +1776,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1775 | 1776 | ||
1776 | // Region ready should always be set | 1777 | // Region ready should always be set |
1777 | Ready = true; | 1778 | Ready = true; |
1778 | |||
1779 | |||
1780 | IConfig restartConfig = m_config.Configs["RestartModule"]; | ||
1781 | if (restartConfig != null) | ||
1782 | { | ||
1783 | string markerPath = restartConfig.GetString("MarkerPath", String.Empty); | ||
1784 | |||
1785 | if (markerPath != String.Empty) | ||
1786 | { | ||
1787 | string path = Path.Combine(markerPath, RegionInfo.RegionID.ToString() + ".ready"); | ||
1788 | try | ||
1789 | { | ||
1790 | string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString(); | ||
1791 | FileStream fs = File.Create(path); | ||
1792 | System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | ||
1793 | Byte[] buf = enc.GetBytes(pidstring); | ||
1794 | fs.Write(buf, 0, buf.Length); | ||
1795 | fs.Close(); | ||
1796 | } | ||
1797 | catch (Exception) | ||
1798 | { | ||
1799 | } | ||
1800 | } | ||
1801 | } | ||
1802 | } | 1779 | } |
1803 | else | 1780 | else |
1804 | { | 1781 | { |
@@ -4818,6 +4795,20 @@ Label_GroupsDone: | |||
4818 | return true; | 4795 | return true; |
4819 | } | 4796 | } |
4820 | 4797 | ||
4798 | |||
4799 | /// <summary> | ||
4800 | /// Tries to teleport agent within region. | ||
4801 | /// </summary> | ||
4802 | /// <param name="remoteClient"></param> | ||
4803 | /// <param name="position"></param> | ||
4804 | /// <param name="lookAt"></param> | ||
4805 | /// <param name="teleportFlags"></param> | ||
4806 | public void RequestLocalTeleport(ScenePresence sp, Vector3 position, Vector3 vel, | ||
4807 | Vector3 lookat, int flags) | ||
4808 | { | ||
4809 | sp.LocalTeleport(position, vel, lookat, flags); | ||
4810 | } | ||
4811 | |||
4821 | /// <summary> | 4812 | /// <summary> |
4822 | /// Tries to teleport agent to another region. | 4813 | /// Tries to teleport agent to another region. |
4823 | /// </summary> | 4814 | /// </summary> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 7d5bbbf..c0bafc5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -119,6 +119,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
119 | 119 | ||
120 | // private PrimCountTaintedDelegate handlerPrimCountTainted = null; | 120 | // private PrimCountTaintedDelegate handlerPrimCountTainted = null; |
121 | 121 | ||
122 | public bool IsViewerCachable | ||
123 | { | ||
124 | get | ||
125 | { | ||
126 | // needs more exclusion ? | ||
127 | return(Backup && !IsTemporary && !inTransit && !IsSelected && !UsesPhysics && !IsAttachmentCheckFull() && | ||
128 | !RootPart.Shape.MeshFlagEntry && // animations are not sent correctly for now | ||
129 | RootPart.KeyframeMotion == null && | ||
130 | (DateTime.UtcNow.Ticks - timeLastChanged > 36000000000) && //36000000000 is one hour | ||
131 | RootPart.Velocity.LengthSquared() < 1e8f && // should not be needed | ||
132 | RootPart.Acceleration.LengthSquared() < 1e4f // should not be needed | ||
133 | ); | ||
134 | } | ||
135 | } | ||
136 | |||
122 | /// <summary> | 137 | /// <summary> |
123 | /// Signal whether the non-inventory attributes of any prims in the group have changed | 138 | /// Signal whether the non-inventory attributes of any prims in the group have changed |
124 | /// since the group's last persistent backup | 139 | /// since the group's last persistent backup |
@@ -128,7 +143,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
128 | private long timeLastChanged = 0; | 143 | private long timeLastChanged = 0; |
129 | private long m_maxPersistTime = 0; | 144 | private long m_maxPersistTime = 0; |
130 | private long m_minPersistTime = 0; | 145 | private long m_minPersistTime = 0; |
131 | // private Random m_rand; | 146 | |
147 | public int PseudoCRC; | ||
132 | 148 | ||
133 | /// <summary> | 149 | /// <summary> |
134 | /// This indicates whether the object has changed such that it needs to be repersisted to permenant storage | 150 | /// This indicates whether the object has changed such that it needs to be repersisted to permenant storage |
@@ -145,40 +161,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
145 | { | 161 | { |
146 | if (value) | 162 | if (value) |
147 | { | 163 | { |
148 | |||
149 | if (Backup) | 164 | if (Backup) |
150 | { | ||
151 | m_scene.SceneGraph.FireChangeBackup(this); | 165 | m_scene.SceneGraph.FireChangeBackup(this); |
152 | } | 166 | |
167 | PseudoCRC = (int)(DateTime.UtcNow.Ticks); ; | ||
153 | timeLastChanged = DateTime.UtcNow.Ticks; | 168 | timeLastChanged = DateTime.UtcNow.Ticks; |
154 | if (!m_hasGroupChanged) | 169 | if (!m_hasGroupChanged) |
155 | timeFirstChanged = DateTime.UtcNow.Ticks; | 170 | timeFirstChanged = timeLastChanged; |
156 | if (m_rootPart != null && m_scene != null) | 171 | if (m_rootPart != null && m_scene != null) |
157 | { | 172 | { |
158 | /* | ||
159 | if (m_rand == null) | ||
160 | { | ||
161 | byte[] val = new byte[16]; | ||
162 | m_rootPart.UUID.ToBytes(val, 0); | ||
163 | m_rand = new Random(BitConverter.ToInt32(val, 0)); | ||
164 | } | ||
165 | */ | ||
166 | if (m_scene.GetRootAgentCount() == 0) | 173 | if (m_scene.GetRootAgentCount() == 0) |
167 | { | 174 | { |
168 | //If the region is empty, this change has been made by an automated process | 175 | //If the region is empty, this change has been made by an automated process |
169 | //and thus we delay the persist time by a random amount between 1.5 and 2.5. | 176 | //and thus we delay the persist time by a random amount between 1.5 and 2.5. |
170 | 177 | ||
171 | // float factor = 1.5f + (float)(m_rand.NextDouble()); | ||
172 | float factor = 2.0f; | 178 | float factor = 2.0f; |
173 | m_maxPersistTime = (long)((float)m_scene.m_persistAfter * factor); | 179 | m_maxPersistTime = (long)(m_scene.m_persistAfter * factor); |
174 | m_minPersistTime = (long)((float)m_scene.m_dontPersistBefore * factor); | 180 | m_minPersistTime = (long)(m_scene.m_dontPersistBefore * factor); |
175 | } | 181 | } |
176 | else | 182 | else |
177 | { | 183 | { |
178 | //If the region is not empty, we want to obey the minimum and maximum persist times | ||
179 | //but add a random factor so we stagger the object persistance a little | ||
180 | // m_maxPersistTime = (long)((float)m_scene.m_persistAfter * (1.0d - (m_rand.NextDouble() / 5.0d))); //Multiply by 1.0-1.5 | ||
181 | // m_minPersistTime = (long)((float)m_scene.m_dontPersistBefore * (1.0d + (m_rand.NextDouble() / 2.0d))); //Multiply by 0.8-1.0 | ||
182 | m_maxPersistTime = m_scene.m_persistAfter; | 184 | m_maxPersistTime = m_scene.m_persistAfter; |
183 | m_minPersistTime = m_scene.m_dontPersistBefore; | 185 | m_minPersistTime = m_scene.m_dontPersistBefore; |
184 | } | 186 | } |
@@ -768,9 +770,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
768 | } | 770 | } |
769 | 771 | ||
770 | if(av.IsNPC) | 772 | if(av.IsNPC) |
771 | av.crossingFlags = 0; | 773 | av.m_crossingFlags = 0; |
772 | else | 774 | else |
773 | av.crossingFlags = cflags; | 775 | av.m_crossingFlags = cflags; |
774 | 776 | ||
775 | av.PrevSitOffset = av.OffsetPosition; | 777 | av.PrevSitOffset = av.OffsetPosition; |
776 | av.ParentID = 0; | 778 | av.ParentID = 0; |
@@ -819,7 +821,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
819 | if(entityTransfer.CrossAgentCreateFarChild(av,destination, newpos, ctx)) | 821 | if(entityTransfer.CrossAgentCreateFarChild(av,destination, newpos, ctx)) |
820 | crossedfar = true; | 822 | crossedfar = true; |
821 | else | 823 | else |
822 | av.crossingFlags = 0; | 824 | av.m_crossingFlags = 0; |
823 | } | 825 | } |
824 | 826 | ||
825 | if(crossedfar) | 827 | if(crossedfar) |
@@ -832,7 +834,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
832 | av.IsInTransit = true; | 834 | av.IsInTransit = true; |
833 | m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val); | 835 | m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val); |
834 | 836 | ||
835 | if(av.crossingFlags > 0) | 837 | if(av.m_crossingFlags > 0) |
836 | entityTransfer.CrossAgentToNewRegionAsync(av, newpos, destination, false, ctx); | 838 | entityTransfer.CrossAgentToNewRegionAsync(av, newpos, destination, false, ctx); |
837 | 839 | ||
838 | if (av.IsChildAgent) | 840 | if (av.IsChildAgent) |
@@ -847,7 +849,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
847 | av.ParentPart = null; | 849 | av.ParentPart = null; |
848 | // In any case | 850 | // In any case |
849 | av.IsInTransit = false; | 851 | av.IsInTransit = false; |
850 | av.crossingFlags = 0; | 852 | av.m_crossingFlags = 0; |
851 | m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", av.Firstname, av.Lastname); | 853 | m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", av.Firstname, av.Lastname); |
852 | } | 854 | } |
853 | else | 855 | else |
@@ -863,7 +865,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
863 | oldp.X = Util.Clamp<float>(oldp.X, 0.5f, sog.m_scene.RegionInfo.RegionSizeX - 0.5f); | 865 | oldp.X = Util.Clamp<float>(oldp.X, 0.5f, sog.m_scene.RegionInfo.RegionSizeX - 0.5f); |
864 | oldp.Y = Util.Clamp<float>(oldp.Y, 0.5f, sog.m_scene.RegionInfo.RegionSizeY - 0.5f); | 866 | oldp.Y = Util.Clamp<float>(oldp.Y, 0.5f, sog.m_scene.RegionInfo.RegionSizeY - 0.5f); |
865 | av.AbsolutePosition = oldp; | 867 | av.AbsolutePosition = oldp; |
866 | av.crossingFlags = 0; | 868 | av.m_crossingFlags = 0; |
867 | av.sitAnimation = "SIT"; | 869 | av.sitAnimation = "SIT"; |
868 | av.IsInTransit = false; | 870 | av.IsInTransit = false; |
869 | if(av.Animator!= null) | 871 | if(av.Animator!= null) |
@@ -924,7 +926,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
924 | ScenePresence av = avinfo.av; | 926 | ScenePresence av = avinfo.av; |
925 | av.ParentUUID = UUID.Zero; | 927 | av.ParentUUID = UUID.Zero; |
926 | av.ParentID = avinfo.ParentID; | 928 | av.ParentID = avinfo.ParentID; |
927 | av.crossingFlags = 0; | 929 | av.m_crossingFlags = 0; |
928 | } | 930 | } |
929 | } | 931 | } |
930 | avsToCross.Clear(); | 932 | avsToCross.Clear(); |
@@ -1330,6 +1332,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1330 | public SceneObjectGroup() | 1332 | public SceneObjectGroup() |
1331 | { | 1333 | { |
1332 | m_lastCollisionSoundMS = Util.GetTimeStampMS() + 1000.0; | 1334 | m_lastCollisionSoundMS = Util.GetTimeStampMS() + 1000.0; |
1335 | PseudoCRC = (int)(DateTime.UtcNow.Ticks); | ||
1333 | } | 1336 | } |
1334 | 1337 | ||
1335 | /// <summary> | 1338 | /// <summary> |
@@ -2441,6 +2444,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
2441 | } | 2444 | } |
2442 | } | 2445 | } |
2443 | 2446 | ||
2447 | public void SendUpdateProbes(IClientAPI remoteClient) | ||
2448 | { | ||
2449 | PrimUpdateFlags update = PrimUpdateFlags.UpdateProbe; | ||
2450 | |||
2451 | RootPart.SendUpdate(remoteClient, update); | ||
2452 | |||
2453 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
2454 | for (int i = 0; i < parts.Length; i++) | ||
2455 | { | ||
2456 | SceneObjectPart part = parts[i]; | ||
2457 | if (part != RootPart) | ||
2458 | part.SendUpdate(remoteClient, update); | ||
2459 | } | ||
2460 | } | ||
2461 | |||
2444 | #region Copying | 2462 | #region Copying |
2445 | 2463 | ||
2446 | /// <summary> | 2464 | /// <summary> |
@@ -2516,6 +2534,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2516 | } | 2534 | } |
2517 | 2535 | ||
2518 | dupe.InvalidatePartsLinkMaps(); | 2536 | dupe.InvalidatePartsLinkMaps(); |
2537 | dupe.PseudoCRC = (int)(DateTime.UtcNow.Ticks); | ||
2519 | m_dupeInProgress = false; | 2538 | m_dupeInProgress = false; |
2520 | return dupe; | 2539 | return dupe; |
2521 | } | 2540 | } |
@@ -2769,6 +2788,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2769 | } | 2788 | } |
2770 | } | 2789 | } |
2771 | 2790 | ||
2791 | PseudoCRC = (int)(DateTime.UtcNow.Ticks); | ||
2772 | rpart.ScheduleFullUpdate(); | 2792 | rpart.ScheduleFullUpdate(); |
2773 | } | 2793 | } |
2774 | 2794 | ||
@@ -2808,6 +2828,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2808 | part.ResetIDs(part.LinkNum); // Don't change link nums | 2828 | part.ResetIDs(part.LinkNum); // Don't change link nums |
2809 | m_parts.Add(part.UUID, part); | 2829 | m_parts.Add(part.UUID, part); |
2810 | } | 2830 | } |
2831 | PseudoCRC = (int)(DateTime.UtcNow.Ticks); | ||
2811 | } | 2832 | } |
2812 | } | 2833 | } |
2813 | 2834 | ||
@@ -3117,7 +3138,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3117 | } | 3138 | } |
3118 | } | 3139 | } |
3119 | 3140 | ||
3120 | |||
3121 | // 'linkPart' == the root of the group being linked into this group | 3141 | // 'linkPart' == the root of the group being linked into this group |
3122 | SceneObjectPart linkPart = objectGroup.m_rootPart; | 3142 | SceneObjectPart linkPart = objectGroup.m_rootPart; |
3123 | 3143 | ||
@@ -3160,7 +3180,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3160 | axPos *= Quaternion.Conjugate(parentRot); | 3180 | axPos *= Quaternion.Conjugate(parentRot); |
3161 | linkPart.OffsetPosition = axPos; | 3181 | linkPart.OffsetPosition = axPos; |
3162 | 3182 | ||
3163 | |||
3164 | // If there is only one SOP in a SOG, the LinkNum is zero. I.e., not a linkset. | 3183 | // If there is only one SOP in a SOG, the LinkNum is zero. I.e., not a linkset. |
3165 | // Now that we know this SOG has at least two SOPs in it, the new root | 3184 | // Now that we know this SOG has at least two SOPs in it, the new root |
3166 | // SOP becomes the first in the linkset. | 3185 | // SOP becomes the first in the linkset. |
@@ -3193,8 +3212,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3193 | 3212 | ||
3194 | linkPart.CreateSelected = true; | 3213 | linkPart.CreateSelected = true; |
3195 | 3214 | ||
3196 | // let physics know preserve part volume dtc messy since UpdatePrimFlags doesn't look to parent changes for now | 3215 | linkPart.UpdatePrimFlags(grpusephys, grptemporary, (IsPhantom || (linkPart.Flags & PrimFlags.Phantom) != 0), linkPart.VolumeDetectActive || RootPart.VolumeDetectActive, true); |
3197 | linkPart.UpdatePrimFlags(grpusephys, grptemporary, (IsPhantom || (linkPart.Flags & PrimFlags.Phantom) != 0), linkPart.VolumeDetectActive, true); | ||
3198 | 3216 | ||
3199 | // If the added SOP is physical, also tell the physics engine about the link relationship. | 3217 | // If the added SOP is physical, also tell the physics engine about the link relationship. |
3200 | if (linkPart.PhysActor != null && m_rootPart.PhysActor != null && m_rootPart.PhysActor.IsPhysical) | 3218 | if (linkPart.PhysActor != null && m_rootPart.PhysActor != null && m_rootPart.PhysActor.IsPhysical) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 312ce26..5e2204e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -312,7 +312,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
312 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; | 312 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; |
313 | private Vector3 m_sitTargetPosition; | 313 | private Vector3 m_sitTargetPosition; |
314 | private string m_sitAnimation = "SIT"; | 314 | private string m_sitAnimation = "SIT"; |
315 | private bool m_occupied; // KF if any av is sitting on this prim | ||
316 | private string m_text = String.Empty; | 315 | private string m_text = String.Empty; |
317 | private string m_touchName = String.Empty; | 316 | private string m_touchName = String.Empty; |
318 | private UndoRedoState m_UndoRedo = null; | 317 | private UndoRedoState m_UndoRedo = null; |
@@ -1001,7 +1000,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1001 | get | 1000 | get |
1002 | { | 1001 | { |
1003 | PhysicsActor actor = PhysActor; | 1002 | PhysicsActor actor = PhysActor; |
1004 | if (actor != null) | 1003 | if (actor != null && actor.IsPhysical) |
1005 | { | 1004 | { |
1006 | m_acceleration = actor.Acceleration; | 1005 | m_acceleration = actor.Acceleration; |
1007 | } | 1006 | } |
@@ -1038,8 +1037,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1038 | { | 1037 | { |
1039 | get | 1038 | get |
1040 | { | 1039 | { |
1041 | if (m_text.Length > 256) // yes > 254 | 1040 | if (m_text.Length > 254) |
1042 | return m_text.Substring(0, 256); | 1041 | return m_text.Substring(0, 254); |
1043 | return m_text; | 1042 | return m_text; |
1044 | } | 1043 | } |
1045 | set { m_text = value; } | 1044 | set { m_text = value; } |
@@ -1179,9 +1178,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1179 | 1178 | ||
1180 | set | 1179 | set |
1181 | { | 1180 | { |
1181 | string old = m_mediaUrl; | ||
1182 | m_mediaUrl = value; | 1182 | m_mediaUrl = value; |
1183 | 1183 | ||
1184 | if (ParentGroup != null) | 1184 | if (ParentGroup != null && old != m_mediaUrl) |
1185 | ParentGroup.HasGroupChanged = true; | 1185 | ParentGroup.HasGroupChanged = true; |
1186 | } | 1186 | } |
1187 | } | 1187 | } |
@@ -1385,13 +1385,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1385 | } | 1385 | } |
1386 | } | 1386 | } |
1387 | 1387 | ||
1388 | [XmlIgnore] | ||
1389 | public bool IsOccupied // KF If an av is sittingon this prim | ||
1390 | { | ||
1391 | get { return m_occupied; } | ||
1392 | set { m_occupied = value; } | ||
1393 | } | ||
1394 | |||
1395 | /// <summary> | 1388 | /// <summary> |
1396 | /// ID of the avatar that is sat on us if we have a sit target. If there is no such avatar then is UUID.Zero | 1389 | /// ID of the avatar that is sat on us if we have a sit target. If there is no such avatar then is UUID.Zero |
1397 | /// </summary> | 1390 | /// </summary> |
@@ -2338,10 +2331,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2338 | { | 2331 | { |
2339 | ParentGroup.Scene.RemovePhysicalPrim(1); | 2332 | ParentGroup.Scene.RemovePhysicalPrim(1); |
2340 | 2333 | ||
2341 | Velocity = new Vector3(0, 0, 0); | 2334 | Stop(); |
2342 | Acceleration = new Vector3(0, 0, 0); | ||
2343 | AngularVelocity = new Vector3(0, 0, 0); | ||
2344 | APIDActive = false; | ||
2345 | 2335 | ||
2346 | if (pa.Phantom && !VolumeDetectActive) | 2336 | if (pa.Phantom && !VolumeDetectActive) |
2347 | { | 2337 | { |
@@ -2475,13 +2465,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2475 | 2465 | ||
2476 | public uint GetEffectiveObjectFlags() | 2466 | public uint GetEffectiveObjectFlags() |
2477 | { | 2467 | { |
2478 | // Commenting this section of code out since it doesn't actually do anything, as enums are handled by | 2468 | uint eff = (uint)Flags | (uint)LocalFlags; |
2479 | // value rather than reference | 2469 | if(m_inventory == null || m_inventory.Count == 0) |
2480 | // PrimFlags f = _flags; | 2470 | eff |= (uint)PrimFlags.InventoryEmpty; |
2481 | // if (m_parentGroup == null || m_parentGroup.RootPart == this) | 2471 | return eff; |
2482 | // f &= ~(PrimFlags.Touch | PrimFlags.Money); | ||
2483 | |||
2484 | return (uint)Flags | (uint)LocalFlags; | ||
2485 | } | 2472 | } |
2486 | 2473 | ||
2487 | // some of this lines need be moved to other place later | 2474 | // some of this lines need be moved to other place later |
@@ -3896,15 +3883,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3896 | { | 3883 | { |
3897 | if (Shape.SculptEntry && !ignoreSculpt) | 3884 | if (Shape.SculptEntry && !ignoreSculpt) |
3898 | return PrimType.SCULPT; | 3885 | return PrimType.SCULPT; |
3899 | 3886 | ProfileShape ps = (ProfileShape)(Shape.ProfileCurve & 0x07); | |
3900 | if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Square) | 3887 | if (ps == ProfileShape.Square) |
3901 | { | 3888 | { |
3902 | if (Shape.PathCurve == (byte)Extrusion.Straight) | 3889 | if (Shape.PathCurve == (byte)Extrusion.Straight) |
3903 | return PrimType.BOX; | 3890 | return PrimType.BOX; |
3904 | else if (Shape.PathCurve == (byte)Extrusion.Curve1) | 3891 | else if (Shape.PathCurve == (byte)Extrusion.Curve1) |
3905 | return PrimType.TUBE; | 3892 | return PrimType.TUBE; |
3906 | } | 3893 | } |
3907 | else if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Circle) | 3894 | else if (ps == ProfileShape.Circle) |
3908 | { | 3895 | { |
3909 | if (Shape.PathCurve == (byte)Extrusion.Straight || Shape.PathCurve == (byte)Extrusion.Flexible) | 3896 | if (Shape.PathCurve == (byte)Extrusion.Straight || Shape.PathCurve == (byte)Extrusion.Flexible) |
3910 | return PrimType.CYLINDER; | 3897 | return PrimType.CYLINDER; |
@@ -3912,12 +3899,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3912 | else if (Shape.PathCurve == (byte)Extrusion.Curve1) | 3899 | else if (Shape.PathCurve == (byte)Extrusion.Curve1) |
3913 | return PrimType.TORUS; | 3900 | return PrimType.TORUS; |
3914 | } | 3901 | } |
3915 | else if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle) | 3902 | else if (ps == ProfileShape.HalfCircle) |
3916 | { | 3903 | { |
3917 | if (Shape.PathCurve == (byte)Extrusion.Curve1 || Shape.PathCurve == (byte)Extrusion.Curve2) | 3904 | if (Shape.PathCurve == (byte)Extrusion.Curve1 || Shape.PathCurve == (byte)Extrusion.Curve2) |
3918 | return PrimType.SPHERE; | 3905 | return PrimType.SPHERE; |
3919 | } | 3906 | } |
3920 | else if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.EquilateralTriangle) | 3907 | else if (ps == ProfileShape.EquilateralTriangle) |
3921 | { | 3908 | { |
3922 | if (Shape.PathCurve == (byte)Extrusion.Straight || Shape.PathCurve == (byte)Extrusion.Flexible) | 3909 | if (Shape.PathCurve == (byte)Extrusion.Straight || Shape.PathCurve == (byte)Extrusion.Flexible) |
3923 | return PrimType.PRISM; | 3910 | return PrimType.PRISM; |
@@ -4004,9 +3991,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
4004 | /// <param name="text"></param> | 3991 | /// <param name="text"></param> |
4005 | public void SetText(string text) | 3992 | public void SetText(string text) |
4006 | { | 3993 | { |
4007 | Text = text; | 3994 | string oldtext = m_text; |
3995 | m_text = text; | ||
4008 | 3996 | ||
4009 | if (ParentGroup != null) | 3997 | if (ParentGroup != null && oldtext != text) |
4010 | { | 3998 | { |
4011 | ParentGroup.HasGroupChanged = true; | 3999 | ParentGroup.HasGroupChanged = true; |
4012 | ScheduleFullUpdate(); | 4000 | ScheduleFullUpdate(); |
@@ -4021,11 +4009,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
4021 | /// <param name="alpha"></param> | 4009 | /// <param name="alpha"></param> |
4022 | public void SetText(string text, Vector3 color, double alpha) | 4010 | public void SetText(string text, Vector3 color, double alpha) |
4023 | { | 4011 | { |
4012 | Color oldcolor = Color; | ||
4013 | string oldtext = m_text; | ||
4024 | Color = Color.FromArgb((int) (alpha*0xff), | 4014 | Color = Color.FromArgb((int) (alpha*0xff), |
4025 | (int) (color.X*0xff), | 4015 | (int) (color.X*0xff), |
4026 | (int) (color.Y*0xff), | 4016 | (int) (color.Y*0xff), |
4027 | (int) (color.Z*0xff)); | 4017 | (int) (color.Z*0xff)); |
4028 | SetText(text); | 4018 | m_text = text; |
4019 | if(ParentGroup != null && (oldcolor != Color || oldtext != m_text)) | ||
4020 | { | ||
4021 | ParentGroup.HasGroupChanged = true; | ||
4022 | ScheduleFullUpdate(); | ||
4023 | } | ||
4029 | } | 4024 | } |
4030 | 4025 | ||
4031 | public void StoreUndoState(ObjectChangeType change) | 4026 | public void StoreUndoState(ObjectChangeType change) |
@@ -4722,14 +4717,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4722 | if ((SetPhantom && !UsePhysics && !SetVD) || ParentGroup.IsAttachment || PhysicsShapeType == (byte)PhysShapeType.none | 4717 | if ((SetPhantom && !UsePhysics && !SetVD) || ParentGroup.IsAttachment || PhysicsShapeType == (byte)PhysShapeType.none |
4723 | || (Shape.PathCurve == (byte)Extrusion.Flexible)) | 4718 | || (Shape.PathCurve == (byte)Extrusion.Flexible)) |
4724 | { | 4719 | { |
4720 | Stop(); | ||
4725 | if (pa != null) | 4721 | if (pa != null) |
4726 | { | 4722 | { |
4727 | if(wasUsingPhysics) | 4723 | if(wasUsingPhysics) |
4728 | ParentGroup.Scene.RemovePhysicalPrim(1); | 4724 | ParentGroup.Scene.RemovePhysicalPrim(1); |
4729 | RemoveFromPhysics(); | 4725 | RemoveFromPhysics(); |
4730 | } | 4726 | } |
4731 | |||
4732 | Stop(); | ||
4733 | } | 4727 | } |
4734 | 4728 | ||
4735 | else | 4729 | else |
@@ -5130,7 +5124,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
5130 | 5124 | ||
5131 | if (changeFlags == 0) | 5125 | if (changeFlags == 0) |
5132 | return; | 5126 | return; |
5133 | m_shape.TextureEntry = newTex.GetBytes(9); | 5127 | // we do need better compacter do just the trivial case |
5128 | if(nsides == 1 && newTex.FaceTextures[0] != null) | ||
5129 | { | ||
5130 | newTex.DefaultTexture = newTex.GetFace(0); | ||
5131 | newTex.FaceTextures[0] = null; | ||
5132 | } | ||
5133 | m_shape.TextureEntry = newTex.GetBytes(nsides); | ||
5134 | TriggerScriptChangedEvent(changeFlags); | 5134 | TriggerScriptChangedEvent(changeFlags); |
5135 | ParentGroup.HasGroupChanged = true; | 5135 | ParentGroup.HasGroupChanged = true; |
5136 | ScheduleUpdate(PrimUpdateFlags.Textures); | 5136 | ScheduleUpdate(PrimUpdateFlags.Textures); |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 1c5d23d..f569d21 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -99,6 +99,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
99 | public bool IsViewerUIGod { get; set; } | 99 | public bool IsViewerUIGod { get; set; } |
100 | public bool IsGod { get; set; } | 100 | public bool IsGod { get; set; } |
101 | 101 | ||
102 | private bool m_gotRegionHandShake = false; | ||
103 | |||
102 | private PresenceType m_presenceType; | 104 | private PresenceType m_presenceType; |
103 | public PresenceType PresenceType | 105 | public PresenceType PresenceType |
104 | { | 106 | { |
@@ -163,6 +165,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
163 | public static readonly float MOVEMENT = .25f; | 165 | public static readonly float MOVEMENT = .25f; |
164 | public static readonly float SIGNIFICANT_MOVEMENT = 16.0f; | 166 | public static readonly float SIGNIFICANT_MOVEMENT = 16.0f; |
165 | public static readonly float CHILDUPDATES_MOVEMENT = 100.0f; | 167 | public static readonly float CHILDUPDATES_MOVEMENT = 100.0f; |
168 | public static readonly float CHILDAGENTSCHECK_MOVEMENT = 1024f; // 32m | ||
166 | public static readonly float CHILDUPDATES_TIME = 2000f; // min time between child updates (ms) | 169 | public static readonly float CHILDUPDATES_TIME = 2000f; // min time between child updates (ms) |
167 | 170 | ||
168 | private UUID m_previusParcelUUID = UUID.Zero; | 171 | private UUID m_previusParcelUUID = UUID.Zero; |
@@ -288,7 +291,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
288 | private Quaternion m_lastRotation; | 291 | private Quaternion m_lastRotation; |
289 | private Vector3 m_lastVelocity; | 292 | private Vector3 m_lastVelocity; |
290 | private Vector3 m_lastSize = new Vector3(0.45f,0.6f,1.9f); | 293 | private Vector3 m_lastSize = new Vector3(0.45f,0.6f,1.9f); |
291 | private bool SentInitialData = false; | 294 | private int NeedInitialData = -1; |
292 | 295 | ||
293 | private int m_userFlags; | 296 | private int m_userFlags; |
294 | public int UserFlags | 297 | public int UserFlags |
@@ -339,8 +342,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
339 | private int m_lastChildUpdatesTime; | 342 | private int m_lastChildUpdatesTime; |
340 | private int m_lastChildAgentUpdateGodLevel; | 343 | private int m_lastChildAgentUpdateGodLevel; |
341 | private float m_lastChildAgentUpdateDrawDistance; | 344 | private float m_lastChildAgentUpdateDrawDistance; |
345 | private float m_lastRegionsDrawDistance; | ||
342 | private Vector3 m_lastChildAgentUpdatePosition; | 346 | private Vector3 m_lastChildAgentUpdatePosition; |
343 | // private Vector3 m_lastChildAgentUpdateCamPosition; | 347 | private Vector3 m_lastChildAgentCheckPosition; |
348 | // private Vector3 m_lastChildAgentUpdateCamPosition; | ||
344 | 349 | ||
345 | private Vector3 m_lastCameraRayCastCam; | 350 | private Vector3 m_lastCameraRayCastCam; |
346 | private Vector3 m_lastCameraRayCastPos; | 351 | private Vector3 m_lastCameraRayCastPos; |
@@ -457,9 +462,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
457 | #region For teleports and crossings callbacks | 462 | #region For teleports and crossings callbacks |
458 | 463 | ||
459 | /// <summary> | 464 | /// <summary> |
460 | /// In the V1 teleport protocol, the destination simulator sends ReleaseAgent to this address. | 465 | /// the destination simulator sends ReleaseAgent to this address, for very long range tps, HG. |
461 | /// </summary> | 466 | /// </summary> |
462 | private string m_callbackURI; | 467 | private string m_callbackURI; // to remove with v1 support |
468 | private string m_newCallbackURI; | ||
463 | 469 | ||
464 | /// <summary> | 470 | /// <summary> |
465 | /// Records the region from which this presence originated, if not from login. | 471 | /// Records the region from which this presence originated, if not from login. |
@@ -595,9 +601,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
595 | public string Firstname { get; private set; } | 601 | public string Firstname { get; private set; } |
596 | public string Lastname { get; private set; } | 602 | public string Lastname { get; private set; } |
597 | 603 | ||
598 | public bool haveGroupInformation; | 604 | public bool m_haveGroupInformation; |
599 | public bool gotCrossUpdate; | 605 | public bool m_gotCrossUpdate; |
600 | public byte crossingFlags; | 606 | public byte m_crossingFlags; |
601 | 607 | ||
602 | public string Grouptitle | 608 | public string Grouptitle |
603 | { | 609 | { |
@@ -624,7 +630,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
624 | { | 630 | { |
625 | get | 631 | get |
626 | { | 632 | { |
627 | return Util.Clamp(m_drawDistance, 32f, m_scene.MaxRegionViewDistance); | 633 | return Util.Clamp(m_drawDistance + 64f, m_scene.MinRegionViewDistance, m_scene.MaxRegionViewDistance); |
628 | } | 634 | } |
629 | } | 635 | } |
630 | 636 | ||
@@ -880,7 +886,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
880 | } | 886 | } |
881 | 887 | ||
882 | public bool IsChildAgent { get; set; } | 888 | public bool IsChildAgent { get; set; } |
883 | public bool IsLoggingIn { get; set; } | ||
884 | 889 | ||
885 | /// <summary> | 890 | /// <summary> |
886 | /// If the avatar is sitting, the local ID of the prim that it's sitting on. If not sitting then zero. | 891 | /// If the avatar is sitting, the local ID of the prim that it's sitting on. If not sitting then zero. |
@@ -1073,12 +1078,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
1073 | AttachmentsSyncLock = new Object(); | 1078 | AttachmentsSyncLock = new Object(); |
1074 | AllowMovement = true; | 1079 | AllowMovement = true; |
1075 | IsChildAgent = true; | 1080 | IsChildAgent = true; |
1076 | IsLoggingIn = false; | ||
1077 | m_sendCoarseLocationsMethod = SendCoarseLocationsDefault; | 1081 | m_sendCoarseLocationsMethod = SendCoarseLocationsDefault; |
1078 | Animator = new ScenePresenceAnimator(this); | 1082 | Animator = new ScenePresenceAnimator(this); |
1079 | Overrides = new MovementAnimationOverrides(); | 1083 | Overrides = new MovementAnimationOverrides(); |
1080 | PresenceType = type; | 1084 | PresenceType = type; |
1081 | DrawDistance = world.DefaultDrawDistance; | 1085 | m_drawDistance = client.StartFar; |
1086 | if(m_drawDistance > 32) | ||
1087 | { | ||
1088 | if(m_drawDistance > world.MaxDrawDistance) | ||
1089 | m_drawDistance = world.MaxDrawDistance; | ||
1090 | } | ||
1091 | else | ||
1092 | m_drawDistance = world.DefaultDrawDistance; | ||
1082 | RegionHandle = world.RegionInfo.RegionHandle; | 1093 | RegionHandle = world.RegionInfo.RegionHandle; |
1083 | ControllingClient = client; | 1094 | ControllingClient = client; |
1084 | Firstname = ControllingClient.FirstName; | 1095 | Firstname = ControllingClient.FirstName; |
@@ -1212,7 +1223,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1212 | ControllingClient.OnForceReleaseControls += HandleForceReleaseControls; | 1223 | ControllingClient.OnForceReleaseControls += HandleForceReleaseControls; |
1213 | ControllingClient.OnAutoPilotGo += MoveToTargetHandle; | 1224 | ControllingClient.OnAutoPilotGo += MoveToTargetHandle; |
1214 | ControllingClient.OnUpdateThrottles += RaiseUpdateThrottles; | 1225 | ControllingClient.OnUpdateThrottles += RaiseUpdateThrottles; |
1215 | // ControllingClient.OnAgentFOV += HandleAgentFOV; | 1226 | ControllingClient.OnRegionHandShakeReply += RegionHandShakeReply; |
1227 | |||
1228 | // ControllingClient.OnAgentFOV += HandleAgentFOV; | ||
1216 | 1229 | ||
1217 | // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); | 1230 | // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); |
1218 | // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); | 1231 | // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); |
@@ -1232,7 +1245,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1232 | ControllingClient.OnForceReleaseControls -= HandleForceReleaseControls; | 1245 | ControllingClient.OnForceReleaseControls -= HandleForceReleaseControls; |
1233 | ControllingClient.OnAutoPilotGo -= MoveToTargetHandle; | 1246 | ControllingClient.OnAutoPilotGo -= MoveToTargetHandle; |
1234 | ControllingClient.OnUpdateThrottles -= RaiseUpdateThrottles; | 1247 | ControllingClient.OnUpdateThrottles -= RaiseUpdateThrottles; |
1235 | // ControllingClient.OnAgentFOV += HandleAgentFOV; | 1248 | ControllingClient.OnRegionHandShakeReply -= RegionHandShakeReply; |
1249 | |||
1250 | // ControllingClient.OnAgentFOV += HandleAgentFOV; | ||
1236 | } | 1251 | } |
1237 | 1252 | ||
1238 | private void SetDirectionVectors() | 1253 | private void SetDirectionVectors() |
@@ -1302,13 +1317,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1302 | ParentPart = null; | 1317 | ParentPart = null; |
1303 | PrevSitOffset = Vector3.Zero; | 1318 | PrevSitOffset = Vector3.Zero; |
1304 | HandleForceReleaseControls(ControllingClient, UUID); // needs testing | 1319 | HandleForceReleaseControls(ControllingClient, UUID); // needs testing |
1305 | IsLoggingIn = false; | ||
1306 | } | 1320 | } |
1307 | else | 1321 | else |
1308 | { | 1322 | { |
1309 | part.AddSittingAvatar(this); | 1323 | part.AddSittingAvatar(this); |
1310 | // if not actually on the target invalidate it | 1324 | // if not actually on the target invalidate it |
1311 | if(gotCrossUpdate && (crossingFlags & 0x04) == 0) | 1325 | if(m_gotCrossUpdate && (m_crossingFlags & 0x04) == 0) |
1312 | part.SitTargetAvatar = UUID.Zero; | 1326 | part.SitTargetAvatar = UUID.Zero; |
1313 | 1327 | ||
1314 | ParentID = part.LocalId; | 1328 | ParentID = part.LocalId; |
@@ -1326,10 +1340,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1326 | } | 1340 | } |
1327 | ParentUUID = UUID.Zero; | 1341 | ParentUUID = UUID.Zero; |
1328 | } | 1342 | } |
1329 | else | ||
1330 | { | ||
1331 | IsLoggingIn = false; | ||
1332 | } | ||
1333 | 1343 | ||
1334 | IsChildAgent = false; | 1344 | IsChildAgent = false; |
1335 | } | 1345 | } |
@@ -1594,9 +1604,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1594 | public void MakeChildAgent(ulong newRegionHandle) | 1604 | public void MakeChildAgent(ulong newRegionHandle) |
1595 | { | 1605 | { |
1596 | m_updateAgentReceivedAfterTransferEvent.Reset(); | 1606 | m_updateAgentReceivedAfterTransferEvent.Reset(); |
1597 | haveGroupInformation = false; | 1607 | m_haveGroupInformation = false; |
1598 | gotCrossUpdate = false; | 1608 | m_gotCrossUpdate = false; |
1599 | crossingFlags = 0; | 1609 | m_crossingFlags = 0; |
1600 | m_scene.EventManager.OnRegionHeartbeatEnd -= RegionHeartbeatEnd; | 1610 | m_scene.EventManager.OnRegionHeartbeatEnd -= RegionHeartbeatEnd; |
1601 | 1611 | ||
1602 | RegionHandle = newRegionHandle; | 1612 | RegionHandle = newRegionHandle; |
@@ -1641,10 +1651,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1641 | m_previusParcelUUID = UUID.Zero; | 1651 | m_previusParcelUUID = UUID.Zero; |
1642 | m_currentParcelHide = false; | 1652 | m_currentParcelHide = false; |
1643 | m_currentParcelUUID = UUID.Zero; | 1653 | m_currentParcelUUID = UUID.Zero; |
1644 | // FIXME: Set RegionHandle to the region handle of the scene this agent is moving into | 1654 | |
1645 | |||
1646 | CollisionPlane = Vector4.UnitW; | 1655 | CollisionPlane = Vector4.UnitW; |
1647 | 1656 | ||
1657 | // we need to kill this on agents that do not see the new region | ||
1658 | m_scene.ForEachRootScenePresence(delegate(ScenePresence p) | ||
1659 | { | ||
1660 | if (!p.knowsNeighbourRegion(newRegionHandle)) | ||
1661 | { | ||
1662 | SendKillTo(p); | ||
1663 | } | ||
1664 | }); | ||
1648 | m_scene.EventManager.TriggerOnMakeChildAgent(this); | 1665 | m_scene.EventManager.TriggerOnMakeChildAgent(this); |
1649 | } | 1666 | } |
1650 | 1667 | ||
@@ -1671,10 +1688,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1671 | // } | 1688 | // } |
1672 | } | 1689 | } |
1673 | 1690 | ||
1674 | /// <summary> | ||
1675 | /// Do not call this directly. Call Scene.RequestTeleportLocation() instead. | ||
1676 | /// </summary> | ||
1677 | /// <param name="pos"></param> | ||
1678 | public void Teleport(Vector3 pos) | 1691 | public void Teleport(Vector3 pos) |
1679 | { | 1692 | { |
1680 | TeleportWithMomentum(pos, Vector3.Zero); | 1693 | TeleportWithMomentum(pos, Vector3.Zero); |
@@ -1719,37 +1732,95 @@ namespace OpenSim.Region.Framework.Scenes | |||
1719 | SendTerseUpdateToAllClients(); | 1732 | SendTerseUpdateToAllClients(); |
1720 | } | 1733 | } |
1721 | 1734 | ||
1722 | public void avnLocalTeleport(Vector3 newpos, Vector3? newvel, bool rotateToVelXY) | 1735 | public void LocalTeleport(Vector3 newpos, Vector3 newvel, Vector3 newlookat, int flags) |
1723 | { | 1736 | { |
1724 | if(!CheckLocalTPLandingPoint(ref newpos)) | 1737 | if (newpos.X <= 0) |
1725 | return; | 1738 | { |
1739 | newpos.X = 0.1f; | ||
1740 | if (newvel.X < 0) | ||
1741 | newvel.X = 0; | ||
1742 | } | ||
1743 | else if (newpos.X >= Scene.RegionInfo.RegionSizeX) | ||
1744 | { | ||
1745 | newpos.X = Scene.RegionInfo.RegionSizeX - 0.1f; | ||
1746 | if (newvel.X > 0) | ||
1747 | newvel.X = 0; | ||
1748 | } | ||
1749 | |||
1750 | if (newpos.Y <= 0) | ||
1751 | { | ||
1752 | newpos.Y = 0.1f; | ||
1753 | if (newvel.Y < 0) | ||
1754 | newvel.Y = 0; | ||
1755 | } | ||
1756 | else if (newpos.Y >= Scene.RegionInfo.RegionSizeY) | ||
1757 | { | ||
1758 | newpos.Y = Scene.RegionInfo.RegionSizeY - 0.1f; | ||
1759 | if (newvel.Y > 0) | ||
1760 | newvel.Y = 0; | ||
1761 | } | ||
1726 | 1762 | ||
1727 | AbsolutePosition = newpos; | 1763 | string reason; |
1764 | if (!m_scene.TestLandRestrictions(UUID, out reason, ref newpos.X, ref newpos.Y)) | ||
1765 | return ; | ||
1766 | |||
1767 | if (IsSatOnObject) | ||
1768 | StandUp(); | ||
1769 | |||
1770 | float localHalfAVHeight = 0.8f; | ||
1771 | if (Appearance != null) | ||
1772 | localHalfAVHeight = Appearance.AvatarHeight * 0.5f; | ||
1728 | 1773 | ||
1729 | if (newvel.HasValue) | 1774 | float posZLimit = (float)Scene.Heightmap[(int)newpos.X, (int)newpos.Y]; |
1775 | posZLimit += localHalfAVHeight + 0.1f; | ||
1776 | if (newpos.Z < posZLimit) | ||
1777 | newpos.Z = posZLimit; | ||
1778 | |||
1779 | if((flags & 0x1e) != 0) | ||
1730 | { | 1780 | { |
1731 | if ((Vector3)newvel == Vector3.Zero) | 1781 | if ((flags & 8) != 0) |
1782 | Flying = true; | ||
1783 | else if ((flags & 16) != 0) | ||
1784 | Flying = false; | ||
1785 | |||
1786 | uint tpflags = (uint)TeleportFlags.ViaLocation; | ||
1787 | if(Flying) | ||
1788 | tpflags |= (uint)TeleportFlags.IsFlying; | ||
1789 | |||
1790 | Vector3 lookat = Lookat; | ||
1791 | |||
1792 | if ((flags & 2) != 0) | ||
1732 | { | 1793 | { |
1733 | if (PhysicsActor != null) | 1794 | newlookat.Z = 0; |
1734 | PhysicsActor.SetMomentum(Vector3.Zero); | 1795 | newlookat.Normalize(); |
1735 | m_velocity = Vector3.Zero; | 1796 | if (Math.Abs(newlookat.X) > 0.001 || Math.Abs(newlookat.Y) > 0.001) |
1797 | lookat = newlookat; | ||
1736 | } | 1798 | } |
1737 | else | 1799 | else if((flags & 4) != 0) |
1738 | { | 1800 | { |
1739 | if (PhysicsActor != null) | 1801 | if((flags & 1) != 0) |
1740 | PhysicsActor.SetMomentum((Vector3)newvel); | 1802 | newlookat = newvel; |
1741 | m_velocity = (Vector3)newvel; | 1803 | else |
1742 | 1804 | newlookat = m_velocity; | |
1743 | if (rotateToVelXY) | 1805 | newlookat.Z = 0; |
1744 | { | 1806 | newlookat.Normalize(); |
1745 | Vector3 lookAt = (Vector3)newvel; | 1807 | if (Math.Abs(newlookat.X) > 0.001 || Math.Abs(newlookat.Y) > 0.001) |
1746 | lookAt.Z = 0; | 1808 | lookat = newlookat; |
1747 | lookAt.Normalize(); | ||
1748 | ControllingClient.SendLocalTeleport(newpos, lookAt, (uint)TeleportFlags.ViaLocation); | ||
1749 | return; | ||
1750 | } | ||
1751 | } | 1809 | } |
1810 | |||
1811 | AbsolutePosition = newpos; | ||
1812 | ControllingClient.SendLocalTeleport(newpos, lookat, tpflags); | ||
1752 | } | 1813 | } |
1814 | else | ||
1815 | AbsolutePosition = newpos; | ||
1816 | |||
1817 | if ((flags & 1) != 0) | ||
1818 | { | ||
1819 | if (PhysicsActor != null) | ||
1820 | PhysicsActor.SetMomentum(newvel); | ||
1821 | m_velocity = newvel; | ||
1822 | } | ||
1823 | |||
1753 | SendTerseUpdateToAllClients(); | 1824 | SendTerseUpdateToAllClients(); |
1754 | } | 1825 | } |
1755 | 1826 | ||
@@ -2126,277 +2197,233 @@ namespace OpenSim.Region.Framework.Scenes | |||
2126 | return; | 2197 | return; |
2127 | } | 2198 | } |
2128 | 2199 | ||
2200 | if(IsChildAgent) | ||
2201 | { | ||
2202 | return; // how? | ||
2203 | } | ||
2129 | 2204 | ||
2130 | //m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 2205 | //m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
2131 | 2206 | ||
2132 | if(!haveGroupInformation && !IsChildAgent && !IsNPC) | 2207 | if (!IsNPC) |
2133 | { | 2208 | { |
2134 | IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); | 2209 | if (!m_haveGroupInformation) |
2135 | if (gm != null) | 2210 | { |
2136 | Grouptitle = gm.GetGroupTitle(m_uuid); | 2211 | IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); |
2212 | if (gm != null) | ||
2213 | Grouptitle = gm.GetGroupTitle(m_uuid); | ||
2137 | 2214 | ||
2138 | //m_log.DebugFormat("[CompleteMovement] Missing Grouptitle: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 2215 | //m_log.DebugFormat("[CompleteMovement] Missing Grouptitle: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
2139 | 2216 | ||
2140 | InventoryFolderBase cof = m_scene.InventoryService.GetFolderForType(client.AgentId, (FolderType)46); | 2217 | InventoryFolderBase cof = m_scene.InventoryService.GetFolderForType(client.AgentId, (FolderType)46); |
2141 | if (cof == null) | 2218 | if (cof == null) |
2142 | COF = UUID.Zero; | 2219 | COF = UUID.Zero; |
2143 | else | 2220 | else |
2144 | COF = cof.ID; | 2221 | COF = cof.ID; |
2145 | 2222 | ||
2146 | m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF); | 2223 | m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF); |
2224 | } | ||
2147 | } | 2225 | } |
2148 | 2226 | ||
2149 | if (!string.IsNullOrEmpty(m_callbackURI)) | 2227 | if (m_teleportFlags > 0) |
2150 | { | 2228 | m_gotCrossUpdate = false; // sanity check |
2151 | // We cannot sleep here since this would hold up the inbound packet processing thread, as | ||
2152 | // CompleteMovement() is executed synchronously. However, it might be better to delay the release | ||
2153 | // here until we know for sure that the agent is active in this region. Sending AgentMovementComplete | ||
2154 | // is not enough for Imprudence clients - there appears to be a small delay (<200ms, <500ms) until they regard this | ||
2155 | // region as the current region, meaning that a close sent before then will fail the teleport. | ||
2156 | // System.Threading.Thread.Sleep(2000); | ||
2157 | 2229 | ||
2158 | m_log.DebugFormat( | 2230 | if (!m_gotCrossUpdate) |
2159 | "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}", | 2231 | RotateToLookAt(look); |
2160 | client.Name, client.AgentId, m_callbackURI); | ||
2161 | 2232 | ||
2162 | UUID originID; | 2233 | m_previusParcelHide = false; |
2234 | m_previusParcelUUID = UUID.Zero; | ||
2235 | m_currentParcelHide = false; | ||
2236 | m_currentParcelUUID = UUID.Zero; | ||
2237 | ParcelDwellTickMS = Util.GetTimeStampMS(); | ||
2163 | 2238 | ||
2164 | lock (m_originRegionIDAccessLock) | 2239 | m_inTransit = false; |
2165 | originID = m_originRegionID; | ||
2166 | 2240 | ||
2167 | Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI); | 2241 | // Tell the client that we're ready to send rest |
2168 | m_callbackURI = null; | 2242 | if (!m_gotCrossUpdate) |
2169 | //m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 2243 | { |
2244 | m_gotRegionHandShake = false; // allow it if not a crossing | ||
2245 | ControllingClient.SendRegionHandshake(); | ||
2170 | } | 2246 | } |
2171 | // else | ||
2172 | // { | ||
2173 | // m_log.DebugFormat( | ||
2174 | // "[SCENE PRESENCE]: No callback provided on CompleteMovement of {0} {1} to {2}", | ||
2175 | // client.Name, client.AgentId, m_scene.RegionInfo.RegionName); | ||
2176 | // } | ||
2177 | 2247 | ||
2178 | |||
2179 | // Tell the client that we're totally ready | ||
2180 | ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); | 2248 | ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); |
2181 | //m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | ||
2182 | 2249 | ||
2183 | bool isHGTP = (m_teleportFlags & TeleportFlags.ViaHGLogin) != 0; | 2250 | bool isHGTP = (m_teleportFlags & TeleportFlags.ViaHGLogin) != 0; |
2184 | 2251 | ||
2185 | int delayctnr = Util.EnvironmentTickCount(); | 2252 | if(!IsNPC) |
2186 | |||
2187 | if (!IsChildAgent) | ||
2188 | { | 2253 | { |
2189 | if( ParentPart != null && !IsNPC && (crossingFlags & 0x08) != 0) | 2254 | if( ParentPart != null && (m_crossingFlags & 0x08) != 0) |
2190 | { | 2255 | { |
2191 | ParentPart.ParentGroup.SendFullAnimUpdateToClient(ControllingClient); | 2256 | ParentPart.ParentGroup.SendFullAnimUpdateToClient(ControllingClient); |
2192 | } | 2257 | } |
2193 | 2258 | ||
2194 | // verify baked textures and cache | 2259 | // verify baked textures and cache |
2195 | bool cachedbaked = false; | 2260 | if (m_scene.AvatarFactory != null && !isHGTP) |
2196 | |||
2197 | if (IsNPC) | ||
2198 | cachedbaked = true; | ||
2199 | else | ||
2200 | { | 2261 | { |
2201 | if (m_scene.AvatarFactory != null && !isHGTP) | 2262 | if (!m_scene.AvatarFactory.ValidateBakedTextureCache(this)) |
2202 | cachedbaked = m_scene.AvatarFactory.ValidateBakedTextureCache(this); | 2263 | m_scene.AvatarFactory.QueueAppearanceSave(UUID); |
2203 | |||
2204 | // not sure we need this | ||
2205 | if (!cachedbaked) | ||
2206 | { | ||
2207 | if (m_scene.AvatarFactory != null) | ||
2208 | m_scene.AvatarFactory.QueueAppearanceSave(UUID); | ||
2209 | } | ||
2210 | } | 2264 | } |
2211 | //m_log.DebugFormat("[CompleteMovement] Baked check: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | ||
2212 | } | 2265 | } |
2213 | 2266 | ||
2214 | if(m_teleportFlags > 0) | ||
2215 | { | ||
2216 | gotCrossUpdate = false; // sanity check | ||
2217 | if(Util.EnvironmentTickCountSubtract(delayctnr)< 500) | ||
2218 | Thread.Sleep(500); // let viewers catch us | ||
2219 | } | ||
2220 | |||
2221 | if(!gotCrossUpdate) | ||
2222 | RotateToLookAt(look); | ||
2223 | |||
2224 | // HG | ||
2225 | if(isHGTP) | 2267 | if(isHGTP) |
2226 | { | 2268 | { |
2227 | // ControllingClient.SendNameReply(m_uuid, Firstname, Lastname); | 2269 | // ControllingClient.SendNameReply(m_uuid, Firstname, Lastname); |
2228 | m_log.DebugFormat("[CompleteMovement] HG"); | 2270 | m_log.DebugFormat("[CompleteMovement] HG"); |
2229 | } | 2271 | } |
2230 | 2272 | ||
2231 | m_previusParcelHide = false; | 2273 | if (!IsNPC) |
2232 | m_previusParcelUUID = UUID.Zero; | ||
2233 | m_currentParcelHide = false; | ||
2234 | m_currentParcelUUID = UUID.Zero; | ||
2235 | ParcelDwellTickMS = Util.GetTimeStampMS(); | ||
2236 | |||
2237 | if(!IsNPC) | ||
2238 | { | 2274 | { |
2239 | GodController.SyncViewerState(); | 2275 | GodController.SyncViewerState(); |
2240 | 2276 | ||
2241 | // start sending terrain patchs | 2277 | // start sending terrain patchs |
2242 | if (!gotCrossUpdate) | 2278 | if (!m_gotCrossUpdate) |
2243 | Scene.SendLayerData(ControllingClient); | 2279 | Scene.SendLayerData(ControllingClient); |
2244 | } | ||
2245 | // send initial land overlay and parcel | ||
2246 | ILandChannel landch = m_scene.LandChannel; | ||
2247 | if (landch != null) | ||
2248 | landch.sendClientInitialLandInfo(client); | ||
2249 | 2280 | ||
2250 | if (!IsChildAgent) | 2281 | // send initial land overlay and parcel |
2251 | { | 2282 | ILandChannel landch = m_scene.LandChannel; |
2252 | List<ScenePresence> allpresences = m_scene.GetScenePresences(); | 2283 | if (landch != null) |
2284 | landch.sendClientInitialLandInfo(client, !m_gotCrossUpdate); | ||
2285 | } | ||
2253 | 2286 | ||
2254 | // send avatar object to all presences including us, so they cross it into region | 2287 | List<ScenePresence> allpresences = m_scene.GetScenePresences(); |
2255 | // then hide if necessary | ||
2256 | 2288 | ||
2257 | SendInitialAvatarDataToAllAgents(allpresences); | 2289 | // send avatar object to all presences including us, so they cross it into region |
2290 | // then hide if necessary | ||
2291 | SendInitialAvatarDataToAllAgents(allpresences); | ||
2258 | 2292 | ||
2259 | // send this look | 2293 | // send this look |
2294 | if (!IsNPC) | ||
2260 | SendAppearanceToAgent(this); | 2295 | SendAppearanceToAgent(this); |
2261 | 2296 | ||
2262 | // send this animations | 2297 | // send this animations |
2263 | 2298 | ||
2264 | UUID[] animIDs = null; | 2299 | UUID[] animIDs = null; |
2265 | int[] animseqs = null; | 2300 | int[] animseqs = null; |
2266 | UUID[] animsobjs = null; | 2301 | UUID[] animsobjs = null; |
2267 | 2302 | ||
2268 | if (Animator != null) | 2303 | if (Animator != null) |
2269 | Animator.GetArrays(out animIDs, out animseqs, out animsobjs); | 2304 | Animator.GetArrays(out animIDs, out animseqs, out animsobjs); |
2270 | 2305 | ||
2271 | bool haveAnims = (animIDs != null && animseqs != null && animsobjs != null); | 2306 | bool haveAnims = (animIDs != null && animseqs != null && animsobjs != null); |
2272 | 2307 | ||
2273 | if (haveAnims) | 2308 | if (!IsNPC && haveAnims) |
2274 | SendAnimPackToAgent(this, animIDs, animseqs, animsobjs); | 2309 | SendAnimPackToAgent(this, animIDs, animseqs, animsobjs); |
2275 | 2310 | ||
2276 | // we should be able to receive updates, etc | 2311 | // send look and animations to others |
2277 | // so release them | 2312 | // if not cached we send greys |
2278 | m_inTransit = false; | 2313 | // uncomented if will wait till avatar does baking |
2314 | //if (cachedbaked) | ||
2279 | 2315 | ||
2280 | // send look and animations to others | 2316 | { |
2281 | // if not cached we send greys | 2317 | foreach (ScenePresence p in allpresences) |
2282 | // uncomented if will wait till avatar does baking | ||
2283 | //if (cachedbaked) | ||
2284 | { | 2318 | { |
2285 | foreach (ScenePresence p in allpresences) | 2319 | if (p == this) |
2286 | { | 2320 | continue; |
2287 | if (p == this) | ||
2288 | continue; | ||
2289 | |||
2290 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) | ||
2291 | continue; | ||
2292 | |||
2293 | SendAppearanceToAgentNF(p); | ||
2294 | if (haveAnims) | ||
2295 | SendAnimPackToAgentNF(p, animIDs, animseqs, animsobjs); | ||
2296 | } | ||
2297 | } // greys if | ||
2298 | 2321 | ||
2299 | //m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 2322 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) |
2323 | continue; | ||
2300 | 2324 | ||
2301 | // attachments | 2325 | SendAppearanceToAgentNF(p); |
2302 | if (IsNPC || IsRealLogin(m_teleportFlags)) | 2326 | if (haveAnims) |
2303 | { | 2327 | SendAnimPackToAgentNF(p, animIDs, animseqs, animsobjs); |
2304 | if (Scene.AttachmentsModule != null) | 2328 | } |
2305 | // Util.FireAndForget( | 2329 | } |
2306 | // o => | ||
2307 | // { | ||
2308 | 2330 | ||
2309 | if (!IsNPC) | 2331 | // attachments |
2310 | Scene.AttachmentsModule.RezAttachments(this); | 2332 | if (IsNPC || IsRealLogin(m_teleportFlags)) |
2311 | else | 2333 | { |
2312 | Util.FireAndForget(x => | 2334 | if (Scene.AttachmentsModule != null) |
2335 | { | ||
2336 | if(IsNPC) | ||
2337 | { | ||
2338 | Util.FireAndForget(x => | ||
2313 | { | 2339 | { |
2314 | Scene.AttachmentsModule.RezAttachments(this); | 2340 | Scene.AttachmentsModule.RezAttachments(this); |
2315 | }); | 2341 | }); |
2316 | 2342 | } | |
2317 | // }); | 2343 | else |
2344 | Scene.AttachmentsModule.RezAttachments(this); | ||
2318 | } | 2345 | } |
2319 | else | 2346 | } |
2347 | else | ||
2348 | { | ||
2349 | if (m_attachments.Count > 0) | ||
2320 | { | 2350 | { |
2321 | if (m_attachments.Count > 0) | 2351 | foreach (SceneObjectGroup sog in m_attachments) |
2322 | { | 2352 | { |
2323 | // m_log.DebugFormat( | 2353 | sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); |
2324 | // "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); | 2354 | sog.ResumeScripts(); |
2355 | } | ||
2325 | 2356 | ||
2326 | foreach (SceneObjectGroup sog in m_attachments) | 2357 | foreach (ScenePresence p in allpresences) |
2358 | { | ||
2359 | if (p == this) | ||
2327 | { | 2360 | { |
2328 | sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); | 2361 | SendAttachmentsToAgentNF(this); |
2329 | sog.ResumeScripts(); | 2362 | continue; |
2330 | } | 2363 | } |
2331 | 2364 | ||
2332 | foreach (ScenePresence p in allpresences) | 2365 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) |
2333 | { | 2366 | continue; |
2334 | if (p == this) | ||
2335 | { | ||
2336 | SendAttachmentsToAgentNF(this); | ||
2337 | continue; | ||
2338 | } | ||
2339 | |||
2340 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) | ||
2341 | continue; | ||
2342 | 2367 | ||
2343 | SendAttachmentsToAgentNF(p); | 2368 | SendAttachmentsToAgentNF(p); |
2344 | } | ||
2345 | } | 2369 | } |
2346 | } | 2370 | } |
2371 | } | ||
2347 | 2372 | ||
2348 | //m_log.DebugFormat("[CompleteMovement] attachments: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 2373 | if (!IsNPC) |
2349 | if (openChildAgents) | 2374 | { |
2375 | if(m_gotCrossUpdate) | ||
2350 | { | 2376 | { |
2377 | SendOtherAgentsAvatarFullToMe(); | ||
2378 | |||
2351 | // Create child agents in neighbouring regions | 2379 | // Create child agents in neighbouring regions |
2352 | IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); | 2380 | IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); |
2353 | if (m_agentTransfer != null) | 2381 | if (m_agentTransfer != null) |
2354 | { | 2382 | { |
2355 | m_agentTransfer.EnableChildAgents(this); | 2383 | m_agentTransfer.EnableChildAgents(this); |
2356 | } | 2384 | } |
2357 | } | ||
2358 | 2385 | ||
2359 | m_lastChildUpdatesTime = Util.EnvironmentTickCount() + 10000; | 2386 | m_lastChildUpdatesTime = Util.EnvironmentTickCount() + 10000; |
2360 | m_lastChildAgentUpdatePosition = AbsolutePosition; | 2387 | m_lastChildAgentUpdatePosition = AbsolutePosition; |
2361 | m_lastChildAgentUpdateDrawDistance = DrawDistance; | 2388 | m_lastChildAgentCheckPosition = m_lastChildAgentUpdatePosition; |
2389 | m_lastChildAgentUpdateDrawDistance = DrawDistance; | ||
2390 | m_lastRegionsDrawDistance = RegionViewDistance; | ||
2362 | 2391 | ||
2363 | m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; | 2392 | m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; |
2364 | m_childUpdatesBusy = false; // allow them | 2393 | m_childUpdatesBusy = false; // allow them |
2365 | } | ||
2366 | 2394 | ||
2367 | //m_log.DebugFormat("[CompleteMovement] openChildAgents: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 2395 | } |
2368 | |||
2369 | // send the rest of the world | ||
2370 | if (m_teleportFlags > 0 && !IsNPC || m_currentParcelHide) | ||
2371 | SendInitialDataToMe(); | ||
2372 | 2396 | ||
2373 | // priority uses avatar position only | 2397 | // send the rest of the world |
2374 | // m_reprioritizationLastPosition = AbsolutePosition; | 2398 | //if (m_teleportFlags > 0 || m_currentParcelHide) |
2375 | // m_reprioritizationLastDrawDistance = DrawDistance; | 2399 | //SendInitialDataToMe(); |
2376 | // m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it | 2400 | //SendOtherAgentsAvatarFullToMe(); |
2377 | // m_reprioritizationBusy = false; | ||
2378 | 2401 | ||
2379 | //m_log.DebugFormat("[CompleteMovement] SendInitialDataToMe: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 2402 | // priority uses avatar position only |
2403 | // m_reprioritizationLastPosition = AbsolutePosition; | ||
2404 | // m_reprioritizationLastDrawDistance = DrawDistance; | ||
2405 | // m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it | ||
2406 | // m_reprioritizationBusy = false; | ||
2380 | 2407 | ||
2381 | if (!IsChildAgent && openChildAgents) | 2408 | if (openChildAgents) |
2382 | { | ||
2383 | IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); | ||
2384 | if (friendsModule != null) | ||
2385 | { | 2409 | { |
2386 | if(gotCrossUpdate) | 2410 | IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); |
2387 | friendsModule.IsNowRoot(this); | 2411 | if (friendsModule != null) |
2388 | else | 2412 | { |
2389 | friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); | 2413 | if(m_gotCrossUpdate) |
2414 | friendsModule.IsNowRoot(this); | ||
2415 | else | ||
2416 | friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); | ||
2417 | } | ||
2418 | //m_log.DebugFormat("[CompleteMovement] friendsModule: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | ||
2390 | } | 2419 | } |
2391 | //m_log.DebugFormat("[CompleteMovement] friendsModule: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | ||
2392 | |||
2393 | } | 2420 | } |
2394 | } | 2421 | } |
2395 | finally | 2422 | finally |
2396 | { | 2423 | { |
2397 | haveGroupInformation = false; | 2424 | m_haveGroupInformation = false; |
2398 | gotCrossUpdate = false; | 2425 | m_gotCrossUpdate = false; |
2399 | crossingFlags = 0; | 2426 | m_crossingFlags = 0; |
2400 | m_inTransit = false; | 2427 | m_inTransit = false; |
2401 | } | 2428 | } |
2402 | 2429 | ||
@@ -3108,10 +3135,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3108 | Vector2 regionSize; | 3135 | Vector2 regionSize; |
3109 | regionSize = new Vector2(m_scene.RegionInfo.RegionSizeX, m_scene.RegionInfo.RegionSizeY); | 3136 | regionSize = new Vector2(m_scene.RegionInfo.RegionSizeX, m_scene.RegionInfo.RegionSizeY); |
3110 | 3137 | ||
3111 | if (pos.X < 0 || pos.X >= regionSize.X | 3138 | if (pos.X < 0.5f) |
3112 | || pos.Y < 0 || pos.Y >= regionSize.Y | 3139 | pos.X = 0.5f; |
3113 | || pos.Z < 0) | 3140 | else if (pos.X > regionSize.X - 0.5f) |
3114 | return; | 3141 | pos.X = regionSize.X - 0.5f; |
3142 | if (pos.Y < 0.5f) | ||
3143 | pos.Y = 0.5f; | ||
3144 | else if (pos.Y > regionSize.Y - 0.5f) | ||
3145 | pos.Y = regionSize.Y - 0.5f; | ||
3115 | 3146 | ||
3116 | float terrainHeight; | 3147 | float terrainHeight; |
3117 | Scene targetScene = m_scene; | 3148 | Scene targetScene = m_scene; |
@@ -3709,10 +3740,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3709 | if (IsChildAgent) | 3740 | if (IsChildAgent) |
3710 | return; | 3741 | return; |
3711 | 3742 | ||
3712 | // m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick.. | ||
3713 | sitAnimation = "SIT_GROUND_CONSTRAINED"; | 3743 | sitAnimation = "SIT_GROUND_CONSTRAINED"; |
3714 | // Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); | ||
3715 | // TriggerScenePresenceUpdated(); | ||
3716 | SitGround = true; | 3744 | SitGround = true; |
3717 | RemoveFromPhysicalScene(); | 3745 | RemoveFromPhysicalScene(); |
3718 | 3746 | ||
@@ -3813,14 +3841,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3813 | direc.Z = 0; | 3841 | direc.Z = 0; |
3814 | } | 3842 | } |
3815 | 3843 | ||
3816 | // m_log.DebugFormat("[SCENE PRESENCE]: Setting force to apply to {0} for {1}", direc, Name); | ||
3817 | /* | ||
3818 | lock(m_forceToApplyLock) | ||
3819 | { | ||
3820 | m_forceToApply = direc; | ||
3821 | m_forceToApplyValid = true; | ||
3822 | } | ||
3823 | */ | ||
3824 | TargetVelocity = direc; | 3844 | TargetVelocity = direc; |
3825 | Animator.UpdateMovementAnimations(); | 3845 | Animator.UpdateMovementAnimations(); |
3826 | } | 3846 | } |
@@ -3837,15 +3857,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
3837 | 3857 | ||
3838 | public override void Update() | 3858 | public override void Update() |
3839 | { | 3859 | { |
3840 | if(IsChildAgent || IsDeleted) | 3860 | if (IsDeleted) |
3841 | return; | 3861 | return; |
3842 | 3862 | ||
3843 | CheckForBorderCrossing(); | 3863 | if (NeedInitialData > 0) |
3864 | { | ||
3865 | SendInitialData(); | ||
3866 | return; | ||
3867 | } | ||
3844 | 3868 | ||
3845 | if (IsInTransit || IsLoggingIn) | 3869 | if (IsChildAgent || IsInTransit) |
3846 | return; | 3870 | return; |
3847 | 3871 | ||
3848 | if(m_movingToTarget) | 3872 | CheckForBorderCrossing(); |
3873 | |||
3874 | if (m_movingToTarget) | ||
3849 | { | 3875 | { |
3850 | m_delayedStop = -1; | 3876 | m_delayedStop = -1; |
3851 | Vector3 control = Vector3.Zero; | 3877 | Vector3 control = Vector3.Zero; |
@@ -4020,29 +4046,95 @@ namespace OpenSim.Region.Framework.Scenes | |||
4020 | ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); | 4046 | ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); |
4021 | } | 4047 | } |
4022 | 4048 | ||
4023 | public void SendInitialDataToMe() | 4049 | public void RegionHandShakeReply (IClientAPI client) |
4024 | { | 4050 | { |
4025 | // Send all scene object to the new client | 4051 | if(IsNPC) |
4026 | SentInitialData = true; | 4052 | return; |
4053 | |||
4054 | lock (m_completeMovementLock) | ||
4055 | { | ||
4056 | if(m_gotRegionHandShake) | ||
4057 | return; | ||
4058 | m_gotRegionHandShake = true; | ||
4059 | NeedInitialData = 1; | ||
4060 | } | ||
4061 | } | ||
4062 | |||
4063 | private void SendInitialData() | ||
4064 | { | ||
4065 | uint flags = ControllingClient.GetViewerCaps(); | ||
4066 | if((flags & 0x1000) == 0) // wait for seeds sending | ||
4067 | return; | ||
4068 | |||
4069 | // lock (m_completeMovementLock) | ||
4070 | { | ||
4071 | if(NeedInitialData < 0) | ||
4072 | return; | ||
4073 | |||
4074 | // give some extra time to make sure viewers did process seeds | ||
4075 | if(++NeedInitialData < 4) // needs fix if update rate changes on heartbeat | ||
4076 | return; | ||
4077 | } | ||
4078 | |||
4079 | NeedInitialData = -1; | ||
4080 | |||
4081 | bool selfappearance = (flags & 4) != 0; | ||
4082 | |||
4083 | // this should enqueued on the client processing job to save threads | ||
4027 | Util.FireAndForget(delegate | 4084 | Util.FireAndForget(delegate |
4028 | { | 4085 | { |
4029 | // we created a new ScenePresence (a new child agent) in a fresh region. | 4086 | if(!IsChildAgent) |
4030 | // Request info about all the (root) agents in this region | 4087 | { |
4031 | // Note: This won't send data *to* other clients in that region (children don't send) | 4088 | // close v1 sender region obsolete |
4089 | if (!string.IsNullOrEmpty(m_callbackURI)) | ||
4090 | { | ||
4091 | m_log.DebugFormat( | ||
4092 | "[SCENE PRESENCE({0})]: Releasing {1} {2} with old callback to {3}", | ||
4093 | Scene.RegionInfo.RegionName, Name, UUID, m_callbackURI); | ||
4094 | |||
4095 | UUID originID; | ||
4096 | |||
4097 | lock (m_originRegionIDAccessLock) | ||
4098 | originID = m_originRegionID; | ||
4099 | |||
4100 | Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI); | ||
4101 | m_callbackURI = null; | ||
4102 | } | ||
4103 | // v0.7 close HG sender region | ||
4104 | else if (!string.IsNullOrEmpty(m_newCallbackURI)) | ||
4105 | { | ||
4106 | m_log.DebugFormat( | ||
4107 | "[SCENE PRESENCE({0})]: Releasing {1} {2} with callback to {3}", | ||
4108 | Scene.RegionInfo.RegionName, Name, UUID, m_newCallbackURI); | ||
4109 | |||
4110 | UUID originID; | ||
4111 | |||
4112 | lock (m_originRegionIDAccessLock) | ||
4113 | originID = m_originRegionID; | ||
4114 | |||
4115 | Scene.SimulationService.ReleaseAgent(originID, UUID, m_newCallbackURI); | ||
4116 | m_newCallbackURI = null; | ||
4117 | } | ||
4118 | IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); | ||
4119 | if (m_agentTransfer != null) | ||
4120 | { | ||
4121 | m_agentTransfer.CloseOldChildAgents(this); | ||
4122 | } | ||
4123 | } | ||
4124 | |||
4125 | m_log.DebugFormat("[SCENE PRESENCE({0})]: SendInitialData for {1}", Scene.RegionInfo.RegionName, UUID); | ||
4032 | if (m_teleportFlags <= 0) | 4126 | if (m_teleportFlags <= 0) |
4033 | { | 4127 | { |
4034 | Scene.SendLayerData(ControllingClient); | 4128 | Scene.SendLayerData(ControllingClient); |
4035 | 4129 | ||
4036 | ILandChannel landch = m_scene.LandChannel; | 4130 | ILandChannel landch = m_scene.LandChannel; |
4037 | if (landch != null) | 4131 | if (landch != null) |
4038 | { | 4132 | landch.sendClientInitialLandInfo(ControllingClient, true); |
4039 | landch.sendClientInitialLandInfo(ControllingClient); | ||
4040 | } | ||
4041 | } | 4133 | } |
4042 | 4134 | ||
4043 | SendOtherAgentsAvatarFullToMe(); | 4135 | SendOtherAgentsAvatarFullToMe(); |
4044 | 4136 | ||
4045 | if(m_scene.ObjectsCullingByDistance) | 4137 | if (m_scene.ObjectsCullingByDistance) |
4046 | { | 4138 | { |
4047 | m_reprioritizationBusy = true; | 4139 | m_reprioritizationBusy = true; |
4048 | m_reprioritizationLastPosition = AbsolutePosition; | 4140 | m_reprioritizationLastPosition = AbsolutePosition; |
@@ -4051,23 +4143,63 @@ namespace OpenSim.Region.Framework.Scenes | |||
4051 | ControllingClient.ReprioritizeUpdates(); | 4143 | ControllingClient.ReprioritizeUpdates(); |
4052 | m_reprioritizationLastTime = Util.EnvironmentTickCount(); | 4144 | m_reprioritizationLastTime = Util.EnvironmentTickCount(); |
4053 | m_reprioritizationBusy = false; | 4145 | m_reprioritizationBusy = false; |
4054 | return; | ||
4055 | } | 4146 | } |
4056 | 4147 | else | |
4057 | EntityBase[] entities = Scene.Entities.GetEntities(); | ||
4058 | foreach (EntityBase e in entities) | ||
4059 | { | 4148 | { |
4060 | if (e != null && e is SceneObjectGroup && !((SceneObjectGroup)e).IsAttachment) | 4149 | //bool cacheCulling = (flags & 1) != 0; |
4061 | ((SceneObjectGroup)e).SendFullAnimUpdateToClient(ControllingClient); | 4150 | bool cacheEmpty = (flags & 2) != 0;; |
4151 | |||
4152 | EntityBase[] entities = Scene.Entities.GetEntities(); | ||
4153 | if(cacheEmpty) | ||
4154 | { | ||
4155 | foreach (EntityBase e in entities) | ||
4156 | { | ||
4157 | if (e != null && e is SceneObjectGroup && !((SceneObjectGroup)e).IsAttachment) | ||
4158 | ((SceneObjectGroup)e).SendFullAnimUpdateToClient(ControllingClient); | ||
4159 | } | ||
4160 | } | ||
4161 | else | ||
4162 | { | ||
4163 | foreach (EntityBase e in entities) | ||
4164 | { | ||
4165 | if (e != null && e is SceneObjectGroup && !((SceneObjectGroup)e).IsAttachment) | ||
4166 | { | ||
4167 | SceneObjectGroup grp = e as SceneObjectGroup; | ||
4168 | if(grp.IsViewerCachable) | ||
4169 | grp.SendUpdateProbes(ControllingClient); | ||
4170 | else | ||
4171 | grp.SendFullAnimUpdateToClient(ControllingClient); | ||
4172 | } | ||
4173 | } | ||
4174 | } | ||
4175 | |||
4176 | m_reprioritizationLastPosition = AbsolutePosition; | ||
4177 | m_reprioritizationLastDrawDistance = DrawDistance; | ||
4178 | m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it | ||
4179 | |||
4180 | m_reprioritizationBusy = false; | ||
4062 | } | 4181 | } |
4063 | 4182 | ||
4064 | m_reprioritizationLastPosition = AbsolutePosition; | 4183 | if (!IsChildAgent) |
4065 | m_reprioritizationLastDrawDistance = DrawDistance; | 4184 | { |
4066 | m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it | 4185 | // Create child agents in neighbouring regions |
4186 | IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); | ||
4187 | if (m_agentTransfer != null) | ||
4188 | { | ||
4189 | m_agentTransfer.EnableChildAgents(this); | ||
4190 | } | ||
4067 | 4191 | ||
4068 | m_reprioritizationBusy = false; | 4192 | m_lastChildUpdatesTime = Util.EnvironmentTickCount() + 10000; |
4193 | m_lastChildAgentUpdatePosition = AbsolutePosition; | ||
4194 | m_lastChildAgentCheckPosition = m_lastChildAgentUpdatePosition; | ||
4195 | m_lastChildAgentUpdateDrawDistance = DrawDistance; | ||
4196 | m_lastRegionsDrawDistance = RegionViewDistance; | ||
4069 | 4197 | ||
4198 | m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; | ||
4199 | m_childUpdatesBusy = false; // allow them | ||
4200 | } | ||
4070 | }); | 4201 | }); |
4202 | |||
4071 | } | 4203 | } |
4072 | 4204 | ||
4073 | /// <summary> | 4205 | /// <summary> |
@@ -4131,8 +4263,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
4131 | { | 4263 | { |
4132 | m_lastSize = Appearance.AvatarSize; | 4264 | m_lastSize = Appearance.AvatarSize; |
4133 | int count = 0; | 4265 | int count = 0; |
4266 | SceneObjectPart sitroot = null; | ||
4267 | if (ParentID != 0 && ParentPart != null) // we need to send the sitting root prim | ||
4268 | { | ||
4269 | sitroot = ParentPart.ParentGroup.RootPart; | ||
4270 | } | ||
4134 | foreach (ScenePresence p in presences) | 4271 | foreach (ScenePresence p in presences) |
4135 | { | 4272 | { |
4273 | if (sitroot != null) // we need to send the sitting root prim | ||
4274 | { | ||
4275 | p.ControllingClient.SendEntityFullUpdateImmediate(ParentPart.ParentGroup.RootPart); | ||
4276 | } | ||
4136 | p.ControllingClient.SendEntityFullUpdateImmediate(this); | 4277 | p.ControllingClient.SendEntityFullUpdateImmediate(this); |
4137 | if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) | 4278 | if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) |
4138 | // either just kill the object | 4279 | // either just kill the object |
@@ -4146,6 +4287,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
4146 | 4287 | ||
4147 | public void SendInitialAvatarDataToAgent(ScenePresence p) | 4288 | public void SendInitialAvatarDataToAgent(ScenePresence p) |
4148 | { | 4289 | { |
4290 | if(ParentID != 0 && ParentPart != null) // we need to send the sitting root prim | ||
4291 | { | ||
4292 | p.ControllingClient.SendEntityFullUpdateImmediate(ParentPart.ParentGroup.RootPart); | ||
4293 | } | ||
4149 | p.ControllingClient.SendEntityFullUpdateImmediate(this); | 4294 | p.ControllingClient.SendEntityFullUpdateImmediate(this); |
4150 | if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) | 4295 | if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) |
4151 | // either just kill the object | 4296 | // either just kill the object |
@@ -4273,12 +4418,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4273 | if(IsDeleted || !ControllingClient.IsActive) | 4418 | if(IsDeleted || !ControllingClient.IsActive) |
4274 | return; | 4419 | return; |
4275 | 4420 | ||
4276 | if(!SentInitialData) | ||
4277 | { | ||
4278 | SendInitialDataToMe(); | ||
4279 | return; | ||
4280 | } | ||
4281 | |||
4282 | if(m_reprioritizationBusy) | 4421 | if(m_reprioritizationBusy) |
4283 | return; | 4422 | return; |
4284 | 4423 | ||
@@ -4339,62 +4478,91 @@ namespace OpenSim.Region.Framework.Scenes | |||
4339 | m_scene.EventManager.TriggerSignificantClientMovement(this); | 4478 | m_scene.EventManager.TriggerSignificantClientMovement(this); |
4340 | } | 4479 | } |
4341 | 4480 | ||
4481 | if(IsNPC) | ||
4482 | return; | ||
4483 | |||
4342 | // updates priority recalc | 4484 | // updates priority recalc |
4343 | checkRePrioritization(); | 4485 | checkRePrioritization(); |
4344 | 4486 | ||
4345 | if(m_childUpdatesBusy) | 4487 | if(m_childUpdatesBusy || RegionViewDistance == 0) |
4346 | return; | 4488 | return; |
4347 | 4489 | ||
4348 | //possible KnownRegionHandles always contains current region and this check is not needed | 4490 | int tdiff = Util.EnvironmentTickCountSubtract(m_lastChildUpdatesTime); |
4349 | int minhandles = KnownRegionHandles.Contains(RegionHandle) ? 1 : 0; | 4491 | if (tdiff < CHILDUPDATES_TIME) |
4350 | if(KnownRegionHandles.Count > minhandles) | 4492 | return; |
4351 | { | ||
4352 | int tdiff = Util.EnvironmentTickCountSubtract(m_lastChildUpdatesTime); | ||
4353 | if(tdiff < CHILDUPDATES_TIME) | ||
4354 | return; | ||
4355 | 4493 | ||
4356 | bool doUpdate = false; | 4494 | bool viewchanged = Math.Abs(RegionViewDistance - m_lastRegionsDrawDistance) > 32.0f; |
4357 | if(m_lastChildAgentUpdateGodLevel != GodController.ViwerUIGodLevel) | ||
4358 | doUpdate = true; | ||
4359 | |||
4360 | if(!doUpdate && Math.Abs(DrawDistance - m_lastChildAgentUpdateDrawDistance) > 32.0f) | ||
4361 | doUpdate = true; | ||
4362 | 4495 | ||
4363 | if(!doUpdate) | 4496 | IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); |
4497 | float dx = pos.X - m_lastChildAgentCheckPosition.X; | ||
4498 | float dy = pos.Y - m_lastChildAgentCheckPosition.Y; | ||
4499 | if ((m_agentTransfer != null) && (viewchanged || ((dx * dx + dy * dy) > CHILDAGENTSCHECK_MOVEMENT))) | ||
4500 | { | ||
4501 | m_childUpdatesBusy = true; | ||
4502 | m_lastChildAgentCheckPosition = pos; | ||
4503 | m_lastChildAgentUpdatePosition = pos; | ||
4504 | m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; | ||
4505 | m_lastChildAgentUpdateDrawDistance = DrawDistance; | ||
4506 | m_lastRegionsDrawDistance = RegionViewDistance; | ||
4507 | // m_lastChildAgentUpdateCamPosition = CameraPosition; | ||
4508 | |||
4509 | Util.FireAndForget( | ||
4510 | o => | ||
4511 | { | ||
4512 | m_agentTransfer.EnableChildAgents(this); | ||
4513 | m_lastChildUpdatesTime = Util.EnvironmentTickCount(); | ||
4514 | m_childUpdatesBusy = false; | ||
4515 | }, null, "ScenePresence.CheckChildAgents"); | ||
4516 | } | ||
4517 | else | ||
4518 | { | ||
4519 | //possible KnownRegionHandles always contains current region and this check is not needed | ||
4520 | int minhandles = KnownRegionHandles.Contains(RegionHandle) ? 1 : 0; | ||
4521 | if(KnownRegionHandles.Count > minhandles) | ||
4364 | { | 4522 | { |
4365 | diff = pos - m_lastChildAgentUpdatePosition; | 4523 | bool doUpdate = false; |
4366 | if (diff.LengthSquared() > CHILDUPDATES_MOVEMENT) | 4524 | if (m_lastChildAgentUpdateGodLevel != GodController.ViwerUIGodLevel) |
4367 | doUpdate = true; | 4525 | doUpdate = true; |
4368 | } | ||
4369 | 4526 | ||
4370 | if(doUpdate) | 4527 | if (Math.Abs(DrawDistance - m_lastChildAgentUpdateDrawDistance) > 32.0f) |
4371 | { | 4528 | doUpdate = true; |
4372 | m_childUpdatesBusy = true; | 4529 | |
4373 | m_lastChildAgentUpdatePosition = pos; | 4530 | if(!doUpdate) |
4374 | m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; | 4531 | { |
4375 | m_lastChildAgentUpdateDrawDistance = DrawDistance; | 4532 | diff = pos - m_lastChildAgentUpdatePosition; |
4376 | // m_lastChildAgentUpdateCamPosition = CameraPosition; | 4533 | if (diff.LengthSquared() > CHILDUPDATES_MOVEMENT) |
4377 | 4534 | doUpdate = true; | |
4378 | AgentPosition agentpos = new AgentPosition(); | 4535 | } |
4379 | agentpos.AgentID = new UUID(UUID.Guid); | 4536 | |
4380 | agentpos.SessionID = ControllingClient.SessionId; | 4537 | if (doUpdate) |
4381 | agentpos.Size = Appearance.AvatarSize; | 4538 | { |
4382 | agentpos.Center = CameraPosition; | 4539 | m_childUpdatesBusy = true; |
4383 | agentpos.Far = DrawDistance; | 4540 | m_lastChildAgentUpdatePosition = pos; |
4384 | agentpos.Position = AbsolutePosition; | 4541 | m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; |
4385 | agentpos.Velocity = Velocity; | 4542 | m_lastChildAgentUpdateDrawDistance = DrawDistance; |
4386 | agentpos.RegionHandle = RegionHandle; | 4543 | // m_lastChildAgentUpdateCamPosition = CameraPosition; |
4387 | agentpos.GodData = GodController.State(); | 4544 | |
4388 | agentpos.Throttles = ControllingClient.GetThrottlesPacked(1); | 4545 | AgentPosition agentpos = new AgentPosition(); |
4389 | 4546 | agentpos.AgentID = new UUID(UUID.Guid); | |
4390 | // Let's get this out of the update loop | 4547 | agentpos.SessionID = ControllingClient.SessionId; |
4391 | Util.FireAndForget( | 4548 | agentpos.Size = Appearance.AvatarSize; |
4392 | o => | 4549 | agentpos.Center = CameraPosition; |
4393 | { | 4550 | agentpos.Far = DrawDistance; |
4394 | m_scene.SendOutChildAgentUpdates(agentpos, this); | 4551 | agentpos.Position = AbsolutePosition; |
4395 | m_lastChildUpdatesTime = Util.EnvironmentTickCount(); | 4552 | agentpos.Velocity = Velocity; |
4396 | m_childUpdatesBusy = false; | 4553 | agentpos.RegionHandle = RegionHandle; |
4397 | }, null, "ScenePresence.SendOutChildAgentUpdates"); | 4554 | agentpos.GodData = GodController.State(); |
4555 | agentpos.Throttles = ControllingClient.GetThrottlesPacked(1); | ||
4556 | |||
4557 | // Let's get this out of the update loop | ||
4558 | Util.FireAndForget( | ||
4559 | o => | ||
4560 | { | ||
4561 | m_scene.SendOutChildAgentUpdates(agentpos, this); | ||
4562 | m_lastChildUpdatesTime = Util.EnvironmentTickCount(); | ||
4563 | m_childUpdatesBusy = false; | ||
4564 | }, null, "ScenePresence.SendOutChildAgentUpdates"); | ||
4565 | } | ||
4398 | } | 4566 | } |
4399 | } | 4567 | } |
4400 | } | 4568 | } |
@@ -4547,12 +4715,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4547 | byebyeRegions.Add(handle); | 4715 | byebyeRegions.Add(handle); |
4548 | else if(handle == curRegionHandle) | 4716 | else if(handle == curRegionHandle) |
4549 | { | 4717 | { |
4718 | continue; | ||
4719 | /* | ||
4550 | RegionInfo curreg = m_scene.RegionInfo; | 4720 | RegionInfo curreg = m_scene.RegionInfo; |
4551 | if (Util.IsOutsideView(255, curreg.RegionLocX, newRegionX, curreg.RegionLocY, newRegionY, | 4721 | if (Util.IsOutsideView(255, curreg.RegionLocX, newRegionX, curreg.RegionLocY, newRegionY, |
4552 | (int)curreg.RegionSizeX, (int)curreg.RegionSizeX, newRegionSizeX, newRegionSizeY)) | 4722 | (int)curreg.RegionSizeX, (int)curreg.RegionSizeX, newRegionSizeX, newRegionSizeY)) |
4553 | { | 4723 | { |
4554 | byebyeRegions.Add(handle); | 4724 | byebyeRegions.Add(handle); |
4555 | } | 4725 | } |
4726 | */ | ||
4556 | } | 4727 | } |
4557 | else | 4728 | else |
4558 | { | 4729 | { |
@@ -4732,6 +4903,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4732 | public void CopyTo(AgentData cAgent, bool isCrossUpdate) | 4903 | public void CopyTo(AgentData cAgent, bool isCrossUpdate) |
4733 | { | 4904 | { |
4734 | cAgent.CallbackURI = m_callbackURI; | 4905 | cAgent.CallbackURI = m_callbackURI; |
4906 | cAgent.NewCallbackURI = m_newCallbackURI; | ||
4735 | 4907 | ||
4736 | cAgent.AgentID = UUID; | 4908 | cAgent.AgentID = UUID; |
4737 | cAgent.RegionID = Scene.RegionInfo.RegionID; | 4909 | cAgent.RegionID = Scene.RegionInfo.RegionID; |
@@ -4792,7 +4964,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4792 | 4964 | ||
4793 | if(isCrossUpdate) | 4965 | if(isCrossUpdate) |
4794 | { | 4966 | { |
4795 | cAgent.CrossingFlags = crossingFlags; | 4967 | cAgent.CrossingFlags = m_crossingFlags; |
4796 | cAgent.CrossingFlags |= 1; | 4968 | cAgent.CrossingFlags |= 1; |
4797 | cAgent.CrossExtraFlags = 0; | 4969 | cAgent.CrossExtraFlags = 0; |
4798 | if((LastCommands & ScriptControlled.CONTROL_LBUTTON) != 0) | 4970 | if((LastCommands & ScriptControlled.CONTROL_LBUTTON) != 0) |
@@ -4818,9 +4990,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
4818 | private void CopyFrom(AgentData cAgent) | 4990 | private void CopyFrom(AgentData cAgent) |
4819 | { | 4991 | { |
4820 | m_callbackURI = cAgent.CallbackURI; | 4992 | m_callbackURI = cAgent.CallbackURI; |
4821 | // m_log.DebugFormat( | 4993 | m_newCallbackURI = cAgent.NewCallbackURI; |
4822 | // "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()", | 4994 | // m_log.DebugFormat( |
4823 | // Name, m_scene.RegionInfo.RegionName, m_callbackURI); | 4995 | // "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()", |
4996 | // Name, m_scene.RegionInfo.RegionName, m_callbackURI); | ||
4824 | 4997 | ||
4825 | GodController.SetState(cAgent.GodData); | 4998 | GodController.SetState(cAgent.GodData); |
4826 | 4999 | ||
@@ -4928,9 +5101,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4928 | if (cAgent.MotionState != 0) | 5101 | if (cAgent.MotionState != 0) |
4929 | Animator.currentControlState = (ScenePresenceAnimator.motionControlStates) cAgent.MotionState; | 5102 | Animator.currentControlState = (ScenePresenceAnimator.motionControlStates) cAgent.MotionState; |
4930 | 5103 | ||
4931 | crossingFlags = cAgent.CrossingFlags; | 5104 | m_crossingFlags = cAgent.CrossingFlags; |
4932 | gotCrossUpdate = (crossingFlags != 0); | 5105 | m_gotCrossUpdate = (m_crossingFlags != 0); |
4933 | if(gotCrossUpdate) | 5106 | if(m_gotCrossUpdate) |
4934 | { | 5107 | { |
4935 | LastCommands &= ~(ScriptControlled.CONTROL_LBUTTON | ScriptControlled.CONTROL_ML_LBUTTON); | 5108 | LastCommands &= ~(ScriptControlled.CONTROL_LBUTTON | ScriptControlled.CONTROL_ML_LBUTTON); |
4936 | if((cAgent.CrossExtraFlags & 1) != 0) | 5109 | if((cAgent.CrossExtraFlags & 1) != 0) |
@@ -4940,11 +5113,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
4940 | MouseDown = (cAgent.CrossExtraFlags & 3) != 0; | 5113 | MouseDown = (cAgent.CrossExtraFlags & 3) != 0; |
4941 | } | 5114 | } |
4942 | 5115 | ||
4943 | haveGroupInformation = false; | 5116 | m_haveGroupInformation = false; |
4944 | // using this as protocol detection don't want to mess with the numbers for now | 5117 | // using this as protocol detection don't want to mess with the numbers for now |
4945 | if(cAgent.ActiveGroupTitle != null) | 5118 | if(cAgent.ActiveGroupTitle != null) |
4946 | { | 5119 | { |
4947 | haveGroupInformation = true; | 5120 | m_haveGroupInformation = true; |
4948 | COF = cAgent.agentCOF; | 5121 | COF = cAgent.agentCOF; |
4949 | if(ControllingClient.IsGroupMember(cAgent.ActiveGroupID)) | 5122 | if(ControllingClient.IsGroupMember(cAgent.ActiveGroupID)) |
4950 | { | 5123 | { |
@@ -6624,7 +6797,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
6624 | if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) | 6797 | if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) |
6625 | continue; | 6798 | continue; |
6626 | 6799 | ||
6627 | // only those on previus parcel need receive kills | 6800 | // only those on previous parcel need receive kills |
6628 | if (previusParcelID == p.currentParcelUUID) | 6801 | if (previusParcelID == p.currentParcelUUID) |
6629 | { | 6802 | { |
6630 | if(!p.IsViewerUIGod) | 6803 | if(!p.IsViewerUIGod) |
@@ -6756,7 +6929,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
6756 | } | 6929 | } |
6757 | else | 6930 | else |
6758 | { | 6931 | { |
6759 | GodController.HasMovedAway(); | 6932 | lock (m_completeMovementLock) |
6933 | { | ||
6934 | GodController.HasMovedAway(); | ||
6935 | NeedInitialData = -1; | ||
6936 | m_gotRegionHandShake = false; | ||
6937 | } | ||
6938 | |||
6760 | List<ScenePresence> allpresences = m_scene.GetScenePresences(); | 6939 | List<ScenePresence> allpresences = m_scene.GetScenePresences(); |
6761 | foreach (ScenePresence p in allpresences) | 6940 | foreach (ScenePresence p in allpresences) |
6762 | { | 6941 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index bc440fc..50b0cb5 100755 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | |||
@@ -556,7 +556,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
556 | sb[27].StatID = (uint)Stats.PhysicsLodTasks; | 556 | sb[27].StatID = (uint)Stats.PhysicsLodTasks; |
557 | sb[27].StatValue = 0; | 557 | sb[27].StatValue = 0; |
558 | 558 | ||
559 | sb[28].StatID = (uint)Stats.ScriptEps; // we actuall have this, but not messing array order AGAIN | 559 | sb[28].StatID = (uint)Stats.ScriptEps; // we actually have this, but not messing array order AGAIN |
560 | sb[28].StatValue = (float)Math.Round(m_scriptEventsPerSecond * updateTimeFactor); | 560 | sb[28].StatValue = (float)Math.Round(m_scriptEventsPerSecond * updateTimeFactor); |
561 | 561 | ||
562 | sb[29].StatID = (uint)Stats.SimAIStepTimeMS; | 562 | sb[29].StatID = (uint)Stats.SimAIStepTimeMS; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs index abf8c48..7c3eab1 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs | |||
@@ -155,11 +155,15 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
155 | sp1SceneA.AbsolutePosition = so1StartPos; | 155 | sp1SceneA.AbsolutePosition = so1StartPos; |
156 | sp1SceneA.HandleAgentRequestSit(sp1SceneA.ControllingClient, sp1SceneA.UUID, so1.UUID, Vector3.Zero); | 156 | sp1SceneA.HandleAgentRequestSit(sp1SceneA.ControllingClient, sp1SceneA.UUID, so1.UUID, Vector3.Zero); |
157 | 157 | ||
158 | sceneA.Update(4); | ||
159 | sceneB.Update(4); | ||
158 | // Cross | 160 | // Cross |
159 | sceneA.SceneGraph.UpdatePrimGroupPosition( | 161 | sceneA.SceneGraph.UpdatePrimGroupPosition( |
160 | so1.LocalId, new Vector3(so1StartPos.X, so1StartPos.Y - 20, so1StartPos.Z), sp1SceneA.ControllingClient); | 162 | so1.LocalId, new Vector3(so1StartPos.X, so1StartPos.Y - 20, so1StartPos.Z), sp1SceneA.ControllingClient); |
161 | 163 | ||
162 | // crossing is async | 164 | // crossing is async |
165 | sceneA.Update(4); | ||
166 | sceneB.Update(4); | ||
163 | Thread.Sleep(500); | 167 | Thread.Sleep(500); |
164 | 168 | ||
165 | SceneObjectGroup so1PostCross; | 169 | SceneObjectGroup so1PostCross; |
@@ -171,6 +175,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
171 | TestClient sceneBTc = ((TestClient)sp1SceneBPostCross.ControllingClient); | 175 | TestClient sceneBTc = ((TestClient)sp1SceneBPostCross.ControllingClient); |
172 | sceneBTc.CompleteMovement(); | 176 | sceneBTc.CompleteMovement(); |
173 | 177 | ||
178 | sceneA.Update(4); | ||
179 | sceneB.Update(4); | ||
180 | |||
174 | Assert.IsFalse(sp1SceneBPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly true"); | 181 | Assert.IsFalse(sp1SceneBPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly true"); |
175 | Assert.IsTrue(sp1SceneBPostCross.IsSatOnObject); | 182 | Assert.IsTrue(sp1SceneBPostCross.IsSatOnObject); |
176 | 183 | ||
@@ -188,6 +195,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
188 | sceneB.SceneGraph.UpdatePrimGroupPosition( | 195 | sceneB.SceneGraph.UpdatePrimGroupPosition( |
189 | so1PostCross.LocalId, new Vector3(so1PostCrossPos.X, so1PostCrossPos.Y + 20, so1PostCrossPos.Z), sp1SceneBPostCross.ControllingClient); | 196 | so1PostCross.LocalId, new Vector3(so1PostCrossPos.X, so1PostCrossPos.Y + 20, so1PostCrossPos.Z), sp1SceneBPostCross.ControllingClient); |
190 | 197 | ||
198 | sceneA.Update(4); | ||
199 | sceneB.Update(4); | ||
191 | // crossing is async | 200 | // crossing is async |
192 | Thread.Sleep(500); | 201 | Thread.Sleep(500); |
193 | 202 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs index 94e6b99..676d7eb 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs | |||
@@ -212,6 +212,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
212 | ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId); | 212 | ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId); |
213 | sp.AbsolutePosition = new Vector3(30, 31, 32); | 213 | sp.AbsolutePosition = new Vector3(30, 31, 32); |
214 | 214 | ||
215 | sceneA.Update(4); | ||
216 | sceneB.Update(4); | ||
217 | |||
215 | List<TestClient> destinationTestClients = new List<TestClient>(); | 218 | List<TestClient> destinationTestClients = new List<TestClient>(); |
216 | EntityTransferHelpers.SetupSendRegionTeleportTriggersDestinationClientCreateAndCompleteMovement( | 219 | EntityTransferHelpers.SetupSendRegionTeleportTriggersDestinationClientCreateAndCompleteMovement( |
217 | (TestClient)sp.ControllingClient, destinationTestClients); | 220 | (TestClient)sp.ControllingClient, destinationTestClients); |
@@ -224,11 +227,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
224 | (uint)TeleportFlags.ViaLocation); | 227 | (uint)TeleportFlags.ViaLocation); |
225 | 228 | ||
226 | // Assert.That(sceneA.GetScenePresence(userId), Is.Null); | 229 | // Assert.That(sceneA.GetScenePresence(userId), Is.Null); |
230 | sceneA.Update(4); | ||
231 | sceneB.Update(4); | ||
227 | 232 | ||
228 | ScenePresence sceneBSp = sceneB.GetScenePresence(userId); | 233 | ScenePresence sceneBSp = sceneB.GetScenePresence(userId); |
229 | Assert.That(sceneBSp, Is.Not.Null); | 234 | Assert.That(sceneBSp, Is.Not.Null); |
230 | Assert.That(sceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName)); | 235 | Assert.That(sceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName)); |
231 | Assert.That(sceneBSp.AbsolutePosition, Is.EqualTo(teleportPosition)); | 236 | Assert.That(sceneBSp.AbsolutePosition.X, Is.EqualTo(teleportPosition.X)); |
237 | Assert.That(sceneBSp.AbsolutePosition.Y, Is.EqualTo(teleportPosition.Y)); | ||
232 | 238 | ||
233 | //Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(0)); | 239 | //Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(0)); |
234 | //Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); | 240 | //Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); |
@@ -239,7 +245,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
239 | 245 | ||
240 | // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera | 246 | // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera |
241 | // position instead). | 247 | // position instead). |
242 | // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); | 248 | // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); |
243 | } | 249 | } |
244 | 250 | ||
245 | /// <summary> | 251 | /// <summary> |
@@ -310,7 +316,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
310 | ScenePresence sceneASp = sceneA.GetScenePresence(userId); | 316 | ScenePresence sceneASp = sceneA.GetScenePresence(userId); |
311 | Assert.That(sceneASp, Is.Not.Null); | 317 | Assert.That(sceneASp, Is.Not.Null); |
312 | Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName)); | 318 | Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName)); |
313 | Assert.That(sceneASp.AbsolutePosition, Is.EqualTo(preTeleportPosition)); | 319 | Assert.That(sceneASp.AbsolutePosition.X, Is.EqualTo(preTeleportPosition.X)); |
320 | Assert.That(sceneASp.AbsolutePosition.Y, Is.EqualTo(preTeleportPosition.Y)); | ||
314 | 321 | ||
315 | Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(1)); | 322 | Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(1)); |
316 | Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); | 323 | Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); |
@@ -369,6 +376,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
369 | ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId); | 376 | ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId); |
370 | sp.AbsolutePosition = preTeleportPosition; | 377 | sp.AbsolutePosition = preTeleportPosition; |
371 | 378 | ||
379 | sceneA.Update(4); | ||
380 | sceneB.Update(4); | ||
381 | |||
372 | // Make sceneB refuse CreateAgent | 382 | // Make sceneB refuse CreateAgent |
373 | sceneB.LoginsEnabled = false; | 383 | sceneB.LoginsEnabled = false; |
374 | 384 | ||
@@ -379,14 +389,18 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
379 | teleportLookAt, | 389 | teleportLookAt, |
380 | (uint)TeleportFlags.ViaLocation); | 390 | (uint)TeleportFlags.ViaLocation); |
381 | 391 | ||
382 | // ((TestClient)sp.ControllingClient).CompleteTeleportClientSide(); | 392 | // ((TestClient)sp.ControllingClient).CompleteTeleportClientSide(); |
393 | |||
394 | sceneA.Update(4); | ||
395 | sceneB.Update(4); | ||
383 | 396 | ||
384 | Assert.That(sceneB.GetScenePresence(userId), Is.Null); | 397 | Assert.That(sceneB.GetScenePresence(userId), Is.Null); |
385 | 398 | ||
386 | ScenePresence sceneASp = sceneA.GetScenePresence(userId); | 399 | ScenePresence sceneASp = sceneA.GetScenePresence(userId); |
387 | Assert.That(sceneASp, Is.Not.Null); | 400 | Assert.That(sceneASp, Is.Not.Null); |
388 | Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName)); | 401 | Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName)); |
389 | Assert.That(sceneASp.AbsolutePosition, Is.EqualTo(preTeleportPosition)); | 402 | Assert.That(sceneASp.AbsolutePosition.X, Is.EqualTo(preTeleportPosition.X)); |
403 | Assert.That(sceneASp.AbsolutePosition.Y, Is.EqualTo(preTeleportPosition.Y)); | ||
390 | 404 | ||
391 | Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(1)); | 405 | Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(1)); |
392 | Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); | 406 | Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); |
@@ -458,6 +472,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
458 | ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId); | 472 | ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId); |
459 | sp.AbsolutePosition = preTeleportPosition; | 473 | sp.AbsolutePosition = preTeleportPosition; |
460 | 474 | ||
475 | sceneA.Update(4); | ||
476 | sceneB.Update(4); | ||
477 | |||
461 | sceneA.RequestTeleportLocation( | 478 | sceneA.RequestTeleportLocation( |
462 | sp.ControllingClient, | 479 | sp.ControllingClient, |
463 | sceneB.RegionInfo.RegionHandle, | 480 | sceneB.RegionInfo.RegionHandle, |
@@ -468,13 +485,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
468 | // FIXME: Not setting up InformClientOfNeighbour on the TestClient means that it does not initiate | 485 | // FIXME: Not setting up InformClientOfNeighbour on the TestClient means that it does not initiate |
469 | // communication with the destination region. But this is a very non-obvious way of doing it - really we | 486 | // communication with the destination region. But this is a very non-obvious way of doing it - really we |
470 | // should be forced to expicitly set this up. | 487 | // should be forced to expicitly set this up. |
488 | sceneA.Update(4); | ||
489 | sceneB.Update(4); | ||
471 | 490 | ||
472 | Assert.That(sceneB.GetScenePresence(userId), Is.Null); | 491 | Assert.That(sceneB.GetScenePresence(userId), Is.Null); |
473 | 492 | ||
474 | ScenePresence sceneASp = sceneA.GetScenePresence(userId); | 493 | ScenePresence sceneASp = sceneA.GetScenePresence(userId); |
475 | Assert.That(sceneASp, Is.Not.Null); | 494 | Assert.That(sceneASp, Is.Not.Null); |
476 | Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName)); | 495 | Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName)); |
477 | Assert.That(sceneASp.AbsolutePosition, Is.EqualTo(preTeleportPosition)); | 496 | Assert.That(sceneASp.AbsolutePosition.X, Is.EqualTo(preTeleportPosition.X)); |
497 | Assert.That(sceneASp.AbsolutePosition.Y, Is.EqualTo(preTeleportPosition.Y)); | ||
478 | 498 | ||
479 | Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(1)); | 499 | Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(1)); |
480 | Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); | 500 | Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); |
@@ -614,6 +634,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
614 | ScenePresence beforeSceneASp = SceneHelpers.AddScenePresence(sceneA, tc, acd); | 634 | ScenePresence beforeSceneASp = SceneHelpers.AddScenePresence(sceneA, tc, acd); |
615 | beforeSceneASp.AbsolutePosition = new Vector3(30, 31, 32); | 635 | beforeSceneASp.AbsolutePosition = new Vector3(30, 31, 32); |
616 | 636 | ||
637 | sceneA.Update(4); | ||
638 | sceneB.Update(4); | ||
639 | |||
617 | Assert.That(beforeSceneASp, Is.Not.Null); | 640 | Assert.That(beforeSceneASp, Is.Not.Null); |
618 | Assert.That(beforeSceneASp.IsChildAgent, Is.False); | 641 | Assert.That(beforeSceneASp.IsChildAgent, Is.False); |
619 | 642 | ||
@@ -638,6 +661,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
638 | teleportLookAt, | 661 | teleportLookAt, |
639 | (uint)TeleportFlags.ViaLocation); | 662 | (uint)TeleportFlags.ViaLocation); |
640 | 663 | ||
664 | sceneA.Update(4); | ||
665 | sceneB.Update(4); | ||
666 | |||
641 | ScenePresence afterSceneASp = sceneA.GetScenePresence(userId); | 667 | ScenePresence afterSceneASp = sceneA.GetScenePresence(userId); |
642 | Assert.That(afterSceneASp, Is.Not.Null); | 668 | Assert.That(afterSceneASp, Is.Not.Null); |
643 | Assert.That(afterSceneASp.IsChildAgent, Is.True); | 669 | Assert.That(afterSceneASp.IsChildAgent, Is.True); |
@@ -646,7 +672,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
646 | Assert.That(afterSceneBSp, Is.Not.Null); | 672 | Assert.That(afterSceneBSp, Is.Not.Null); |
647 | Assert.That(afterSceneBSp.IsChildAgent, Is.False); | 673 | Assert.That(afterSceneBSp.IsChildAgent, Is.False); |
648 | Assert.That(afterSceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName)); | 674 | Assert.That(afterSceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName)); |
649 | Assert.That(afterSceneBSp.AbsolutePosition, Is.EqualTo(teleportPosition)); | 675 | Assert.That(afterSceneBSp.AbsolutePosition.X, Is.EqualTo(teleportPosition.X)); |
676 | Assert.That(afterSceneBSp.AbsolutePosition.Y, Is.EqualTo(teleportPosition.Y)); | ||
650 | 677 | ||
651 | Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(0)); | 678 | Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(0)); |
652 | Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(1)); | 679 | Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(1)); |