aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs143
1 files changed, 118 insertions, 25 deletions
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