aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-01-09 15:46:45 +0000
committerJustin Clarke Casey2008-01-09 15:46:45 +0000
commit796ae57bea5e7004ac8d41bee2d496d645db81ce (patch)
treecf40811cc9b7ae91e679d639785bd6ab4fd422d0 /OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
parent* removed another superfluous debug message (diff)
downloadopensim-SC_OLD-796ae57bea5e7004ac8d41bee2d496d645db81ce.zip
opensim-SC_OLD-796ae57bea5e7004ac8d41bee2d496d645db81ce.tar.gz
opensim-SC_OLD-796ae57bea5e7004ac8d41bee2d496d645db81ce.tar.bz2
opensim-SC_OLD-796ae57bea5e7004ac8d41bee2d496d645db81ce.tar.xz
Prim inventory script saving phase 2.
* It is now possible to edit and save scripts directly from prim inventories * On saving, the script will be restarted in the region * Doesn't appear that it's yet possible to drag inventory contents back to agent inventory. Not quite sure why this is yet - the perms all look very permissive.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs107
1 files changed, 89 insertions, 18 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
index 9e2c256..5d197e3 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
@@ -144,7 +144,26 @@ namespace OpenSim.Region.Environment.Scenes
144 itemId, Name, UUID); 144 itemId, Name, UUID);
145 } 145 }
146 146
147 } 147 }
148
149 /// <summary>
150 /// Stop a script which is in this prim's inventory.
151 /// </summary>
152 /// <param name="itemId"></param>
153 public void StopScript(LLUUID itemId)
154 {
155 if (m_taskInventory.ContainsKey(itemId))
156 {
157 m_parentGroup.Scene.EventManager.TriggerRemoveScript(LocalID, itemId);
158 }
159 else
160 {
161 MainLog.Instance.Error(
162 "PRIMINVENTORY",
163 "Couldn't stop script with ID {0} since it couldn't be found for prim {1}, {2}",
164 itemId, Name, UUID);
165 }
166 }
148 167
149 /// <summary> 168 /// <summary>
150 /// Add an item to this prim's inventory. 169 /// Add an item to this prim's inventory.
@@ -173,33 +192,85 @@ namespace OpenSim.Region.Environment.Scenes
173 192
174 m_inventorySerial++; 193 m_inventorySerial++;
175 } 194 }
195
196 /// <summary>
197 /// Returns an existing inventory item. Returns the original, so any changes will be live.
198 /// </summary>
199 /// <param name="itemID"></param>
200 /// <returns>null if the item does not exist</returns>
201 public TaskInventoryItem GetInventoryItem(LLUUID itemID)
202 {
203 if (m_taskInventory.ContainsKey(itemID))
204 {
205 return m_taskInventory[itemID];
206 }
207 else
208 {
209 MainLog.Instance.Error(
210 "PRIMINVENTORY",
211 "Tried to retrieve item ID {0} from prim {1}, {2} but the item does not exist in this inventory",
212 itemID, Name, UUID);
213 }
214
215 return null;
216 }
217
218 /// <summary>
219 /// Update an existing inventory item.
220 /// </summary>
221 /// <param name="item">The updated item. An item with the same id must already exist
222 /// in this prim's inventory.</param>
223 /// <returns>false if the item did not exist, true if the update occurred succesfully</returns>
224 public bool UpdateInventoryItem(TaskInventoryItem item)
225 {
226 if (m_taskInventory.ContainsKey(item.item_id))
227 {
228 m_taskInventory[item.item_id] = item;
229 m_inventorySerial++;
230
231 return true;
232 }
233 else
234 {
235 MainLog.Instance.Error(
236 "PRIMINVENTORY",
237 "Tried to retrieve item ID {0} from prim {1}, {2} but the item does not exist in this inventory",
238 item.item_id, Name, UUID);
239 }
240
241 return false;
242 }
176 243
177 /// <summary> 244 /// <summary>
178 /// Remove an item from this prim's inventory 245 /// Remove an item from this prim's inventory
179 /// </summary> 246 /// </summary>
180 /// <param name="remoteClient"></param>
181 /// <param name="localID"></param>
182 /// <param name="itemID"></param> 247 /// <param name="itemID"></param>
183 /// <returns>Numeric asset type of the item removed.</returns> 248 /// <returns>Numeric asset type of the item removed. Returns -1 if the item did not exist
184 public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) 249 /// in this prim's inventory.</returns>
250 public int RemoveInventoryItem(LLUUID itemID)
185 { 251 {
186 if (localID == LocalID) 252 if (m_taskInventory.ContainsKey(itemID))
187 { 253 {
188 if (m_taskInventory.ContainsKey(itemID)) 254 string type = m_taskInventory[itemID].inv_type;
255 m_taskInventory.Remove(itemID);
256 m_inventorySerial++;
257 if (type == "lsltext")
258 {
259 return 10;
260 }
261 else
189 { 262 {
190 string type = m_taskInventory[itemID].inv_type; 263 return 0;
191 m_taskInventory.Remove(itemID);
192 m_inventorySerial++;
193 if (type == "lsltext")
194 {
195 return 10;
196 }
197 else
198 {
199 return 0;
200 }
201 } 264 }
202 } 265 }
266 else
267 {
268 MainLog.Instance.Error(
269 "PRIMINVENTORY",
270 "Tried to remove item ID {0} from prim {1}, {2} but the item does not exist in this inventory",
271 itemID, Name, UUID);
272 }
273
203 return -1; 274 return -1;
204 } 275 }
205 276