aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2014-07-31 03:10:50 +0100
committerUbitUmarov2014-07-31 03:10:50 +0100
commita5e9429f2bb2276486cc2f1ed2249e14fba90d6a (patch)
tree30373d517c5adbea792afb993d8a99546022b26b
parentmake HandlerRegionHandshakeReply processing async and delay it a bit. This (diff)
downloadopensim-SC_OLD-a5e9429f2bb2276486cc2f1ed2249e14fba90d6a.zip
opensim-SC_OLD-a5e9429f2bb2276486cc2f1ed2249e14fba90d6a.tar.gz
opensim-SC_OLD-a5e9429f2bb2276486cc2f1ed2249e14fba90d6a.tar.bz2
opensim-SC_OLD-a5e9429f2bb2276486cc2f1ed2249e14fba90d6a.tar.xz
MESS: changes in MakeRootAgent and CompleteMovement reordering things.
Added sending of land overlay and parcel information. This in order to only send avatar related information after having its position well defined and on the right parcel. THIS MAY STILL BE BAD :)
-rw-r--r--OpenSim/Framework/ILandChannel.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandChannel.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs26
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs143
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs1
-rw-r--r--OpenSim/Tests/Common/Mock/TestLandChannel.cs1
6 files changed, 151 insertions, 30 deletions
diff --git a/OpenSim/Framework/ILandChannel.cs b/OpenSim/Framework/ILandChannel.cs
index c46c03c..63cc7eb 100644
--- a/OpenSim/Framework/ILandChannel.cs
+++ b/OpenSim/Framework/ILandChannel.cs
@@ -93,5 +93,7 @@ namespace OpenSim.Region.Framework.Interfaces
93 93
94 void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id); 94 void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id);
95 void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id); 95 void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id);
96 void sendClientInitialLandInfo(IClientAPI remoteClient);
97
96 } 98 }
97} 99}
diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
index beb0a24..378826d 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
@@ -213,7 +213,13 @@ namespace OpenSim.Region.CoreModules.World.Land
213 m_landManagementModule.setParcelOtherCleanTime(remoteClient, localID, otherCleanTime); 213 m_landManagementModule.setParcelOtherCleanTime(remoteClient, localID, otherCleanTime);
214 } 214 }
215 } 215 }
216 216 public void sendClientInitialLandInfo(IClientAPI remoteClient)
217 {
218 if (m_landManagementModule != null)
219 {
220 m_landManagementModule.sendClientInitialLandInfo(remoteClient);
221 }
222 }
217 #endregion 223 #endregion
218 } 224 }
219} 225}
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index c444c29..0a2882a 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -146,7 +146,7 @@ namespace OpenSim.Region.CoreModules.World.Land
146 m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage; 146 m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage;
147 m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan; 147 m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan;
148 m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps; 148 m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps;
149 149
150 lock (m_scene) 150 lock (m_scene)
151 { 151 {
152 m_scene.LandChannel = (ILandChannel)landChannel; 152 m_scene.LandChannel = (ILandChannel)landChannel;
@@ -194,13 +194,14 @@ namespace OpenSim.Region.CoreModules.World.Land
194 client.OnParcelEjectUser += ClientOnParcelEjectUser; 194 client.OnParcelEjectUser += ClientOnParcelEjectUser;
195 client.OnParcelFreezeUser += ClientOnParcelFreezeUser; 195 client.OnParcelFreezeUser += ClientOnParcelFreezeUser;
196 client.OnSetStartLocationRequest += ClientOnSetHome; 196 client.OnSetStartLocationRequest += ClientOnSetHome;
197 197/* avatar is still a child here position is unknow
198 EntityBase presenceEntity; 198 EntityBase presenceEntity;
199 if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence) 199 if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence)
200 { 200 {
201 SendParcelOverlay(client); 201 SendParcelOverlay(client);
202 SendLandUpdate((ScenePresence)presenceEntity, true); 202 SendLandUpdate((ScenePresence)presenceEntity, true);
203 } 203 }
204*/
204 } 205 }
205 206
206 public void EventMakeChildAgent(ScenePresence avatar) 207 public void EventMakeChildAgent(ScenePresence avatar)
@@ -385,12 +386,29 @@ namespace OpenSim.Region.CoreModules.World.Land
385 return; 386 return;
386 } 387 }
387 388
389 public void sendClientInitialLandInfo(IClientAPI remoteClient)
390 {
391 SendParcelOverlay(remoteClient);
392 ScenePresence avatar;
393 if (!m_scene.TryGetScenePresence(remoteClient.AgentId, out avatar))
394 return;
395 if (avatar.IsChildAgent)
396 return;
397
398 ILandObject over = GetLandObject(avatar.AbsolutePosition.X,avatar.AbsolutePosition.Y);
399 if (over == null)
400 return;
401
402 avatar.currentParcelUUID = over.LandData.GlobalID;
403 over.SendLandUpdateToClient(avatar.ControllingClient);
404 }
405
388 public void SendLandUpdate(ScenePresence avatar, bool force) 406 public void SendLandUpdate(ScenePresence avatar, bool force)
389 { 407 {
390 if (avatar.IsChildAgent) 408 if (avatar.IsChildAgent)
391 return; 409 return;
392 410
393 ILandObject over = GetLandObjectClipedXY(avatar.AbsolutePosition.X,avatar.AbsolutePosition.Y); 411 ILandObject over = GetLandObjectClipedXY(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
394 412
395 if (over != null) 413 if (over != null)
396 { 414 {
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 6b627be..5775747 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -140,8 +140,67 @@ namespace OpenSim.Region.Framework.Scenes
140 /// </summary> 140 /// </summary>
141 public static readonly float SIGNIFICANT_MOVEMENT = 2.0f; 141 public static readonly float SIGNIFICANT_MOVEMENT = 2.0f;
142 142
143 public UUID currentParcelUUID = UUID.Zero; 143 private UUID m_currentParcelUUID = UUID.Zero;
144 private object parcelLock = new Object();
144 145
146 public UUID currentParcelUUID
147 {
148 get { return m_currentParcelUUID; }
149 set
150 {
151 lock (parcelLock)
152 {
153 m_currentParcelUUID = value;
154 }
155 }
156 }
157
158 public bool ParcelAllowThisAvatarSounds
159 {
160 get
161 {
162 try
163 {
164 lock (parcelLock)
165 {
166 ILandObject land = m_scene.LandChannel.GetLandObject(AbsolutePosition.X, AbsolutePosition.Y);
167 if (land == null)
168 return true;
169 if (land.LandData.AnyAVSounds)
170 return true;
171 if (!land.LandData.GroupAVSounds)
172 return false;
173 return land.LandData.GroupID == ControllingClient.ActiveGroupId;
174 }
175 }
176 catch
177 {
178 return true;
179 }
180 }
181 }
182
183 public bool ParcelHideThisAvatar
184 {
185 get
186 {
187 try
188 {
189 lock (parcelLock)
190 {
191 ILandObject land = m_scene.LandChannel.GetLandObject(AbsolutePosition.X, AbsolutePosition.Y);
192 if (land == null || !land.LandData.SeeAVs)
193 return false;
194 return true;
195 }
196 }
197 catch
198 {
199 return false;
200 }
201 }
202 }
203
145 /// <value> 204 /// <value>
146 /// The animator for this avatar 205 /// The animator for this avatar
147 /// </value> 206 /// </value>
@@ -482,21 +541,7 @@ namespace OpenSim.Region.Framework.Scenes
482 } 541 }
483 } 542 }
484 543
485 public bool ParcelAllowThisAvatarSounds
486 {
487 get
488 {
489 ILandObject land = m_scene.LandChannel.GetLandObject(AbsolutePosition.X, AbsolutePosition.Y);
490 if (land == null)
491 return true;
492 544
493 if (land.LandData.AnyAVSounds)
494 return true;
495 if (!land.LandData.GroupAVSounds)
496 return false;
497 return land.LandData.GroupID == ControllingClient.ActiveGroupId;
498 }
499 }
500 545
501 public byte State { get; set; } 546 public byte State { get; set; }
502 547
@@ -1023,6 +1068,9 @@ namespace OpenSim.Region.Framework.Scenes
1023 /// This method is on the critical path for transferring an avatar from one region to another. Delay here 1068 /// This method is on the critical path for transferring an avatar from one region to another. Delay here
1024 /// delays that crossing. 1069 /// delays that crossing.
1025 /// </remarks> 1070 /// </remarks>
1071
1072
1073 // only in use as part of completemovement
1026 private bool MakeRootAgent(Vector3 pos, bool isFlying) 1074 private bool MakeRootAgent(Vector3 pos, bool isFlying)
1027 { 1075 {
1028 lock (m_completeMovementLock) 1076 lock (m_completeMovementLock)
@@ -1229,6 +1277,7 @@ namespace OpenSim.Region.Framework.Scenes
1229 // 1277 //
1230 // One cannot simply iterate over attachments in a fire and forget thread because this would no longer 1278 // One cannot simply iterate over attachments in a fire and forget thread because this would no longer
1231 // be locked, allowing race conditions if other code changes the attachments list. 1279 // be locked, allowing race conditions if other code changes the attachments list.
1280
1232 List<SceneObjectGroup> attachments = GetAttachments(); 1281 List<SceneObjectGroup> attachments = GetAttachments();
1233 1282
1234 if (attachments.Count > 0) 1283 if (attachments.Count > 0)
@@ -1236,16 +1285,19 @@ namespace OpenSim.Region.Framework.Scenes
1236 m_log.DebugFormat( 1285 m_log.DebugFormat(
1237 "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); 1286 "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name);
1238 1287
1239 // Resume scripts 1288 // Resume scripts this possible should also be moved down after sending the avatar to viewer ?
1240 foreach (SceneObjectGroup sog in attachments) 1289 foreach (SceneObjectGroup sog in attachments)
1241 { 1290 {
1242 sog.ScheduleGroupForFullUpdate(); 1291// sending attachments before the avatar ?
1292// moved to completemovement where it already was
1293// sog.ScheduleGroupForFullUpdate();
1243 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); 1294 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource());
1244 sog.ResumeScripts(); 1295 sog.ResumeScripts();
1245 } 1296 }
1246 } 1297 }
1247 } 1298 }
1248 1299
1300/*
1249 SendAvatarDataToAllAgents(); 1301 SendAvatarDataToAllAgents();
1250 1302
1251 // send the animations of the other presences to me 1303 // send the animations of the other presences to me
@@ -1254,6 +1306,7 @@ namespace OpenSim.Region.Framework.Scenes
1254 if (presence != this) 1306 if (presence != this)
1255 presence.Animator.SendAnimPackToClient(ControllingClient); 1307 presence.Animator.SendAnimPackToClient(ControllingClient);
1256 }); 1308 });
1309*/
1257 1310
1258 // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will 1311 // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will
1259 // stall on the border crossing since the existing child agent will still have the last movement 1312 // stall on the border crossing since the existing child agent will still have the last movement
@@ -1421,6 +1474,9 @@ namespace OpenSim.Region.Framework.Scenes
1421 1474
1422 public void StopFlying() 1475 public void StopFlying()
1423 { 1476 {
1477 if (IsInTransit)
1478 return;
1479
1424 Vector3 pos = AbsolutePosition; 1480 Vector3 pos = AbsolutePosition;
1425 if (Appearance.AvatarHeight != 127.0f) 1481 if (Appearance.AvatarHeight != 127.0f)
1426 pos += new Vector3(0f, 0f, (Appearance.AvatarHeight / 6f)); 1482 pos += new Vector3(0f, 0f, (Appearance.AvatarHeight / 6f));
@@ -1661,9 +1717,7 @@ namespace OpenSim.Region.Framework.Scenes
1661 m_log.InfoFormat( 1717 m_log.InfoFormat(
1662 "[SCENE PRESENCE]: Completing movement of {0} into region {1} in position {2}", 1718 "[SCENE PRESENCE]: Completing movement of {0} into region {1} in position {2}",
1663 client.Name, Scene.Name, AbsolutePosition); 1719 client.Name, Scene.Name, AbsolutePosition);
1664 1720
1665
1666
1667 m_inTransit = true; 1721 m_inTransit = true;
1668 try 1722 try
1669 { 1723 {
@@ -1709,8 +1763,9 @@ namespace OpenSim.Region.Framework.Scenes
1709 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); 1763 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
1710 1764
1711 // Remember in HandleUseCircuitCode, we delayed this to here 1765 // Remember in HandleUseCircuitCode, we delayed this to here
1712 if (m_teleportFlags > 0) 1766// this prims etc, moved down
1713 SendInitialDataToMe(); 1767// if (m_teleportFlags > 0)
1768// SendInitialDataToMe();
1714 1769
1715 // m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); 1770 // m_log.DebugFormat("[SCENE PRESENCE] Completed movement");
1716 1771
@@ -1742,6 +1797,20 @@ namespace OpenSim.Region.Framework.Scenes
1742 // client.Name, client.AgentId, m_scene.RegionInfo.RegionName); 1797 // client.Name, client.AgentId, m_scene.RegionInfo.RegionName);
1743 // } 1798 // }
1744 1799
1800 // send initial land overlay and parcel
1801 if (!IsChildAgent)
1802 {
1803 ILandChannel landch = m_scene.LandChannel;
1804 if (landch != null)
1805 {
1806 landch.sendClientInitialLandInfo(client);
1807 }
1808 }
1809
1810 // send agentData to all clients including us (?)
1811 // get appearance
1812 // if in cache sent it to all clients
1813 // send what we have to us, even if not in cache ( bad? )
1745 ValidateAndSendAppearanceAndAgentData(); 1814 ValidateAndSendAppearanceAndAgentData();
1746 1815
1747 // Create child agents in neighbouring regions 1816 // Create child agents in neighbouring regions
@@ -1750,11 +1819,11 @@ namespace OpenSim.Region.Framework.Scenes
1750 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); 1819 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
1751 if (m_agentTransfer != null) 1820 if (m_agentTransfer != null)
1752 m_agentTransfer.EnableChildAgents(this); 1821 m_agentTransfer.EnableChildAgents(this);
1753 1822/* moved down
1754 IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); 1823 IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
1755 if (friendsModule != null) 1824 if (friendsModule != null)
1756 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); 1825 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
1757 1826*/
1758 } 1827 }
1759 1828
1760 // XXX: If we force an update here, then multiple attachments do appear correctly on a destination region 1829 // XXX: If we force an update here, then multiple attachments do appear correctly on a destination region
@@ -1769,6 +1838,27 @@ namespace OpenSim.Region.Framework.Scenes
1769 // m_log.DebugFormat( 1838 // m_log.DebugFormat(
1770 // "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms", 1839 // "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms",
1771 // client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds); 1840 // client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds);
1841
1842 // send the rest of the world
1843 if (m_teleportFlags > 0)
1844 SendInitialDataToMe();
1845
1846 if (!IsChildAgent)
1847 {
1848// moved from makeroot missing in sendInitialDataToMe ?
1849 m_scene.ForEachRootScenePresence(delegate(ScenePresence presence)
1850 {
1851 if (presence != this)
1852 presence.Animator.SendAnimPackToClient(ControllingClient);
1853 });
1854
1855 if (openChildAgents)
1856 {
1857 IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
1858 if (friendsModule != null)
1859 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
1860 }
1861 }
1772 } 1862 }
1773 finally 1863 finally
1774 { 1864 {
@@ -1864,6 +1954,9 @@ namespace OpenSim.Region.Framework.Scenes
1864 return; 1954 return;
1865 } 1955 }
1866 1956
1957 if (IsInTransit)
1958 return;
1959
1867 #region Sanity Checking 1960 #region Sanity Checking
1868 1961
1869 // This is irritating. Really. 1962 // This is irritating. Really.
@@ -3307,13 +3400,13 @@ namespace OpenSim.Region.Framework.Scenes
3307 SendAvatarDataToAllAgents(); 3400 SendAvatarDataToAllAgents();
3308 3401
3309 // This invocation always shows up in the viewer logs as an error. Is it needed? 3402 // This invocation always shows up in the viewer logs as an error. Is it needed?
3403 // try to send what we have even if not in cache
3310 SendAppearanceToAgent(this); 3404 SendAppearanceToAgent(this);
3311 3405
3312 // If we are using the the cached appearance then send it out to everyone 3406 // If we are using the the cached appearance then send it out to everyone
3313 if (cachedappearance) 3407 if (cachedappearance)
3314 { 3408 {
3315 m_log.DebugFormat("[SCENE PRESENCE]: Baked textures are in the cache for {0} in {1}", Name, m_scene.Name); 3409 m_log.DebugFormat("[SCENE PRESENCE]: Baked textures are in the cache for {0} in {1}", Name, m_scene.Name);
3316
3317 // If the avatars baked textures are all in the cache, then we have a 3410 // If the avatars baked textures are all in the cache, then we have a
3318 // complete appearance... send it out, if not, then we'll send it when 3411 // complete appearance... send it out, if not, then we'll send it when
3319 // the avatar finishes updating its appearance 3412 // the avatar finishes updating its appearance
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs
index 4bf2a82..e5e76e9 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs
@@ -196,6 +196,7 @@ namespace OpenSim.Region.RegionCombinerModule
196 RootRegionLandChannel.SetParcelOtherCleanTime(remoteClient, localID, otherCleanTime); 196 RootRegionLandChannel.SetParcelOtherCleanTime(remoteClient, localID, otherCleanTime);
197 } 197 }
198 198
199 public void sendClientInitialLandInfo(IClientAPI remoteClient) { }
199 #endregion 200 #endregion
200 } 201 }
201} \ No newline at end of file 202} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Mock/TestLandChannel.cs b/OpenSim/Tests/Common/Mock/TestLandChannel.cs
index 3115035..8135bfc 100644
--- a/OpenSim/Tests/Common/Mock/TestLandChannel.cs
+++ b/OpenSim/Tests/Common/Mock/TestLandChannel.cs
@@ -111,5 +111,6 @@ namespace OpenSim.Tests.Common.Mock
111 111
112 public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {} 112 public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {}
113 public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {} 113 public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {}
114 public void sendClientInitialLandInfo(IClientAPI remoteClient) { }
114 } 115 }
115} \ No newline at end of file 116} \ No newline at end of file