diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs index aab2291..5f93986 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs | |||
@@ -33,6 +33,7 @@ using System.Xml.Serialization; | |||
33 | using libsecondlife; | 33 | using libsecondlife; |
34 | 34 | ||
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Console; | ||
36 | using OpenSim.Region.Environment.Interfaces; | 37 | using OpenSim.Region.Environment.Interfaces; |
37 | using OpenSim.Region.Environment.Scenes.Scripting; | 38 | using OpenSim.Region.Environment.Scenes.Scripting; |
38 | 39 | ||
@@ -79,6 +80,53 @@ namespace OpenSim.Region.Environment.Scenes | |||
79 | { | 80 | { |
80 | get { return m_inventorySerial; } | 81 | get { return m_inventorySerial; } |
81 | } | 82 | } |
83 | |||
84 | |||
85 | /// <summary> | ||
86 | /// Start all the scripts contained in this prim's inventory | ||
87 | /// </summary> | ||
88 | public void StartScripts() | ||
89 | { | ||
90 | foreach (TaskInventoryItem item in m_taskInventory.Values) | ||
91 | { | ||
92 | if ("lsltext" == item.type) | ||
93 | { | ||
94 | StartScript(item); | ||
95 | } | ||
96 | } | ||
97 | } | ||
98 | |||
99 | /// <summary> | ||
100 | /// Start a script in this prim | ||
101 | /// </summary> | ||
102 | /// <param name="item"></param> | ||
103 | /// <returns>true if script asset was found, false if it wasn't</returns> | ||
104 | public bool StartScript(TaskInventoryItem item) | ||
105 | { | ||
106 | // MainLog.Instance.Verbose( | ||
107 | // "PRIMINVENTORY", | ||
108 | // "Starting script {0}, {1} in prim {2}, {3}", | ||
109 | // item.name, item.item_id, Name, UUID); | ||
110 | |||
111 | AssetBase rezAsset = m_parentGroup.Scene.AssetCache.GetAsset(item.asset_id, false); | ||
112 | |||
113 | if (rezAsset != null) | ||
114 | { | ||
115 | string script = Helpers.FieldToUTF8String(rezAsset.Data); | ||
116 | m_parentGroup.Scene.EventManager.TriggerRezScript(LocalID, item.item_id, script); | ||
117 | |||
118 | return true; | ||
119 | } | ||
120 | else | ||
121 | { | ||
122 | MainLog.Instance.Error( | ||
123 | "PRIMINVENTORY", | ||
124 | "Couldn't start script {0}, {1} since asset ID {2} could not be found", | ||
125 | item.name, item.item_id, item.asset_id); | ||
126 | } | ||
127 | |||
128 | return false; | ||
129 | } | ||
82 | 130 | ||
83 | /// <summary> | 131 | /// <summary> |
84 | /// Add an item to this prim's inventory. | 132 | /// Add an item to this prim's inventory. |