diff options
author | Talun | 2012-04-09 19:58:07 +0100 |
---|---|---|
committer | Melanie | 2012-04-09 21:25:22 +0100 |
commit | 78c0028179923710949fea349baad2e6bebc49bd (patch) | |
tree | ad83b28069f46f0890cae3f9405f3d4c5f273da8 /OpenSim/Region/Framework | |
parent | Addresses mantis #5846 (diff) | |
download | opensim-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/Region/Framework')
5 files changed, 131 insertions, 2 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) |