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/ScriptEngine/Shared/Api/Implementation') 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 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) --- .../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') 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 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/ScriptEngine/Shared/Api/Implementation') 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 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 --- .../Shared/Api/Implementation/LSL_Api.cs | 48 ++++++++++++++-------- 1 file changed, 31 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') 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/ScriptEngine/Shared/Api/Implementation') 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/ScriptEngine/Shared/Api/Implementation') 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/ScriptEngine/Shared/Api/Implementation') 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/ScriptEngine/Shared/Api/Implementation') 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/ScriptEngine/Shared/Api/Implementation') 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