From e681e1f09af76fd545ad39a883cfd32ed1f8f23c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 7 Feb 2025 22:04:01 +0000 Subject: [PATCH] add llGetLinkSitFlags and dummy llSetLinkSitFlags --- .../Shared/Api/Implementation/LSL_Api.cs | 57 +++++++++---------- .../Shared/Api/Interface/ILSL_Api.cs | 2 + .../Shared/Api/Runtime/LSL_Constants.cs | 8 +++ .../Shared/Api/Runtime/LSL_Stub.cs | 10 +++- 4 files changed, 45 insertions(+), 32 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5bc0417c02..81b7c3a617 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4961,37 +4961,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// The number of a link in the linkset or a link-related constant. /// /// - /// The name determined to match the specified link number. + /// The name determined to match the specified link number, NULL_KEY /// - /// - /// The rules governing the returned name are not simple. The only - /// time a blank name is returned is if the target prim has a blank - /// name. If no prim with the given link number can be found then - /// usually NULL_KEY is returned but there are exceptions. - /// - /// In a single unlinked prim, A call with 0 returns the name, all - /// other values for link number return NULL_KEY - /// - /// In link sets it is more complicated. - /// - /// If the script is in the root prim:- - /// A zero link number returns NULL_KEY. - /// Positive link numbers return the name of the prim, or NULL_KEY - /// if a prim does not exist at that position. - /// Negative link numbers return the name of the first child prim. - /// - /// If the script is in a child prim:- - /// Link numbers 0 or 1 return the name of the root prim. - /// Positive link numbers return the name of the prim or NULL_KEY - /// if a prim does not exist at that position. - /// Negative numbers return the name of the root prim. - /// - /// References - /// http://lslwiki.net/lslwiki/wakka.php?wakka=llGetLinkName - /// Mentions NULL_KEY being returned - /// http://wiki.secondlife.com/wiki/LlGetLinkName - /// Mentions using the LINK_* constants, some of which are negative - /// + public LSL_String llGetLinkName(int linknum) { @@ -19325,6 +19297,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_Integer(1); } + + public LSL_Integer llGetLinkSitFlags(LSL_Integer linknum) + { + SceneObjectPart part = linknum == ScriptBaseClass.LINK_THIS ? m_host : m_host.ParentGroup.GetLinkNumPart(linknum); + if (part is not null) + { + int flags = ScriptBaseClass.SIT_FLAG_OPENSIMFORCED; + if(part.IsSitTargetSet) + flags |= 0x01; + return new LSL_Integer(flags); + } + return new LSL_Integer(0); + } + + public void llSetLinkSitFlags(LSL_Integer linknum, LSL_Integer flags) + { + // does nothing since we do not have any of the flags + /* + SceneObjectPart part = linknum == ScriptBaseClass.LINK_THIS ? m_host : m_host.ParentGroup.GetLinkNumPart(linknum); + if (part is not null) + { + } + */ + } + } public class NotecardCache diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 5ae734c701..13f6386d98 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -526,6 +526,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Key llRezObjectWithParams(string inventory, LSL_List lparam); LSL_String llGetStartString(); + LSL_Integer llGetLinkSitFlags(LSL_Integer linknum); + void llSetLinkSitFlags(LSL_Integer linknum, LSL_Integer flags); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index d112195b3f..40cb9129ad 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -1075,5 +1075,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int REZ_LOCK_AXES = 11; public const int REZ_DAMAGE_TYPE = 12; public const int REZ_PARAM_STRING = 13; + + public const int SIT_FLAG_SIT_TARGET = 0x01; + public const int SIT_FLAG_ALLOW_UNSIT = 0x02; // unsupported always true + public const int SIT_FLAG_SCRIPTED_ONLY = 0x04; // unsupported always false + public const int SIT_FLAG_NO_COLLIDE = 0x10; // unsupported always true + public const int SIT_FLAG_NO_DAMAGE = 0x20; // unsupported always true + public const int SIT_FLAG_OPENSIMFORCED = SIT_FLAG_ALLOW_UNSIT | SIT_FLAG_NO_COLLIDE | SIT_FLAG_NO_DAMAGE; + } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 53f46f369e..06b375507a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -2822,9 +2822,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public LSL_String llGetStartString() + public LSL_Integer llGetLinkSitFlags(LSL_Integer linknum) { - return m_LSL_Functions.llGetStartString(); + return m_LSL_Functions.llGetLinkSitFlags(linknum); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void llSetLinkSitFlags(LSL_Integer linknum, LSL_Integer flags) + { + m_LSL_Functions.llSetLinkSitFlags(linknum, flags); } }