diff options
author | Melanie | 2010-11-16 01:37:44 +0100 |
---|---|---|
committer | Melanie | 2010-11-16 01:37:44 +0100 |
commit | c2ac5dc35822fd85751b1da4a96a0062e600b55c (patch) | |
tree | 3e3640b8253307e9c183b88252b3db2effe37352 /OpenSim | |
parent | When detaching a scripted item, always consider it modified. Script states (diff) | |
download | opensim-SC-c2ac5dc35822fd85751b1da4a96a0062e600b55c.zip opensim-SC-c2ac5dc35822fd85751b1da4a96a0062e600b55c.tar.gz opensim-SC-c2ac5dc35822fd85751b1da4a96a0062e600b55c.tar.bz2 opensim-SC-c2ac5dc35822fd85751b1da4a96a0062e600b55c.tar.xz |
Can't detach an object from within the script thread because it will throw.
Use FireAndForget for that.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 8f05359..c602307 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -3213,17 +3213,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3213 | 3213 | ||
3214 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) | 3214 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) |
3215 | { | 3215 | { |
3216 | SceneObjectGroup grp = m_host.ParentGroup; | ||
3217 | UUID itemID = grp.GetFromItemID(); | ||
3218 | |||
3219 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | ||
3220 | |||
3221 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; | 3216 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; |
3222 | if (attachmentsModule != null) | 3217 | if (attachmentsModule != null) |
3223 | attachmentsModule.ShowDetachInUserInventory(itemID, presence.ControllingClient); | 3218 | Util.FireAndForget(DetachWrapper, m_host); |
3224 | } | 3219 | } |
3225 | } | 3220 | } |
3226 | 3221 | ||
3222 | private void DetachWrapper(object o) | ||
3223 | { | ||
3224 | SceneObjectPart host = (SceneObjectPart)o; | ||
3225 | |||
3226 | SceneObjectGroup grp = host.ParentGroup; | ||
3227 | UUID itemID = grp.GetFromItemID(); | ||
3228 | ScenePresence presence = World.GetScenePresence(host.OwnerID); | ||
3229 | |||
3230 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; | ||
3231 | if (attachmentsModule != null) | ||
3232 | attachmentsModule.ShowDetachInUserInventory(itemID, presence.ControllingClient); | ||
3233 | } | ||
3234 | |||
3227 | public void llTakeCamera(string avatar) | 3235 | public void llTakeCamera(string avatar) |
3228 | { | 3236 | { |
3229 | m_host.AddScriptLPS(1); | 3237 | m_host.AddScriptLPS(1); |