diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/EventManager.cs | 13 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 28 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 35 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 79 |
4 files changed, 74 insertions, 81 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 5b1c9f4..ac5f433 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -755,7 +755,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
755 | public event ScriptTimerEvent OnScriptTimerEvent; | 755 | public event ScriptTimerEvent OnScriptTimerEvent; |
756 | */ | 756 | */ |
757 | 757 | ||
758 | public delegate void EstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool EstateSun, float LindenHour); | 758 | public delegate void EstateToolsSunUpdate(ulong regionHandle); |
759 | public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); | 759 | public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); |
760 | 760 | ||
761 | public event EstateToolsSunUpdate OnEstateToolsSunUpdate; | 761 | public event EstateToolsSunUpdate OnEstateToolsSunUpdate; |
@@ -2536,13 +2536,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2536 | } | 2536 | } |
2537 | 2537 | ||
2538 | /// <summary> | 2538 | /// <summary> |
2539 | /// Updates the system as to how the position of the sun should be handled. | 2539 | /// Called when the sun's position parameters have changed in the Region and/or Estate |
2540 | /// </summary> | 2540 | /// </summary> |
2541 | /// <param name="regionHandle"></param> | 2541 | /// <param name="regionHandle">The region that changed</param> |
2542 | /// <param name="FixedTime">True if the Sun Position is fixed</param> | 2542 | public void TriggerEstateToolsSunUpdate(ulong regionHandle) |
2543 | /// <param name="useEstateTime">True if the Estate Settings should be used instead of region</param> | ||
2544 | /// <param name="FixedSunHour">The hour 0.0 <= FixedSunHour <= 24.0 at which the sun is fixed at. Sun Hour 0 is sun-rise, when Day/Night ratio is 1:1</param> | ||
2545 | public void TriggerEstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool useEstateTime, float FixedSunHour) | ||
2546 | { | 2543 | { |
2547 | EstateToolsSunUpdate handlerEstateToolsSunUpdate = OnEstateToolsSunUpdate; | 2544 | EstateToolsSunUpdate handlerEstateToolsSunUpdate = OnEstateToolsSunUpdate; |
2548 | if (handlerEstateToolsSunUpdate != null) | 2545 | if (handlerEstateToolsSunUpdate != null) |
@@ -2551,7 +2548,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2551 | { | 2548 | { |
2552 | try | 2549 | try |
2553 | { | 2550 | { |
2554 | d(regionHandle, FixedTime, useEstateTime, FixedSunHour); | 2551 | d(regionHandle); |
2555 | } | 2552 | } |
2556 | catch (Exception e) | 2553 | catch (Exception e) |
2557 | { | 2554 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2a1949d..54e3b2d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -5619,33 +5619,7 @@ Environment.Exit(1); | |||
5619 | 5619 | ||
5620 | public void TriggerEstateSunUpdate() | 5620 | public void TriggerEstateSunUpdate() |
5621 | { | 5621 | { |
5622 | float sun; | 5622 | EventManager.TriggerEstateToolsSunUpdate(RegionInfo.RegionHandle); |
5623 | if (RegionInfo.RegionSettings.UseEstateSun) | ||
5624 | { | ||
5625 | sun = (float)RegionInfo.EstateSettings.SunPosition; | ||
5626 | if (RegionInfo.EstateSettings.UseGlobalTime) | ||
5627 | { | ||
5628 | sun = EventManager.GetCurrentTimeAsSunLindenHour() - 6.0f; | ||
5629 | } | ||
5630 | |||
5631 | // | ||
5632 | EventManager.TriggerEstateToolsSunUpdate( | ||
5633 | RegionInfo.RegionHandle, | ||
5634 | RegionInfo.EstateSettings.FixedSun, | ||
5635 | RegionInfo.RegionSettings.UseEstateSun, | ||
5636 | sun); | ||
5637 | } | ||
5638 | else | ||
5639 | { | ||
5640 | // Use the Sun Position from the Region Settings | ||
5641 | sun = (float)RegionInfo.RegionSettings.SunPosition - 6.0f; | ||
5642 | |||
5643 | EventManager.TriggerEstateToolsSunUpdate( | ||
5644 | RegionInfo.RegionHandle, | ||
5645 | RegionInfo.RegionSettings.FixedSun, | ||
5646 | RegionInfo.RegionSettings.UseEstateSun, | ||
5647 | sun); | ||
5648 | } | ||
5649 | } | 5623 | } |
5650 | 5624 | ||
5651 | private void HandleReloadEstate(string module, string[] cmd) | 5625 | private void HandleReloadEstate(string module, string[] cmd) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 1fc8d3d..7490ac8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -945,6 +945,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
945 | /// </remarks> | 945 | /// </remarks> |
946 | public UUID FromFolderID { get; set; } | 946 | public UUID FromFolderID { get; set; } |
947 | 947 | ||
948 | /// <summary> | ||
949 | /// IDs of all avatars sat on this scene object. | ||
950 | /// </summary> | ||
951 | /// <remarks> | ||
952 | /// We need this so that we can maintain a linkset wide ordering of avatars sat on different parts. | ||
953 | /// This must be locked before it is read or written. | ||
954 | /// SceneObjectPart sitting avatar add/remove code also locks on this object to avoid race conditions. | ||
955 | /// No avatar should appear more than once in this list. | ||
956 | /// Do not manipulate this list directly - use the Add/Remove sitting avatar methods on SceneObjectPart. | ||
957 | /// </remarks> | ||
958 | protected internal List<UUID> m_sittingAvatars = new List<UUID>(); | ||
959 | |||
948 | #endregion | 960 | #endregion |
949 | 961 | ||
950 | // ~SceneObjectGroup() | 962 | // ~SceneObjectGroup() |
@@ -4523,17 +4535,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
4523 | } | 4535 | } |
4524 | 4536 | ||
4525 | /// <summary> | 4537 | /// <summary> |
4538 | /// Get a copy of the list of sitting avatars on all prims of this object. | ||
4539 | /// </summary> | ||
4540 | /// <remarks> | ||
4541 | /// This is sorted by the order in which avatars sat down. If an avatar stands up then all avatars that sat | ||
4542 | /// down after it move one place down the list. | ||
4543 | /// </remarks> | ||
4544 | /// <returns>A list of the sitting avatars. Returns an empty list if there are no sitting avatars.</returns> | ||
4545 | public List<UUID> GetSittingAvatars() | ||
4546 | { | ||
4547 | lock (m_sittingAvatars) | ||
4548 | return new List<UUID>(m_sittingAvatars); | ||
4549 | } | ||
4550 | |||
4551 | /// <summary> | ||
4526 | /// Gets the number of sitting avatars. | 4552 | /// Gets the number of sitting avatars. |
4527 | /// </summary> | 4553 | /// </summary> |
4528 | /// <remarks>This applies to all sitting avatars whether there is a sit target set or not.</remarks> | 4554 | /// <remarks>This applies to all sitting avatars whether there is a sit target set or not.</remarks> |
4529 | /// <returns></returns> | 4555 | /// <returns></returns> |
4530 | public int GetSittingAvatarsCount() | 4556 | public int GetSittingAvatarsCount() |
4531 | { | 4557 | { |
4532 | int count = 0; | 4558 | lock (m_sittingAvatars) |
4533 | 4559 | return m_sittingAvatars.Count; | |
4534 | Array.ForEach<SceneObjectPart>(m_parts.GetArray(), p => count += p.GetSittingAvatarsCount()); | ||
4535 | |||
4536 | return count; | ||
4537 | } | 4560 | } |
4538 | 4561 | ||
4539 | public override string ToString() | 4562 | public override string ToString() |
@@ -4542,7 +4565,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4542 | } | 4565 | } |
4543 | 4566 | ||
4544 | #region ISceneObject | 4567 | #region ISceneObject |
4545 | 4568 | ||
4546 | public virtual ISceneObject CloneForNewScene() | 4569 | public virtual ISceneObject CloneForNewScene() |
4547 | { | 4570 | { |
4548 | SceneObjectGroup sog = Copy(false); | 4571 | SceneObjectGroup sog = Copy(false); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 143a339..e68793a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -1342,7 +1342,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1342 | public UUID SitTargetAvatar { get; set; } | 1342 | public UUID SitTargetAvatar { get; set; } |
1343 | 1343 | ||
1344 | /// <summary> | 1344 | /// <summary> |
1345 | /// IDs of all avatars start on this object part. | 1345 | /// IDs of all avatars sat on this part. |
1346 | /// </summary> | 1346 | /// </summary> |
1347 | /// <remarks> | 1347 | /// <remarks> |
1348 | /// We need to track this so that we can stop sat upon prims from being attached. | 1348 | /// We need to track this so that we can stop sat upon prims from being attached. |
@@ -5196,18 +5196,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
5196 | /// <param name='avatarId'></param> | 5196 | /// <param name='avatarId'></param> |
5197 | protected internal bool AddSittingAvatar(UUID avatarId) | 5197 | protected internal bool AddSittingAvatar(UUID avatarId) |
5198 | { | 5198 | { |
5199 | if (IsSitTargetSet && SitTargetAvatar == UUID.Zero) | 5199 | lock (ParentGroup.m_sittingAvatars) |
5200 | SitTargetAvatar = avatarId; | 5200 | { |
5201 | if (IsSitTargetSet && SitTargetAvatar == UUID.Zero) | ||
5202 | SitTargetAvatar = avatarId; | ||
5201 | 5203 | ||
5202 | HashSet<UUID> sittingAvatars = m_sittingAvatars; | 5204 | if (m_sittingAvatars == null) |
5205 | m_sittingAvatars = new HashSet<UUID>(); | ||
5203 | 5206 | ||
5204 | if (sittingAvatars == null) | 5207 | if (m_sittingAvatars.Add(avatarId)) |
5205 | sittingAvatars = new HashSet<UUID>(); | 5208 | { |
5209 | ParentGroup.m_sittingAvatars.Add(avatarId); | ||
5206 | 5210 | ||
5207 | lock (sittingAvatars) | 5211 | return true; |
5208 | { | 5212 | } |
5209 | m_sittingAvatars = sittingAvatars; | 5213 | |
5210 | return m_sittingAvatars.Add(avatarId); | 5214 | return false; |
5211 | } | 5215 | } |
5212 | } | 5216 | } |
5213 | 5217 | ||
@@ -5221,27 +5225,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
5221 | /// <param name='avatarId'></param> | 5225 | /// <param name='avatarId'></param> |
5222 | protected internal bool RemoveSittingAvatar(UUID avatarId) | 5226 | protected internal bool RemoveSittingAvatar(UUID avatarId) |
5223 | { | 5227 | { |
5224 | if (SitTargetAvatar == avatarId) | 5228 | lock (ParentGroup.m_sittingAvatars) |
5225 | SitTargetAvatar = UUID.Zero; | 5229 | { |
5226 | 5230 | if (SitTargetAvatar == avatarId) | |
5227 | HashSet<UUID> sittingAvatars = m_sittingAvatars; | 5231 | SitTargetAvatar = UUID.Zero; |
5228 | 5232 | ||
5229 | // This can occur under a race condition where another thread | 5233 | if (m_sittingAvatars == null) |
5230 | if (sittingAvatars == null) | 5234 | return false; |
5231 | return false; | ||
5232 | 5235 | ||
5233 | lock (sittingAvatars) | 5236 | if (m_sittingAvatars.Remove(avatarId)) |
5234 | { | ||
5235 | if (sittingAvatars.Remove(avatarId)) | ||
5236 | { | 5237 | { |
5237 | if (sittingAvatars.Count == 0) | 5238 | if (m_sittingAvatars.Count == 0) |
5238 | m_sittingAvatars = null; | 5239 | m_sittingAvatars = null; |
5239 | 5240 | ||
5241 | ParentGroup.m_sittingAvatars.Remove(avatarId); | ||
5242 | |||
5240 | return true; | 5243 | return true; |
5241 | } | 5244 | } |
5242 | } | ||
5243 | 5245 | ||
5244 | return false; | 5246 | return false; |
5247 | } | ||
5245 | } | 5248 | } |
5246 | 5249 | ||
5247 | /// <summary> | 5250 | /// <summary> |
@@ -5251,16 +5254,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
5251 | /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns> | 5254 | /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns> |
5252 | public HashSet<UUID> GetSittingAvatars() | 5255 | public HashSet<UUID> GetSittingAvatars() |
5253 | { | 5256 | { |
5254 | HashSet<UUID> sittingAvatars = m_sittingAvatars; | 5257 | lock (ParentGroup.m_sittingAvatars) |
5255 | |||
5256 | if (sittingAvatars == null) | ||
5257 | { | 5258 | { |
5258 | return null; | 5259 | if (m_sittingAvatars == null) |
5259 | } | 5260 | return null; |
5260 | else | 5261 | else |
5261 | { | 5262 | return new HashSet<UUID>(m_sittingAvatars); |
5262 | lock (sittingAvatars) | ||
5263 | return new HashSet<UUID>(sittingAvatars); | ||
5264 | } | 5263 | } |
5265 | } | 5264 | } |
5266 | 5265 | ||
@@ -5271,13 +5270,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
5271 | /// <returns></returns> | 5270 | /// <returns></returns> |
5272 | public int GetSittingAvatarsCount() | 5271 | public int GetSittingAvatarsCount() |
5273 | { | 5272 | { |
5274 | HashSet<UUID> sittingAvatars = m_sittingAvatars; | 5273 | lock (ParentGroup.m_sittingAvatars) |
5275 | 5274 | { | |
5276 | if (sittingAvatars == null) | 5275 | if (m_sittingAvatars == null) |
5277 | return 0; | 5276 | return 0; |
5278 | 5277 | else | |
5279 | lock (sittingAvatars) | 5278 | return m_sittingAvatars.Count; |
5280 | return sittingAvatars.Count; | 5279 | } |
5281 | } | 5280 | } |
5282 | } | 5281 | } |
5283 | } | 5282 | } \ No newline at end of file |