diff options
author | Justin Clark-Casey (justincc) | 2012-06-20 00:10:19 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-06-20 00:10:19 +0100 |
commit | 0fa303b1cf244b3066395413e640318b2122c19f (patch) | |
tree | 2288cbbe86aab9fe6c7460229b23f09afb59a91d /OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |
parent | If RegionReady is active, don't falsely say that logins are enabled in the ma... (diff) | |
download | opensim-SC_OLD-0fa303b1cf244b3066395413e640318b2122c19f.zip opensim-SC_OLD-0fa303b1cf244b3066395413e640318b2122c19f.tar.gz opensim-SC_OLD-0fa303b1cf244b3066395413e640318b2122c19f.tar.bz2 opensim-SC_OLD-0fa303b1cf244b3066395413e640318b2122c19f.tar.xz |
Log how many scripts are candidates for starting and how many are actually started.
Adds DebugLevel infrastructure to XEngine though currently commented out and unused.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 110 |
1 files changed, 58 insertions, 52 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 8810903..c223474 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -217,14 +217,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
217 | } | 217 | } |
218 | } | 218 | } |
219 | 219 | ||
220 | /// <summary> | 220 | public int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) |
221 | /// Start all the scripts contained in this prim's inventory | ||
222 | /// </summary> | ||
223 | public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) | ||
224 | { | 221 | { |
222 | int scriptsValidForStarting = 0; | ||
223 | |||
225 | List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL); | 224 | List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL); |
226 | foreach (TaskInventoryItem item in scripts) | 225 | foreach (TaskInventoryItem item in scripts) |
227 | CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); | 226 | if (CreateScriptInstance(item, startParam, postOnRez, engine, stateSource)) |
227 | scriptsValidForStarting++; | ||
228 | |||
229 | return scriptsValidForStarting; | ||
228 | } | 230 | } |
229 | 231 | ||
230 | public ArrayList GetScriptErrors(UUID itemID) | 232 | public ArrayList GetScriptErrors(UUID itemID) |
@@ -264,61 +266,65 @@ namespace OpenSim.Region.Framework.Scenes | |||
264 | /// Start a script which is in this prim's inventory. | 266 | /// Start a script which is in this prim's inventory. |
265 | /// </summary> | 267 | /// </summary> |
266 | /// <param name="item"></param> | 268 | /// <param name="item"></param> |
267 | /// <returns></returns> | 269 | /// <returns>true if the script instance was created, false otherwise</returns> |
268 | public void CreateScriptInstance(TaskInventoryItem item, int startParam, bool postOnRez, string engine, int stateSource) | 270 | public bool CreateScriptInstance(TaskInventoryItem item, int startParam, bool postOnRez, string engine, int stateSource) |
269 | { | 271 | { |
270 | // m_log.DebugFormat("[PRIM INVENTORY]: Starting script {0} {1} in prim {2} {3} in {4}", | 272 | // m_log.DebugFormat("[PRIM INVENTORY]: Starting script {0} {1} in prim {2} {3} in {4}", |
271 | // item.Name, item.ItemID, m_part.Name, m_part.UUID, m_part.ParentGroup.Scene.RegionInfo.RegionName); | 273 | // item.Name, item.ItemID, m_part.Name, m_part.UUID, m_part.ParentGroup.Scene.RegionInfo.RegionName); |
272 | 274 | ||
273 | if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID)) | 275 | if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID)) |
274 | return; | 276 | return false; |
275 | 277 | ||
276 | m_part.AddFlag(PrimFlags.Scripted); | 278 | m_part.AddFlag(PrimFlags.Scripted); |
277 | 279 | ||
278 | if (!m_part.ParentGroup.Scene.RegionInfo.RegionSettings.DisableScripts) | 280 | if (m_part.ParentGroup.Scene.RegionInfo.RegionSettings.DisableScripts) |
281 | return false; | ||
282 | |||
283 | if (stateSource == 2 && // Prim crossing | ||
284 | m_part.ParentGroup.Scene.m_trustBinaries) | ||
279 | { | 285 | { |
280 | if (stateSource == 2 && // Prim crossing | 286 | lock (m_items) |
281 | m_part.ParentGroup.Scene.m_trustBinaries) | ||
282 | { | 287 | { |
283 | lock (m_items) | 288 | m_items[item.ItemID].PermsMask = 0; |
284 | { | 289 | m_items[item.ItemID].PermsGranter = UUID.Zero; |
285 | m_items[item.ItemID].PermsMask = 0; | ||
286 | m_items[item.ItemID].PermsGranter = UUID.Zero; | ||
287 | } | ||
288 | |||
289 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( | ||
290 | m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource); | ||
291 | m_part.ParentGroup.AddActiveScriptCount(1); | ||
292 | m_part.ScheduleFullUpdate(); | ||
293 | return; | ||
294 | } | 290 | } |
291 | |||
292 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( | ||
293 | m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource); | ||
294 | m_part.ParentGroup.AddActiveScriptCount(1); | ||
295 | m_part.ScheduleFullUpdate(); | ||
296 | return true; | ||
297 | } | ||
295 | 298 | ||
296 | AssetBase asset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString()); | 299 | AssetBase asset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString()); |
297 | if (null == asset) | 300 | if (null == asset) |
301 | { | ||
302 | m_log.ErrorFormat( | ||
303 | "[PRIM INVENTORY]: Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found", | ||
304 | item.Name, item.ItemID, m_part.AbsolutePosition, | ||
305 | m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID); | ||
306 | |||
307 | return false; | ||
308 | } | ||
309 | else | ||
310 | { | ||
311 | if (m_part.ParentGroup.m_savedScriptState != null) | ||
312 | item.OldItemID = RestoreSavedScriptState(item.LoadedItemID, item.OldItemID, item.ItemID); | ||
313 | |||
314 | lock (m_items) | ||
298 | { | 315 | { |
299 | m_log.ErrorFormat( | 316 | m_items[item.ItemID].OldItemID = item.OldItemID; |
300 | "[PRIM INVENTORY]: Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found", | 317 | m_items[item.ItemID].PermsMask = 0; |
301 | item.Name, item.ItemID, m_part.AbsolutePosition, | 318 | m_items[item.ItemID].PermsGranter = UUID.Zero; |
302 | m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID); | ||
303 | } | 319 | } |
304 | else | ||
305 | { | ||
306 | if (m_part.ParentGroup.m_savedScriptState != null) | ||
307 | item.OldItemID = RestoreSavedScriptState(item.LoadedItemID, item.OldItemID, item.ItemID); | ||
308 | 320 | ||
309 | lock (m_items) | 321 | string script = Utils.BytesToString(asset.Data); |
310 | { | 322 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( |
311 | m_items[item.ItemID].OldItemID = item.OldItemID; | 323 | m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); |
312 | m_items[item.ItemID].PermsMask = 0; | 324 | m_part.ParentGroup.AddActiveScriptCount(1); |
313 | m_items[item.ItemID].PermsGranter = UUID.Zero; | 325 | m_part.ScheduleFullUpdate(); |
314 | } | ||
315 | 326 | ||
316 | string script = Utils.BytesToString(asset.Data); | 327 | return true; |
317 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( | ||
318 | m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); | ||
319 | m_part.ParentGroup.AddActiveScriptCount(1); | ||
320 | m_part.ScheduleFullUpdate(); | ||
321 | } | ||
322 | } | 328 | } |
323 | } | 329 | } |
324 | 330 | ||
@@ -384,22 +390,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
384 | return stateID; | 390 | return stateID; |
385 | } | 391 | } |
386 | 392 | ||
387 | /// <summary> | 393 | public bool CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource) |
388 | /// Start a script which is in this prim's inventory. | ||
389 | /// </summary> | ||
390 | /// <param name="itemId"> | ||
391 | /// A <see cref="UUID"/> | ||
392 | /// </param> | ||
393 | public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource) | ||
394 | { | 394 | { |
395 | TaskInventoryItem item = GetInventoryItem(itemId); | 395 | TaskInventoryItem item = GetInventoryItem(itemId); |
396 | if (item != null) | 396 | if (item != null) |
397 | CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); | 397 | { |
398 | return CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); | ||
399 | } | ||
398 | else | 400 | else |
401 | { | ||
399 | m_log.ErrorFormat( | 402 | m_log.ErrorFormat( |
400 | "[PRIM INVENTORY]: Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}", | 403 | "[PRIM INVENTORY]: Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}", |
401 | itemId, m_part.Name, m_part.UUID, | 404 | itemId, m_part.Name, m_part.UUID, |
402 | m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); | 405 | m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); |
406 | |||
407 | return false; | ||
408 | } | ||
403 | } | 409 | } |
404 | 410 | ||
405 | /// <summary> | 411 | /// <summary> |