Merge branch 'master' of /home/opensim/var/repo/opensim
commit
4b278c64d6
|
@ -225,6 +225,16 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// </summary></returns>
|
/// </summary></returns>
|
||||||
bool ContainsScripts();
|
bool ContainsScripts();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the count of scripts contained
|
||||||
|
/// </summary></returns>
|
||||||
|
int ScriptCount();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the count of running scripts contained
|
||||||
|
/// </summary></returns>
|
||||||
|
int RunningScriptCount();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the uuids of all items in this inventory
|
/// Get the uuids of all items in this inventory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -69,6 +69,12 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
|
|
||||||
ArrayList GetScriptErrors(UUID itemID);
|
ArrayList GetScriptErrors(UUID itemID);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if a script is running.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="itemID">The item ID of the script.</param>
|
||||||
|
bool GetScriptState(UUID itemID);
|
||||||
|
|
||||||
void SaveAllState();
|
void SaveAllState();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -3255,7 +3255,33 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
for (int i = 0; i < parts.Length; i++)
|
for (int i = 0; i < parts.Length; i++)
|
||||||
parts[i].TriggerScriptChangedEvent(val);
|
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()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition);
|
return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition);
|
||||||
|
|
|
@ -1081,10 +1081,59 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
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()
|
public List<UUID> GetInventoryList()
|
||||||
{
|
{
|
||||||
List<UUID> ret = new List<UUID>();
|
List<UUID> ret = new List<UUID>();
|
||||||
|
|
|
@ -3418,6 +3418,44 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return m_attachments.Count > 0;
|
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()
|
public bool HasScriptedAttachments()
|
||||||
{
|
{
|
||||||
lock (m_attachments)
|
lock (m_attachments)
|
||||||
|
|
|
@ -10358,19 +10358,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
break;
|
break;
|
||||||
// For the following 8 see the Object version below
|
// For the following 8 see the Object version below
|
||||||
case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT:
|
case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT:
|
||||||
ret.Add(new LSL_Integer(0));
|
ret.Add(new LSL_Integer(av.RunningScriptCount()));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT:
|
case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT:
|
||||||
ret.Add(new LSL_Integer(0));
|
ret.Add(new LSL_Integer(av.ScriptCount()));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_SCRIPT_MEMORY:
|
case ScriptBaseClass.OBJECT_SCRIPT_MEMORY:
|
||||||
ret.Add(new LSL_Integer(0));
|
ret.Add(new LSL_Integer(av.RunningScriptCount() * 16384));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_SCRIPT_TIME:
|
case ScriptBaseClass.OBJECT_SCRIPT_TIME:
|
||||||
ret.Add(new LSL_Float(0));
|
ret.Add(new LSL_Float(0));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE:
|
case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE:
|
||||||
ret.Add(new LSL_Integer(0));
|
ret.Add(new LSL_Integer(1));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_SERVER_COST:
|
case ScriptBaseClass.OBJECT_SERVER_COST:
|
||||||
ret.Add(new LSL_Float(0));
|
ret.Add(new LSL_Float(0));
|
||||||
|
@ -10422,24 +10422,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
case ScriptBaseClass.OBJECT_CREATOR:
|
case ScriptBaseClass.OBJECT_CREATOR:
|
||||||
ret.Add(new LSL_String(obj.CreatorID.ToString()));
|
ret.Add(new LSL_String(obj.CreatorID.ToString()));
|
||||||
break;
|
break;
|
||||||
// The following 8 I have intentionaly coded to return zero. They are part of
|
|
||||||
// "Land Impact" calculations. These calculations are probably not applicable
|
|
||||||
// to OpenSim, required figures (cpu/memory usage) are not currently tracked
|
|
||||||
// I have intentionally left these all at zero rather than return possibly
|
|
||||||
// missleading numbers
|
|
||||||
case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT:
|
case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT:
|
||||||
// in SL this currently includes crashed scripts
|
ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount()));
|
||||||
ret.Add(new LSL_Integer(0));
|
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT:
|
case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT:
|
||||||
ret.Add(new LSL_Integer(0));
|
ret.Add(new LSL_Integer(obj.ParentGroup.ScriptCount()));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_SCRIPT_MEMORY:
|
case ScriptBaseClass.OBJECT_SCRIPT_MEMORY:
|
||||||
// The value returned in SL for mono scripts is 65536 * number of active scripts
|
// The value returned in SL for mono scripts is 65536 * number of active scripts
|
||||||
ret.Add(new LSL_Integer(0));
|
// and 16384 * number of active scripts for LSO. since llGetFreememory
|
||||||
|
// is coded to give the LSO value use it here
|
||||||
|
ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount() * 16384));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_SCRIPT_TIME:
|
case ScriptBaseClass.OBJECT_SCRIPT_TIME:
|
||||||
// Average cpu time per simulator frame expended on all scripts in the objetc
|
// Average cpu time per simulator frame expended on all scripts in the object
|
||||||
|
// Not currently available at Object level
|
||||||
ret.Add(new LSL_Float(0));
|
ret.Add(new LSL_Float(0));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE:
|
case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE:
|
||||||
|
@ -10447,18 +10444,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
// equivalent of the number of prims in a linkset if it does not
|
// equivalent of the number of prims in a linkset if it does not
|
||||||
// contain a mesh anywhere in the link set or is not a normal prim
|
// contain a mesh anywhere in the link set or is not a normal prim
|
||||||
// The value returned in SL for normal prims is prim count
|
// The value returned in SL for normal prims is prim count
|
||||||
ret.Add(new LSL_Integer(0));
|
ret.Add(new LSL_Integer(obj.ParentGroup.PrimCount));
|
||||||
break;
|
break;
|
||||||
|
// The following 3 costs I have intentionaly coded to return zero. They are part of
|
||||||
|
// "Land Impact" calculations. These calculations are probably not applicable
|
||||||
|
// to OpenSim and are not yet complete in SL
|
||||||
case ScriptBaseClass.OBJECT_SERVER_COST:
|
case ScriptBaseClass.OBJECT_SERVER_COST:
|
||||||
// The value returned in SL for normal prims is prim count
|
// The linden calculation is here
|
||||||
|
// http://wiki.secondlife.com/wiki/Mesh/Mesh_Server_Weight
|
||||||
|
// The value returned in SL for normal prims looks like the prim count
|
||||||
ret.Add(new LSL_Float(0));
|
ret.Add(new LSL_Float(0));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_STREAMING_COST:
|
case ScriptBaseClass.OBJECT_STREAMING_COST:
|
||||||
// The value returned in SL for normal prims is prim count * 0.06
|
// The linden calculation is here
|
||||||
|
// http://wiki.secondlife.com/wiki/Mesh/Mesh_Streaming_Cost
|
||||||
|
// The value returned in SL for normal prims looks like the prim count * 0.06
|
||||||
ret.Add(new LSL_Float(0));
|
ret.Add(new LSL_Float(0));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_PHYSICS_COST:
|
case ScriptBaseClass.OBJECT_PHYSICS_COST:
|
||||||
// The value returned in SL for normal prims is prim count
|
// The linden calculation is here
|
||||||
|
// http://wiki.secondlife.com/wiki/Mesh/Mesh_physics
|
||||||
|
// The value returned in SL for normal prims looks like the prim count
|
||||||
ret.Add(new LSL_Float(0));
|
ret.Add(new LSL_Float(0));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue