diff options
author | Melanie | 2012-04-09 21:40:03 +0100 |
---|---|---|
committer | Melanie | 2012-04-09 21:40:03 +0100 |
commit | 67d4f1d66cef2ff51453f113bdaef375004b17c9 (patch) | |
tree | 975abcb48e2492950ea974567379de88809f57f5 | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Mantis5502 implementation of some of the new constants (diff) | |
download | opensim-SC-67d4f1d66cef2ff51453f113bdaef375004b17c9.zip opensim-SC-67d4f1d66cef2ff51453f113bdaef375004b17c9.tar.gz opensim-SC-67d4f1d66cef2ff51453f113bdaef375004b17c9.tar.bz2 opensim-SC-67d4f1d66cef2ff51453f113bdaef375004b17c9.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/Framework/Interfaces/IScriptModule.cs
OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
Diffstat (limited to '')
7 files changed, 159 insertions, 21 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index 32f4eea..4d70888 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs | |||
@@ -228,6 +228,16 @@ namespace OpenSim.Region.Framework.Interfaces | |||
228 | bool ContainsScripts(); | 228 | bool ContainsScripts(); |
229 | 229 | ||
230 | /// <summary> | 230 | /// <summary> |
231 | /// Returns the count of scripts contained | ||
232 | /// </summary></returns> | ||
233 | int ScriptCount(); | ||
234 | |||
235 | /// <summary> | ||
236 | /// Returns the count of running scripts contained | ||
237 | /// </summary></returns> | ||
238 | int RunningScriptCount(); | ||
239 | |||
240 | /// <summary> | ||
231 | /// Get the uuids of all items in this inventory | 241 | /// Get the uuids of all items in this inventory |
232 | /// </summary> | 242 | /// </summary> |
233 | /// <returns></returns> | 243 | /// <returns></returns> |
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs index ce66100..4f8be10 100644 --- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs | |||
@@ -71,6 +71,12 @@ namespace OpenSim.Region.Framework.Interfaces | |||
71 | 71 | ||
72 | bool HasScript(UUID itemID, out bool running); | 72 | bool HasScript(UUID itemID, out bool running); |
73 | 73 | ||
74 | /// <summary> | ||
75 | /// Returns true if a script is running. | ||
76 | /// </summary> | ||
77 | /// <param name="itemID">The item ID of the script.</param> | ||
78 | bool GetScriptState(UUID itemID); | ||
79 | |||
74 | void SaveAllState(); | 80 | void SaveAllState(); |
75 | 81 | ||
76 | /// <summary> | 82 | /// <summary> |
@@ -87,4 +93,4 @@ namespace OpenSim.Region.Framework.Interfaces | |||
87 | /// </returns> | 93 | /// </returns> |
88 | Dictionary<uint, float> GetObjectScriptsExecutionTimes(); | 94 | Dictionary<uint, float> GetObjectScriptsExecutionTimes(); |
89 | } | 95 | } |
90 | } \ No newline at end of file | 96 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index b806d91..77e808e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -156,7 +156,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
156 | // that the region position is cached or performance will degrade | 156 | // that the region position is cached or performance will degrade |
157 | Utils.LongToUInts(regionHandle, out x, out y); | 157 | Utils.LongToUInts(regionHandle, out x, out y); |
158 | GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); | 158 | GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); |
159 | // bool v = true; | 159 | if (dest == null) |
160 | continue; | ||
161 | |||
160 | if (!simulatorList.Contains(dest.ServerURI)) | 162 | if (!simulatorList.Contains(dest.ServerURI)) |
161 | { | 163 | { |
162 | // we havent seen this simulator before, add it to the list | 164 | // we havent seen this simulator before, add it to the list |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 107d9b6..5786f48 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -4017,7 +4017,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
4017 | for (int i = 0; i < parts.Length; i++) | 4017 | for (int i = 0; i < parts.Length; i++) |
4018 | parts[i].TriggerScriptChangedEvent(val); | 4018 | parts[i].TriggerScriptChangedEvent(val); |
4019 | } | 4019 | } |
4020 | 4020 | ||
4021 | /// <summary> | ||
4022 | /// Returns a count of the number of scripts in this groups parts. | ||
4023 | /// </summary> | ||
4024 | public int ScriptCount() | ||
4025 | { | ||
4026 | int count = 0; | ||
4027 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
4028 | for (int i = 0; i < parts.Length; i++) | ||
4029 | count += parts[i].Inventory.ScriptCount(); | ||
4030 | |||
4031 | return count; | ||
4032 | } | ||
4033 | |||
4034 | /// <summary> | ||
4035 | /// Returns a count of the number of running scripts in this groups parts. | ||
4036 | /// </summary> | ||
4037 | public int RunningScriptCount() | ||
4038 | { | ||
4039 | int count = 0; | ||
4040 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
4041 | for (int i = 0; i < parts.Length; i++) | ||
4042 | count += parts[i].Inventory.RunningScriptCount(); | ||
4043 | |||
4044 | return count; | ||
4045 | } | ||
4046 | |||
4021 | public override string ToString() | 4047 | public override string ToString() |
4022 | { | 4048 | { |
4023 | return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition); | 4049 | 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 a2649ee..7e629c0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -1280,9 +1280,59 @@ namespace OpenSim.Region.Framework.Scenes | |||
1280 | return true; | 1280 | return true; |
1281 | } | 1281 | } |
1282 | } | 1282 | } |
1283 | |||
1283 | return false; | 1284 | return false; |
1284 | } | 1285 | } |
1285 | 1286 | ||
1287 | /// <summary> | ||
1288 | /// Returns the count of scripts in this parts inventory. | ||
1289 | /// </summary> | ||
1290 | /// <returns></returns> | ||
1291 | public int ScriptCount() | ||
1292 | { | ||
1293 | int count = 0; | ||
1294 | lock (m_items) | ||
1295 | { | ||
1296 | foreach (TaskInventoryItem item in m_items.Values) | ||
1297 | { | ||
1298 | if (item.InvType == (int)InventoryType.LSL) | ||
1299 | { | ||
1300 | count++; | ||
1301 | } | ||
1302 | } | ||
1303 | } | ||
1304 | |||
1305 | return count; | ||
1306 | } | ||
1307 | /// <summary> | ||
1308 | /// Returns the count of running scripts in this parts inventory. | ||
1309 | /// </summary> | ||
1310 | /// <returns></returns> | ||
1311 | public int RunningScriptCount() | ||
1312 | { | ||
1313 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); | ||
1314 | if (engines.Length == 0) | ||
1315 | return 0; | ||
1316 | |||
1317 | int count = 0; | ||
1318 | List<TaskInventoryItem> scripts = GetInventoryScripts(); | ||
1319 | |||
1320 | foreach (TaskInventoryItem item in scripts) | ||
1321 | { | ||
1322 | foreach (IScriptModule engine in engines) | ||
1323 | { | ||
1324 | if (engine != null) | ||
1325 | { | ||
1326 | if (engine.GetScriptState(item.ItemID)) | ||
1327 | { | ||
1328 | count++; | ||
1329 | } | ||
1330 | } | ||
1331 | } | ||
1332 | } | ||
1333 | return count; | ||
1334 | } | ||
1335 | |||
1286 | public List<UUID> GetInventoryList() | 1336 | public List<UUID> GetInventoryList() |
1287 | { | 1337 | { |
1288 | List<UUID> ret = new List<UUID>(); | 1338 | List<UUID> ret = new List<UUID>(); |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b51d41b..0cb1556 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -3521,6 +3521,44 @@ namespace OpenSim.Region.Framework.Scenes | |||
3521 | return m_attachments.Count > 0; | 3521 | return m_attachments.Count > 0; |
3522 | } | 3522 | } |
3523 | 3523 | ||
3524 | /// <summary> | ||
3525 | /// Returns the total count of scripts in all parts inventories. | ||
3526 | /// </summary> | ||
3527 | public int ScriptCount() | ||
3528 | { | ||
3529 | int count = 0; | ||
3530 | lock (m_attachments) | ||
3531 | { | ||
3532 | foreach (SceneObjectGroup gobj in m_attachments) | ||
3533 | { | ||
3534 | if (gobj != null) | ||
3535 | { | ||
3536 | count += gobj.ScriptCount(); | ||
3537 | } | ||
3538 | } | ||
3539 | } | ||
3540 | return count; | ||
3541 | } | ||
3542 | |||
3543 | /// <summary> | ||
3544 | /// Returns the total count of running scripts in all parts. | ||
3545 | /// </summary> | ||
3546 | public int RunningScriptCount() | ||
3547 | { | ||
3548 | int count = 0; | ||
3549 | lock (m_attachments) | ||
3550 | { | ||
3551 | foreach (SceneObjectGroup gobj in m_attachments) | ||
3552 | { | ||
3553 | if (gobj != null) | ||
3554 | { | ||
3555 | count += gobj.RunningScriptCount(); | ||
3556 | } | ||
3557 | } | ||
3558 | } | ||
3559 | return count; | ||
3560 | } | ||
3561 | |||
3524 | public bool HasScriptedAttachments() | 3562 | public bool HasScriptedAttachments() |
3525 | { | 3563 | { |
3526 | lock (m_attachments) | 3564 | 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 7cf284d..a95dd63 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -11175,19 +11175,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11175 | break; | 11175 | break; |
11176 | // For the following 8 see the Object version below | 11176 | // For the following 8 see the Object version below |
11177 | case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: | 11177 | case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: |
11178 | ret.Add(new LSL_Integer(0)); | 11178 | ret.Add(new LSL_Integer(av.RunningScriptCount())); |
11179 | break; | 11179 | break; |
11180 | case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: | 11180 | case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: |
11181 | ret.Add(new LSL_Integer(0)); | 11181 | ret.Add(new LSL_Integer(av.ScriptCount())); |
11182 | break; | 11182 | break; |
11183 | case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: | 11183 | case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: |
11184 | ret.Add(new LSL_Integer(0)); | 11184 | ret.Add(new LSL_Integer(av.RunningScriptCount() * 16384)); |
11185 | break; | 11185 | break; |
11186 | case ScriptBaseClass.OBJECT_SCRIPT_TIME: | 11186 | case ScriptBaseClass.OBJECT_SCRIPT_TIME: |
11187 | ret.Add(new LSL_Float(0)); | 11187 | ret.Add(new LSL_Float(0)); |
11188 | break; | 11188 | break; |
11189 | case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: | 11189 | case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: |
11190 | ret.Add(new LSL_Integer(0)); | 11190 | ret.Add(new LSL_Integer(1)); |
11191 | break; | 11191 | break; |
11192 | case ScriptBaseClass.OBJECT_SERVER_COST: | 11192 | case ScriptBaseClass.OBJECT_SERVER_COST: |
11193 | ret.Add(new LSL_Float(0)); | 11193 | ret.Add(new LSL_Float(0)); |
@@ -11239,24 +11239,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11239 | case ScriptBaseClass.OBJECT_CREATOR: | 11239 | case ScriptBaseClass.OBJECT_CREATOR: |
11240 | ret.Add(new LSL_String(obj.CreatorID.ToString())); | 11240 | ret.Add(new LSL_String(obj.CreatorID.ToString())); |
11241 | break; | 11241 | break; |
11242 | // The following 8 I have intentionaly coded to return zero. They are part of | ||
11243 | // "Land Impact" calculations. These calculations are probably not applicable | ||
11244 | // to OpenSim, required figures (cpu/memory usage) are not currently tracked | ||
11245 | // I have intentionally left these all at zero rather than return possibly | ||
11246 | // missleading numbers | ||
11247 | case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: | 11242 | case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: |
11248 | // in SL this currently includes crashed scripts | 11243 | ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount())); |
11249 | ret.Add(new LSL_Integer(0)); | ||
11250 | break; | 11244 | break; |
11251 | case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: | 11245 | case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: |
11252 | ret.Add(new LSL_Integer(0)); | 11246 | ret.Add(new LSL_Integer(obj.ParentGroup.ScriptCount())); |
11253 | break; | 11247 | break; |
11254 | case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: | 11248 | case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: |
11255 | // The value returned in SL for mono scripts is 65536 * number of active scripts | 11249 | // The value returned in SL for mono scripts is 65536 * number of active scripts |
11256 | ret.Add(new LSL_Integer(0)); | 11250 | // and 16384 * number of active scripts for LSO. since llGetFreememory |
11251 | // is coded to give the LSO value use it here | ||
11252 | ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount() * 16384)); | ||
11257 | break; | 11253 | break; |
11258 | case ScriptBaseClass.OBJECT_SCRIPT_TIME: | 11254 | case ScriptBaseClass.OBJECT_SCRIPT_TIME: |
11259 | // Average cpu time per simulator frame expended on all scripts in the objetc | 11255 | // Average cpu time per simulator frame expended on all scripts in the object |
11256 | // Not currently available at Object level | ||
11260 | ret.Add(new LSL_Float(0)); | 11257 | ret.Add(new LSL_Float(0)); |
11261 | break; | 11258 | break; |
11262 | case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: | 11259 | case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: |
@@ -11264,18 +11261,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11264 | // equivalent of the number of prims in a linkset if it does not | 11261 | // equivalent of the number of prims in a linkset if it does not |
11265 | // contain a mesh anywhere in the link set or is not a normal prim | 11262 | // contain a mesh anywhere in the link set or is not a normal prim |
11266 | // The value returned in SL for normal prims is prim count | 11263 | // The value returned in SL for normal prims is prim count |
11267 | ret.Add(new LSL_Integer(0)); | 11264 | ret.Add(new LSL_Integer(obj.ParentGroup.PrimCount)); |
11268 | break; | 11265 | break; |
11266 | // The following 3 costs I have intentionaly coded to return zero. They are part of | ||
11267 | // "Land Impact" calculations. These calculations are probably not applicable | ||
11268 | // to OpenSim and are not yet complete in SL | ||
11269 | case ScriptBaseClass.OBJECT_SERVER_COST: | 11269 | case ScriptBaseClass.OBJECT_SERVER_COST: |
11270 | // The value returned in SL for normal prims is prim count | 11270 | // The linden calculation is here |
11271 | // http://wiki.secondlife.com/wiki/Mesh/Mesh_Server_Weight | ||
11272 | // The value returned in SL for normal prims looks like the prim count | ||
11271 | ret.Add(new LSL_Float(0)); | 11273 | ret.Add(new LSL_Float(0)); |
11272 | break; | 11274 | break; |
11273 | case ScriptBaseClass.OBJECT_STREAMING_COST: | 11275 | case ScriptBaseClass.OBJECT_STREAMING_COST: |
11274 | // The value returned in SL for normal prims is prim count * 0.06 | 11276 | // The linden calculation is here |
11277 | // http://wiki.secondlife.com/wiki/Mesh/Mesh_Streaming_Cost | ||
11278 | // The value returned in SL for normal prims looks like the prim count * 0.06 | ||
11275 | ret.Add(new LSL_Float(0)); | 11279 | ret.Add(new LSL_Float(0)); |
11276 | break; | 11280 | break; |
11277 | case ScriptBaseClass.OBJECT_PHYSICS_COST: | 11281 | case ScriptBaseClass.OBJECT_PHYSICS_COST: |
11278 | // The value returned in SL for normal prims is prim count | 11282 | // The linden calculation is here |
11283 | // http://wiki.secondlife.com/wiki/Mesh/Mesh_physics | ||
11284 | // The value returned in SL for normal prims looks like the prim count | ||
11279 | ret.Add(new LSL_Float(0)); | 11285 | ret.Add(new LSL_Float(0)); |
11280 | break; | 11286 | break; |
11281 | default: | 11287 | default: |