mirror of
https://github.com/opensim/opensim.git
synced 2026-08-09 18:55:58 +08:00
For scripts in attachments, don't save .state files apart from the initial one as these are ignored since .state is saved in the attachment's asset.
This eliminates pointless work and exceptions when an appdomain is unloaded whilst an attachment script state is persisted. Adds test for this case. Relates to http://opensimulator.org/mantis/view.php?id=7407
This commit is contained in:
@@ -116,26 +116,44 @@ namespace OpenSim.Tests.Common
|
||||
/// <returns>The item that was added</returns>
|
||||
public static TaskInventoryItem AddScript(
|
||||
Scene scene, SceneObjectPart part, string scriptName, string scriptSource)
|
||||
{
|
||||
return AddScript(scene, part, UUID.Random(), UUID.Random(), scriptName, scriptSource);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a simple script to the given part.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// TODO: Accept input for item and asset IDs so that we have completely replicatable regression tests rather
|
||||
/// than a random component.
|
||||
/// </remarks>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="part"></param>
|
||||
/// <param name="itemId">Item UUID for the script</param>
|
||||
/// <param name="assetId">Asset UUID for the script</param>
|
||||
/// <param name="scriptName">Name of the script to add</param>
|
||||
/// <param name="scriptSource">LSL script source</param>
|
||||
/// <returns>The item that was added</returns>
|
||||
public static TaskInventoryItem AddScript(
|
||||
Scene scene, SceneObjectPart part, UUID itemId, UUID assetId, string scriptName, string scriptSource)
|
||||
{
|
||||
AssetScriptText ast = new AssetScriptText();
|
||||
ast.Source = scriptSource;
|
||||
ast.Encode();
|
||||
|
||||
UUID assetUuid = UUID.Random();
|
||||
UUID itemUuid = UUID.Random();
|
||||
|
||||
AssetBase asset
|
||||
= AssetHelpers.CreateAsset(assetUuid, AssetType.LSLText, ast.AssetData, UUID.Zero);
|
||||
= AssetHelpers.CreateAsset(assetId, AssetType.LSLText, ast.AssetData, UUID.Zero);
|
||||
scene.AssetService.Store(asset);
|
||||
TaskInventoryItem item
|
||||
= new TaskInventoryItem
|
||||
{ Name = scriptName, AssetID = assetUuid, ItemID = itemUuid,
|
||||
Type = (int)AssetType.LSLText, InvType = (int)InventoryType.LSL };
|
||||
{ Name = scriptName, AssetID = assetId, ItemID = itemId,
|
||||
Type = (int)AssetType.LSLText, InvType = (int)InventoryType.LSL };
|
||||
part.Inventory.AddInventoryItem(item, true);
|
||||
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Add a scene object item to the given part.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user