add osResetAllScripts(LSL_Integer AllLinkset). use with care

This commit is contained in:
UbitUmarov
2019-10-11 00:01:59 +01:00
parent 55d70f5df7
commit 2c1909a873
5 changed files with 126 additions and 27 deletions

View File

@@ -5560,5 +5560,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return LSL_Rotation.Slerp(a, b, amount);
}
public void osResetAllScripts(LSL_Integer linkset)
{
UUID me = m_item.ItemID;
List<TaskInventoryItem> scripts = new List<TaskInventoryItem>();
if(linkset != 0)
{
SceneObjectGroup sog = m_host.ParentGroup;
if(sog.inTransit || sog.IsDeleted)
return;
SceneObjectPart[] parts = sog.Parts;
for (int i = 0; i < parts.Length; i++)
{
scripts.AddRange(parts[i].Inventory.GetInventoryItems(InventoryType.LSL));
}
}
else
scripts.AddRange(m_host.Inventory.GetInventoryItems(InventoryType.LSL));
foreach(TaskInventoryItem script in scripts)
{
if(script.ItemID == me)
continue;
m_ScriptEngine.ResetScript(script.ItemID);
}
if (m_UrlModule != null)
m_UrlModule.ScriptRemoved(me);
m_ScriptEngine.ApiResetScript(me);
}
}
}

View File

@@ -556,5 +556,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_Key osGetLastChangedEventKey();
LSL_Float osGetPSTWallclock();
LSL_Rotation osSlerp(LSL_Rotation a, LSL_Rotation b, LSL_Float amount);
void osResetAllScripts(LSL_Integer AllLinkset);
}
}

View File

@@ -35,7 +35,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public partial class ScriptBaseClass
{
// SCRIPTS CONSTANTS
public static readonly LSLInteger OS_APIVERSION = 8;
public static readonly LSLInteger OS_APIVERSION = 9;
public static readonly LSLInteger TRUE = 1;
public static readonly LSLInteger FALSE = 0;

View File

@@ -1412,5 +1412,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_OSSL_Functions.osSlerp(a, b, amount);
}
public void osResetAllScripts(LSL_Integer allLinkSet)
{
m_OSSL_Functions.osResetAllScripts(allLinkSet);
}
}
}