From 30e5e5cce631d8a3a94b149c6ae1bd1170a17a46 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 2 Jan 2013 19:25:52 +0000 Subject: If an NPC is unowned, then always auto-grant permissions requested via llRequestPermissions() This is consistent with all other OSSL NPC functions that allow unowned avatars to be manipulated. Aims to address http://opensimulator.org/mantis/view.php?id=6483 --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index f9b90c5..d69551f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3463,7 +3463,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api INPCModule npcModule = World.RequestModuleInterface(); if (npcModule != null && npcModule.IsNPC(agentID, World)) { - if (agentID == m_host.ParentGroup.OwnerID || npcModule.GetOwner(agentID) == m_host.ParentGroup.OwnerID) + if (npcModule.CheckPermissions(agentID, m_host.OwnerID)) { lock (m_host.TaskInventory) { -- cgit v1.1 From addab1244ecc586b0a6fc8560b94c871567b78da Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 2 Jan 2013 21:38:00 +0000 Subject: Add "show animations" console command for debug purposes. This shows the current animation sequence and default anims for avatars. --- .../Avatar/Animations/AnimationsCommandModule.cs | 215 +++++++++++++++++++++ .../Avatar/Attachments/AttachmentsCommandModule.cs | 1 + 2 files changed, 216 insertions(+) create mode 100644 OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs b/OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs new file mode 100644 index 0000000..2d418f1 --- /dev/null +++ b/OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs @@ -0,0 +1,215 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using log4net; +using Mono.Addins; +using Nini.Config; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Framework.Console; +using OpenSim.Framework.Monitoring; +using OpenSim.Region.ClientStack.LindenUDP; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Scenes.Animation; +using OpenSim.Services.Interfaces; + +namespace OpenSim.Region.OptionalModules.Avatar.Animations +{ + /// + /// A module that just holds commands for inspecting avatar animations. + /// + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AnimationsCommandModule")] + public class AnimationsCommandModule : ISharedRegionModule + { +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private List m_scenes = new List(); + + public string Name { get { return "Animations Command Module"; } } + + public Type ReplaceableInterface { get { return null; } } + + public void Initialise(IConfigSource source) + { +// m_log.DebugFormat("[ANIMATIONS COMMAND MODULE]: INITIALIZED MODULE"); + } + + public void PostInitialise() + { +// m_log.DebugFormat("[ANIMATIONS COMMAND MODULE]: POST INITIALIZED MODULE"); + } + + public void Close() + { +// m_log.DebugFormat("[ANIMATIONS COMMAND MODULE]: CLOSED MODULE"); + } + + public void AddRegion(Scene scene) + { +// m_log.DebugFormat("[ANIMATIONS COMMAND MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); + } + + public void RemoveRegion(Scene scene) + { +// m_log.DebugFormat("[ATTACHMENTS COMMAND MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName); + + lock (m_scenes) + m_scenes.Remove(scene); + } + + public void RegionLoaded(Scene scene) + { +// m_log.DebugFormat("[ANIMATIONS COMMAND MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); + + lock (m_scenes) + m_scenes.Add(scene); + + scene.AddCommand( + "Users", this, "show animations", + "show animations [ ]", + "Show animation information for avatars in this simulator.", + "If no name is supplied then information for all avatars is shown.\n" + + "Please note that for inventory animations, the animation name is the name under which the animation was originally uploaded\n" + + ", which is not necessarily the current inventory name.", + HandleShowAnimationsCommand); + } + + protected void HandleShowAnimationsCommand(string module, string[] cmd) + { + if (cmd.Length != 2 && cmd.Length < 4) + { + MainConsole.Instance.OutputFormat("Usage: show animations [ ]"); + return; + } + + bool targetNameSupplied = false; + string optionalTargetFirstName = null; + string optionalTargetLastName = null; + + if (cmd.Length >= 4) + { + targetNameSupplied = true; + optionalTargetFirstName = cmd[2]; + optionalTargetLastName = cmd[3]; + } + + StringBuilder sb = new StringBuilder(); + + lock (m_scenes) + { + foreach (Scene scene in m_scenes) + { + if (targetNameSupplied) + { + ScenePresence sp = scene.GetScenePresence(optionalTargetFirstName, optionalTargetLastName); + if (sp != null && !sp.IsChildAgent) + GetAttachmentsReport(sp, sb); + } + else + { + scene.ForEachRootScenePresence(sp => GetAttachmentsReport(sp, sb)); + } + } + } + + MainConsole.Instance.Output(sb.ToString()); + } + + private void GetAttachmentsReport(ScenePresence sp, StringBuilder sb) + { + sb.AppendFormat("Animations for {0}\n", sp.Name); + + ConsoleDisplayList cdl = new ConsoleDisplayList(); + ScenePresenceAnimator spa = sp.Animator; + AnimationSet anims = sp.Animator.Animations; + + string cma = spa.CurrentMovementAnimation; + cdl.AddRow( + "Current movement anim", + string.Format("{0}, {1}", DefaultAvatarAnimations.GetDefaultAnimation(cma), cma)); + + UUID defaultAnimId = anims.DefaultAnimation.AnimID; + cdl.AddRow( + "Default anim", + string.Format("{0}, {1}", defaultAnimId, GetAnimName(sp.Scene.AssetService, defaultAnimId))); + + UUID implicitDefaultAnimId = anims.ImplicitDefaultAnimation.AnimID; + cdl.AddRow( + "Implicit default anim", + string.Format("{0}, {1}", implicitDefaultAnimId, GetAnimName(sp.Scene.AssetService, implicitDefaultAnimId))); + + cdl.AddToStringBuilder(sb); + + ConsoleDisplayTable cdt = new ConsoleDisplayTable() { Indent = 2 }; + cdt.AddColumn("Animation ID", 36); + cdt.AddColumn("Name", 20); + cdt.AddColumn("Seq", 3); + cdt.AddColumn("Object ID", 36); + + UUID[] animIds; + int[] sequenceNumbers; + UUID[] objectIds; + + sp.Animator.Animations.GetArrays(out animIds, out sequenceNumbers, out objectIds); + + for (int i = 0; i < animIds.Length; i++) + { + UUID animId = animIds[i]; + string animName = GetAnimName(sp.Scene.AssetService, animId); + int seq = sequenceNumbers[i]; + UUID objectId = objectIds[i]; + + cdt.Rows.Add(new ConsoleDisplayTableRow(animId, animName, seq, objectId)); + } + + cdt.AddToStringBuilder(sb); + sb.Append("\n"); + } + + private string GetAnimName(IAssetService assetService, UUID animId) + { + string animName; + + if (!DefaultAvatarAnimations.AnimsNames.TryGetValue(animId, out animName)) + { + AssetMetadata amd = assetService.GetMetadata(animId.ToString()); + if (amd != null) + animName = amd.Name; + else + animName = "Unknown"; + } + + return animName; + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs b/OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs index 68bcb4a..d97e3b3 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs @@ -97,6 +97,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments "Users", this, "attachments show", "attachments show [ ]", "Show attachment information for avatars in this simulator.", + "If no name is supplied then information for all avatars is shown.", HandleShowAttachmentsCommand); } -- cgit v1.1 From 70695a6ed96064f0bfd94a6e0c6da935b6e8f908 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Wed, 12 Dec 2012 17:10:08 +0200 Subject: Implemented Return Objects when it's invoked from the Top Colliders or Top Scripts dialogs --- .../CoreModules/World/Land/LandManagementModule.cs | 60 ++++++++++++++++++++-- 1 file changed, 55 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 7149aad..e85b7a2 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -1395,15 +1395,65 @@ namespace OpenSim.Region.CoreModules.World.Land public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) { - ILandObject selectedParcel = null; - lock (m_landList) + if (localID != -1) { - m_landList.TryGetValue(localID, out selectedParcel); + ILandObject selectedParcel = null; + lock (m_landList) + { + m_landList.TryGetValue(localID, out selectedParcel); + } + + if (selectedParcel == null) return; + + selectedParcel.ReturnLandObjects(returnType, agentIDs, taskIDs, remoteClient); } + else + { + if (returnType != 1) + { + m_log.WarnFormat("[LAND MANAGEMENT MODULE] ReturnObjectsInParcel: unknown return type {0}", returnType); + return; + } + + // We get here when the user returns objects from the list of Top Colliders or Top Scripts. + // In that case we receive specific object UUID's, but no parcel ID. - if (selectedParcel == null) return; + Dictionary> returns = new Dictionary>(); - selectedParcel.ReturnLandObjects(returnType, agentIDs, taskIDs, remoteClient); + foreach (UUID groupID in taskIDs) + { + SceneObjectGroup obj = m_scene.GetSceneObjectGroup(groupID); + if (obj != null) + { + if (!returns.ContainsKey(obj.OwnerID)) + returns[obj.OwnerID] = new HashSet(); + returns[obj.OwnerID].Add(obj); + } + else + { + m_log.WarnFormat("[LAND MANAGEMENT MODULE] ReturnObjectsInParcel: unknown object {0}", groupID); + } + } + + int num = 0; + foreach (HashSet objs in returns.Values) + num += objs.Count; + m_log.DebugFormat("[LAND MANAGEMENT MODULE] Returning {0} specific object(s)", num); + + foreach (HashSet objs in returns.Values) + { + List objs2 = new List(objs); + if (m_scene.Permissions.CanReturnObjects(null, remoteClient.AgentId, objs2)) + { + m_scene.returnObjects(objs2.ToArray(), remoteClient.AgentId); + } + else + { + m_log.WarnFormat("[LAND MANAGEMENT MODULE] ReturnObjectsInParcel: not permitted to return {0} object(s) belonging to user {1}", + objs2.Count, objs2[0].OwnerID); + } + } + } } public void EventManagerOnNoLandDataFromStorage() -- cgit v1.1 From 6b55f5183787fb719c7bd4547e5894096a7aed51 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 2 Jan 2013 22:11:13 +0000 Subject: minor: Allow objects to be added directly to a row on a ConsoleDisplayTable rather than having to ToString() them first --- .../Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs b/OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs index 2d418f1..ffef912 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs @@ -189,7 +189,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Animations int seq = sequenceNumbers[i]; UUID objectId = objectIds[i]; - cdt.Rows.Add(new ConsoleDisplayTableRow(animId, animName, seq, objectId)); + cdt.AddRow(animId, animName, seq, objectId); } cdt.AddToStringBuilder(sb); -- cgit v1.1 From d2f4ca0dfed69637892c2346fa87c88f08c9b8e5 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Thu, 23 Aug 2012 21:23:16 +0300 Subject: If Save OAR/IAR times-out while waiting for assets then notify the caller that the operation failed --- .../Archiver/InventoryArchiveWriteRequest.cs | 10 ++++++-- .../World/Archiver/ArchiveWriteRequest.cs | 28 +++++++++++++++------- .../CoreModules/World/Archiver/AssetsArchiver.cs | 7 ------ .../CoreModules/World/Archiver/AssetsRequest.cs | 18 +++++++------- 4 files changed, 37 insertions(+), 26 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index d0e88f6..4c85637 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs @@ -124,7 +124,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver SaveAssets = true; } - protected void ReceivedAllAssets(ICollection assetsFoundUuids, ICollection assetsNotFoundUuids) + protected void ReceivedAllAssets(ICollection assetsFoundUuids, ICollection assetsNotFoundUuids, bool timedOut) { Exception reportedException = null; bool succeeded = true; @@ -143,6 +143,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver m_saveStream.Close(); } + if (timedOut) + { + succeeded = false; + reportedException = new Exception("Loading assets timed out"); + } + m_module.TriggerInventoryArchiveSaved( m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException); } @@ -350,7 +356,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver { m_log.DebugFormat("[INVENTORY ARCHIVER]: Not saving assets since --noassets was specified"); - ReceivedAllAssets(new List(), new List()); + ReceivedAllAssets(new List(), new List(), false); } } catch (Exception) diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs index 7bdd65c..367693d 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs @@ -587,19 +587,29 @@ namespace OpenSim.Region.CoreModules.World.Archiver } } - protected void ReceivedAllAssets( - ICollection assetsFoundUuids, ICollection assetsNotFoundUuids) + protected void ReceivedAllAssets(ICollection assetsFoundUuids, ICollection assetsNotFoundUuids, bool timedOut) { - foreach (UUID uuid in assetsNotFoundUuids) + string errorMessage; + + if (timedOut) { - m_log.DebugFormat("[ARCHIVER]: Could not find asset {0}", uuid); + errorMessage = "Loading assets timed out"; } + else + { + foreach (UUID uuid in assetsNotFoundUuids) + { + m_log.DebugFormat("[ARCHIVER]: Could not find asset {0}", uuid); + } - // m_log.InfoFormat( - // "[ARCHIVER]: Received {0} of {1} assets requested", - // assetsFoundUuids.Count, assetsFoundUuids.Count + assetsNotFoundUuids.Count); + // m_log.InfoFormat( + // "[ARCHIVER]: Received {0} of {1} assets requested", + // assetsFoundUuids.Count, assetsFoundUuids.Count + assetsNotFoundUuids.Count); - CloseArchive(String.Empty); + errorMessage = String.Empty; + } + + CloseArchive(errorMessage); } /// @@ -626,4 +636,4 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_rootScene.EventManager.TriggerOarFileSaved(m_requestId, errorMessage); } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs index 95d109c..c1ff94d 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs @@ -150,12 +150,5 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_log.InfoFormat("[ARCHIVER]: Added {0} assets to archive", m_assetsWritten); } - /// - /// Only call this if you need to force a close on the underlying writer. - /// - public void ForceClose() - { - m_archiveWriter.Close(); - } } } diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs index 103eb47..b22bcf9 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs @@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// Method called when all the necessary assets for an archive request have been received. /// public delegate void AssetsRequestCallback( - ICollection assetsFoundUuids, ICollection assetsNotFoundUuids); + ICollection assetsFoundUuids, ICollection assetsNotFoundUuids, bool timedOut); enum RequestState { @@ -148,7 +148,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver if (m_repliesRequired == 0) { m_requestState = RequestState.Completed; - PerformAssetsRequestCallback(null); + PerformAssetsRequestCallback(false); return; } @@ -164,7 +164,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver protected void OnRequestCallbackTimeout(object source, ElapsedEventArgs args) { - bool close = true; + bool timedOut = true; try { @@ -174,7 +174,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver // the final request came in (assuming that such a thing is possible) if (m_requestState == RequestState.Completed) { - close = false; + timedOut = false; return; } @@ -223,8 +223,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver } finally { - if (close) - m_assetsArchiver.ForceClose(); + if (timedOut) + Util.FireAndForget(PerformAssetsRequestCallback, true); } } @@ -294,7 +294,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver // We want to stop using the asset cache thread asap // as we now need to do the work of producing the rest of the archive - Util.FireAndForget(PerformAssetsRequestCallback); + Util.FireAndForget(PerformAssetsRequestCallback, false); } else { @@ -315,9 +315,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver { Culture.SetCurrentCulture(); + Boolean timedOut = (Boolean)o; + try { - m_assetsRequestCallback(m_foundAssetUuids, m_notFoundAssetUuids); + m_assetsRequestCallback(m_foundAssetUuids, m_notFoundAssetUuids, timedOut); } catch (Exception e) { -- cgit v1.1 From 9784e4e07db63a23897876dfbd27974878d5eca9 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Thu, 9 Aug 2012 14:51:05 +0300 Subject: Changed locks to prevent deadlocks (especially during multi-region Load OAR) --- .../World/Archiver/ArchiveReadRequest.cs | 42 ++++++++++++------- .../CoreModules/World/Land/LandManagementModule.cs | 47 +++++++++++++--------- .../CoreModules/World/Land/PrimCountModule.cs | 11 +++-- 3 files changed, 61 insertions(+), 39 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index c810242..32d245f 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -604,13 +604,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// private bool ResolveUserUuid(Scene scene, UUID uuid) { - if (!m_validUserUuids.ContainsKey(uuid)) + lock (m_validUserUuids) { - UserAccount account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, uuid); - m_validUserUuids.Add(uuid, account != null); - } + if (!m_validUserUuids.ContainsKey(uuid)) + { + // Note: we call GetUserAccount() inside the lock because this UserID is likely + // to occur many times, and we only want to query the users service once. + UserAccount account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, uuid); + m_validUserUuids.Add(uuid, account != null); + } - return m_validUserUuids[uuid]; + return m_validUserUuids[uuid]; + } } /// @@ -623,19 +628,26 @@ namespace OpenSim.Region.CoreModules.World.Archiver if (uuid == UUID.Zero) return true; // this means the object has no group - if (!m_validGroupUuids.ContainsKey(uuid)) + lock (m_validGroupUuids) { - bool exists; - - if (m_groupsModule == null) - exists = false; - else - exists = (m_groupsModule.GetGroupRecord(uuid) != null); + if (!m_validGroupUuids.ContainsKey(uuid)) + { + bool exists; + if (m_groupsModule == null) + { + exists = false; + } + else + { + // Note: we call GetGroupRecord() inside the lock because this GroupID is likely + // to occur many times, and we only want to query the groups service once. + exists = (m_groupsModule.GetGroupRecord(uuid) != null); + } + m_validGroupUuids.Add(uuid, exists); + } - m_validGroupUuids.Add(uuid, exists); + return m_validGroupUuids[uuid]; } - - return m_validGroupUuids[uuid]; } /// Load an asset diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index e85b7a2..4b1e6b9 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -287,14 +287,15 @@ namespace OpenSim.Region.CoreModules.World.Land LandData newData = data.Copy(); newData.LocalID = local_id; + ILandObject land; lock (m_landList) { - if (m_landList.ContainsKey(local_id)) - { - m_landList[local_id].LandData = newData; - m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, m_landList[local_id]); - } + if (m_landList.TryGetValue(local_id, out land)) + land.LandData = newData; } + + if (land != null) + m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, land); } public bool AllowedForcefulBans @@ -613,7 +614,7 @@ namespace OpenSim.Region.CoreModules.World.Land // Only now can we add the prim counts to the land object - we rely on the global ID which is generated // as a random UUID inside LandData initialization if (m_primCountModule != null) - new_land.PrimCounts = m_primCountModule.GetPrimCounts(new_land.LandData.GlobalID); + new_land.PrimCounts = m_primCountModule.GetPrimCounts(new_land.LandData.GlobalID); lock (m_landList) { @@ -650,6 +651,7 @@ namespace OpenSim.Region.CoreModules.World.Land /// Land.localID of the peice of land to remove. public void removeLandObject(int local_id) { + ILandObject land; lock (m_landList) { for (int x = 0; x < 64; x++) @@ -666,9 +668,11 @@ namespace OpenSim.Region.CoreModules.World.Land } } - m_scene.EventManager.TriggerLandObjectRemoved(m_landList[local_id].LandData.GlobalID); + land = m_landList[local_id]; m_landList.Remove(local_id); } + + m_scene.EventManager.TriggerLandObjectRemoved(land.LandData.GlobalID); } /// @@ -676,21 +680,27 @@ namespace OpenSim.Region.CoreModules.World.Land /// public void Clear(bool setupDefaultParcel) { + List parcels; lock (m_landList) { - foreach (ILandObject lo in m_landList.Values) - { - //m_scene.SimulationDataService.RemoveLandObject(lo.LandData.GlobalID); - m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID); - } + parcels = new List(m_landList.Values); + } + + foreach (ILandObject lo in parcels) + { + //m_scene.SimulationDataService.RemoveLandObject(lo.LandData.GlobalID); + m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID); + } + lock (m_landList) + { m_landList.Clear(); ResetSimLandObjects(); - - if (setupDefaultParcel) - CreateDefaultParcel(); } + + if (setupDefaultParcel) + CreateDefaultParcel(); } private void performFinalLandJoin(ILandObject master, ILandObject slave) @@ -1458,11 +1468,8 @@ namespace OpenSim.Region.CoreModules.World.Land public void EventManagerOnNoLandDataFromStorage() { - lock (m_landList) - { - ResetSimLandObjects(); - CreateDefaultParcel(); - } + ResetSimLandObjects(); + CreateDefaultParcel(); } #endregion diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index f9cc0cf..9b51cc8 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -490,11 +490,14 @@ namespace OpenSim.Region.CoreModules.World.Land m_Scene.ForEachSOG(AddObject); - List primcountKeys = new List(m_PrimCounts.Keys); - foreach (UUID k in primcountKeys) + lock (m_PrimCounts) { - if (!m_OwnerMap.ContainsKey(k)) - m_PrimCounts.Remove(k); + List primcountKeys = new List(m_PrimCounts.Keys); + foreach (UUID k in primcountKeys) + { + if (!m_OwnerMap.ContainsKey(k)) + m_PrimCounts.Remove(k); + } } m_Tainted = false; -- cgit v1.1 From 2db1f22b8930a4350f06b11f76fceb359c31d54d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 2 Jan 2013 22:31:18 +0000 Subject: minor: minor code and log formatting fixes to recent changes in LandManagementModule --- OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 4b1e6b9..6e0c007 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -1413,7 +1413,8 @@ namespace OpenSim.Region.CoreModules.World.Land m_landList.TryGetValue(localID, out selectedParcel); } - if (selectedParcel == null) return; + if (selectedParcel == null) + return; selectedParcel.ReturnLandObjects(returnType, agentIDs, taskIDs, remoteClient); } @@ -1421,7 +1422,7 @@ namespace OpenSim.Region.CoreModules.World.Land { if (returnType != 1) { - m_log.WarnFormat("[LAND MANAGEMENT MODULE] ReturnObjectsInParcel: unknown return type {0}", returnType); + m_log.WarnFormat("[LAND MANAGEMENT MODULE]: ReturnObjectsInParcel: unknown return type {0}", returnType); return; } @@ -1441,14 +1442,14 @@ namespace OpenSim.Region.CoreModules.World.Land } else { - m_log.WarnFormat("[LAND MANAGEMENT MODULE] ReturnObjectsInParcel: unknown object {0}", groupID); + m_log.WarnFormat("[LAND MANAGEMENT MODULE]: ReturnObjectsInParcel: unknown object {0}", groupID); } } int num = 0; foreach (HashSet objs in returns.Values) num += objs.Count; - m_log.DebugFormat("[LAND MANAGEMENT MODULE] Returning {0} specific object(s)", num); + m_log.DebugFormat("[LAND MANAGEMENT MODULE]: Returning {0} specific object(s)", num); foreach (HashSet objs in returns.Values) { @@ -1459,7 +1460,7 @@ namespace OpenSim.Region.CoreModules.World.Land } else { - m_log.WarnFormat("[LAND MANAGEMENT MODULE] ReturnObjectsInParcel: not permitted to return {0} object(s) belonging to user {1}", + m_log.WarnFormat("[LAND MANAGEMENT MODULE]: ReturnObjectsInParcel: not permitted to return {0} object(s) belonging to user {1}", objs2.Count, objs2[0].OwnerID); } } -- cgit v1.1 From 8f31649faddfc2f7a28131f592b1e79ae75b863f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 2 Jan 2013 22:37:50 +0000 Subject: Fix indenting on ConsoleDisplayTable, align indenting on "show animations" console command --- .../Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs b/OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs index ffef912..e951d9e 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs @@ -149,7 +149,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Animations { sb.AppendFormat("Animations for {0}\n", sp.Name); - ConsoleDisplayList cdl = new ConsoleDisplayList(); + ConsoleDisplayList cdl = new ConsoleDisplayList() { Indent = 2 }; ScenePresenceAnimator spa = sp.Animator; AnimationSet anims = sp.Animator.Animations; -- cgit v1.1 From 24e486e9dfd5838b1ce1085586f84998aec3aae3 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Tue, 25 Dec 2012 10:50:03 +0200 Subject: Fixed: the AvatarEnteringNewParcel event wasn't triggered in some cases If an avatar moved between regions: A -> B -> A, then when returning to region A the AvatarEnteringNewParcel wasn't triggered. This happened because the ScenePresence in region A still remembered its previous 'currentParcelUUID', so it appeared as if the avatar didn't change parcels. Now, however, when a ScenePresence becomes a child presence we clear its 'currentParcelUUID'. --- OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 6e0c007..dbf5138 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -133,6 +133,7 @@ namespace OpenSim.Region.CoreModules.World.Land m_scene.EventManager.OnValidateLandBuy += EventManagerOnValidateLandBuy; m_scene.EventManager.OnLandBuy += EventManagerOnLandBuy; m_scene.EventManager.OnNewClient += EventManagerOnNewClient; + m_scene.EventManager.OnMakeChildAgent += EventMakeChildAgent; m_scene.EventManager.OnSignificantClientMovement += EventManagerOnSignificantClientMovement; m_scene.EventManager.OnNoticeNoLandDataFromStorage += EventManagerOnNoLandDataFromStorage; m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage; @@ -218,6 +219,11 @@ namespace OpenSim.Region.CoreModules.World.Land } } + public void EventMakeChildAgent(ScenePresence avatar) + { + avatar.currentParcelUUID = UUID.Zero; + } + void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) { //If we are forcing a position for them to go -- cgit v1.1 From 1a6694b26487e4b9bd33e1c6c4415fb7d36f0d1d Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Tue, 25 Dec 2012 10:47:45 +0200 Subject: Fixed several problems with the Sun: some settings didn't work, or were inconsistently used. - The sun position is always calculated by combining the sun settings in the Region and Estate. This fixes the problem that 'UseEstateSun' didn't work. - To remove ambiguity, the EstateToolsSunUpdate event no longer accepts the sun's position as parameters. That's because the position is always calculated from the Region and Estate settings. - Use only the 'FixedSun' flag to determine whether the sun is fixed; not the 'UseGlobalTime' flag. - Don't change the region's 'SunPosition' field according to the sun's position: this field is used only to set the position when using a FixedSun. (The 'SunVector' field does get updated according to the sun's position in the sky) --- .../World/Estate/EstateManagementModule.cs | 3 +- OpenSim/Region/CoreModules/World/Sun/SunModule.cs | 44 ++++++++++++---------- OpenSim/Region/Framework/Scenes/EventManager.cs | 13 +++---- OpenSim/Region/Framework/Scenes/Scene.cs | 28 +------------- .../Shared/Api/Implementation/OSSL_Api.cs | 10 ++--- 5 files changed, 37 insertions(+), 61 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index eb06fcc..d05abc5 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -118,7 +118,7 @@ namespace OpenSim.Region.CoreModules.World.Estate { uint sun = 0; - if (!Scene.RegionInfo.EstateSettings.UseGlobalTime) + if (Scene.RegionInfo.EstateSettings.FixedSun) sun = (uint)(Scene.RegionInfo.EstateSettings.SunPosition * 1024.0) + 0x1800; UUID estateOwner; estateOwner = Scene.RegionInfo.EstateSettings.EstateOwner; @@ -1091,6 +1091,7 @@ namespace OpenSim.Region.CoreModules.World.Estate { Scene.RegionInfo.EstateSettings.UseGlobalTime = false; Scene.RegionInfo.EstateSettings.SunPosition = (parms2 - 0x1800)/1024.0; + // Warning: FixedSun should be set to True, otherwise this sun position won't be used. } if ((parms1 & 0x00000010) != 0) diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs index a321c09..6f344c8 100644 --- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs +++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs @@ -252,12 +252,11 @@ namespace OpenSim.Region.CoreModules } // TODO: Decouple this, so we can get rid of Linden Hour info - // Update Region infor with new Sun Position and Hour + // Update Region with new Sun Vector // set estate settings for region access to sun position if (receivedEstateToolsSunUpdate) { m_scene.RegionInfo.RegionSettings.SunVector = Position; - m_scene.RegionInfo.RegionSettings.SunPosition = GetCurrentTimeAsLindenSunHour(); } } @@ -395,7 +394,7 @@ namespace OpenSim.Region.CoreModules ready = false; // Remove our hooks - m_scene.EventManager.OnFrame -= SunUpdate; + m_scene.EventManager.OnFrame -= SunUpdate; m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; m_scene.EventManager.OnEstateToolsSunUpdate -= EstateToolsSunUpdate; m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour; @@ -459,26 +458,33 @@ namespace OpenSim.Region.CoreModules SunToClient(avatar.ControllingClient); } - /// - /// - /// - /// - /// Is the sun's position fixed? - /// Use the Region or Estate Sun hour? - /// What hour of the day is the Sun Fixed at? - public void EstateToolsSunUpdate(ulong regionHandle, bool FixedSun, bool useEstateTime, float FixedSunHour) + public void EstateToolsSunUpdate(ulong regionHandle) { if (m_scene.RegionInfo.RegionHandle == regionHandle) { - // Must limit the Sun Hour to 0 ... 24 - while (FixedSunHour > 24.0f) - FixedSunHour -= 24; + float sunFixedHour; + bool fixedSun; - while (FixedSunHour < 0) - FixedSunHour += 24; + if (m_scene.RegionInfo.RegionSettings.UseEstateSun) + { + sunFixedHour = (float)m_scene.RegionInfo.EstateSettings.SunPosition; + fixedSun = m_scene.RegionInfo.EstateSettings.FixedSun; + } + else + { + sunFixedHour = (float)m_scene.RegionInfo.RegionSettings.SunPosition - 6.0f; + fixedSun = m_scene.RegionInfo.RegionSettings.FixedSun; + } + + // Must limit the Sun Hour to 0 ... 24 + while (sunFixedHour > 24.0f) + sunFixedHour -= 24; - m_SunFixedHour = FixedSunHour; - m_SunFixed = FixedSun; + while (sunFixedHour < 0) + sunFixedHour += 24; + + m_SunFixedHour = sunFixedHour; + m_SunFixed = fixedSun; // m_log.DebugFormat("[SUN]: Sun Settings Update: Fixed Sun? : {0}", m_SunFixed.ToString()); // m_log.DebugFormat("[SUN]: Sun Settings Update: Sun Hour : {0}", m_SunFixedHour.ToString()); @@ -501,7 +507,7 @@ namespace OpenSim.Region.CoreModules { m_scene.ForEachRootClient(delegate(IClientAPI client) { - SunToClient(client); + SunToClient(client); }); } diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 4c49b71..6b08e0f 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -751,7 +751,7 @@ namespace OpenSim.Region.Framework.Scenes public event ScriptTimerEvent OnScriptTimerEvent; */ - public delegate void EstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool EstateSun, float LindenHour); + public delegate void EstateToolsSunUpdate(ulong regionHandle); public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); public event EstateToolsSunUpdate OnEstateToolsSunUpdate; @@ -2507,13 +2507,10 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Updates the system as to how the position of the sun should be handled. + /// Called when the sun's position parameters have changed in the Region and/or Estate /// - /// - /// True if the Sun Position is fixed - /// True if the Estate Settings should be used instead of region - /// 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 - public void TriggerEstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool useEstateTime, float FixedSunHour) + /// The region that changed + public void TriggerEstateToolsSunUpdate(ulong regionHandle) { EstateToolsSunUpdate handlerEstateToolsSunUpdate = OnEstateToolsSunUpdate; if (handlerEstateToolsSunUpdate != null) @@ -2522,7 +2519,7 @@ namespace OpenSim.Region.Framework.Scenes { try { - d(regionHandle, FixedTime, useEstateTime, FixedSunHour); + d(regionHandle); } catch (Exception e) { diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index cca295c..11b63b7 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -5345,33 +5345,7 @@ namespace OpenSim.Region.Framework.Scenes public void TriggerEstateSunUpdate() { - float sun; - if (RegionInfo.RegionSettings.UseEstateSun) - { - sun = (float)RegionInfo.EstateSettings.SunPosition; - if (RegionInfo.EstateSettings.UseGlobalTime) - { - sun = EventManager.GetCurrentTimeAsSunLindenHour() - 6.0f; - } - - // - EventManager.TriggerEstateToolsSunUpdate( - RegionInfo.RegionHandle, - RegionInfo.EstateSettings.FixedSun, - RegionInfo.RegionSettings.UseEstateSun, - sun); - } - else - { - // Use the Sun Position from the Region Settings - sun = (float)RegionInfo.RegionSettings.SunPosition - 6.0f; - - EventManager.TriggerEstateToolsSunUpdate( - RegionInfo.RegionHandle, - RegionInfo.RegionSettings.FixedSun, - RegionInfo.RegionSettings.UseEstateSun, - sun); - } + EventManager.TriggerEstateToolsSunUpdate(RegionInfo.RegionHandle); } private void HandleReloadEstate(string module, string[] cmd) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 828288d..33c02ef 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1205,12 +1205,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api sunHour += 24.0; World.RegionInfo.RegionSettings.UseEstateSun = useEstateSun; - World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30 - World.RegionInfo.RegionSettings.FixedSun = sunFixed; + World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30 + World.RegionInfo.RegionSettings.FixedSun = sunFixed; World.RegionInfo.RegionSettings.Save(); - World.EventManager.TriggerEstateToolsSunUpdate( - World.RegionInfo.RegionHandle, sunFixed, useEstateSun, (float)sunHour); + World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle); } /// @@ -1235,8 +1234,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api World.RegionInfo.EstateSettings.FixedSun = sunFixed; World.RegionInfo.EstateSettings.Save(); - World.EventManager.TriggerEstateToolsSunUpdate( - World.RegionInfo.RegionHandle, sunFixed, World.RegionInfo.RegionSettings.UseEstateSun, (float)sunHour); + World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle); } /// -- cgit v1.1 From 589e3e868689c70dccd906ee9f17fad5e11dd4a9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 3 Jan 2013 00:03:29 +0000 Subject: minor: Change channel digger replacement message in TerrainModule to Info from Warn. This is to stop this unnecessarily triggering log analysis code which reports warn and error level statements. --- OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 52b4313..fd30c46 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs @@ -480,7 +480,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain else { m_plugineffects[pluginName] = effect; - m_log.Warn("E ... " + pluginName + " (Replaced)"); + m_log.Info("E ... " + pluginName + " (Replaced)"); } } } -- cgit v1.1 From 79b7c571ffa5cd7b40272dc56642d43f688202f6 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Mon, 29 Oct 2012 11:27:05 +0000 Subject: updating documentation in SampleMoneyModule based on doxygen error log output; changing an xml-style hint to a uri-style hint in the class summary, improving documentation of Initialise method and removing a superfluous parameter, improving documentating of ClientClosed method and documenting an omitted parameter --- .../OptionalModules/World/MoneyModule/SampleMoneyModule.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs index 8f04ede..7bbf500 100644 --- a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs +++ b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs @@ -49,7 +49,7 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule /// (such as land transfers). There is no money code here! Use FORGE as an example for money code. /// Demo Economy/Money Module. This is a purposely crippled module! /// // To land transfer you need to add: - /// -helperuri
+ /// -helperuri http://serveraddress:port/ /// to the command line parameters you use to start up your client /// This commonly looks like -helperuri http://127.0.0.1:9000/ /// @@ -116,10 +116,9 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule } /// - /// Startup + /// Called on startup so the module can be configured. /// - /// - /// + /// Configuration source. public void Initialise(IConfigSource config) { m_gConfig = config; @@ -674,9 +673,12 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule } /// - /// When the client closes the connection we remove their accounting info from memory to free up resources. + /// When the client closes the connection we remove their accounting + /// info from memory to free up resources. /// - /// + /// UUID of agent + /// Scene the agent was connected to. + /// public void ClientClosed(UUID AgentID, Scene scene) { -- cgit v1.1 From a5ac6af16a0b6816fb4edb53f25085b85c21e40f Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Mon, 29 Oct 2012 11:45:47 +0000 Subject: Improving documentation of AttachToAvatar and GetLine methods in LSL_Api.cs based on doxygen error output --- .../Shared/Api/Implementation/LSL_Api.cs | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index d69551f..75749a9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3007,7 +3007,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// /// Attach the object containing this script to the avatar that owns it. /// - /// The attachment point (e.g. ATTACH_CHEST) + /// + /// The attachment point (e.g. ATTACH_CHEST) + /// /// true if the attach suceeded, false if it did not public bool AttachToAvatar(int attachmentPoint) { @@ -5418,9 +5420,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } /// - /// Insert the list identified by into the - /// list designated by such that the first - /// new element has the index specified by + /// Insert the list identified by into the + /// list designated by such that the first + /// new element has the index specified by /// public LSL_List llListInsertList(LSL_List dest, LSL_List src, int index) @@ -11520,7 +11522,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// Get a notecard line. ///
/// - /// Lines start at index 0 + /// Lines start at index 0 /// public static string GetLine(UUID assetID, int lineNumber) { @@ -11549,9 +11551,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// Get a notecard line. ///
/// - /// Lines start at index 0 - /// Maximum length of the returned line. Longer lines will be truncated - /// + /// Lines start at index 0 + /// + /// Maximum length of the returned line. + /// + /// + /// If the line length is longer than , + /// the return string will be truncated. + /// public static string GetLine(UUID assetID, int lineNumber, int maxLength) { string line = GetLine(assetID, lineNumber); -- cgit v1.1 From aa78df4a79e4e357f8424a0163525c3254b2c146 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 26 Oct 2012 11:22:00 +0100 Subject: Scipt modules get the OpenMetaverse types, so lists passed as arguments to script module functions which then later call LSL_Types.list.GetVector3Item() or LSL_Types.list.GetQuaternionItem() methods would then trigger an InvalidCastException, which is now avoided. --- OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 29 +++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index fcb98a5..44fdd1a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs @@ -631,19 +631,44 @@ namespace OpenSim.Region.ScriptEngine.Shared public LSL_Types.Vector3 GetVector3Item(int itemIndex) { - if(m_data[itemIndex] is LSL_Types.Vector3) + if (m_data[itemIndex] is LSL_Types.Vector3) + { return (LSL_Types.Vector3)m_data[itemIndex]; + } + else if(m_data[itemIndex] is OpenMetaverse.Vector3) + { + return new LSL_Types.Vector3( + (OpenMetaverse.Vector3)m_data[itemIndex]); + } else + { throw new InvalidCastException(string.Format( "{0} expected but {1} given", typeof(LSL_Types.Vector3).Name, m_data[itemIndex] != null ? m_data[itemIndex].GetType().Name : "null")); + } } public LSL_Types.Quaternion GetQuaternionItem(int itemIndex) { - return (LSL_Types.Quaternion)m_data[itemIndex]; + if (m_data[itemIndex] is LSL_Types.Quaternion) + { + return (LSL_Types.Quaternion)m_data[itemIndex]; + } + else if(m_data[itemIndex] is OpenMetaverse.Quaternion) + { + return new LSL_Types.Quaternion( + (OpenMetaverse.Quaternion)m_data[itemIndex]); + } + else + { + throw new InvalidCastException(string.Format( + "{0} expected but {1} given", + typeof(LSL_Types.Quaternion).Name, + m_data[itemIndex] != null ? + m_data[itemIndex].GetType().Name : "null")); + } } public LSL_Types.key GetKeyItem(int itemIndex) -- cgit v1.1 From 7f195de3032e909771a3c066d194f073ee0876d6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 3 Jan 2013 20:57:14 +0000 Subject: Fix problem where object attached from ground often does not get attached properly. It seems this is happening because we send a kill for objects that are selected when attached. A code comment says that this is to get the client to deselect it, but v3 and v1 clients do this just fine without the kill. Aims to address http://opensimulator.org/mantis/view.php?id=6456 --- .../Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 24170fc..da59472 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -654,15 +654,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (!silent) { - // Killing it here will cause the client to deselect it - // It then reappears on the avatar, deselected - // through the full update below - // - if (so.IsSelected) - { - m_scene.SendKillObject(new List { so.RootPart.LocalId }); - } - else if (so.HasPrivateAttachmentPoint) + if (so.HasPrivateAttachmentPoint) { // m_log.DebugFormat( // "[ATTACHMENTS MODULE]: Killing private HUD {0} for avatars other than {1} at attachment point {2}", -- cgit v1.1 From a75f24bb7967e45618f03691e6b9837ef6bcdf27 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 3 Jan 2013 21:06:50 +0000 Subject: minor: Add some doc to the extremely unhelpful 'fudge....' comment as to why we're deselecting the prim in code before scheduling an update on attachment --- OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index da59472..58ed554 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -669,7 +669,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments }); } - so.IsSelected = false; // fudge.... + // Fudge below is an extremely unhelpful comment. It's probably here so that the scheduled full update + // will succeed, as that will not update if an attachment is selected. + so.IsSelected = false; // fudge.... + so.ScheduleGroupForFullUpdate(); } -- cgit v1.1 From 9503383887d6af871e843cbcbb141a50df56f551 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Jan 2013 20:34:39 +0000 Subject: Fix llGetLinkKey() to return the last sat avatar as the last link number. As per http://wiki.secondlife.com/wiki/LlGetLinkKey This is done by keeping a scene-object wide list of sitters. This also fixes bugs in this function where linknums 0 and 1 weren't treated properly if there were sitting avatars on a single prim. This also fixes a minor race condition for multiple concurrent sitters on a prim with no current sitters by locking on the object-wide list rather than individual sop lists Addresses http://opensimulator.org/mantis/view.php?id=6477 --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 35 ++++++++-- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 79 +++++++++++----------- .../Shared/Api/Implementation/LSL_Api.cs | 48 ++++++++----- 3 files changed, 99 insertions(+), 63 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 35e7c45..15795e5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -647,6 +647,18 @@ namespace OpenSim.Region.Framework.Scenes /// public UUID FromFolderID { get; set; } + /// + /// IDs of all avatars sat on this scene object. + /// + /// + /// We need this so that we can maintain a linkset wide ordering of avatars sat on different parts. + /// This must be locked before it is read or written. + /// SceneObjectPart sitting avatar add/remove code also locks on this object to avoid race conditions. + /// No avatar should appear more than once in this list. + /// Do not manipulate this list directly - use the Add/Remove sitting avatar methods on SceneObjectPart. + /// + protected internal List m_sittingAvatars = new List(); + #endregion // ~SceneObjectGroup() @@ -3564,17 +3576,28 @@ namespace OpenSim.Region.Framework.Scenes } /// + /// Get a copy of the list of sitting avatars on all prims of this object. + /// + /// + /// This is sorted by the order in which avatars sat down. If an avatar stands up then all avatars that sat + /// down after it move one place down the list. + /// + /// A list of the sitting avatars. Returns an empty list if there are no sitting avatars. + public List GetSittingAvatars() + { + lock (m_sittingAvatars) + return new List(m_sittingAvatars); + } + + /// /// Gets the number of sitting avatars. /// /// This applies to all sitting avatars whether there is a sit target set or not. /// public int GetSittingAvatarsCount() { - int count = 0; - - Array.ForEach(m_parts.GetArray(), p => count += p.GetSittingAvatarsCount()); - - return count; + lock (m_sittingAvatars) + return m_sittingAvatars.Count; } public override string ToString() @@ -3583,7 +3606,7 @@ namespace OpenSim.Region.Framework.Scenes } #region ISceneObject - + public virtual ISceneObject CloneForNewScene() { SceneObjectGroup sog = Copy(false); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 7a97e5f..232861e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1256,7 +1256,7 @@ namespace OpenSim.Region.Framework.Scenes public UUID SitTargetAvatar { get; set; } /// - /// IDs of all avatars start on this object part. + /// IDs of all avatars sat on this part. /// /// /// We need to track this so that we can stop sat upon prims from being attached. @@ -4504,18 +4504,22 @@ namespace OpenSim.Region.Framework.Scenes /// protected internal bool AddSittingAvatar(UUID avatarId) { - if (IsSitTargetSet && SitTargetAvatar == UUID.Zero) - SitTargetAvatar = avatarId; + lock (ParentGroup.m_sittingAvatars) + { + if (IsSitTargetSet && SitTargetAvatar == UUID.Zero) + SitTargetAvatar = avatarId; - HashSet sittingAvatars = m_sittingAvatars; + if (m_sittingAvatars == null) + m_sittingAvatars = new HashSet(); - if (sittingAvatars == null) - sittingAvatars = new HashSet(); + if (m_sittingAvatars.Add(avatarId)) + { + ParentGroup.m_sittingAvatars.Add(avatarId); - lock (sittingAvatars) - { - m_sittingAvatars = sittingAvatars; - return m_sittingAvatars.Add(avatarId); + return true; + } + + return false; } } @@ -4529,27 +4533,26 @@ namespace OpenSim.Region.Framework.Scenes /// protected internal bool RemoveSittingAvatar(UUID avatarId) { - if (SitTargetAvatar == avatarId) - SitTargetAvatar = UUID.Zero; - - HashSet sittingAvatars = m_sittingAvatars; + lock (ParentGroup.m_sittingAvatars) + { + if (SitTargetAvatar == avatarId) + SitTargetAvatar = UUID.Zero; - // This can occur under a race condition where another thread - if (sittingAvatars == null) - return false; + if (m_sittingAvatars == null) + return false; - lock (sittingAvatars) - { - if (sittingAvatars.Remove(avatarId)) + if (m_sittingAvatars.Remove(avatarId)) { - if (sittingAvatars.Count == 0) + if (m_sittingAvatars.Count == 0) m_sittingAvatars = null; + ParentGroup.m_sittingAvatars.Remove(avatarId); + return true; } - } - return false; + return false; + } } /// @@ -4559,16 +4562,12 @@ namespace OpenSim.Region.Framework.Scenes /// A hashset of the sitting avatars. Returns null if there are no sitting avatars. public HashSet GetSittingAvatars() { - HashSet sittingAvatars = m_sittingAvatars; - - if (sittingAvatars == null) - { - return null; - } - else + lock (ParentGroup.m_sittingAvatars) { - lock (sittingAvatars) - return new HashSet(sittingAvatars); + if (m_sittingAvatars == null) + return null; + else + return new HashSet(m_sittingAvatars); } } @@ -4579,13 +4578,13 @@ namespace OpenSim.Region.Framework.Scenes /// public int GetSittingAvatarsCount() { - HashSet sittingAvatars = m_sittingAvatars; - - if (sittingAvatars == null) - return 0; - - lock (sittingAvatars) - return sittingAvatars.Count; + lock (ParentGroup.m_sittingAvatars) + { + if (m_sittingAvatars == null) + return 0; + else + return m_sittingAvatars.Count; + } } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 75749a9..f31bbff 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3738,33 +3738,47 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String llGetLinkKey(int linknum) { m_host.AddScriptLPS(1); - List keytable = new List(); - // parse for sitting avatare-uuids - World.ForEachRootScenePresence(delegate(ScenePresence presence) - { - if (presence.ParentID != 0 && m_host.ParentGroup.ContainsPart(presence.ParentID)) - keytable.Add(presence.UUID); - }); - int totalprims = m_host.ParentGroup.PrimCount + keytable.Count; - if (linknum > m_host.ParentGroup.PrimCount && linknum <= totalprims) + if (linknum < 0) { - return keytable[totalprims - linknum].ToString(); + if (linknum == ScriptBaseClass.LINK_THIS) + return m_host.UUID.ToString(); + else + return ScriptBaseClass.NULL_KEY; } - if (linknum == 1 && m_host.ParentGroup.PrimCount == 1 && keytable.Count == 1) + int actualPrimCount = m_host.ParentGroup.PrimCount; + List sittingAvatarIds = m_host.ParentGroup.GetSittingAvatars(); + int adjustedPrimCount = actualPrimCount + sittingAvatarIds.Count; + + // Special case for a single prim. In this case the linknum is zero. However, this will not match a single + // prim that has any avatars sat upon it (in which case the root prim is link 1). + if (linknum == 0) { - return m_host.UUID.ToString(); - } + if (actualPrimCount == 1 && sittingAvatarIds.Count == 0) + return m_host.UUID.ToString(); - SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknum); - if (part != null) + return ScriptBaseClass.NULL_KEY; + } + // Special case to handle a single prim with sitting avatars. GetLinkPart() would only match zero but + // here we must match 1 (ScriptBaseClass.LINK_ROOT). + else if (linknum == 1 && actualPrimCount == 1) { - return part.UUID.ToString(); + if (sittingAvatarIds.Count > 0) + return m_host.ParentGroup.RootPart.UUID.ToString(); + else + return ScriptBaseClass.NULL_KEY; + } + else if (linknum <= adjustedPrimCount) + { + if (linknum <= actualPrimCount) + return m_host.ParentGroup.GetLinkNumPart(linknum).UUID.ToString(); + else + return sittingAvatarIds[linknum - actualPrimCount - 1].ToString(); } else { - return UUID.Zero.ToString(); + return ScriptBaseClass.NULL_KEY; } } -- cgit v1.1 From 9869ca83b464d3d88cf3f48ff65ea406168c0516 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Jan 2013 20:54:11 +0000 Subject: Fix llGetLinkName() to return the name of the last avatar sat as the last link number. As per http://wiki.secondlife.com/wiki/LlGetLinkName --- .../Shared/Api/Implementation/LSL_Api.cs | 76 ++++++++++------------ 1 file changed, 35 insertions(+), 41 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index f31bbff..f0e0f1a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3824,62 +3824,56 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String llGetLinkName(int linknum) { m_host.AddScriptLPS(1); - // simplest case, this prims link number - if (linknum == m_host.LinkNum || linknum == ScriptBaseClass.LINK_THIS) - return m_host.Name; - // parse for sitting avatare-names - List nametable = new List(); - World.ForEachRootScenePresence(delegate(ScenePresence presence) - { - SceneObjectPart sitPart = presence.ParentPart; - if (sitPart != null && m_host.ParentGroup.ContainsPart(sitPart.LocalId)) - nametable.Add(presence.ControllingClient.Name); - }); - - int totalprims = m_host.ParentGroup.PrimCount + nametable.Count; - if (totalprims > m_host.ParentGroup.PrimCount) + if (linknum < 0) { - // sitting Avatar-Name with negativ linknum / SinglePrim - if (linknum < 0 && m_host.ParentGroup.PrimCount == 1 && nametable.Count == 1) - return nametable[0]; - // Prim-Name / SinglePrim Sitting Avatar - if (linknum == 1 && m_host.ParentGroup.PrimCount == 1 && nametable.Count == 1) + if (linknum == ScriptBaseClass.LINK_THIS) return m_host.Name; - // LinkNumber > of Real PrimSet = AvatarName - if (linknum > m_host.ParentGroup.PrimCount && linknum <= totalprims) - return nametable[totalprims - linknum]; + else + return ScriptBaseClass.NULL_KEY; } - // Single prim - if (m_host.LinkNum == 0) + int actualPrimCount = m_host.ParentGroup.PrimCount; + List sittingAvatarIds = m_host.ParentGroup.GetSittingAvatars(); + int adjustedPrimCount = actualPrimCount + sittingAvatarIds.Count; + + // Special case for a single prim. In this case the linknum is zero. However, this will not match a single + // prim that has any avatars sat upon it (in which case the root prim is link 1). + if (linknum == 0) { - if (linknum == 0 || linknum == ScriptBaseClass.LINK_ROOT) + if (actualPrimCount == 1 && sittingAvatarIds.Count == 0) return m_host.Name; - else - return UUID.Zero.ToString(); - } - // Link set - SceneObjectPart part = null; - if (m_host.LinkNum == 1) // this is the Root prim + return ScriptBaseClass.NULL_KEY; + } + // Special case to handle a single prim with sitting avatars. GetLinkPart() would only match zero but + // here we must match 1 (ScriptBaseClass.LINK_ROOT). + else if (linknum == 1 && actualPrimCount == 1) { - if (linknum < 0) - part = m_host.ParentGroup.GetLinkNumPart(2); + if (sittingAvatarIds.Count > 0) + return m_host.ParentGroup.RootPart.Name; else - part = m_host.ParentGroup.GetLinkNumPart(linknum); + return ScriptBaseClass.NULL_KEY; } - else // this is a child prim + else if (linknum <= adjustedPrimCount) { - if (linknum < 2) - part = m_host.ParentGroup.GetLinkNumPart(1); + if (linknum <= actualPrimCount) + { + return m_host.ParentGroup.GetLinkNumPart(linknum).Name; + } else - part = m_host.ParentGroup.GetLinkNumPart(linknum); + { + ScenePresence sp = World.GetScenePresence(sittingAvatarIds[linknum - actualPrimCount - 1]); + if (sp != null) + return sp.Name; + else + return ScriptBaseClass.NULL_KEY; + } } - if (part != null) - return part.Name; else - return UUID.Zero.ToString(); + { + return ScriptBaseClass.NULL_KEY; + } } public LSL_Integer llGetInventoryNumber(int type) -- cgit v1.1 From a3bf3a2aa5f0213d238ac31e279dd729bc872769 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Jan 2013 20:56:39 +0000 Subject: refactor: simplify llGetNumberOfPrims() to return prim count + sitting avatar count rather than independently inspecting every scene presence --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index f0e0f1a..14aaa86 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7891,14 +7891,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llGetNumberOfPrims() { m_host.AddScriptLPS(1); - int avatarCount = 0; - World.ForEachRootScenePresence(delegate(ScenePresence presence) - { - if (presence.ParentID != 0 && m_host.ParentGroup.ContainsPart(presence.ParentID)) - avatarCount++; - }); - return m_host.ParentGroup.PrimCount + avatarCount; + return m_host.ParentGroup.PrimCount + m_host.ParentGroup.GetSittingAvatarsCount(); } /// -- cgit v1.1 From dce280913706f7359cac07b98a6126af0bb4240b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Jan 2013 21:18:53 +0000 Subject: Automatically grant sit-related llRequestPermissions() for subsequent avatars sitting on the same scene obejct, instead of wrongly popping up request permissions dialog. Resolves http://opensimulator.org/mantis/view.php?id=6478 --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 14aaa86..967c249 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3412,21 +3412,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else { - bool sitting = false; - if (m_host.SitTargetAvatar == agentID) - { - sitting = true; - } - else - { - foreach (SceneObjectPart p in m_host.ParentGroup.Parts) - { - if (p.SitTargetAvatar == agentID) - sitting = true; - } - } - - if (sitting) + if (m_host.ParentGroup.GetSittingAvatars().Contains(agentID) { // When agent is sitting, certain permissions are implicit if requested from sitting agent implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION | -- cgit v1.1 From 7e45096314e7b0223197b597e859d6134f1b8355 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Jan 2013 21:22:51 +0000 Subject: Fix build break caused by missing ) from dce2809. Was hand-typing in a line of code I had tested before but not retested this time --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 967c249..115bac9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3412,7 +3412,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else { - if (m_host.ParentGroup.GetSittingAvatars().Contains(agentID) + if (m_host.ParentGroup.GetSittingAvatars().Contains(agentID)) { // When agent is sitting, certain permissions are implicit if requested from sitting agent implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION | -- cgit v1.1 From 7232cedd2b591a010ad11e5fb86448ac4dea460b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Jan 2013 21:37:11 +0000 Subject: Set default particle burst count to 1 instead of 0 in any set particle system script call that does not have an empty list. As per http://opensimulator.org/mantis/view.php?id=6353 --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 115bac9..ea4e609 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6194,6 +6194,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ps.BurstSpeedMax = 1.0f; ps.BurstRate = 0.1f; ps.PartMaxAge = 10.0f; + ps.BurstPartCount = 1; return ps; } @@ -6215,9 +6216,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SetParticleSystem(m_host, rules); } - private void SetParticleSystem(SceneObjectPart part, LSL_List rules) { - - + private void SetParticleSystem(SceneObjectPart part, LSL_List rules) + { if (rules.Length == 0) { part.RemoveParticleSystem(); -- cgit v1.1