aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorTalun2012-04-09 19:58:07 +0100
committerMelanie2012-04-09 21:25:22 +0100
commit78c0028179923710949fea349baad2e6bebc49bd (patch)
treead83b28069f46f0890cae3f9405f3d4c5f273da8 /OpenSim
parentAddresses mantis #5846 (diff)
downloadopensim-SC_OLD-78c0028179923710949fea349baad2e6bebc49bd.zip
opensim-SC_OLD-78c0028179923710949fea349baad2e6bebc49bd.tar.gz
opensim-SC_OLD-78c0028179923710949fea349baad2e6bebc49bd.tar.bz2
opensim-SC_OLD-78c0028179923710949fea349baad2e6bebc49bd.tar.xz
Mantis5502 implementation of some of the new constants
Signed-off-by: Melanie <melanie@t-data.com>
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityInventory.cs10
-rw-r--r--OpenSim/Region/Framework/Interfaces/IScriptModule.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs28
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs51
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs38
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs42
6 files changed, 155 insertions, 20 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
index 1334905..f5dda34 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
@@ -226,6 +226,16 @@ namespace OpenSim.Region.Framework.Interfaces
226 bool ContainsScripts(); 226 bool ContainsScripts();
227 227
228 /// <summary> 228 /// <summary>
229 /// Returns the count of scripts contained
230 /// </summary></returns>
231 int ScriptCount();
232
233 /// <summary>
234 /// Returns the count of running scripts contained
235 /// </summary></returns>
236 int RunningScriptCount();
237
238 /// <summary>
229 /// Get the uuids of all items in this inventory 239 /// Get the uuids of all items in this inventory
230 /// </summary> 240 /// </summary>
231 /// <returns></returns> 241 /// <returns></returns>
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
index 9cab2e1..c0616ed 100644
--- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
@@ -69,6 +69,12 @@ namespace OpenSim.Region.Framework.Interfaces
69 69
70 ArrayList GetScriptErrors(UUID itemID); 70 ArrayList GetScriptErrors(UUID itemID);
71 71
72 /// <summary>
73 /// Returns true if a script is running.
74 /// </summary>
75 /// <param name="itemID">The item ID of the script.</param>
76 bool GetScriptState(UUID itemID);
77
72 void SaveAllState(); 78 void SaveAllState();
73 79
74 /// <summary> 80 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 17f3be7..7d14814 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -3255,7 +3255,33 @@ namespace OpenSim.Region.Framework.Scenes
3255 for (int i = 0; i < parts.Length; i++) 3255 for (int i = 0; i < parts.Length; i++)
3256 parts[i].TriggerScriptChangedEvent(val); 3256 parts[i].TriggerScriptChangedEvent(val);
3257 } 3257 }
3258 3258
3259 /// <summary>
3260 /// Returns a count of the number of scripts in this groups parts.
3261 /// </summary>
3262 public int ScriptCount()
3263 {
3264 int count = 0;
3265 SceneObjectPart[] parts = m_parts.GetArray();
3266 for (int i = 0; i < parts.Length; i++)
3267 count += parts[i].Inventory.ScriptCount();
3268
3269 return count;
3270 }
3271
3272 /// <summary>
3273 /// Returns a count of the number of running scripts in this groups parts.
3274 /// </summary>
3275 public int RunningScriptCount()
3276 {
3277 int count = 0;
3278 SceneObjectPart[] parts = m_parts.GetArray();
3279 for (int i = 0; i < parts.Length; i++)
3280 count += parts[i].Inventory.RunningScriptCount();
3281
3282 return count;
3283 }
3284
3259 public override string ToString() 3285 public override string ToString()
3260 { 3286 {
3261 return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition); 3287 return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index f7e123b..9a04c65 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -1081,10 +1081,59 @@ namespace OpenSim.Region.Framework.Scenes
1081 } 1081 }
1082 } 1082 }
1083 } 1083 }
1084 1084
1085 return false; 1085 return false;
1086 } 1086 }
1087 1087
1088 /// <summary>
1089 /// Returns the count of scripts in this parts inventory.
1090 /// </summary>
1091 /// <returns></returns>
1092 public int ScriptCount()
1093 {
1094 int count = 0;
1095 lock (m_items)
1096 {
1097 foreach (TaskInventoryItem item in m_items.Values)
1098 {
1099 if (item.InvType == (int)InventoryType.LSL)
1100 {
1101 count++;
1102 }
1103 }
1104 }
1105
1106 return count;
1107 }
1108 /// <summary>
1109 /// Returns the count of running scripts in this parts inventory.
1110 /// </summary>
1111 /// <returns></returns>
1112 public int RunningScriptCount()
1113 {
1114 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
1115 if (engines.Length == 0)
1116 return 0;
1117
1118 int count = 0;
1119 List<TaskInventoryItem> scripts = GetInventoryScripts();
1120
1121 foreach (TaskInventoryItem item in scripts)
1122 {
1123 foreach (IScriptModule engine in engines)
1124 {
1125 if (engine != null)
1126 {
1127 if (engine.GetScriptState(item.ItemID))
1128 {
1129 count++;
1130 }
1131 }
1132 }
1133 }
1134 return count;
1135 }
1136
1088 public List<UUID> GetInventoryList() 1137 public List<UUID> GetInventoryList()
1089 { 1138 {
1090 List<UUID> ret = new List<UUID>(); 1139 List<UUID> ret = new List<UUID>();
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index a21c66f..8863df1 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3418,6 +3418,44 @@ namespace OpenSim.Region.Framework.Scenes
3418 return m_attachments.Count > 0; 3418 return m_attachments.Count > 0;
3419 } 3419 }
3420 3420
3421 /// <summary>
3422 /// Returns the total count of scripts in all parts inventories.
3423 /// </summary>
3424 public int ScriptCount()
3425 {
3426 int count = 0;
3427 lock (m_attachments)
3428 {
3429 foreach (SceneObjectGroup gobj in m_attachments)
3430 {
3431 if (gobj != null)
3432 {
3433 count += gobj.ScriptCount();
3434 }
3435 }
3436 }
3437 return count;
3438 }
3439
3440 /// <summary>
3441 /// Returns the total count of running scripts in all parts.
3442 /// </summary>
3443 public int RunningScriptCount()
3444 {
3445 int count = 0;
3446 lock (m_attachments)
3447 {
3448 foreach (SceneObjectGroup gobj in m_attachments)
3449 {
3450 if (gobj != null)
3451 {
3452 count += gobj.RunningScriptCount();
3453 }
3454 }
3455 }
3456 return count;
3457 }
3458
3421 public bool HasScriptedAttachments() 3459 public bool HasScriptedAttachments()
3422 { 3460 {
3423 lock (m_attachments) 3461 lock (m_attachments)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 291f52e..c38a52e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -10358,19 +10358,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10358 break; 10358 break;
10359 // For the following 8 see the Object version below 10359 // For the following 8 see the Object version below
10360 case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: 10360 case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT:
10361 ret.Add(new LSL_Integer(0)); 10361 ret.Add(new LSL_Integer(av.RunningScriptCount()));
10362 break; 10362 break;
10363 case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: 10363 case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT:
10364 ret.Add(new LSL_Integer(0)); 10364 ret.Add(new LSL_Integer(av.ScriptCount()));
10365 break; 10365 break;
10366 case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: 10366 case ScriptBaseClass.OBJECT_SCRIPT_MEMORY:
10367 ret.Add(new LSL_Integer(0)); 10367 ret.Add(new LSL_Integer(av.RunningScriptCount() * 16384));
10368 break; 10368 break;
10369 case ScriptBaseClass.OBJECT_SCRIPT_TIME: 10369 case ScriptBaseClass.OBJECT_SCRIPT_TIME:
10370 ret.Add(new LSL_Float(0)); 10370 ret.Add(new LSL_Float(0));
10371 break; 10371 break;
10372 case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: 10372 case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE:
10373 ret.Add(new LSL_Integer(0)); 10373 ret.Add(new LSL_Integer(1));
10374 break; 10374 break;
10375 case ScriptBaseClass.OBJECT_SERVER_COST: 10375 case ScriptBaseClass.OBJECT_SERVER_COST:
10376 ret.Add(new LSL_Float(0)); 10376 ret.Add(new LSL_Float(0));
@@ -10422,24 +10422,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10422 case ScriptBaseClass.OBJECT_CREATOR: 10422 case ScriptBaseClass.OBJECT_CREATOR:
10423 ret.Add(new LSL_String(obj.CreatorID.ToString())); 10423 ret.Add(new LSL_String(obj.CreatorID.ToString()));
10424 break; 10424 break;
10425 // The following 8 I have intentionaly coded to return zero. They are part of
10426 // "Land Impact" calculations. These calculations are probably not applicable
10427 // to OpenSim, required figures (cpu/memory usage) are not currently tracked
10428 // I have intentionally left these all at zero rather than return possibly
10429 // missleading numbers
10430 case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: 10425 case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT:
10431 // in SL this currently includes crashed scripts 10426 ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount()));
10432 ret.Add(new LSL_Integer(0));
10433 break; 10427 break;
10434 case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: 10428 case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT:
10435 ret.Add(new LSL_Integer(0)); 10429 ret.Add(new LSL_Integer(obj.ParentGroup.ScriptCount()));
10436 break; 10430 break;
10437 case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: 10431 case ScriptBaseClass.OBJECT_SCRIPT_MEMORY:
10438 // The value returned in SL for mono scripts is 65536 * number of active scripts 10432 // The value returned in SL for mono scripts is 65536 * number of active scripts
10439 ret.Add(new LSL_Integer(0)); 10433 // and 16384 * number of active scripts for LSO. since llGetFreememory
10434 // is coded to give the LSO value use it here
10435 ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount() * 16384));
10440 break; 10436 break;
10441 case ScriptBaseClass.OBJECT_SCRIPT_TIME: 10437 case ScriptBaseClass.OBJECT_SCRIPT_TIME:
10442 // Average cpu time per simulator frame expended on all scripts in the objetc 10438 // Average cpu time per simulator frame expended on all scripts in the object
10439 // Not currently available at Object level
10443 ret.Add(new LSL_Float(0)); 10440 ret.Add(new LSL_Float(0));
10444 break; 10441 break;
10445 case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: 10442 case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE:
@@ -10447,18 +10444,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10447 // equivalent of the number of prims in a linkset if it does not 10444 // equivalent of the number of prims in a linkset if it does not
10448 // contain a mesh anywhere in the link set or is not a normal prim 10445 // contain a mesh anywhere in the link set or is not a normal prim
10449 // The value returned in SL for normal prims is prim count 10446 // The value returned in SL for normal prims is prim count
10450 ret.Add(new LSL_Integer(0)); 10447 ret.Add(new LSL_Integer(obj.ParentGroup.PrimCount));
10451 break; 10448 break;
10449 // The following 3 costs I have intentionaly coded to return zero. They are part of
10450 // "Land Impact" calculations. These calculations are probably not applicable
10451 // to OpenSim and are not yet complete in SL
10452 case ScriptBaseClass.OBJECT_SERVER_COST: 10452 case ScriptBaseClass.OBJECT_SERVER_COST:
10453 // The value returned in SL for normal prims is prim count 10453 // The linden calculation is here
10454 // http://wiki.secondlife.com/wiki/Mesh/Mesh_Server_Weight
10455 // The value returned in SL for normal prims looks like the prim count
10454 ret.Add(new LSL_Float(0)); 10456 ret.Add(new LSL_Float(0));
10455 break; 10457 break;
10456 case ScriptBaseClass.OBJECT_STREAMING_COST: 10458 case ScriptBaseClass.OBJECT_STREAMING_COST:
10457 // The value returned in SL for normal prims is prim count * 0.06 10459 // The linden calculation is here
10460 // http://wiki.secondlife.com/wiki/Mesh/Mesh_Streaming_Cost
10461 // The value returned in SL for normal prims looks like the prim count * 0.06
10458 ret.Add(new LSL_Float(0)); 10462 ret.Add(new LSL_Float(0));
10459 break; 10463 break;
10460 case ScriptBaseClass.OBJECT_PHYSICS_COST: 10464 case ScriptBaseClass.OBJECT_PHYSICS_COST:
10461 // The value returned in SL for normal prims is prim count 10465 // The linden calculation is here
10466 // http://wiki.secondlife.com/wiki/Mesh/Mesh_physics
10467 // The value returned in SL for normal prims looks like the prim count
10462 ret.Add(new LSL_Float(0)); 10468 ret.Add(new LSL_Float(0));
10463 break; 10469 break;
10464 default: 10470 default: