add llIsFriend

This commit is contained in:
UbitUmarov 2024-02-16 17:17:59 +00:00
parent dd58a3a57c
commit 4e2bea288a
4 changed files with 33 additions and 2 deletions

View File

@ -18713,6 +18713,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return new LSL_List(m_host.ParentGroup.LinksetData.ListKeysByPatttern(pattern.m_string, start, count));
}
public LSL_Integer llIsFriend(LSL_Key agent_id)
{
SceneObjectGroup parentsog = m_host.ParentGroup;
if (parentsog is null || parentsog.IsDeleted)
return 0;
if (parentsog.OwnerID.Equals(parentsog.GroupID))
return llSameGroup(agent_id);
IFriendsModule fm = World.RequestModuleInterface<IFriendsModule>();
if(fm is null)
return 0;
if (World.GetScenePresence(parentsog.OwnerID) is null)
return 0;
if (!UUID.TryParse(agent_id, out UUID agent))
return 0;
if (World.GetScenePresence(agent) is null)
return 0;
return fm.IsFriendOnline(parentsog.OwnerID, agent) ? 1 : 0;
}
}
public class NotecardCache

View File

@ -513,5 +513,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void llLinksetDataReset();
LSL_Integer llLinksetDataWrite(LSL_String name, LSL_String value);
LSL_Integer llLinksetDataWriteProtected(LSL_String name, LSL_String value, LSL_String pass);
LSL_Integer llIsFriend(LSL_Key agent_id);
}
}

View File

@ -2784,5 +2784,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{
return m_LSL_Functions.llLinksetDataFindKeys(pattern, start, count);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public LSL_Integer llIsFriend(LSL_Key agent_id)
{
return m_LSL_Functions.llIsFriend(agent_id);
}
}
}

View File

@ -2821,7 +2821,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
public LSLFloat(int i)
{
value = (double)i;
value = i;
}
public LSLFloat(double d)
@ -2834,7 +2834,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
public LSLFloat(ReadOnlySpan<char> s)
{
if(!double.TryParse(s, System.Globalization.NumberStyles.Float, Culture.NumberFormatInfo, out value))
if (!double.TryParse(s, NumberStyles.Float, Culture.NumberFormatInfo, out value))
value = 0;
}