Mantis5502 implementation of some of the new constants

Signed-off-by: Melanie <melanie@t-data.com>
This commit is contained in:
Talun
2012-04-09 19:58:07 +01:00
committed by Melanie
parent 0f277dfa17
commit 78c0028179
6 changed files with 155 additions and 20 deletions

View File

@@ -3255,7 +3255,33 @@ namespace OpenSim.Region.Framework.Scenes
for (int i = 0; i < parts.Length; i++)
parts[i].TriggerScriptChangedEvent(val);
}
/// <summary>
/// Returns a count of the number of scripts in this groups parts.
/// </summary>
public int ScriptCount()
{
int count = 0;
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
count += parts[i].Inventory.ScriptCount();
return count;
}
/// <summary>
/// Returns a count of the number of running scripts in this groups parts.
/// </summary>
public int RunningScriptCount()
{
int count = 0;
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
count += parts[i].Inventory.RunningScriptCount();
return count;
}
public override string ToString()
{
return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition);

View File

@@ -1081,10 +1081,59 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
return false;
}
/// <summary>
/// Returns the count of scripts in this parts inventory.
/// </summary>
/// <returns></returns>
public int ScriptCount()
{
int count = 0;
lock (m_items)
{
foreach (TaskInventoryItem item in m_items.Values)
{
if (item.InvType == (int)InventoryType.LSL)
{
count++;
}
}
}
return count;
}
/// <summary>
/// Returns the count of running scripts in this parts inventory.
/// </summary>
/// <returns></returns>
public int RunningScriptCount()
{
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
if (engines.Length == 0)
return 0;
int count = 0;
List<TaskInventoryItem> scripts = GetInventoryScripts();
foreach (TaskInventoryItem item in scripts)
{
foreach (IScriptModule engine in engines)
{
if (engine != null)
{
if (engine.GetScriptState(item.ItemID))
{
count++;
}
}
}
}
return count;
}
public List<UUID> GetInventoryList()
{
List<UUID> ret = new List<UUID>();

View File

@@ -3418,6 +3418,44 @@ namespace OpenSim.Region.Framework.Scenes
return m_attachments.Count > 0;
}
/// <summary>
/// Returns the total count of scripts in all parts inventories.
/// </summary>
public int ScriptCount()
{
int count = 0;
lock (m_attachments)
{
foreach (SceneObjectGroup gobj in m_attachments)
{
if (gobj != null)
{
count += gobj.ScriptCount();
}
}
}
return count;
}
/// <summary>
/// Returns the total count of running scripts in all parts.
/// </summary>
public int RunningScriptCount()
{
int count = 0;
lock (m_attachments)
{
foreach (SceneObjectGroup gobj in m_attachments)
{
if (gobj != null)
{
count += gobj.RunningScriptCount();
}
}
}
return count;
}
public bool HasScriptedAttachments()
{
lock (m_attachments)