diff options
author | Justin Clark-Casey (justincc) | 2011-08-24 20:49:23 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-08-24 20:49:23 +0100 |
commit | cf3ffe5bb4c6a8bea9599b6143c2f7793500c984 (patch) | |
tree | 80ff937e194c85ec7f599bb6e254c239c69f0b56 /OpenSim/Region/ScriptEngine | |
parent | rename AttachmentsModule.ShowDetachInUserInventory() to DetachSingleAttachmen... (diff) | |
download | opensim-SC-cf3ffe5bb4c6a8bea9599b6143c2f7793500c984.zip opensim-SC-cf3ffe5bb4c6a8bea9599b6143c2f7793500c984.tar.gz opensim-SC-cf3ffe5bb4c6a8bea9599b6143c2f7793500c984.tar.bz2 opensim-SC-cf3ffe5bb4c6a8bea9599b6143c2f7793500c984.tar.xz |
Fix llAttachToAvatar()
Apart from one obvious bug, this was failing because attempting to serialize the script from inside the script (as part of saving the attachment as an inventory asset) was triggering an extremely long delay.
So we now don't do this. The state will be serialized anyway when the avatar normally logs out.
The worst that can happen is that if the client/server crashes, the attachment scripts start without previous state.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
3 files changed, 22 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs index 8b7871b..0cc0fe7 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs | |||
@@ -58,7 +58,11 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
58 | /// </summary> | 58 | /// </summary> |
59 | public interface IScriptInstance | 59 | public interface IScriptInstance |
60 | { | 60 | { |
61 | /// <summary> | ||
62 | /// Is this script currently running? | ||
63 | /// </summary> | ||
61 | bool Running { get; set; } | 64 | bool Running { get; set; } |
65 | |||
62 | bool ShuttingDown { get; set; } | 66 | bool ShuttingDown { get; set; } |
63 | string State { get; set; } | 67 | string State { get; set; } |
64 | IScriptEngine Engine { get; } | 68 | IScriptEngine Engine { get; } |
@@ -78,7 +82,14 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
78 | 82 | ||
79 | void Init(); | 83 | void Init(); |
80 | void Start(); | 84 | void Start(); |
85 | |||
86 | /// <summary> | ||
87 | /// Stop the script. | ||
88 | /// </summary> | ||
89 | /// <param name="timeout"></param> | ||
90 | /// <returns>true if the script was successfully stopped, false otherwise</returns> | ||
81 | bool Stop(int timeout); | 91 | bool Stop(int timeout); |
92 | |||
82 | void SetState(string state); | 93 | void SetState(string state); |
83 | 94 | ||
84 | void PostEvent(EventParams data); | 95 | void PostEvent(EventParams data); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ffa0e24..d340ef2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2964,8 +2964,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2964 | { | 2964 | { |
2965 | m_host.AddScriptLPS(1); | 2965 | m_host.AddScriptLPS(1); |
2966 | 2966 | ||
2967 | if (m_host.ParentGroup.RootPart.AttachmentPoint == 0) | 2967 | // if (m_host.ParentGroup.RootPart.AttachmentPoint == 0) |
2968 | return; | 2968 | // return; |
2969 | 2969 | ||
2970 | TaskInventoryItem item; | 2970 | TaskInventoryItem item; |
2971 | 2971 | ||
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index d253c6a..c443669 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -1294,9 +1294,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1294 | 1294 | ||
1295 | public string GetXMLState(UUID itemID) | 1295 | public string GetXMLState(UUID itemID) |
1296 | { | 1296 | { |
1297 | // m_log.DebugFormat("[XEngine]: Getting XML state for {0}", itemID); | ||
1298 | |||
1297 | IScriptInstance instance = GetInstance(itemID); | 1299 | IScriptInstance instance = GetInstance(itemID); |
1298 | if (instance == null) | 1300 | if (instance == null) |
1301 | { | ||
1302 | // m_log.DebugFormat("[XEngine]: Found no script for {0}, returning empty string", itemID); | ||
1299 | return ""; | 1303 | return ""; |
1304 | } | ||
1305 | |||
1300 | string xml = instance.GetXMLState(); | 1306 | string xml = instance.GetXMLState(); |
1301 | 1307 | ||
1302 | XmlDocument sdoc = new XmlDocument(); | 1308 | XmlDocument sdoc = new XmlDocument(); |
@@ -1437,6 +1443,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1437 | mapData.InnerText = map; | 1443 | mapData.InnerText = map; |
1438 | 1444 | ||
1439 | stateData.AppendChild(mapData); | 1445 | stateData.AppendChild(mapData); |
1446 | |||
1447 | // m_log.DebugFormat("[XEngine]: Got XML state for {0}", itemID); | ||
1448 | |||
1440 | return doc.InnerXml; | 1449 | return doc.InnerXml; |
1441 | } | 1450 | } |
1442 | 1451 | ||