This commit is contained in:
Adil El Farissi
2024-07-09 02:06:53 +00:00
12 changed files with 409 additions and 148 deletions

View File

@@ -7788,17 +7788,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetCameraEyeOffset(LSL_Vector offset)
{
m_host.SetCameraEyeOffset(offset);
if (m_host.ParentGroup.RootPart.GetCameraEyeOffset().IsZero())
m_host.ParentGroup.RootPart.SetCameraEyeOffset(offset);
}
public void llSetCameraAtOffset(LSL_Vector offset)
{
m_host.SetCameraAtOffset(offset);
if (m_host.ParentGroup.RootPart.GetCameraAtOffset().IsZero())
m_host.ParentGroup.RootPart.SetCameraAtOffset(offset);
}
public void llSetLinkCamera(LSL_Integer link, LSL_Vector eye, LSL_Vector at)
@@ -14991,6 +14985,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return tid.ToString();
}
public LSL_String llGetNotecardLineSync(string name, int line)
{
if (line < 0)
return ScriptBaseClass.NAK;
if (!UUID.TryParse(name, out UUID assetID))
{
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name, 7);
if (item is null)
{
Error("llGetNotecardLineSync", "Can't find notecard '" + name + "'");
return ScriptBaseClass.NAK;
}
assetID = item.AssetID;
}
if (NotecardCache.IsCached(assetID))
{
return NotecardCache.GetllLine(assetID, line, 1024);
}
else
{
return ScriptBaseClass.NAK;
}
}
public LSL_Key llGetNotecardLine(string name, int line)
{
if (!UUID.TryParse(name, out UUID assetID))
@@ -18768,6 +18789,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return 0;
}
public LSL_Integer llDerezObject(LSL_Key objectUUID, LSL_Integer flag)
{
if (!UUID.TryParse(objectUUID, out UUID objUUID))
return new LSL_Integer(0);
if (objUUID.IsZero())
return new LSL_Integer(0);
SceneObjectGroup sceneOG = World.GetSceneObjectGroup(objUUID);
if (sceneOG is null || sceneOG.IsDeleted || sceneOG.IsAttachment)
return new LSL_Integer(0);
if (sceneOG.OwnerID.NotEqual(m_host.OwnerID))
return new LSL_Integer(0);
// restrict to objects rezzed by host
if (sceneOG.RezzerID.NotEqual(m_host.ParentGroup.UUID))
return new LSL_Integer(0);
if (sceneOG.UUID.Equals(m_host.ParentGroup.UUID))
return new LSL_Integer(0);
if (flag.value == 0)
World.DeleteSceneObject(sceneOG, false);
else
sceneOG.RootPart.AddFlag(PrimFlags.TemporaryOnRez);
return new LSL_Integer(1);
}
}
public class NotecardCache
@@ -18811,6 +18863,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return "";
}
public static string GetllLine(UUID assetID, int lineNumber, int maxLength)
{
if (m_Notecards.TryGetValue(assetID, 30000, out string[] text))
{
if (lineNumber >= text.Length)
return "\n\n\n";
return text[lineNumber].Length < maxLength ? text[lineNumber] : text[lineNumber][..maxLength];
}
return ScriptBaseClass.NAK;
}
/// <summary>
/// Get a notecard line.
/// </summary>

View File

@@ -176,6 +176,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void llGetNextEmail(string address, string subject);
LSL_Key llGetNotecardLine(string name, int line);
LSL_Key llGetNumberOfNotecardLines(string name);
LSL_String llGetNotecardLineSync(string name, int line);
LSL_Integer llGetNumberOfPrims();
LSL_Integer llGetNumberOfSides();
LSL_String llGetObjectDesc();
@@ -521,5 +522,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_Integer llLinksetDataWriteProtected(LSL_String name, LSL_String value, LSL_String pass);
LSL_Integer llIsFriend(LSL_Key agent_id);
LSL_Integer llDerezObject(LSL_Key objectUUID, LSL_Integer flag);
}
}

View File

@@ -609,6 +609,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const string NULL_KEY = "00000000-0000-0000-0000-000000000000";
public const string EOF = "\n\n\n";
public const string NAK = "\n\u0015\n";
public const double PI = 3.14159274f;
public const double TWO_PI = 6.28318548f;
public const double PI_BY_TWO = 1.57079637f;

View File

@@ -758,6 +758,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_LSL_Functions.llGetNumberOfNotecardLines(name);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public LSL_String llGetNotecardLineSync(string name, int line)
{
return m_LSL_Functions.llGetNotecardLineSync(name, line);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public LSL_Integer llGetNumberOfPrims()
{
@@ -2796,11 +2802,17 @@ 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);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public LSL_Integer llDerezObject(LSL_Key objectUUID, LSL_Integer flag)
{
return m_LSL_Functions.llDerezObject(objectUUID, flag);
}
}
}