diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs | 70 |
1 files changed, 38 insertions, 32 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs index fbf2794..dc195f8 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs | |||
@@ -137,7 +137,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
137 | /// <summary> | 137 | /// <summary> |
138 | /// Start all the scripts contained in this prim's inventory | 138 | /// Start all the scripts contained in this prim's inventory |
139 | /// </summary> | 139 | /// </summary> |
140 | public void StartScripts() | 140 | public void CreateScriptInstances(int startParam, bool postOnRez) |
141 | { | 141 | { |
142 | lock (m_taskInventory) | 142 | lock (m_taskInventory) |
143 | { | 143 | { |
@@ -146,25 +146,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
146 | // XXX more hardcoding badness. Should be an enum in TaskInventoryItem | 146 | // XXX more hardcoding badness. Should be an enum in TaskInventoryItem |
147 | if (10 == item.Type) | 147 | if (10 == item.Type) |
148 | { | 148 | { |
149 | StartScript(item); | 149 | CreateScriptInstance(item, startParam, postOnRez); |
150 | } | ||
151 | } | ||
152 | } | ||
153 | } | ||
154 | |||
155 | /// <summary> | ||
156 | /// Start all the scripts contained in this prim's inventory | ||
157 | /// </summary> | ||
158 | public void StartScripts(int param) | ||
159 | { | ||
160 | lock (m_taskInventory) | ||
161 | { | ||
162 | foreach (TaskInventoryItem item in m_taskInventory.Values) | ||
163 | { | ||
164 | // XXX more hardcoding badness. Should be an enum in TaskInventoryItem | ||
165 | if (10 == item.Type) | ||
166 | { | ||
167 | StartScript(item, param); | ||
168 | } | 150 | } |
169 | } | 151 | } |
170 | } | 152 | } |
@@ -173,7 +155,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
173 | /// <summary> | 155 | /// <summary> |
174 | /// Stop all the scripts in this prim. | 156 | /// Stop all the scripts in this prim. |
175 | /// </summary> | 157 | /// </summary> |
176 | public void StopScripts() | 158 | public void RemoveScriptInstances() |
177 | { | 159 | { |
178 | lock (m_taskInventory) | 160 | lock (m_taskInventory) |
179 | { | 161 | { |
@@ -181,7 +163,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
181 | { | 163 | { |
182 | if (10 == item.Type) | 164 | if (10 == item.Type) |
183 | { | 165 | { |
184 | StopScript(item.ItemID); | 166 | RemoveScriptInstance(item.ItemID); |
185 | RemoveScriptEvents(item.ItemID); | 167 | RemoveScriptEvents(item.ItemID); |
186 | } | 168 | } |
187 | } | 169 | } |
@@ -193,13 +175,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
193 | /// </summary> | 175 | /// </summary> |
194 | /// <param name="item"></param> | 176 | /// <param name="item"></param> |
195 | /// <returns></returns> | 177 | /// <returns></returns> |
196 | public void StartScript(TaskInventoryItem item, int param) | ||
197 | { | ||
198 | StartScript(item); | ||
199 | m_parentGroup.Scene.EventManager.TriggerOnRezEvent(LocalId, item.ItemID, param); | ||
200 | } | ||
201 | 178 | ||
202 | public void StartScript(TaskInventoryItem item) | 179 | public void CreateScriptInstance(TaskInventoryItem item, int startParam, bool postOnRez) |
203 | { | 180 | { |
204 | // m_log.InfoFormat( | 181 | // m_log.InfoFormat( |
205 | // "[PRIM INVENTORY]: " + | 182 | // "[PRIM INVENTORY]: " + |
@@ -223,7 +200,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
223 | else | 200 | else |
224 | { | 201 | { |
225 | string script = Helpers.FieldToUTF8String(asset.Data); | 202 | string script = Helpers.FieldToUTF8String(asset.Data); |
226 | m_parentGroup.Scene.EventManager.TriggerRezScript(LocalId,item.ItemID,script); | 203 | m_parentGroup.Scene.EventManager.TriggerRezScript(LocalId,item.ItemID,script, startParam, postOnRez); |
227 | m_parentGroup.AddActiveScriptCount(1); | 204 | m_parentGroup.AddActiveScriptCount(1); |
228 | ScheduleFullUpdate(); | 205 | ScheduleFullUpdate(); |
229 | } | 206 | } |
@@ -237,13 +214,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
237 | /// <param name="itemId"> | 214 | /// <param name="itemId"> |
238 | /// A <see cref="LLUUID"/> | 215 | /// A <see cref="LLUUID"/> |
239 | /// </param> | 216 | /// </param> |
240 | public void StartScript(LLUUID itemId) | 217 | public void CreateScriptInstance(LLUUID itemId, int startParam, bool postOnRez) |
241 | { | 218 | { |
242 | lock (m_taskInventory) | 219 | lock (m_taskInventory) |
243 | { | 220 | { |
244 | if (m_taskInventory.ContainsKey(itemId)) | 221 | if (m_taskInventory.ContainsKey(itemId)) |
245 | { | 222 | { |
246 | StartScript(m_taskInventory[itemId]); | 223 | CreateScriptInstance(m_taskInventory[itemId], startParam, postOnRez); |
247 | 224 | ||
248 | } | 225 | } |
249 | else | 226 | else |
@@ -260,7 +237,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
260 | /// Stop a script which is in this prim's inventory. | 237 | /// Stop a script which is in this prim's inventory. |
261 | /// </summary> | 238 | /// </summary> |
262 | /// <param name="itemId"></param> | 239 | /// <param name="itemId"></param> |
263 | public void StopScript(LLUUID itemId) | 240 | public void RemoveScriptInstance(LLUUID itemId) |
264 | { | 241 | { |
265 | if (m_taskInventory.ContainsKey(itemId)) | 242 | if (m_taskInventory.ContainsKey(itemId)) |
266 | { | 243 | { |
@@ -330,6 +307,35 @@ namespace OpenSim.Region.Environment.Scenes | |||
330 | ParentGroup.HasGroupChanged = true; | 307 | ParentGroup.HasGroupChanged = true; |
331 | } | 308 | } |
332 | 309 | ||
310 | public void AddInventoryItemExclusive(TaskInventoryItem item) | ||
311 | { | ||
312 | item.ParentID = UUID; | ||
313 | item.ParentPartID = UUID; | ||
314 | |||
315 | List<TaskInventoryItem> il = new List<TaskInventoryItem>(m_taskInventory.Values); | ||
316 | foreach(TaskInventoryItem i in il) | ||
317 | { | ||
318 | if(i.Name == item.Name) | ||
319 | { | ||
320 | if(i.Type == 10) | ||
321 | RemoveScriptInstance(i.ItemID); | ||
322 | RemoveInventoryItem(i.ItemID); | ||
323 | break; | ||
324 | } | ||
325 | } | ||
326 | |||
327 | lock (m_taskInventory) | ||
328 | { | ||
329 | m_taskInventory.Add(item.ItemID, item); | ||
330 | TriggerScriptChangedEvent(Changed.INVENTORY); | ||
331 | } | ||
332 | |||
333 | m_inventorySerial++; | ||
334 | //m_inventorySerial += 2; | ||
335 | HasInventoryChanged = true; | ||
336 | ParentGroup.HasGroupChanged = true; | ||
337 | } | ||
338 | |||
333 | /// <summary> | 339 | /// <summary> |
334 | /// Restore a whole collection of items to the prim's inventory at once. | 340 | /// Restore a whole collection of items to the prim's inventory at once. |
335 | /// We assume that the items already have all their fields correctly filled out. | 341 | /// We assume that the items already have all their fields correctly filled out. |