diff options
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 278 |
1 files changed, 238 insertions, 40 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 5775747..b8ad78e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -140,7 +140,10 @@ 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 | private UUID m_currentParcelUUID = UUID.Zero; | 143 | private UUID m_previusParcelUUID = UUID.Zero; |
144 | private UUID m_currentParcelUUID = UUID.Zero; | ||
145 | private bool m_previusParcelHide = false; | ||
146 | private bool m_currentParcelHide = false; | ||
144 | private object parcelLock = new Object(); | 147 | private object parcelLock = new Object(); |
145 | 148 | ||
146 | public UUID currentParcelUUID | 149 | public UUID currentParcelUUID |
@@ -150,7 +153,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
150 | { | 153 | { |
151 | lock (parcelLock) | 154 | lock (parcelLock) |
152 | { | 155 | { |
156 | m_previusParcelHide = m_currentParcelHide; | ||
157 | m_previusParcelUUID = m_currentParcelUUID; | ||
153 | m_currentParcelUUID = value; | 158 | m_currentParcelUUID = value; |
159 | m_currentParcelHide = false; | ||
160 | ILandObject land = m_scene.LandChannel.GetLandObject(AbsolutePosition.X, AbsolutePosition.Y); | ||
161 | if (land != null && !land.LandData.SeeAVs) | ||
162 | m_currentParcelHide = true; | ||
163 | if (m_previusParcelUUID != UUID.Zero) | ||
164 | ParcelCrossCheck(); | ||
154 | } | 165 | } |
155 | } | 166 | } |
156 | } | 167 | } |
@@ -188,10 +199,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
188 | { | 199 | { |
189 | lock (parcelLock) | 200 | lock (parcelLock) |
190 | { | 201 | { |
191 | ILandObject land = m_scene.LandChannel.GetLandObject(AbsolutePosition.X, AbsolutePosition.Y); | 202 | return m_currentParcelHide; |
192 | if (land == null || !land.LandData.SeeAVs) | ||
193 | return false; | ||
194 | return true; | ||
195 | } | 203 | } |
196 | } | 204 | } |
197 | catch | 205 | catch |
@@ -542,7 +550,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
542 | } | 550 | } |
543 | 551 | ||
544 | 552 | ||
545 | |||
546 | public byte State { get; set; } | 553 | public byte State { get; set; } |
547 | 554 | ||
548 | private AgentManager.ControlFlags m_AgentControlFlags; | 555 | private AgentManager.ControlFlags m_AgentControlFlags; |
@@ -1071,6 +1078,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1071 | 1078 | ||
1072 | 1079 | ||
1073 | // only in use as part of completemovement | 1080 | // only in use as part of completemovement |
1081 | // other uses need fix | ||
1074 | private bool MakeRootAgent(Vector3 pos, bool isFlying) | 1082 | private bool MakeRootAgent(Vector3 pos, bool isFlying) |
1075 | { | 1083 | { |
1076 | lock (m_completeMovementLock) | 1084 | lock (m_completeMovementLock) |
@@ -1097,16 +1105,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1097 | part.ParentGroup.AddAvatar(UUID); | 1105 | part.ParentGroup.AddAvatar(UUID); |
1098 | if (part.SitTargetPosition != Vector3.Zero) | 1106 | if (part.SitTargetPosition != Vector3.Zero) |
1099 | part.SitTargetAvatar = UUID; | 1107 | part.SitTargetAvatar = UUID; |
1100 | // ParentPosition = part.GetWorldPosition(); | ||
1101 | ParentID = part.LocalId; | 1108 | ParentID = part.LocalId; |
1102 | ParentPart = part; | 1109 | ParentPart = part; |
1103 | m_pos = PrevSitOffset; | 1110 | m_pos = PrevSitOffset; |
1104 | // pos = ParentPosition; | ||
1105 | pos = part.GetWorldPosition(); | 1111 | pos = part.GetWorldPosition(); |
1106 | } | 1112 | } |
1107 | ParentUUID = UUID.Zero; | 1113 | ParentUUID = UUID.Zero; |
1108 | |||
1109 | // Animator.TrySetMovementAnimation("SIT"); | ||
1110 | } | 1114 | } |
1111 | else | 1115 | else |
1112 | { | 1116 | { |
@@ -1161,7 +1165,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1161 | // Moved this from SendInitialData to ensure that Appearance is initialized | 1165 | // Moved this from SendInitialData to ensure that Appearance is initialized |
1162 | // before the inventory is processed in MakeRootAgent. This fixes a race condition | 1166 | // before the inventory is processed in MakeRootAgent. This fixes a race condition |
1163 | // related to the handling of attachments | 1167 | // related to the handling of attachments |
1164 | //m_scene.GetAvatarAppearance(ControllingClient, out Appearance); | 1168 | |
1165 | if (m_scene.TestBorderCross(pos, Cardinals.E)) | 1169 | if (m_scene.TestBorderCross(pos, Cardinals.E)) |
1166 | { | 1170 | { |
1167 | Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E); | 1171 | Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E); |
@@ -1496,7 +1500,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1496 | else | 1500 | else |
1497 | CollisionPlane = new Vector4(0, 0, 0, pos.Z - (1.56f / 6f)); | 1501 | CollisionPlane = new Vector4(0, 0, 0, pos.Z - (1.56f / 6f)); |
1498 | 1502 | ||
1499 | ControllingClient.SendAgentTerseUpdate(this); | 1503 | SendAgentTerseUpdate(this); |
1500 | } | 1504 | } |
1501 | 1505 | ||
1502 | /// <summary> | 1506 | /// <summary> |
@@ -1797,6 +1801,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1797 | // client.Name, client.AgentId, m_scene.RegionInfo.RegionName); | 1801 | // client.Name, client.AgentId, m_scene.RegionInfo.RegionName); |
1798 | // } | 1802 | // } |
1799 | 1803 | ||
1804 | m_currentParcelHide = false; | ||
1805 | m_currentParcelUUID = UUID.Zero; | ||
1806 | |||
1800 | // send initial land overlay and parcel | 1807 | // send initial land overlay and parcel |
1801 | if (!IsChildAgent) | 1808 | if (!IsChildAgent) |
1802 | { | 1809 | { |
@@ -1807,6 +1814,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1807 | } | 1814 | } |
1808 | } | 1815 | } |
1809 | 1816 | ||
1817 | m_previusParcelHide = m_currentParcelHide; | ||
1818 | m_previusParcelUUID = m_currentParcelUUID; | ||
1819 | |||
1810 | // send agentData to all clients including us (?) | 1820 | // send agentData to all clients including us (?) |
1811 | // get appearance | 1821 | // get appearance |
1812 | // if in cache sent it to all clients | 1822 | // if in cache sent it to all clients |
@@ -1819,11 +1829,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1819 | IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); | 1829 | IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); |
1820 | if (m_agentTransfer != null) | 1830 | if (m_agentTransfer != null) |
1821 | m_agentTransfer.EnableChildAgents(this); | 1831 | m_agentTransfer.EnableChildAgents(this); |
1822 | /* moved down | ||
1823 | IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); | ||
1824 | if (friendsModule != null) | ||
1825 | friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); | ||
1826 | */ | ||
1827 | } | 1832 | } |
1828 | 1833 | ||
1829 | // XXX: If we force an update here, then multiple attachments do appear correctly on a destination region | 1834 | // XXX: If we force an update here, then multiple attachments do appear correctly on a destination region |
@@ -1845,13 +1850,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1845 | 1850 | ||
1846 | if (!IsChildAgent) | 1851 | if (!IsChildAgent) |
1847 | { | 1852 | { |
1848 | // moved from makeroot missing in sendInitialDataToMe ? | 1853 | // moved from makeroot missing in sendInitialDataToMe |
1854 | // its already there | ||
1855 | /* | ||
1849 | m_scene.ForEachRootScenePresence(delegate(ScenePresence presence) | 1856 | m_scene.ForEachRootScenePresence(delegate(ScenePresence presence) |
1850 | { | 1857 | { |
1851 | if (presence != this) | 1858 | if (presence != this) |
1852 | presence.Animator.SendAnimPackToClient(ControllingClient); | 1859 | presence.Animator.SendAnimPackToClient(ControllingClient); |
1853 | }); | 1860 | }); |
1854 | 1861 | */ | |
1855 | if (openChildAgents) | 1862 | if (openChildAgents) |
1856 | { | 1863 | { |
1857 | IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); | 1864 | IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); |
@@ -2064,7 +2071,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2064 | 2071 | ||
2065 | // We need to send this back to the client in order to stop the edit beams | 2072 | // We need to send this back to the client in order to stop the edit beams |
2066 | if ((oldState & (uint)AgentState.Editing) != 0 && State == (uint)AgentState.None) | 2073 | if ((oldState & (uint)AgentState.Editing) != 0 && State == (uint)AgentState.None) |
2067 | ControllingClient.SendAgentTerseUpdate(this); | 2074 | SendAgentTerseUpdate(this); |
2068 | 2075 | ||
2069 | PhysicsActor actor = PhysicsActor; | 2076 | PhysicsActor actor = PhysicsActor; |
2070 | 2077 | ||
@@ -2303,7 +2310,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2303 | 2310 | ||
2304 | // We need to send this back to the client in order to see the edit beams | 2311 | // We need to send this back to the client in order to see the edit beams |
2305 | if ((State & (uint)AgentState.Editing) != 0) | 2312 | if ((State & (uint)AgentState.Editing) != 0) |
2306 | ControllingClient.SendAgentTerseUpdate(this); | 2313 | SendAgentTerseUpdate(this); |
2307 | 2314 | ||
2308 | m_scene.EventManager.TriggerOnClientMovement(this); | 2315 | m_scene.EventManager.TriggerOnClientMovement(this); |
2309 | } | 2316 | } |
@@ -3230,6 +3237,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3230 | 3237 | ||
3231 | if (IsChildAgent == false) | 3238 | if (IsChildAgent == false) |
3232 | { | 3239 | { |
3240 | if (IsInTransit) | ||
3241 | return; | ||
3242 | |||
3233 | // NOTE: Velocity is not the same as m_velocity. Velocity will attempt to | 3243 | // NOTE: Velocity is not the same as m_velocity. Velocity will attempt to |
3234 | // grab the latest PhysicsActor velocity, whereas m_velocity is often | 3244 | // grab the latest PhysicsActor velocity, whereas m_velocity is often |
3235 | // storing a requested force instead of an actual traveling velocity | 3245 | // storing a requested force instead of an actual traveling velocity |
@@ -3258,9 +3268,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3258 | 3268 | ||
3259 | #region Update Client(s) | 3269 | #region Update Client(s) |
3260 | 3270 | ||
3271 | // this is diferente from SendTerseUpdateToClient | ||
3272 | // this sends bypassing ententies updates | ||
3273 | public void SendAgentTerseUpdate(ISceneEntity p) | ||
3274 | { | ||
3275 | ControllingClient.SendAgentTerseUpdate(p); | ||
3276 | } | ||
3261 | 3277 | ||
3262 | /// <summary> | 3278 | /// <summary> |
3263 | /// Sends a location update to the client connected to this scenePresence | 3279 | /// Sends a location update to the client connected to this scenePresence |
3280 | /// via entity updates | ||
3264 | /// </summary> | 3281 | /// </summary> |
3265 | /// <param name="remoteClient"></param> | 3282 | /// <param name="remoteClient"></param> |
3266 | public void SendTerseUpdateToClient(IClientAPI remoteClient) | 3283 | public void SendTerseUpdateToClient(IClientAPI remoteClient) |
@@ -3270,7 +3287,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3270 | if (remoteClient.IsActive) | 3287 | if (remoteClient.IsActive) |
3271 | { | 3288 | { |
3272 | //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity); | 3289 | //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity); |
3273 | |||
3274 | remoteClient.SendEntityUpdate( | 3290 | remoteClient.SendEntityUpdate( |
3275 | this, | 3291 | this, |
3276 | PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity | 3292 | PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity |
@@ -3280,6 +3296,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
3280 | } | 3296 | } |
3281 | } | 3297 | } |
3282 | 3298 | ||
3299 | public void SendTerseUpdateToAgentClient(ScenePresence p) | ||
3300 | { | ||
3301 | // messy checks because a client doesn't know what presence it belongs too | ||
3302 | if (p.IsChildAgent) | ||
3303 | return; | ||
3304 | |||
3305 | if (p.IsInTransit) | ||
3306 | return; | ||
3307 | |||
3308 | IClientAPI remoteClient = p.ControllingClient; | ||
3309 | if (remoteClient == null) | ||
3310 | return; | ||
3311 | |||
3312 | if (!remoteClient.IsActive) | ||
3313 | return; | ||
3314 | |||
3315 | if (ParcelHideThisAvatar && p.currentParcelUUID != currentParcelUUID) | ||
3316 | return; | ||
3317 | |||
3318 | |||
3319 | //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity); | ||
3320 | remoteClient.SendEntityUpdate( | ||
3321 | this, | ||
3322 | PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity | ||
3323 | | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity); | ||
3324 | |||
3325 | m_scene.StatsReporter.AddAgentUpdates(1); | ||
3326 | } | ||
3283 | 3327 | ||
3284 | // vars to support reduced update frequency when velocity is unchanged | 3328 | // vars to support reduced update frequency when velocity is unchanged |
3285 | private Vector3 lastVelocitySentToAllClients = Vector3.Zero; | 3329 | private Vector3 lastVelocitySentToAllClients = Vector3.Zero; |
@@ -3321,7 +3365,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3321 | lastPositionSentToAllClients = OffsetPosition; | 3365 | lastPositionSentToAllClients = OffsetPosition; |
3322 | 3366 | ||
3323 | // Console.WriteLine("Scheduled update for {0} in {1}", Name, Scene.Name); | 3367 | // Console.WriteLine("Scheduled update for {0} in {1}", Name, Scene.Name); |
3324 | m_scene.ForEachClient(SendTerseUpdateToClient); | 3368 | // m_scene.ForEachClient(SendTerseUpdateToClient); |
3369 | m_scene.ForEachScenePresence(SendTerseUpdateToAgentClient); | ||
3325 | } | 3370 | } |
3326 | TriggerScenePresenceUpdated(); | 3371 | TriggerScenePresenceUpdated(); |
3327 | } | 3372 | } |
@@ -3389,6 +3434,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3389 | if (!cachedappearance) | 3434 | if (!cachedappearance) |
3390 | { | 3435 | { |
3391 | Appearance.ResetAppearance(); | 3436 | Appearance.ResetAppearance(); |
3437 | // save what ???? | ||
3438 | // maybe needed so the tryretry repair works? | ||
3392 | if (m_scene.AvatarFactory != null) | 3439 | if (m_scene.AvatarFactory != null) |
3393 | m_scene.AvatarFactory.QueueAppearanceSave(UUID); | 3440 | m_scene.AvatarFactory.QueueAppearanceSave(UUID); |
3394 | } | 3441 | } |
@@ -3400,10 +3447,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3400 | SendAvatarDataToAllAgents(); | 3447 | SendAvatarDataToAllAgents(); |
3401 | 3448 | ||
3402 | // This invocation always shows up in the viewer logs as an error. Is it needed? | 3449 | // 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 | 3450 | // send all information we have |
3451 | // possible not needed since viewer should ask about it | ||
3452 | // least it all ask for baked | ||
3404 | SendAppearanceToAgent(this); | 3453 | SendAppearanceToAgent(this); |
3405 | 3454 | ||
3406 | // If we are using the the cached appearance then send it out to everyone | 3455 | // If we are using the the cached appearance then send it out to everyone |
3456 | // send even grays | ||
3407 | if (cachedappearance) | 3457 | if (cachedappearance) |
3408 | { | 3458 | { |
3409 | m_log.DebugFormat("[SCENE PRESENCE]: Baked textures are in the cache for {0} in {1}", Name, m_scene.Name); | 3459 | m_log.DebugFormat("[SCENE PRESENCE]: Baked textures are in the cache for {0} in {1}", Name, m_scene.Name); |
@@ -3432,17 +3482,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
3432 | } | 3482 | } |
3433 | 3483 | ||
3434 | m_lastSize = Appearance.AvatarSize; | 3484 | m_lastSize = Appearance.AvatarSize; |
3435 | |||
3436 | int count = 0; | 3485 | int count = 0; |
3486 | |||
3437 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) | 3487 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
3438 | { | 3488 | { |
3439 | SendAvatarDataToAgent(scenePresence); | 3489 | SendAvatarDataToAgent(scenePresence); |
3440 | count++; | 3490 | count++; |
3441 | }); | 3491 | }); |
3442 | 3492 | ||
3443 | m_scene.StatsReporter.AddAgentUpdates(count); | 3493 | m_scene.StatsReporter.AddAgentUpdates(count); |
3444 | } | 3494 | } |
3445 | 3495 | ||
3446 | /// <summary> | 3496 | /// <summary> |
3447 | /// Send avatar data for all other root agents to this agent, this agent | 3497 | /// Send avatar data for all other root agents to this agent, this agent |
3448 | /// can be either a child or root | 3498 | /// can be either a child or root |
@@ -3450,12 +3500,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3450 | public void SendOtherAgentsAvatarDataToMe() | 3500 | public void SendOtherAgentsAvatarDataToMe() |
3451 | { | 3501 | { |
3452 | int count = 0; | 3502 | int count = 0; |
3503 | |||
3453 | m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) | 3504 | m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) |
3454 | { | 3505 | { |
3455 | // only send information about other root agents | 3506 | // only send information about other root agents |
3456 | if (scenePresence.UUID == UUID) | 3507 | if (scenePresence.UUID == UUID) |
3457 | return; | 3508 | return; |
3458 | 3509 | ||
3459 | scenePresence.SendAvatarDataToAgent(this); | 3510 | scenePresence.SendAvatarDataToAgent(this); |
3460 | count++; | 3511 | count++; |
3461 | }); | 3512 | }); |
@@ -3470,7 +3521,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3470 | public void SendAvatarDataToAgent(ScenePresence avatar) | 3521 | public void SendAvatarDataToAgent(ScenePresence avatar) |
3471 | { | 3522 | { |
3472 | //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID); | 3523 | //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID); |
3473 | 3524 | if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID) | |
3525 | return; | ||
3474 | avatar.ControllingClient.SendAvatarDataImmediate(this); | 3526 | avatar.ControllingClient.SendAvatarDataImmediate(this); |
3475 | Animator.SendAnimPackToClient(avatar.ControllingClient); | 3527 | Animator.SendAnimPackToClient(avatar.ControllingClient); |
3476 | } | 3528 | } |
@@ -3481,7 +3533,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3481 | /// </summary> | 3533 | /// </summary> |
3482 | public void SendAppearanceToAllOtherAgents() | 3534 | public void SendAppearanceToAllOtherAgents() |
3483 | { | 3535 | { |
3484 | // m_log.DebugFormat("[SCENE PRESENCE] SendAppearanceToAllOtherAgents: {0} {1}", Name, UUID); | 3536 | // m_log.DebugFormat("[SCENE PRESENCE] SendAppearanceToAllOtherAgents: {0} {1}", Name, UUID); |
3485 | 3537 | ||
3486 | // only send update from root agents to other clients; children are only "listening posts" | 3538 | // only send update from root agents to other clients; children are only "listening posts" |
3487 | if (IsChildAgent) | 3539 | if (IsChildAgent) |
@@ -3492,7 +3544,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3492 | 3544 | ||
3493 | return; | 3545 | return; |
3494 | } | 3546 | } |
3495 | 3547 | ||
3496 | int count = 0; | 3548 | int count = 0; |
3497 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) | 3549 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
3498 | { | 3550 | { |
@@ -3503,7 +3555,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3503 | SendAppearanceToAgent(scenePresence); | 3555 | SendAppearanceToAgent(scenePresence); |
3504 | count++; | 3556 | count++; |
3505 | }); | 3557 | }); |
3506 | |||
3507 | m_scene.StatsReporter.AddAgentUpdates(count); | 3558 | m_scene.StatsReporter.AddAgentUpdates(count); |
3508 | } | 3559 | } |
3509 | 3560 | ||
@@ -3537,11 +3588,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3537 | { | 3588 | { |
3538 | // m_log.DebugFormat( | 3589 | // m_log.DebugFormat( |
3539 | // "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); | 3590 | // "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); |
3540 | 3591 | if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID) | |
3592 | return; | ||
3541 | avatar.ControllingClient.SendAppearance( | 3593 | avatar.ControllingClient.SendAppearance( |
3542 | UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); | 3594 | UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); |
3543 | |||
3544 | |||
3545 | } | 3595 | } |
3546 | 3596 | ||
3547 | #endregion | 3597 | #endregion |
@@ -4077,6 +4127,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4077 | /// </summary> | 4127 | /// </summary> |
4078 | public void UpdateMovement() | 4128 | public void UpdateMovement() |
4079 | { | 4129 | { |
4130 | if (IsInTransit) | ||
4131 | return; | ||
4080 | if (m_forceToApply.HasValue) | 4132 | if (m_forceToApply.HasValue) |
4081 | { | 4133 | { |
4082 | Vector3 force = m_forceToApply.Value; | 4134 | Vector3 force = m_forceToApply.Value; |
@@ -4155,7 +4207,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4155 | { | 4207 | { |
4156 | if (IsChildAgent || Animator == null) | 4208 | if (IsChildAgent || Animator == null) |
4157 | return; | 4209 | return; |
4158 | 4210 | ||
4211 | if(IsInTransit) | ||
4212 | return; | ||
4159 | //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) | 4213 | //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) |
4160 | // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents( | 4214 | // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents( |
4161 | // as of this comment the interval is set in AddToPhysicalScene | 4215 | // as of this comment the interval is set in AddToPhysicalScene |
@@ -4503,6 +4557,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
4503 | return validated; | 4557 | return validated; |
4504 | } | 4558 | } |
4505 | 4559 | ||
4560 | |||
4561 | public void SendAttachmentsToClient(IClientAPI client) | ||
4562 | { | ||
4563 | lock (m_attachments) | ||
4564 | { | ||
4565 | foreach (SceneObjectGroup gobj in m_attachments) | ||
4566 | { | ||
4567 | gobj.SendFullUpdateToClient(client); | ||
4568 | } | ||
4569 | } | ||
4570 | } | ||
4571 | |||
4506 | /// <summary> | 4572 | /// <summary> |
4507 | /// Send a script event to this scene presence's attachments | 4573 | /// Send a script event to this scene presence's attachments |
4508 | /// </summary> | 4574 | /// </summary> |
@@ -5245,5 +5311,137 @@ namespace OpenSim.Region.Framework.Scenes | |||
5245 | m_log.InfoFormat("[SCENE PRESENCE]: TELEPORT ******************"); | 5311 | m_log.InfoFormat("[SCENE PRESENCE]: TELEPORT ******************"); |
5246 | 5312 | ||
5247 | } | 5313 | } |
5314 | |||
5315 | private void ParcelCrossCheck() | ||
5316 | { | ||
5317 | List<ScenePresence> killsToSendto = new List<ScenePresence>(); | ||
5318 | List<ScenePresence> killsToSendme = new List<ScenePresence>(); | ||
5319 | List<ScenePresence> viewsToSendto = new List<ScenePresence>(); | ||
5320 | List<ScenePresence> viewsToSendme = new List<ScenePresence>(); | ||
5321 | List<ScenePresence> allpresences = null; | ||
5322 | |||
5323 | if (m_currentParcelHide) | ||
5324 | { | ||
5325 | // now on a private parcel | ||
5326 | allpresences = m_scene.GetScenePresences(); | ||
5327 | |||
5328 | if (m_previusParcelHide && m_previusParcelUUID != UUID.Zero) | ||
5329 | { | ||
5330 | foreach (ScenePresence p in allpresences) | ||
5331 | { | ||
5332 | if (p.IsChildAgent || p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) | ||
5333 | continue; | ||
5334 | |||
5335 | // only those on previus parcel need receive kills | ||
5336 | if (m_previusParcelUUID == p.currentParcelUUID) | ||
5337 | { | ||
5338 | killsToSendto.Add(p); // they dont see me | ||
5339 | killsToSendme.Add(p); // i dont see them | ||
5340 | } | ||
5341 | // only those on new parcel need see | ||
5342 | if (m_currentParcelUUID == p.currentParcelUUID) | ||
5343 | { | ||
5344 | viewsToSendto.Add(p); // they see me | ||
5345 | viewsToSendme.Add(p); // i see them | ||
5346 | } | ||
5347 | } | ||
5348 | } | ||
5349 | else | ||
5350 | { | ||
5351 | //was on a public area | ||
5352 | allpresences = m_scene.GetScenePresences(); | ||
5353 | |||
5354 | foreach (ScenePresence p in allpresences) | ||
5355 | { | ||
5356 | if (p.IsChildAgent || p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) | ||
5357 | continue; | ||
5358 | |||
5359 | // those not on new parcel dont see me | ||
5360 | if (m_currentParcelUUID != p.currentParcelUUID) | ||
5361 | { | ||
5362 | killsToSendto.Add(p); // they dont see me | ||
5363 | } | ||
5364 | else | ||
5365 | { | ||
5366 | viewsToSendme.Add(p); // i see those on it | ||
5367 | } | ||
5368 | } | ||
5369 | } | ||
5370 | allpresences.Clear(); | ||
5371 | } // now on a private parcel end | ||
5372 | |||
5373 | else | ||
5374 | { | ||
5375 | // now on public parcel | ||
5376 | if (m_previusParcelHide && m_previusParcelUUID != UUID.Zero) | ||
5377 | { | ||
5378 | // was on private area | ||
5379 | allpresences = m_scene.GetScenePresences(); | ||
5380 | |||
5381 | foreach (ScenePresence p in allpresences) | ||
5382 | { | ||
5383 | if (p.IsChildAgent || p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) | ||
5384 | continue; | ||
5385 | // only those old parcel need receive kills | ||
5386 | if (m_previusParcelUUID == p.currentParcelUUID) | ||
5387 | { | ||
5388 | killsToSendme.Add(p); // i dont see them | ||
5389 | } | ||
5390 | else | ||
5391 | { | ||
5392 | viewsToSendto.Add(p); // they see me | ||
5393 | } | ||
5394 | } | ||
5395 | } | ||
5396 | else | ||
5397 | return; // was on a public area also | ||
5398 | } // now on public parcel end | ||
5399 | |||
5400 | // send the things | ||
5401 | // kill main avatar object | ||
5402 | if (killsToSendto.Count > 0) | ||
5403 | { | ||
5404 | foreach (ScenePresence p in killsToSendto) | ||
5405 | { | ||
5406 | try { p.ControllingClient.SendKillObject(new List<uint> { LocalId }); } | ||
5407 | catch (NullReferenceException) { } | ||
5408 | } | ||
5409 | } | ||
5410 | |||
5411 | if (killsToSendme.Count > 0) | ||
5412 | { | ||
5413 | foreach (ScenePresence p in killsToSendme) | ||
5414 | { | ||
5415 | try {ControllingClient.SendKillObject(new List<uint> { p.LocalId }); } | ||
5416 | catch (NullReferenceException) { } | ||
5417 | } | ||
5418 | } | ||
5419 | |||
5420 | if (viewsToSendto.Count > 0) | ||
5421 | { | ||
5422 | foreach (ScenePresence p in viewsToSendto) | ||
5423 | { | ||
5424 | p.ControllingClient.SendAvatarDataImmediate(this); | ||
5425 | SendAppearanceToAgent(p); | ||
5426 | SendAttachmentsToClient(p.ControllingClient); | ||
5427 | if (Animator != null) | ||
5428 | Animator.SendAnimPackToClient(p.ControllingClient); | ||
5429 | } | ||
5430 | } | ||
5431 | |||
5432 | if (viewsToSendme.Count > 0) | ||
5433 | { | ||
5434 | foreach (ScenePresence p in viewsToSendme) | ||
5435 | { | ||
5436 | ControllingClient.SendAvatarDataImmediate(p); | ||
5437 | p.SendAppearanceToAgent(this); | ||
5438 | p.SendAttachmentsToClient(ControllingClient); | ||
5439 | if (p.Animator != null) | ||
5440 | p.Animator.SendAnimPackToClient(ControllingClient); | ||
5441 | } | ||
5442 | } | ||
5443 | |||
5444 | |||
5445 | } | ||
5248 | } | 5446 | } |
5249 | } | 5447 | } |